summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
Diffstat (limited to 'cmds')
-rw-r--r--cmds/am/src/com/android/commands/am/Am.java48
-rw-r--r--cmds/servicemanager/service_manager.c1
2 files changed, 49 insertions, 0 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 140222e..95a8e2c 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -28,6 +28,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.IIntentReceiver;
import android.content.Intent;
+import android.content.pm.IPackageDataObserver;
import android.content.pm.IPackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
@@ -109,6 +110,8 @@ public class Am {
runStartService();
} else if (op.equals("force-stop")) {
runForceStop();
+ } else if (op.equals("clear-data")) {
+ runClearData();
} else if (op.equals("kill")) {
runKill();
} else if (op.equals("kill-all")) {
@@ -206,6 +209,21 @@ public class Am {
}
intent.putExtra(key, list);
hasIntentInfo = true;
+ } else if (opt.equals("--ef")) {
+ String key = nextArgRequired();
+ String value = nextArgRequired();
+ intent.putExtra(key, Float.valueOf(value));
+ hasIntentInfo = true;
+ } else if (opt.equals("--efa")) {
+ String key = nextArgRequired();
+ String value = nextArgRequired();
+ String[] strings = value.split(",");
+ float[] list = new float[strings.length];
+ for (int i = 0; i < strings.length; i++) {
+ list[i] = Float.valueOf(strings[i]);
+ }
+ intent.putExtra(key, list);
+ hasIntentInfo = true;
} else if (opt.equals("--ez")) {
String key = nextArgRequired();
String value = nextArgRequired();
@@ -500,6 +518,31 @@ public class Am {
mAm.killAllBackgroundProcesses();
}
+ class ClearUserDataObserver extends IPackageDataObserver.Stub {
+ public int status = -1;
+
+ public void onRemoveCompleted(final String packageName, final boolean succeeded) {
+ synchronized (this) {
+ status = succeeded ? 0 : 1;
+ notify();
+ }
+ }
+ }
+
+ private void runClearData() throws Exception {
+ ClearUserDataObserver observer = new ClearUserDataObserver();
+ mAm.clearApplicationUserData(nextArgRequired(), observer);
+ synchronized (observer) {
+ while (observer.status < 0) {
+ try {
+ observer.wait();
+ } catch (InterruptedException ex) {
+ }
+ }
+ }
+ System.exit(observer.status);
+ }
+
private void sendBroadcast() throws Exception {
Intent intent = makeIntent();
IntentReceiver receiver = new IntentReceiver();
@@ -1220,6 +1263,7 @@ public class Am {
" [--R COUNT] [-S] <INTENT>\n" +
" am startservice <INTENT>\n" +
" am force-stop <PACKAGE>\n" +
+ " am clear-data <PACKAGE>\n" +
" am kill <PACKAGE>\n" +
" am kill-all\n" +
" am broadcast <INTENT>\n" +
@@ -1253,6 +1297,8 @@ public class Am {
"\n" +
"am kill-all: Kill all background processes.\n" +
"\n" +
+ "am clear-data: clear the user data associated with <PACKAGE>.\n" +
+ "\n" +
"am broadcast: send a broadcast Intent.\n" +
"\n" +
"am instrument: start an Instrumentation. Typically this target <COMPONENT>\n" +
@@ -1292,9 +1338,11 @@ public class Am {
" [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]\n" +
" [--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]\n" +
" [--el <EXTRA_KEY> <EXTRA_LONG_VALUE> ...]\n" +
+ " [--ef <EXTRA_KEY> <EXTRA_FLOAT_VALUE> ...]\n" +
" [--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...]\n" +
" [--eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]\n" +
" [--ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]\n" +
+ " [--efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]\n" +
" [-n <COMPONENT>] [-f <FLAGS>]\n" +
" [--grant-read-uri-permission] [--grant-write-uri-permission]\n" +
" [--debug-log-resolution] [--exclude-stopped-packages]\n" +
diff --git a/cmds/servicemanager/service_manager.c b/cmds/servicemanager/service_manager.c
index 2df450f..b45b257 100644
--- a/cmds/servicemanager/service_manager.c
+++ b/cmds/servicemanager/service_manager.c
@@ -46,6 +46,7 @@ static struct {
{ AID_RADIO, "isms" },
{ AID_RADIO, "iphonesubinfo" },
{ AID_RADIO, "simphonebook" },
+ { AID_MEDIA, "aah.common_clock" },
};
void *svcmgr_handle;