From 85ced632680642fce680d141ddd10299ff849233 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Wed, 22 Jul 2015 11:11:46 -0700 Subject: More info to support CTS, fix reconcile bug. Surface more details and commands for storage volumes to support CTS testing. Fix user reconciliation bug that skipped user setup on empty volumes. Bug: 22658804, 22633097 Change-Id: I4221312d1cce24d1f5a2c108095cf3cf471598ed --- .../android/server/pm/PackageManagerService.java | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'services') diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index c139389..9e7e5ec 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -15600,12 +15600,8 @@ public class PackageManagerService extends IPackageManager.Stub { * recycled. */ private void reconcileUsers(String volumeUuid) { - final File[] files = Environment.getDataUserDirectory(volumeUuid).listFiles(); - if (ArrayUtils.isEmpty(files)) { - Slog.d(TAG, "No users found on " + volumeUuid); - return; - } - + final File[] files = FileUtils + .listFilesOrEmpty(Environment.getDataUserDirectory(volumeUuid)); for (File file : files) { if (!file.isDirectory()) continue; @@ -15661,12 +15657,8 @@ public class PackageManagerService extends IPackageManager.Stub { * another volume. */ private void reconcileApps(String volumeUuid) { - final File[] files = Environment.getDataAppDirectory(volumeUuid).listFiles(); - if (ArrayUtils.isEmpty(files)) { - Slog.d(TAG, "No apps found on " + volumeUuid); - return; - } - + final File[] files = FileUtils + .listFilesOrEmpty(Environment.getDataAppDirectory(volumeUuid)); for (File file : files) { final boolean isPackage = (isApkFile(file) || file.isDirectory()) && !PackageInstallerService.isStageName(file.getName()); @@ -15797,7 +15789,12 @@ public class PackageManagerService extends IPackageManager.Stub { } // Now that we're guarded by frozen state, kill app during move - killApplication(packageName, appId, "move pkg"); + final long token = Binder.clearCallingIdentity(); + try { + killApplication(packageName, appId, "move pkg"); + } finally { + Binder.restoreCallingIdentity(token); + } final Bundle extras = new Bundle(); extras.putString(Intent.EXTRA_PACKAGE_NAME, packageName); -- cgit v1.1