diff options
author | Jeff Sharkey <jsharkey@android.com> | 2014-07-25 14:09:37 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@google.com> | 2014-07-25 21:11:47 +0000 |
commit | 20e0c50f601e5930a246d4556118423a49c12ca1 (patch) | |
tree | 02e5ab04fff88af15912830344c8ddff9774f25f /cmds | |
parent | a753f4c6cb8558795e673df1896532cd148781e2 (diff) | |
download | frameworks_base-20e0c50f601e5930a246d4556118423a49c12ca1.zip frameworks_base-20e0c50f601e5930a246d4556118423a49c12ca1.tar.gz frameworks_base-20e0c50f601e5930a246d4556118423a49c12ca1.tar.bz2 |
Offer force-dex-opt when running as root.
Recently we removed the PackageManager inotify triggers, meaning the
only supported ways of installing apps were:
-- adb install -r Foo.apk
-- adb shell stop && adb sync && adb shell start
Iterating on most system apps (like Settings) can use the first
approach, but it doesn't work for "persistent" processes like
SystemUI. (ActivityManager is very particular about how it deals
with persistent apps, and it always sticks with the first
ApplicationInfo found at boot.)
So to enable rapid iteration on persistent apps, we now offer the
one missing piece of forcing a dexopt with a new pm force-dex-opt
command only available to -eng or -userdebug builds. Typical use
for iterating on persistent apps now looks like this:
$ mmm frameworks/base/packages/SystemUI/ && adb sync &&
adb shell pm force-dex-opt com.android.systemui &&
adb shell kill `pid systemui`
Yay!
Change-Id: I0ae2467f1d7cda56c70ba20953cd25fa8ee766ff
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/pm/src/com/android/commands/pm/Pm.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java index 96019b3..bc16800 100644 --- a/cmds/pm/src/com/android/commands/pm/Pm.java +++ b/cmds/pm/src/com/android/commands/pm/Pm.java @@ -253,6 +253,11 @@ public final class Pm { return; } + if ("force-dex-opt".equals(op)) { + runForceDexOpt(); + return; + } + try { if (args.length == 1) { if (args[0].equalsIgnoreCase("-l")) { @@ -1248,6 +1253,15 @@ public final class Pm { System.out.println("Maximum supported users: " + UserManager.getMaxSupportedUsers()); } + public void runForceDexOpt() { + final String packageName = nextArg(); + try { + mPm.forceDexOpt(packageName); + } catch (RemoteException e) { + throw e.rethrowAsRuntimeException(); + } + } + class PackageDeleteObserver extends IPackageDeleteObserver.Stub { boolean finished; boolean result; |