diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-05-11 18:54:45 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-05-12 16:09:43 -0700 |
commit | ade3ecad94d1f4431576f53bae26c35efbf7a2c9 (patch) | |
tree | 066fc83ddeb6c52011e13744152b594911895094 /cmds | |
parent | 807f23b2d8c7148cf6fc95bb88cfc2f78e4be66a (diff) | |
download | frameworks_base-ade3ecad94d1f4431576f53bae26c35efbf7a2c9.zip frameworks_base-ade3ecad94d1f4431576f53bae26c35efbf7a2c9.tar.gz frameworks_base-ade3ecad94d1f4431576f53bae26c35efbf7a2c9.tar.bz2 |
Implement issue #1783881 (manifest option for adb-install-only apps)
You can now use android:testOnly="true" to not allow your .apk to be installed
as a normal app. The only way to do so is with the pm command and giving the
-t option, which sets a new INSTALL_ALLOW_TEST flag when installing.
I also used this to clean up the install API... actually, mostly to hide
it, since it is not accessible to apps so shouldn't be in the SDK. We
will be doing some more work on it, so this will prevent adding yet
another backwards-compatibility-for-no-reason version.
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/pm/src/com/android/commands/pm/Pm.java | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java index ac62757..8212b92 100644 --- a/cmds/pm/src/com/android/commands/pm/Pm.java +++ b/cmds/pm/src/com/android/commands/pm/Pm.java @@ -540,6 +540,9 @@ public final class Pm { case PackageManager.INSTALL_FAILED_NEWER_SDK: s = "INSTALL_FAILED_NEWER_SDK"; break; + case PackageManager.INSTALL_FAILED_TEST_ONLY: + s = "INSTALL_FAILED_TEST_ONLY"; + break; case PackageManager.INSTALL_PARSE_FAILED_NOT_APK: s = "INSTALL_PARSE_FAILED_NOT_APK"; break; @@ -584,9 +587,9 @@ public final class Pm { String opt; while ((opt=nextOption()) != null) { if (opt.equals("-l")) { - installFlags |= PackageManager.FORWARD_LOCK_PACKAGE; + installFlags |= PackageManager.INSTALL_FORWARD_LOCK; } else if (opt.equals("-r")) { - installFlags |= PackageManager.REPLACE_EXISTING_PACKAGE; + installFlags |= PackageManager.INSTALL_REPLACE_EXISTING; } else if (opt.equals("-i")) { installerPackageName = nextOptionData(); if (installerPackageName == null) { @@ -594,6 +597,8 @@ public final class Pm { showUsage(); return; } + } else if (opt.equals("-t")) { + installFlags |= PackageManager.INSTALL_ALLOW_TEST; } else { System.err.println("Error: Unknown option: " + opt); showUsage(); @@ -821,38 +826,39 @@ public final class Pm { System.err.println(" pm list permissions [-g] [-f] [-d] [-u] [GROUP]"); System.err.println(" pm list instrumentation [-f] [TARGET-PACKAGE]"); System.err.println(" pm path PACKAGE"); - System.err.println(" pm install [-l] [-r] [-i INSTALLER_PACKAGE_NAME] PATH"); + System.err.println(" pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] PATH"); System.err.println(" pm uninstall [-k] PACKAGE"); System.err.println(" pm enable PACKAGE_OR_COMPONENT"); System.err.println(" pm disable PACKAGE_OR_COMPONENT"); System.err.println(""); - System.err.println("The list packages command prints all packages. Use"); - System.err.println("the -f option to see their associated file."); + System.err.println("The list packages command prints all packages. Options:"); + System.err.println(" -f: see their associated file."); System.err.println(""); System.err.println("The list permission-groups command prints all known"); System.err.println("permission groups."); System.err.println(""); System.err.println("The list permissions command prints all known"); - System.err.println("permissions, optionally only those in GROUP. Use"); - System.err.println("the -g option to organize by group. Use"); - System.err.println("the -f option to print all information. Use"); - System.err.println("the -s option for a short summary. Use"); - System.err.println("the -d option to only list dangerous permissions. Use"); - System.err.println("the -u option to list only the permissions users will see."); + System.err.println("permissions, optionally only those in GROUP. Options:"); + System.err.println(" -g: organize by group."); + System.err.println(" -f: print all information."); + System.err.println(" -s: short summary."); + System.err.println(" -d: only list dangerous permissions."); + System.err.println(" -u: list only the permissions users will see."); System.err.println(""); System.err.println("The list instrumentation command prints all instrumentations,"); - System.err.println("or only those that target a specified package. Use the -f option"); - System.err.println("to see their associated file."); + System.err.println("or only those that target a specified package. Options:"); + System.err.println(" -f: see their associated file."); System.err.println(""); System.err.println("The path command prints the path to the .apk of a package."); System.err.println(""); - System.err.println("The install command installs a package to the system. Use"); - System.err.println("the -l option to install the package with FORWARD_LOCK. Use"); - System.err.println("the -r option to reinstall an exisiting app, keeping its data."); - System.err.println("the -i option to specify the installer package name."); + System.err.println("The install command 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."); + System.err.println(" -t: allow test .apks to be installed."); + System.err.println(" -i: specify the installer package name."); System.err.println(""); - System.err.println("The uninstall command removes a package from the system. Use"); - System.err.println("the -k option to keep the data and cache directories around"); + System.err.println("The uninstall command removes a package from the system. Options:"); + System.err.println(" -k: keep the data and cache directories around."); System.err.println("after the package removal."); System.err.println(""); System.err.println("The enable and disable commands change the enabled state of"); |