diff options
| author | 2017-08-18 21:55:35 +0000 | |
|---|---|---|
| committer | 2017-08-18 21:55:35 +0000 | |
| commit | 96a91f11c1f5783c673dc7486cea72c9728b9025 (patch) | |
| tree | 77f045f124b2510bddab884b04053ce75f080a41 | |
| parent | 8ee6ecc1d0838a9f3bf8988eb0391b20fba374a5 (diff) | |
| parent | 004f9a3066bc1be589a6c98855ff1232f1c6c024 (diff) | |
Merge "Don't resume activity if user is locked and encryption is unsupported" into oc-mr1-dev am: 1327cdc53d
am: 004f9a3066
Change-Id: Ifcbb0d3fbde8f87052509d5ef0a0b57e013e2245
3 files changed, 14 insertions, 2 deletions
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index 72075a515e02..2aa3d09dd479 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -1508,6 +1508,11 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE) != 0; } + /** @hide */ + public boolean isEncryptionAware() { + return isDirectBootAware() || isPartiallyDirectBootAware(); + } + /** * @hide */ diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java index a2e30676e3d4..d6f4c75f0a0e 100644 --- a/services/core/java/com/android/server/am/ActivityRecord.java +++ b/services/core/java/com/android/server/am/ActivityRecord.java @@ -147,6 +147,7 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; +import android.os.storage.StorageManager; import android.service.voice.IVoiceInteractionSession; import android.util.EventLog; import android.util.Log; @@ -2020,6 +2021,13 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo /** Checks whether the activity should be shown for current user. */ public boolean okToShowLocked() { + // We cannot show activities when the device is locked and the application is not + // encryption aware. + if (!StorageManager.isUserKeyUnlocked(userId) + && !info.applicationInfo.isEncryptionAware()) { + return false; + } + return (info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0 || (mStackSupervisor.isCurrentProfileLocked(userId) && service.mUserController.isUserRunningLocked(userId, 0 /* flags */)); diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 1617defc95a5..8ccefab742df 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -3884,8 +3884,7 @@ public class PackageManagerService extends IPackageManager.Stub throw new SecurityException("Package " + packageName + " is currently frozen!"); } - if (!userKeyUnlocked && !(ps.pkg.applicationInfo.isDirectBootAware() - || ps.pkg.applicationInfo.isPartiallyDirectBootAware())) { + if (!userKeyUnlocked && !ps.pkg.applicationInfo.isEncryptionAware()) { throw new SecurityException("Package " + packageName + " is not encryption aware!"); } } |