diff options
author | Jeff Sharkey <jsharkey@android.com> | 2015-11-05 10:00:05 -0800 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2015-11-05 10:28:43 -0800 |
commit | f131e1aae9c04d58a6ac0c51555ed90ea4158d6e (patch) | |
tree | 8fb893552f61928bda03f6f352f0b18c14ad636d /services | |
parent | c8bb39d98d7c2a07f1a5c745f6e89e379e4a25f0 (diff) | |
download | frameworks_base-f131e1aae9c04d58a6ac0c51555ed90ea4158d6e.zip frameworks_base-f131e1aae9c04d58a6ac0c51555ed90ea4158d6e.tar.gz frameworks_base-f131e1aae9c04d58a6ac0c51555ed90ea4158d6e.tar.bz2 |
Kick movement preconditions onto handler thread.
The bulk of package moving already occurs on the handler thread,
but one of the precondition steps requires that we make an installd
call to calculate disk space of the app. If there was already
another long-running installd call going on, we could end up ANR'ing
the caller.
Since movePackage() is already designed to return a moveId and go
async, we can push all the precondition steps onto the handler thread
to prevent the ANR.
Bug: 25490003
Change-Id: I62d555c23bbf81b791f6f4cabc40c3d64c580cf8
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 4e49312..c1d091b 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -15986,13 +15986,18 @@ public class PackageManagerService extends IPackageManager.Stub { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MOVE_PACKAGE, null); final int moveId = mNextMoveId.getAndIncrement(); - try { - movePackageInternal(packageName, volumeUuid, moveId); - } catch (PackageManagerException e) { - Slog.w(TAG, "Failed to move " + packageName, e); - mMoveCallbacks.notifyStatusChanged(moveId, - PackageManager.MOVE_FAILED_INTERNAL_ERROR); - } + mHandler.post(new Runnable() { + @Override + public void run() { + try { + movePackageInternal(packageName, volumeUuid, moveId); + } catch (PackageManagerException e) { + Slog.w(TAG, "Failed to move " + packageName, e); + mMoveCallbacks.notifyStatusChanged(moveId, + PackageManager.MOVE_FAILED_INTERNAL_ERROR); + } + } + }); return moveId; } |