summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShuo Qian <shuoq@google.com>2019-12-17 17:17:34 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-12-17 17:17:34 +0000
commit65943dbc41b2887b7abaca3d6baab52ac767cd64 (patch)
treee3c9d96127eb12f39eb8845b1e7d0675fa565d45
parenta960204edfa69aebea1bb23ef0d547c29261107e (diff)
parent5c4e7b81b571d11851fd9c63a308e1a910b196b9 (diff)
Merge "Deprecate Data Command in Android"
-rw-r--r--cmds/svc/src/com/android/commands/svc/DataCommand.java44
1 files changed, 11 insertions, 33 deletions
diff --git a/cmds/svc/src/com/android/commands/svc/DataCommand.java b/cmds/svc/src/com/android/commands/svc/DataCommand.java
index 35510cfd38b1..b4dbd1d41bc1 100644
--- a/cmds/svc/src/com/android/commands/svc/DataCommand.java
+++ b/cmds/svc/src/com/android/commands/svc/DataCommand.java
@@ -16,12 +16,16 @@
package com.android.commands.svc;
-import android.os.ServiceManager;
-import android.os.RemoteException;
-import android.content.Context;
-import com.android.internal.telephony.ITelephony;
-
+/**
+ * @deprecated Please use adb shell cmd phone data enabled/disable instead.
+ */
+@Deprecated
public class DataCommand extends Svc.Command {
+
+ private static final String DECPRECATED_MESSAGE =
+ "adb shell svc data enable/disable is deprecated;"
+ + "please use adb shell cmd phone data enable/disable instead.";
+
public DataCommand() {
super("data");
}
@@ -33,36 +37,10 @@ public class DataCommand extends Svc.Command {
public String longHelp() {
return shortHelp() + "\n"
+ "\n"
- + "usage: svc data [enable|disable]\n"
- + " Turn mobile data on or off.\n\n";
+ + DECPRECATED_MESSAGE;
}
public void run(String[] args) {
- boolean validCommand = false;
- if (args.length >= 2) {
- boolean flag = false;
- if ("enable".equals(args[1])) {
- flag = true;
- validCommand = true;
- } else if ("disable".equals(args[1])) {
- flag = false;
- validCommand = true;
- }
- if (validCommand) {
- ITelephony phoneMgr
- = ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE));
- try {
- if (flag) {
- phoneMgr.enableDataConnectivity();
- } else
- phoneMgr.disableDataConnectivity();
- }
- catch (RemoteException e) {
- System.err.println("Mobile data operation failed: " + e);
- }
- return;
- }
- }
- System.err.println(longHelp());
+ System.err.println(DECPRECATED_MESSAGE);
}
}