Merge "Apply non-FBE migration early during boot." into nyc-dev am: 599de361cb

am: a65e7a6dd7

* commit 'a65e7a6dd7f378314f52949e5920a477ffef4ed2':
  Apply non-FBE migration early during boot.

Change-Id: Ie4fd9e03f515a491a60bee445a964faa111c4f52
This commit is contained in:
Jeff Sharkey
2016-05-02 22:41:08 +00:00
committed by android-build-merger

View File

@@ -2684,8 +2684,14 @@ public class PackageManagerService extends IPackageManager.Stub {
// Prepare storage for system user really early during boot, // Prepare storage for system user really early during boot,
// since core system apps like SettingsProvider and SystemUI // since core system apps like SettingsProvider and SystemUI
// can't wait for user to start // can't wait for user to start
final int storageFlags;
if (StorageManager.isFileEncryptedNativeOrEmulated()) {
storageFlags = StorageManager.FLAG_STORAGE_DE;
} else {
storageFlags = StorageManager.FLAG_STORAGE_DE | StorageManager.FLAG_STORAGE_CE;
}
reconcileAppsDataLI(StorageManager.UUID_PRIVATE_INTERNAL, UserHandle.USER_SYSTEM, reconcileAppsDataLI(StorageManager.UUID_PRIVATE_INTERNAL, UserHandle.USER_SYSTEM,
StorageManager.FLAG_STORAGE_DE); storageFlags);
// If this is first boot after an OTA, and a normal boot, then // If this is first boot after an OTA, and a normal boot, then
// we need to clear code cache directories. // we need to clear code cache directories.
@@ -19140,7 +19146,8 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
// First look for stale data that doesn't belong, and check if things // First look for stale data that doesn't belong, and check if things
// have changed since we did our last restorecon // have changed since we did our last restorecon
if ((flags & StorageManager.FLAG_STORAGE_CE) != 0) { if ((flags & StorageManager.FLAG_STORAGE_CE) != 0) {
if (!StorageManager.isUserKeyUnlocked(userId)) { if (StorageManager.isFileEncryptedNativeOrEmulated()
&& !StorageManager.isUserKeyUnlocked(userId)) {
throw new RuntimeException( throw new RuntimeException(
"Yikes, someone asked us to reconcile CE storage while " + userId "Yikes, someone asked us to reconcile CE storage while " + userId
+ " was still locked; this would have caused massive data loss!"); + " was still locked; this would have caused massive data loss!");