diff options
author | Glenn Kasten <gkasten@google.com> | 2014-03-26 19:59:48 +0000 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2014-03-26 19:59:48 +0000 |
commit | 7629a18a3f190368e6268d3f2827824905683268 (patch) | |
tree | 392b2bde32c959d39d7a37bc0f3c46d7fbe3a55b /cmds | |
parent | ab8a501f255b272af887acb0e66eb71cdf24c755 (diff) | |
download | frameworks_base-7629a18a3f190368e6268d3f2827824905683268.zip frameworks_base-7629a18a3f190368e6268d3f2827824905683268.tar.gz frameworks_base-7629a18a3f190368e6268d3f2827824905683268.tar.bz2 |
Revert "Expand install observer semantics"
This reverts commit ab8a501f255b272af887acb0e66eb71cdf24c755.
Change-Id: I4ab4ae1a96efa2adf9d5a513793d8b84eef38b4e
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/pm/src/com/android/commands/pm/Pm.java | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java index f92bed2..d513a10 100644 --- a/cmds/pm/src/com/android/commands/pm/Pm.java +++ b/cmds/pm/src/com/android/commands/pm/Pm.java @@ -25,7 +25,7 @@ import android.content.pm.ContainerEncryptionParams; import android.content.pm.FeatureInfo; import android.content.pm.IPackageDataObserver; import android.content.pm.IPackageDeleteObserver; -import android.content.pm.IPackageInstallObserver2; +import android.content.pm.IPackageInstallObserver; import android.content.pm.IPackageManager; import android.content.pm.InstrumentationInfo; import android.content.pm.PackageInfo; @@ -39,7 +39,6 @@ import android.content.pm.VerificationParams; import android.content.res.AssetManager; import android.content.res.Resources; import android.net.Uri; -import android.os.Bundle; import android.os.IUserManager; import android.os.Process; import android.os.RemoteException; @@ -701,21 +700,14 @@ public final class Pm { ActivityManager.dumpPackageStateStatic(FileDescriptor.out, pkg); } - class PackageInstallObserver extends IPackageInstallObserver2.Stub { + class PackageInstallObserver extends IPackageInstallObserver.Stub { boolean finished; int result; - String extraPermission; - String extraPackage; - @Override - public void packageInstalled(String name, Bundle extras, int status) { + public void packageInstalled(String name, int status) { synchronized( this) { finished = true; result = status; - if (status == PackageManager.INSTALL_FAILED_DUPLICATE_PERMISSION) { - extraPermission = extras.getString(PackageManager.EXTRA_EXISTING_PERMISSION); - extraPackage = extras.getString(PackageManager.EXTRA_EXISTING_PACKAGE); - } notifyAll(); } } @@ -725,8 +717,7 @@ public final class Pm { * Converts a failure code into a string by using reflection to find a matching constant * in PackageManager. */ - private String installFailureToString(PackageInstallObserver obs) { - final int result = obs.result; + private String installFailureToString(int result) { Field[] fields = PackageManager.class.getFields(); for (Field f: fields) { if (f.getType() == int.class) { @@ -741,16 +732,7 @@ public final class Pm { // get the int value and compare it to result. try { if (result == f.getInt(null)) { - StringBuilder sb = new StringBuilder(64); - sb.append(fieldName); - if (obs.extraPermission != null) { - sb.append(" perm="); - sb.append(obs.extraPermission); - } - if (obs.extraPackage != null) { - sb.append(" pkg=" + obs.extraPackage); - } - return sb.toString(); + return fieldName; } } catch (IllegalAccessException e) { // this shouldn't happen since we only look for public static fields. @@ -974,7 +956,7 @@ public final class Pm { VerificationParams verificationParams = new VerificationParams(verificationURI, originatingURI, referrerURI, VerificationParams.NO_UID, null); - mPm.installPackageWithVerificationAndEncryptionEtc(apkURI, null, obs, installFlags, + mPm.installPackageWithVerificationAndEncryption(apkURI, obs, installFlags, installerPackageName, verificationParams, encryptionParams); synchronized (obs) { @@ -988,7 +970,7 @@ public final class Pm { System.out.println("Success"); } else { System.err.println("Failure [" - + installFailureToString(obs) + + installFailureToString(obs.result) + "]"); } } |