diff options
author | Dianne Hackborn <hackbod@google.com> | 2013-06-11 14:26:53 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2013-06-11 14:26:53 -0700 |
commit | cbfd23ee6f14445c3e17c5169abbc80c216fa137 (patch) | |
tree | 9e5063fe418c4df345b371a0678faa4a1fcb0c48 /cmds/pm | |
parent | be4e6aaa0252dd7da28b7aa85beba982538efa46 (diff) | |
download | frameworks_base-cbfd23ee6f14445c3e17c5169abbc80c216fa137.zip frameworks_base-cbfd23ee6f14445c3e17c5169abbc80c216fa137.tar.gz frameworks_base-cbfd23ee6f14445c3e17c5169abbc80c216fa137.tar.bz2 |
Add new API to retrieve a dumpsys of a single package.
Adds a platform API, and pm command. Fixes some issues with
dumping per-package data in package manager, makes battery
stats able to dump per-package state.
Change-Id: I76ee6d059f0ba17f7a7061886792b1b716d46d2d
Diffstat (limited to 'cmds/pm')
-rw-r--r-- | cmds/pm/src/com/android/commands/pm/Pm.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java index 224945a..6f57ae0 100644 --- a/cmds/pm/src/com/android/commands/pm/Pm.java +++ b/cmds/pm/src/com/android/commands/pm/Pm.java @@ -16,8 +16,7 @@ package com.android.commands.pm; -import com.android.internal.content.PackageHelper; - +import android.app.ActivityManager; import android.app.ActivityManagerNative; import android.content.ComponentName; import android.content.pm.ApplicationInfo; @@ -46,6 +45,7 @@ import android.os.UserHandle; import android.os.UserManager; import java.io.File; +import java.io.FileDescriptor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.security.InvalidAlgorithmParameterException; @@ -59,6 +59,8 @@ import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; +import com.android.internal.content.PackageHelper; + public final class Pm { IPackageManager mPm; IUserManager mUm; @@ -105,6 +107,11 @@ public final class Pm { return; } + if ("dump".equals(op)) { + runDump(); + return; + } + if ("install".equals(op)) { runInstall(); return; @@ -672,6 +679,15 @@ public final class Pm { displayPackageFilePath(pkg); } + private void runDump() { + String pkg = nextArg(); + if (pkg == null) { + System.err.println("Error: no package specified"); + return; + } + ActivityManager.dumpPackageStateStatic(FileDescriptor.out, pkg); + } + class PackageInstallObserver extends IPackageInstallObserver.Stub { boolean finished; int result; @@ -1456,6 +1472,7 @@ public final class Pm { System.err.println(" pm list libraries"); System.err.println(" pm list users"); System.err.println(" pm path PACKAGE"); + System.err.println(" pm dump PACKAGE"); System.err.println(" pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f]"); System.err.println(" [--algo <algorithm name> --key <key-in-hex> --iv <IV-in-hex>]"); System.err.println(" [--originating-uri <URI>] [--referrer <URI>] PATH"); @@ -1506,6 +1523,8 @@ public final class Pm { System.err.println(""); System.err.println("pm path: print the path to the .apk of the given PACKAGE."); System.err.println(""); + System.err.println("pm dump: print system state associated w ith the given PACKAGE."); + System.err.println(""); System.err.println("pm install: installs a package to the system. Options:"); System.err.println(" -l: install the package with FORWARD_LOCK."); System.err.println(" -r: reinstall an exisiting app, keeping its data."); |