diff options
author | Kenny Root <kroot@google.com> | 2011-02-28 13:27:19 -0800 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2011-03-01 09:27:57 -0800 |
commit | c39bb4aaa7be1b9b0cc9fb0b1f03d54f7609ffeb (patch) | |
tree | a17b98261c9fa066d13363442585f0a227a29ce7 /services/java | |
parent | 051d4430715ea257f0afd124b919a14ced6385b8 (diff) | |
download | frameworks_base-c39bb4aaa7be1b9b0cc9fb0b1f03d54f7609ffeb.zip frameworks_base-c39bb4aaa7be1b9b0cc9fb0b1f03d54f7609ffeb.tar.gz frameworks_base-c39bb4aaa7be1b9b0cc9fb0b1f03d54f7609ffeb.tar.bz2 |
Switch to returnCode for IPackageDeleteObserver
Before the IPackageDeleteObserver only knew whether the deletion
succeeded or failed, but not the reason why.
Bug: 2520191
Change-Id: I1f0d7c04f06c539660b6e17e7e133defb0f61b5b
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/PackageManagerService.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java index f1a6e15..461a3e5 100644 --- a/services/java/com/android/server/PackageManagerService.java +++ b/services/java/com/android/server/PackageManagerService.java @@ -6204,10 +6204,10 @@ class PackageManagerService extends IPackageManager.Stub { mHandler.post(new Runnable() { public void run() { mHandler.removeCallbacks(this); - final boolean succeded = deletePackageX(packageName, true, true, flags); + final int returnCode = deletePackageX(packageName, true, true, flags); if (observer != null) { try { - observer.packageDeleted(succeded); + observer.packageDeleted(packageName, returnCode); } catch (RemoteException e) { Log.i(TAG, "Observer no longer exists."); } //end catch @@ -6230,17 +6230,17 @@ class PackageManagerService extends IPackageManager.Stub { * persisting settings for later use * sending a broadcast if necessary */ - private boolean deletePackageX(String packageName, boolean sendBroadCast, + private int deletePackageX(String packageName, boolean sendBroadCast, boolean deleteCodeAndResources, int flags) { - PackageRemovedInfo info = new PackageRemovedInfo(); - boolean res; + final PackageRemovedInfo info = new PackageRemovedInfo(); + final boolean res; IDevicePolicyManager dpm = IDevicePolicyManager.Stub.asInterface( ServiceManager.getService(Context.DEVICE_POLICY_SERVICE)); try { if (dpm != null && dpm.packageHasActiveAdmins(packageName)) { Slog.w(TAG, "Not removing package " + packageName + ": has active device admin"); - return false; + return PackageManager.DELETE_FAILED_DEVICE_POLICY_MANAGER; } } catch (RemoteException e) { } @@ -6250,7 +6250,7 @@ class PackageManagerService extends IPackageManager.Stub { flags | REMOVE_CHATTY, info, true); } - if(res && sendBroadCast) { + if (res && sendBroadCast) { boolean systemUpdate = info.isRemovedPackageSystemUpdate; info.sendBroadcast(deleteCodeAndResources, systemUpdate); @@ -6278,7 +6278,8 @@ class PackageManagerService extends IPackageManager.Stub { info.args.doPostDeleteLI(deleteCodeAndResources); } } - return res; + + return res ? PackageManager.DELETE_SUCCEEDED : PackageManager.DELETE_FAILED_INTERNAL_ERROR; } static class PackageRemovedInfo { |