diff options
author | Jeff Sharkey <jsharkey@android.com> | 2016-03-17 22:09:46 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-03-17 22:09:46 +0000 |
commit | 78bcc89df493fa4cc96f893272193fd6b99cdaed (patch) | |
tree | 22cc864d59f126672c151924bbedef3cb67473fc | |
parent | 929d90cf280002482d3c9d382625d64610885a2e (diff) | |
parent | 5a128c4f33aa38d3a35b5884519f6bd3a355512d (diff) |
Merge "Refactoring FBE APIs based on council feedback." into nyc-dev am: a0a58a2
am: 5a128c4
* commit '5a128c4f33aa38d3a35b5884519f6bd3a355512d':
Refactoring FBE APIs based on council feedback.
55 files changed, 1004 insertions, 809 deletions
diff --git a/api/current.txt b/api/current.txt index 320c33d9e411..1bc1291800f2 100644 --- a/api/current.txt +++ b/api/current.txt @@ -443,6 +443,7 @@ package android { field public static final deprecated int dayOfWeekTextAppearance = 16843925; // 0x1010495 field public static final int debuggable = 16842767; // 0x101000f field public static final int defaultHeight = 16844021; // 0x10104f5 + field public static final int defaultToDeviceProtectedStorage = 16844037; // 0x1010505 field public static final int defaultValue = 16843245; // 0x10101ed field public static final int defaultWidth = 16844020; // 0x10104f4 field public static final int delay = 16843212; // 0x10101cc @@ -462,6 +463,7 @@ package android { field public static final int dialogTheme = 16843528; // 0x1010308 field public static final int dialogTitle = 16843250; // 0x10101f2 field public static final int digits = 16843110; // 0x1010166 + field public static final int directBootAware = 16844038; // 0x1010506 field public static final int direction = 16843217; // 0x10101d1 field public static final deprecated int directionDescriptions = 16843681; // 0x10103a1 field public static final int directionPriority = 16843218; // 0x10101d2 @@ -510,7 +512,6 @@ package android { field public static final int ellipsize = 16842923; // 0x10100ab field public static final int ems = 16843096; // 0x1010158 field public static final int enabled = 16842766; // 0x101000e - field public static final int encryptionAware = 16844038; // 0x1010506 field public static final int end = 16843996; // 0x10104dc field public static final int endColor = 16843166; // 0x101019e field public static final int endX = 16844051; // 0x1010513 @@ -575,7 +576,6 @@ package android { field public static final int fontFamily = 16843692; // 0x10103ac field public static final int fontFeatureSettings = 16843959; // 0x10104b7 field public static final int footerDividersEnabled = 16843311; // 0x101022f - field public static final int forceDeviceEncrypted = 16844037; // 0x1010505 field public static final int foreground = 16843017; // 0x1010109 field public static final int foregroundGravity = 16843264; // 0x1010200 field public static final int foregroundTint = 16843885; // 0x101046d @@ -7978,7 +7978,7 @@ package android.content { method public abstract int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); method public abstract deprecated void clearWallpaper() throws java.io.IOException; method public abstract android.content.Context createConfigurationContext(android.content.res.Configuration); - method public abstract android.content.Context createDeviceEncryptedStorageContext(); + method public abstract android.content.Context createDeviceProtectedStorageContext(); method public abstract android.content.Context createDisplayContext(android.view.Display); method public abstract android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; method public abstract java.lang.String[] databaseList(); @@ -8036,10 +8036,10 @@ package android.content { method public abstract deprecated int getWallpaperDesiredMinimumHeight(); method public abstract deprecated int getWallpaperDesiredMinimumWidth(); method public abstract void grantUriPermission(java.lang.String, android.net.Uri, int); - method public abstract boolean isDeviceEncryptedStorage(); + method public abstract boolean isDeviceProtectedStorage(); method public boolean isRestricted(); - method public abstract boolean migrateDatabaseFrom(android.content.Context, java.lang.String); - method public abstract boolean migrateSharedPreferencesFrom(android.content.Context, java.lang.String); + method public abstract boolean moveDatabaseFrom(android.content.Context, java.lang.String); + method public abstract boolean moveSharedPreferencesFrom(android.content.Context, java.lang.String); method public final android.content.res.TypedArray obtainStyledAttributes(int[]); method public final android.content.res.TypedArray obtainStyledAttributes(int, int[]) throws android.content.res.Resources.NotFoundException; method public final android.content.res.TypedArray obtainStyledAttributes(android.util.AttributeSet, int[]); @@ -8174,7 +8174,7 @@ package android.content { method public int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); method public deprecated void clearWallpaper() throws java.io.IOException; method public android.content.Context createConfigurationContext(android.content.res.Configuration); - method public android.content.Context createDeviceEncryptedStorageContext(); + method public android.content.Context createDeviceProtectedStorageContext(); method public android.content.Context createDisplayContext(android.view.Display); method public android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; method public java.lang.String[] databaseList(); @@ -8226,9 +8226,9 @@ package android.content { method public deprecated int getWallpaperDesiredMinimumHeight(); method public deprecated int getWallpaperDesiredMinimumWidth(); method public void grantUriPermission(java.lang.String, android.net.Uri, int); - method public boolean isDeviceEncryptedStorage(); - method public boolean migrateDatabaseFrom(android.content.Context, java.lang.String); - method public boolean migrateSharedPreferencesFrom(android.content.Context, java.lang.String); + method public boolean isDeviceProtectedStorage(); + method public boolean moveDatabaseFrom(android.content.Context, java.lang.String); + method public boolean moveSharedPreferencesFrom(android.content.Context, java.lang.String); method public java.io.FileInputStream openFileInput(java.lang.String) throws java.io.FileNotFoundException; method public java.io.FileOutputStream openFileOutput(java.lang.String, int) throws java.io.FileNotFoundException; method public android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory); @@ -9319,10 +9319,9 @@ package android.content.pm { field public java.lang.String backupAgentName; field public java.lang.String className; field public int compatibleWidthLimitDp; - field public java.lang.String credentialEncryptedDataDir; field public java.lang.String dataDir; field public int descriptionRes; - field public java.lang.String deviceEncryptedDataDir; + field public java.lang.String deviceProtectedDataDir; field public boolean enabled; field public int flags; field public int largestWidthLimitDp; @@ -9359,8 +9358,8 @@ package android.content.pm { method public boolean isEnabled(); field public android.content.pm.ApplicationInfo applicationInfo; field public int descriptionRes; + field public boolean directBootAware; field public boolean enabled; - field public boolean encryptionAware; field public boolean exported; field public java.lang.String processName; } @@ -9831,11 +9830,10 @@ package android.content.pm { field public static final int GET_URI_PERMISSION_PATTERNS = 2048; // 0x800 field public static final int MATCH_ALL = 131072; // 0x20000 field public static final int MATCH_DEFAULT_ONLY = 65536; // 0x10000 + field public static final int MATCH_DIRECT_BOOT_AWARE = 524288; // 0x80000 + field public static final int MATCH_DIRECT_BOOT_UNAWARE = 262144; // 0x40000 field public static final int MATCH_DISABLED_COMPONENTS = 512; // 0x200 field public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 32768; // 0x8000 - field public static final int MATCH_ENCRYPTION_AWARE = 524288; // 0x80000 - field public static final int MATCH_ENCRYPTION_AWARE_AND_UNAWARE = 786432; // 0xc0000 - field public static final int MATCH_ENCRYPTION_UNAWARE = 262144; // 0x40000 field public static final int MATCH_SYSTEM_ONLY = 1048576; // 0x100000 field public static final int MATCH_UNINSTALLED_PACKAGES = 8192; // 0x2000 field public static final long MAXIMUM_VERIFICATION_TIMEOUT = 3600000L; // 0x36ee80L @@ -29376,10 +29374,6 @@ package android.os { method public boolean isSystemUser(); method public boolean isUserAGoat(); method public boolean isUserRunning(android.os.UserHandle); - method public deprecated boolean isUserRunningAndLocked(); - method public deprecated boolean isUserRunningAndLocked(android.os.UserHandle); - method public deprecated boolean isUserRunningAndUnlocked(); - method public deprecated boolean isUserRunningAndUnlocked(android.os.UserHandle); method public boolean isUserRunningOrStopping(android.os.UserHandle); method public boolean isUserUnlocked(); method public boolean isUserUnlocked(android.os.UserHandle); @@ -29941,7 +29935,7 @@ package android.preference { method public void setSharedPreferencesMode(int); method public void setSharedPreferencesName(java.lang.String); method public void setStorageDefault(); - method public void setStorageDeviceEncrypted(); + method public void setStorageDeviceProtected(); field public static final java.lang.String KEY_HAS_SET_DEFAULT_VALUES = "_has_set_default_values"; field public static final java.lang.String METADATA_KEY_PREFERENCES = "android.preference"; } @@ -37918,7 +37912,7 @@ package android.test.mock { method public int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); method public void clearWallpaper(); method public android.content.Context createConfigurationContext(android.content.res.Configuration); - method public android.content.Context createDeviceEncryptedStorageContext(); + method public android.content.Context createDeviceProtectedStorageContext(); method public android.content.Context createDisplayContext(android.view.Display); method public android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; method public java.lang.String[] databaseList(); @@ -37969,9 +37963,9 @@ package android.test.mock { method public int getWallpaperDesiredMinimumHeight(); method public int getWallpaperDesiredMinimumWidth(); method public void grantUriPermission(java.lang.String, android.net.Uri, int); - method public boolean isDeviceEncryptedStorage(); - method public boolean migrateDatabaseFrom(android.content.Context, java.lang.String); - method public boolean migrateSharedPreferencesFrom(android.content.Context, java.lang.String); + method public boolean isDeviceProtectedStorage(); + method public boolean moveDatabaseFrom(android.content.Context, java.lang.String); + method public boolean moveSharedPreferencesFrom(android.content.Context, java.lang.String); method public java.io.FileInputStream openFileInput(java.lang.String) throws java.io.FileNotFoundException; method public java.io.FileOutputStream openFileOutput(java.lang.String, int) throws java.io.FileNotFoundException; method public android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory); diff --git a/api/removed.txt b/api/removed.txt index 8ac2d63d99a2..9b5d3ab0d81c 100644 --- a/api/removed.txt +++ b/api/removed.txt @@ -17,12 +17,40 @@ package android.app.admin { } +package android.content { + + public abstract class Context { + method public deprecated android.content.Context createCredentialEncryptedStorageContext(); + method public deprecated android.content.Context createDeviceEncryptedStorageContext(); + method public deprecated boolean isCredentialEncryptedStorage(); + method public deprecated boolean isDeviceEncryptedStorage(); + method public deprecated boolean migrateDatabaseFrom(android.content.Context, java.lang.String); + method public deprecated boolean migrateSharedPreferencesFrom(android.content.Context, java.lang.String); + } + +} + package android.content.pm { + public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable { + field public deprecated java.lang.String credentialEncryptedDataDir; + field public deprecated java.lang.String deviceEncryptedDataDir; + } + + public class ComponentInfo extends android.content.pm.PackageItemInfo { + field public deprecated boolean encryptionAware; + } + public class PackageInfo implements android.os.Parcelable { field public static final int REQUESTED_PERMISSION_REQUIRED = 1; // 0x1 } + public abstract class PackageManager { + field public static final deprecated int MATCH_ENCRYPTION_AWARE = 524288; // 0x80000 + field public static final deprecated int MATCH_ENCRYPTION_AWARE_AND_UNAWARE = 786432; // 0xc0000 + field public static final deprecated int MATCH_ENCRYPTION_UNAWARE = 262144; // 0x40000 + } + } package android.database { @@ -98,6 +126,19 @@ package android.os { method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int); method public android.graphics.drawable.Drawable getBadgedIconForUser(android.graphics.drawable.Drawable, android.os.UserHandle); method public java.lang.CharSequence getBadgedLabelForUser(java.lang.CharSequence, android.os.UserHandle); + method public deprecated boolean isUserRunningAndLocked(); + method public deprecated boolean isUserRunningAndLocked(android.os.UserHandle); + method public deprecated boolean isUserRunningAndUnlocked(); + method public deprecated boolean isUserRunningAndUnlocked(android.os.UserHandle); + } + +} + +package android.preference { + + public class PreferenceManager { + method public deprecated void setStorageCredentialEncrypted(); + method public deprecated void setStorageDeviceEncrypted(); } } diff --git a/api/system-current.txt b/api/system-current.txt index 721bfe376f29..3a562d15f577 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -538,6 +538,7 @@ package android { field public static final deprecated int dayOfWeekTextAppearance = 16843925; // 0x1010495 field public static final int debuggable = 16842767; // 0x101000f field public static final int defaultHeight = 16844021; // 0x10104f5 + field public static final int defaultToDeviceProtectedStorage = 16844037; // 0x1010505 field public static final int defaultValue = 16843245; // 0x10101ed field public static final int defaultWidth = 16844020; // 0x10104f4 field public static final int delay = 16843212; // 0x10101cc @@ -557,6 +558,7 @@ package android { field public static final int dialogTheme = 16843528; // 0x1010308 field public static final int dialogTitle = 16843250; // 0x10101f2 field public static final int digits = 16843110; // 0x1010166 + field public static final int directBootAware = 16844038; // 0x1010506 field public static final int direction = 16843217; // 0x10101d1 field public static final deprecated int directionDescriptions = 16843681; // 0x10103a1 field public static final int directionPriority = 16843218; // 0x10101d2 @@ -605,7 +607,6 @@ package android { field public static final int ellipsize = 16842923; // 0x10100ab field public static final int ems = 16843096; // 0x1010158 field public static final int enabled = 16842766; // 0x101000e - field public static final int encryptionAware = 16844038; // 0x1010506 field public static final int end = 16843996; // 0x10104dc field public static final int endColor = 16843166; // 0x101019e field public static final int endX = 16844051; // 0x1010513 @@ -670,7 +671,6 @@ package android { field public static final int fontFamily = 16843692; // 0x10103ac field public static final int fontFeatureSettings = 16843959; // 0x10104b7 field public static final int footerDividersEnabled = 16843311; // 0x101022f - field public static final int forceDeviceEncrypted = 16844037; // 0x1010505 field public static final int foreground = 16843017; // 0x1010109 field public static final int foregroundGravity = 16843264; // 0x1010200 field public static final int foregroundTint = 16843885; // 0x101046d @@ -8276,8 +8276,8 @@ package android.content { method public abstract int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); method public abstract deprecated void clearWallpaper() throws java.io.IOException; method public abstract android.content.Context createConfigurationContext(android.content.res.Configuration); - method public abstract android.content.Context createCredentialEncryptedStorageContext(); - method public abstract android.content.Context createDeviceEncryptedStorageContext(); + method public abstract android.content.Context createCredentialProtectedStorageContext(); + method public abstract android.content.Context createDeviceProtectedStorageContext(); method public abstract android.content.Context createDisplayContext(android.view.Display); method public abstract android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; method public abstract java.lang.String[] databaseList(); @@ -8335,11 +8335,11 @@ package android.content { method public abstract deprecated int getWallpaperDesiredMinimumHeight(); method public abstract deprecated int getWallpaperDesiredMinimumWidth(); method public abstract void grantUriPermission(java.lang.String, android.net.Uri, int); - method public abstract boolean isCredentialEncryptedStorage(); - method public abstract boolean isDeviceEncryptedStorage(); + method public abstract boolean isCredentialProtectedStorage(); + method public abstract boolean isDeviceProtectedStorage(); method public boolean isRestricted(); - method public abstract boolean migrateDatabaseFrom(android.content.Context, java.lang.String); - method public abstract boolean migrateSharedPreferencesFrom(android.content.Context, java.lang.String); + method public abstract boolean moveDatabaseFrom(android.content.Context, java.lang.String); + method public abstract boolean moveSharedPreferencesFrom(android.content.Context, java.lang.String); method public final android.content.res.TypedArray obtainStyledAttributes(int[]); method public final android.content.res.TypedArray obtainStyledAttributes(int, int[]) throws android.content.res.Resources.NotFoundException; method public final android.content.res.TypedArray obtainStyledAttributes(android.util.AttributeSet, int[]); @@ -8483,8 +8483,8 @@ package android.content { method public int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); method public deprecated void clearWallpaper() throws java.io.IOException; method public android.content.Context createConfigurationContext(android.content.res.Configuration); - method public android.content.Context createCredentialEncryptedStorageContext(); - method public android.content.Context createDeviceEncryptedStorageContext(); + method public android.content.Context createCredentialProtectedStorageContext(); + method public android.content.Context createDeviceProtectedStorageContext(); method public android.content.Context createDisplayContext(android.view.Display); method public android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; method public java.lang.String[] databaseList(); @@ -8536,10 +8536,10 @@ package android.content { method public deprecated int getWallpaperDesiredMinimumHeight(); method public deprecated int getWallpaperDesiredMinimumWidth(); method public void grantUriPermission(java.lang.String, android.net.Uri, int); - method public boolean isCredentialEncryptedStorage(); - method public boolean isDeviceEncryptedStorage(); - method public boolean migrateDatabaseFrom(android.content.Context, java.lang.String); - method public boolean migrateSharedPreferencesFrom(android.content.Context, java.lang.String); + method public boolean isCredentialProtectedStorage(); + method public boolean isDeviceProtectedStorage(); + method public boolean moveDatabaseFrom(android.content.Context, java.lang.String); + method public boolean moveSharedPreferencesFrom(android.content.Context, java.lang.String); method public java.io.FileInputStream openFileInput(java.lang.String) throws java.io.FileNotFoundException; method public java.io.FileOutputStream openFileOutput(java.lang.String, int) throws java.io.FileNotFoundException; method public android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory); @@ -9642,10 +9642,10 @@ package android.content.pm { field public java.lang.String backupAgentName; field public java.lang.String className; field public int compatibleWidthLimitDp; - field public java.lang.String credentialEncryptedDataDir; + field public java.lang.String credentialProtectedDataDir; field public java.lang.String dataDir; field public int descriptionRes; - field public java.lang.String deviceEncryptedDataDir; + field public java.lang.String deviceProtectedDataDir; field public boolean enabled; field public int flags; field public int largestWidthLimitDp; @@ -9682,8 +9682,8 @@ package android.content.pm { method public boolean isEnabled(); field public android.content.pm.ApplicationInfo applicationInfo; field public int descriptionRes; + field public boolean directBootAware; field public boolean enabled; - field public boolean encryptionAware; field public boolean exported; field public java.lang.String processName; } @@ -10220,11 +10220,10 @@ package android.content.pm { field public static final int MASK_PERMISSION_FLAGS = 255; // 0xff field public static final int MATCH_ALL = 131072; // 0x20000 field public static final int MATCH_DEFAULT_ONLY = 65536; // 0x10000 + field public static final int MATCH_DIRECT_BOOT_AWARE = 524288; // 0x80000 + field public static final int MATCH_DIRECT_BOOT_UNAWARE = 262144; // 0x40000 field public static final int MATCH_DISABLED_COMPONENTS = 512; // 0x200 field public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 32768; // 0x8000 - field public static final int MATCH_ENCRYPTION_AWARE = 524288; // 0x80000 - field public static final int MATCH_ENCRYPTION_AWARE_AND_UNAWARE = 786432; // 0xc0000 - field public static final int MATCH_ENCRYPTION_UNAWARE = 262144; // 0x40000 field public static final int MATCH_SYSTEM_ONLY = 1048576; // 0x100000 field public static final int MATCH_UNINSTALLED_PACKAGES = 8192; // 0x2000 field public static final long MAXIMUM_VERIFICATION_TIMEOUT = 3600000L; // 0x36ee80L @@ -31722,10 +31721,6 @@ package android.os { method public boolean isSystemUser(); method public boolean isUserAGoat(); method public boolean isUserRunning(android.os.UserHandle); - method public deprecated boolean isUserRunningAndLocked(); - method public deprecated boolean isUserRunningAndLocked(android.os.UserHandle); - method public deprecated boolean isUserRunningAndUnlocked(); - method public deprecated boolean isUserRunningAndUnlocked(android.os.UserHandle); method public boolean isUserRunningOrStopping(android.os.UserHandle); method public boolean isUserUnlocked(); method public boolean isUserUnlocked(android.os.UserHandle); @@ -32286,9 +32281,9 @@ package android.preference { method public static void setDefaultValues(android.content.Context, java.lang.String, int, int, boolean); method public void setSharedPreferencesMode(int); method public void setSharedPreferencesName(java.lang.String); - method public void setStorageCredentialEncrypted(); + method public void setStorageCredentialProtected(); method public void setStorageDefault(); - method public void setStorageDeviceEncrypted(); + method public void setStorageDeviceProtected(); field public static final java.lang.String KEY_HAS_SET_DEFAULT_VALUES = "_has_set_default_values"; field public static final java.lang.String METADATA_KEY_PREFERENCES = "android.preference"; } @@ -40665,8 +40660,8 @@ package android.test.mock { method public int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); method public void clearWallpaper(); method public android.content.Context createConfigurationContext(android.content.res.Configuration); - method public android.content.Context createCredentialEncryptedStorageContext(); - method public android.content.Context createDeviceEncryptedStorageContext(); + method public android.content.Context createCredentialProtectedStorageContext(); + method public android.content.Context createDeviceProtectedStorageContext(); method public android.content.Context createDisplayContext(android.view.Display); method public android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; method public java.lang.String[] databaseList(); @@ -40717,10 +40712,10 @@ package android.test.mock { method public int getWallpaperDesiredMinimumHeight(); method public int getWallpaperDesiredMinimumWidth(); method public void grantUriPermission(java.lang.String, android.net.Uri, int); - method public boolean isCredentialEncryptedStorage(); - method public boolean isDeviceEncryptedStorage(); - method public boolean migrateDatabaseFrom(android.content.Context, java.lang.String); - method public boolean migrateSharedPreferencesFrom(android.content.Context, java.lang.String); + method public boolean isCredentialProtectedStorage(); + method public boolean isDeviceProtectedStorage(); + method public boolean moveDatabaseFrom(android.content.Context, java.lang.String); + method public boolean moveSharedPreferencesFrom(android.content.Context, java.lang.String); method public java.io.FileInputStream openFileInput(java.lang.String) throws java.io.FileNotFoundException; method public java.io.FileOutputStream openFileOutput(java.lang.String, int) throws java.io.FileNotFoundException; method public android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory); diff --git a/api/system-removed.txt b/api/system-removed.txt index caeecf5d544d..8bf59df2d890 100644 --- a/api/system-removed.txt +++ b/api/system-removed.txt @@ -15,12 +15,40 @@ package android.app.admin { } +package android.content { + + public abstract class Context { + method public deprecated android.content.Context createCredentialEncryptedStorageContext(); + method public deprecated android.content.Context createDeviceEncryptedStorageContext(); + method public deprecated boolean isCredentialEncryptedStorage(); + method public deprecated boolean isDeviceEncryptedStorage(); + method public deprecated boolean migrateDatabaseFrom(android.content.Context, java.lang.String); + method public deprecated boolean migrateSharedPreferencesFrom(android.content.Context, java.lang.String); + } + +} + package android.content.pm { + public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable { + field public deprecated java.lang.String credentialEncryptedDataDir; + field public deprecated java.lang.String deviceEncryptedDataDir; + } + + public class ComponentInfo extends android.content.pm.PackageItemInfo { + field public deprecated boolean encryptionAware; + } + public class PackageInfo implements android.os.Parcelable { field public static final int REQUESTED_PERMISSION_REQUIRED = 1; // 0x1 } + public abstract class PackageManager { + field public static final deprecated int MATCH_ENCRYPTION_AWARE = 524288; // 0x80000 + field public static final deprecated int MATCH_ENCRYPTION_AWARE_AND_UNAWARE = 786432; // 0xc0000 + field public static final deprecated int MATCH_ENCRYPTION_UNAWARE = 262144; // 0x40000 + } + } package android.database { @@ -96,6 +124,19 @@ package android.os { method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int); method public android.graphics.drawable.Drawable getBadgedIconForUser(android.graphics.drawable.Drawable, android.os.UserHandle); method public java.lang.CharSequence getBadgedLabelForUser(java.lang.CharSequence, android.os.UserHandle); + method public deprecated boolean isUserRunningAndLocked(); + method public deprecated boolean isUserRunningAndLocked(android.os.UserHandle); + method public deprecated boolean isUserRunningAndUnlocked(); + method public deprecated boolean isUserRunningAndUnlocked(android.os.UserHandle); + } + +} + +package android.preference { + + public class PreferenceManager { + method public deprecated void setStorageCredentialEncrypted(); + method public deprecated void setStorageDeviceEncrypted(); } } diff --git a/api/test-current.txt b/api/test-current.txt index 2f8a9b4165a7..563c91ec5fda 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -443,6 +443,7 @@ package android { field public static final deprecated int dayOfWeekTextAppearance = 16843925; // 0x1010495 field public static final int debuggable = 16842767; // 0x101000f field public static final int defaultHeight = 16844021; // 0x10104f5 + field public static final int defaultToDeviceProtectedStorage = 16844037; // 0x1010505 field public static final int defaultValue = 16843245; // 0x10101ed field public static final int defaultWidth = 16844020; // 0x10104f4 field public static final int delay = 16843212; // 0x10101cc @@ -462,6 +463,7 @@ package android { field public static final int dialogTheme = 16843528; // 0x1010308 field public static final int dialogTitle = 16843250; // 0x10101f2 field public static final int digits = 16843110; // 0x1010166 + field public static final int directBootAware = 16844038; // 0x1010506 field public static final int direction = 16843217; // 0x10101d1 field public static final deprecated int directionDescriptions = 16843681; // 0x10103a1 field public static final int directionPriority = 16843218; // 0x10101d2 @@ -510,7 +512,6 @@ package android { field public static final int ellipsize = 16842923; // 0x10100ab field public static final int ems = 16843096; // 0x1010158 field public static final int enabled = 16842766; // 0x101000e - field public static final int encryptionAware = 16844038; // 0x1010506 field public static final int end = 16843996; // 0x10104dc field public static final int endColor = 16843166; // 0x101019e field public static final int endX = 16844051; // 0x1010513 @@ -575,7 +576,6 @@ package android { field public static final int fontFamily = 16843692; // 0x10103ac field public static final int fontFeatureSettings = 16843959; // 0x10104b7 field public static final int footerDividersEnabled = 16843311; // 0x101022f - field public static final int forceDeviceEncrypted = 16844037; // 0x1010505 field public static final int foreground = 16843017; // 0x1010109 field public static final int foregroundGravity = 16843264; // 0x1010200 field public static final int foregroundTint = 16843885; // 0x101046d @@ -7983,7 +7983,7 @@ package android.content { method public abstract int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); method public abstract deprecated void clearWallpaper() throws java.io.IOException; method public abstract android.content.Context createConfigurationContext(android.content.res.Configuration); - method public abstract android.content.Context createDeviceEncryptedStorageContext(); + method public abstract android.content.Context createDeviceProtectedStorageContext(); method public abstract android.content.Context createDisplayContext(android.view.Display); method public abstract android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; method public abstract java.lang.String[] databaseList(); @@ -8042,10 +8042,10 @@ package android.content { method public abstract deprecated int getWallpaperDesiredMinimumHeight(); method public abstract deprecated int getWallpaperDesiredMinimumWidth(); method public abstract void grantUriPermission(java.lang.String, android.net.Uri, int); - method public abstract boolean isDeviceEncryptedStorage(); + method public abstract boolean isDeviceProtectedStorage(); method public boolean isRestricted(); - method public abstract boolean migrateDatabaseFrom(android.content.Context, java.lang.String); - method public abstract boolean migrateSharedPreferencesFrom(android.content.Context, java.lang.String); + method public abstract boolean moveDatabaseFrom(android.content.Context, java.lang.String); + method public abstract boolean moveSharedPreferencesFrom(android.content.Context, java.lang.String); method public final android.content.res.TypedArray obtainStyledAttributes(int[]); method public final android.content.res.TypedArray obtainStyledAttributes(int, int[]) throws android.content.res.Resources.NotFoundException; method public final android.content.res.TypedArray obtainStyledAttributes(android.util.AttributeSet, int[]); @@ -8180,7 +8180,7 @@ package android.content { method public int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); method public deprecated void clearWallpaper() throws java.io.IOException; method public android.content.Context createConfigurationContext(android.content.res.Configuration); - method public android.content.Context createDeviceEncryptedStorageContext(); + method public android.content.Context createDeviceProtectedStorageContext(); method public android.content.Context createDisplayContext(android.view.Display); method public android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; method public java.lang.String[] databaseList(); @@ -8233,9 +8233,9 @@ package android.content { method public deprecated int getWallpaperDesiredMinimumHeight(); method public deprecated int getWallpaperDesiredMinimumWidth(); method public void grantUriPermission(java.lang.String, android.net.Uri, int); - method public boolean isDeviceEncryptedStorage(); - method public boolean migrateDatabaseFrom(android.content.Context, java.lang.String); - method public boolean migrateSharedPreferencesFrom(android.content.Context, java.lang.String); + method public boolean isDeviceProtectedStorage(); + method public boolean moveDatabaseFrom(android.content.Context, java.lang.String); + method public boolean moveSharedPreferencesFrom(android.content.Context, java.lang.String); method public java.io.FileInputStream openFileInput(java.lang.String) throws java.io.FileNotFoundException; method public java.io.FileOutputStream openFileOutput(java.lang.String, int) throws java.io.FileNotFoundException; method public android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory); @@ -9328,10 +9328,9 @@ package android.content.pm { field public java.lang.String backupAgentName; field public java.lang.String className; field public int compatibleWidthLimitDp; - field public java.lang.String credentialEncryptedDataDir; field public java.lang.String dataDir; field public int descriptionRes; - field public java.lang.String deviceEncryptedDataDir; + field public java.lang.String deviceProtectedDataDir; field public boolean enabled; field public int flags; field public int largestWidthLimitDp; @@ -9368,8 +9367,8 @@ package android.content.pm { method public boolean isEnabled(); field public android.content.pm.ApplicationInfo applicationInfo; field public int descriptionRes; + field public boolean directBootAware; field public boolean enabled; - field public boolean encryptionAware; field public boolean exported; field public java.lang.String processName; } @@ -9841,11 +9840,10 @@ package android.content.pm { field public static final int GET_URI_PERMISSION_PATTERNS = 2048; // 0x800 field public static final int MATCH_ALL = 131072; // 0x20000 field public static final int MATCH_DEFAULT_ONLY = 65536; // 0x10000 + field public static final int MATCH_DIRECT_BOOT_AWARE = 524288; // 0x80000 + field public static final int MATCH_DIRECT_BOOT_UNAWARE = 262144; // 0x40000 field public static final int MATCH_DISABLED_COMPONENTS = 512; // 0x200 field public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 32768; // 0x8000 - field public static final int MATCH_ENCRYPTION_AWARE = 524288; // 0x80000 - field public static final int MATCH_ENCRYPTION_AWARE_AND_UNAWARE = 786432; // 0xc0000 - field public static final int MATCH_ENCRYPTION_UNAWARE = 262144; // 0x40000 field public static final int MATCH_SYSTEM_ONLY = 1048576; // 0x100000 field public static final int MATCH_UNINSTALLED_PACKAGES = 8192; // 0x2000 field public static final long MAXIMUM_VERIFICATION_TIMEOUT = 3600000L; // 0x36ee80L @@ -29442,10 +29440,6 @@ package android.os { method public boolean isSystemUser(); method public boolean isUserAGoat(); method public boolean isUserRunning(android.os.UserHandle); - method public deprecated boolean isUserRunningAndLocked(); - method public deprecated boolean isUserRunningAndLocked(android.os.UserHandle); - method public deprecated boolean isUserRunningAndUnlocked(); - method public deprecated boolean isUserRunningAndUnlocked(android.os.UserHandle); method public boolean isUserRunningOrStopping(android.os.UserHandle); method public boolean isUserUnlocked(); method public boolean isUserUnlocked(android.os.UserHandle); @@ -30007,7 +30001,7 @@ package android.preference { method public void setSharedPreferencesMode(int); method public void setSharedPreferencesName(java.lang.String); method public void setStorageDefault(); - method public void setStorageDeviceEncrypted(); + method public void setStorageDeviceProtected(); field public static final java.lang.String KEY_HAS_SET_DEFAULT_VALUES = "_has_set_default_values"; field public static final java.lang.String METADATA_KEY_PREFERENCES = "android.preference"; } @@ -37989,7 +37983,7 @@ package android.test.mock { method public int checkUriPermission(android.net.Uri, java.lang.String, java.lang.String, int, int, int); method public void clearWallpaper(); method public android.content.Context createConfigurationContext(android.content.res.Configuration); - method public android.content.Context createDeviceEncryptedStorageContext(); + method public android.content.Context createDeviceProtectedStorageContext(); method public android.content.Context createDisplayContext(android.view.Display); method public android.content.Context createPackageContext(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException; method public java.lang.String[] databaseList(); @@ -38041,9 +38035,9 @@ package android.test.mock { method public int getWallpaperDesiredMinimumHeight(); method public int getWallpaperDesiredMinimumWidth(); method public void grantUriPermission(java.lang.String, android.net.Uri, int); - method public boolean isDeviceEncryptedStorage(); - method public boolean migrateDatabaseFrom(android.content.Context, java.lang.String); - method public boolean migrateSharedPreferencesFrom(android.content.Context, java.lang.String); + method public boolean isDeviceProtectedStorage(); + method public boolean moveDatabaseFrom(android.content.Context, java.lang.String); + method public boolean moveSharedPreferencesFrom(android.content.Context, java.lang.String); method public java.io.FileInputStream openFileInput(java.lang.String) throws java.io.FileNotFoundException; method public java.io.FileOutputStream openFileOutput(java.lang.String, int) throws java.io.FileNotFoundException; method public android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory); diff --git a/api/test-removed.txt b/api/test-removed.txt index 8ac2d63d99a2..9b5d3ab0d81c 100644 --- a/api/test-removed.txt +++ b/api/test-removed.txt @@ -17,12 +17,40 @@ package android.app.admin { } +package android.content { + + public abstract class Context { + method public deprecated android.content.Context createCredentialEncryptedStorageContext(); + method public deprecated android.content.Context createDeviceEncryptedStorageContext(); + method public deprecated boolean isCredentialEncryptedStorage(); + method public deprecated boolean isDeviceEncryptedStorage(); + method public deprecated boolean migrateDatabaseFrom(android.content.Context, java.lang.String); + method public deprecated boolean migrateSharedPreferencesFrom(android.content.Context, java.lang.String); + } + +} + package android.content.pm { + public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable { + field public deprecated java.lang.String credentialEncryptedDataDir; + field public deprecated java.lang.String deviceEncryptedDataDir; + } + + public class ComponentInfo extends android.content.pm.PackageItemInfo { + field public deprecated boolean encryptionAware; + } + public class PackageInfo implements android.os.Parcelable { field public static final int REQUESTED_PERMISSION_REQUIRED = 1; // 0x1 } + public abstract class PackageManager { + field public static final deprecated int MATCH_ENCRYPTION_AWARE = 524288; // 0x80000 + field public static final deprecated int MATCH_ENCRYPTION_AWARE_AND_UNAWARE = 786432; // 0xc0000 + field public static final deprecated int MATCH_ENCRYPTION_UNAWARE = 262144; // 0x40000 + } + } package android.database { @@ -98,6 +126,19 @@ package android.os { method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int); method public android.graphics.drawable.Drawable getBadgedIconForUser(android.graphics.drawable.Drawable, android.os.UserHandle); method public java.lang.CharSequence getBadgedLabelForUser(java.lang.CharSequence, android.os.UserHandle); + method public deprecated boolean isUserRunningAndLocked(); + method public deprecated boolean isUserRunningAndLocked(android.os.UserHandle); + method public deprecated boolean isUserRunningAndUnlocked(); + method public deprecated boolean isUserRunningAndUnlocked(android.os.UserHandle); + } + +} + +package android.preference { + + public class PreferenceManager { + method public deprecated void setStorageCredentialEncrypted(); + method public deprecated void setStorageDeviceEncrypted(); } } diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java index 75680e6a60ec..4019a56133b4 100644 --- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java +++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java @@ -688,7 +688,7 @@ public class AccessibilityServiceInfo implements Parcelable { /** {@hide} */ public boolean isEncryptionAware() { - return mResolveInfo.serviceInfo.encryptionAware; + return mResolveInfo.serviceInfo.directBootAware; } /** diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 93c668d10f15..dbc6c841b7d5 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -5236,9 +5236,9 @@ public final class ActivityThread { // Setup a location to store generated/compiled graphics code and // JIT profiling data. Note that this data is stored in a - // device-encrypted storage area, so these caches must never contain + // device-protected storage area, so these caches must never contain // user sensitive user data. - final Context deviceContext = appContext.createDeviceEncryptedStorageContext(); + final Context deviceContext = appContext.createDeviceProtectedStorageContext(); final File codeCacheDir = deviceContext.getCodeCacheDir(); if (codeCacheDir != null) { setupGraphicsSupport(data.info, codeCacheDir); diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 4fccbc9a79c2..63a68294fb3d 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -400,7 +400,7 @@ class ContextImpl extends Context { * * @return the number of files moved, or -1 if there was trouble. */ - private static int migrateFiles(File sourceDir, File targetDir, final String prefix) { + private static int moveFiles(File sourceDir, File targetDir, final String prefix) { final File[] sourceFiles = FileUtils.listFilesOrEmpty(sourceDir, new FilenameFilter() { @Override public boolean accept(File dir, String name) { @@ -430,12 +430,12 @@ class ContextImpl extends Context { } @Override - public boolean migrateSharedPreferencesFrom(Context sourceContext, String name) { + public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { synchronized (ContextImpl.class) { final File source = sourceContext.getSharedPreferencesPath(name); final File target = getSharedPreferencesPath(name); - final int res = migrateFiles(source.getParentFile(), target.getParentFile(), + final int res = moveFiles(source.getParentFile(), target.getParentFile(), source.getName()); if (res > 0) { // We moved at least one file, so evict any in-memory caches for @@ -681,11 +681,11 @@ class ContextImpl extends Context { } @Override - public boolean migrateDatabaseFrom(Context sourceContext, String name) { + public boolean moveDatabaseFrom(Context sourceContext, String name) { synchronized (ContextImpl.class) { final File source = sourceContext.getDatabasePath(name); final File target = getDatabasePath(name); - return migrateFiles(source.getParentFile(), target.getParentFile(), + return moveFiles(source.getParentFile(), target.getParentFile(), source.getName()) != -1; } } @@ -1905,17 +1905,17 @@ class ContextImpl extends Context { } @Override - public Context createDeviceEncryptedStorageContext() { - final int flags = (mFlags & ~Context.CONTEXT_CREDENTIAL_ENCRYPTED_STORAGE) - | Context.CONTEXT_DEVICE_ENCRYPTED_STORAGE; + public Context createDeviceProtectedStorageContext() { + final int flags = (mFlags & ~Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE) + | Context.CONTEXT_DEVICE_PROTECTED_STORAGE; return new ContextImpl(this, mMainThread, mPackageInfo, mActivityToken, mUser, flags, mDisplay, null, Display.INVALID_DISPLAY); } @Override - public Context createCredentialEncryptedStorageContext() { - final int flags = (mFlags & ~Context.CONTEXT_DEVICE_ENCRYPTED_STORAGE) - | Context.CONTEXT_CREDENTIAL_ENCRYPTED_STORAGE; + public Context createCredentialProtectedStorageContext() { + final int flags = (mFlags & ~Context.CONTEXT_DEVICE_PROTECTED_STORAGE) + | Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; return new ContextImpl(this, mMainThread, mPackageInfo, mActivityToken, mUser, flags, mDisplay, null, Display.INVALID_DISPLAY); } @@ -1926,13 +1926,13 @@ class ContextImpl extends Context { } @Override - public boolean isDeviceEncryptedStorage() { - return (mFlags & Context.CONTEXT_DEVICE_ENCRYPTED_STORAGE) != 0; + public boolean isDeviceProtectedStorage() { + return (mFlags & Context.CONTEXT_DEVICE_PROTECTED_STORAGE) != 0; } @Override - public boolean isCredentialEncryptedStorage() { - return (mFlags & Context.CONTEXT_CREDENTIAL_ENCRYPTED_STORAGE) != 0; + public boolean isCredentialProtectedStorage() { + return (mFlags & Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE) != 0; } @Override @@ -1944,10 +1944,10 @@ class ContextImpl extends Context { public File getDataDir() { if (mPackageInfo != null) { File res = null; - if (isCredentialEncryptedStorage()) { - res = mPackageInfo.getCredentialEncryptedDataDirFile(); - } else if (isDeviceEncryptedStorage()) { - res = mPackageInfo.getDeviceEncryptedDataDirFile(); + if (isCredentialProtectedStorage()) { + res = mPackageInfo.getCredentialProtectedDataDirFile(); + } else if (isDeviceProtectedStorage()) { + res = mPackageInfo.getDeviceProtectedDataDirFile(); } else { res = mPackageInfo.getDataDirFile(); } @@ -2013,13 +2013,13 @@ class ContextImpl extends Context { // If creator didn't specify which storage to use, use the default // location for application. - if ((flags & (Context.CONTEXT_CREDENTIAL_ENCRYPTED_STORAGE - | Context.CONTEXT_DEVICE_ENCRYPTED_STORAGE)) == 0) { + if ((flags & (Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE + | Context.CONTEXT_DEVICE_PROTECTED_STORAGE)) == 0) { final File dataDir = packageInfo.getDataDirFile(); - if (Objects.equals(dataDir, packageInfo.getCredentialEncryptedDataDirFile())) { - flags |= Context.CONTEXT_CREDENTIAL_ENCRYPTED_STORAGE; - } else if (Objects.equals(dataDir, packageInfo.getDeviceEncryptedDataDirFile())) { - flags |= Context.CONTEXT_DEVICE_ENCRYPTED_STORAGE; + if (Objects.equals(dataDir, packageInfo.getCredentialProtectedDataDirFile())) { + flags |= Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; + } else if (Objects.equals(dataDir, packageInfo.getDeviceProtectedDataDirFile())) { + flags |= Context.CONTEXT_DEVICE_PROTECTED_STORAGE; } } diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java index c68fd659a25b..e090aa442d8e 100644 --- a/core/java/android/app/LoadedApk.java +++ b/core/java/android/app/LoadedApk.java @@ -16,8 +16,6 @@ package android.app; -import android.text.TextUtils; -import android.util.ArrayMap; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; @@ -37,15 +35,17 @@ import android.os.IBinder; import android.os.Process; import android.os.RemoteException; import android.os.StrictMode; +import android.os.SystemProperties; import android.os.Trace; import android.os.UserHandle; +import android.text.TextUtils; import android.util.AndroidRuntimeException; +import android.util.ArrayMap; import android.util.Log; import android.util.Slog; import android.util.SparseArray; -import android.view.DisplayAdjustments; import android.view.Display; -import android.os.SystemProperties; +import android.view.DisplayAdjustments; import dalvik.system.VMRuntime; @@ -56,11 +56,10 @@ import java.lang.ref.WeakReference; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; -import java.util.List; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Enumeration; +import java.util.List; import java.util.Objects; final class IntentReceiverLeaked extends AndroidRuntimeException { @@ -95,8 +94,8 @@ public final class LoadedApk { private String mDataDir; private String mLibDir; private File mDataDirFile; - private File mDeviceEncryptedDataDirFile; - private File mCredentialEncryptedDataDirFile; + private File mDeviceProtectedDataDirFile; + private File mCredentialProtectedDataDirFile; private final ClassLoader mBaseClassLoader; private final boolean mSecurityViolation; private final boolean mIncludeCode; @@ -186,8 +185,8 @@ public final class LoadedApk { mSharedLibraries = null; mDataDir = null; mDataDirFile = null; - mDeviceEncryptedDataDirFile = null; - mCredentialEncryptedDataDirFile = null; + mDeviceProtectedDataDirFile = null; + mCredentialProtectedDataDirFile = null; mLibDir = null; mBaseClassLoader = null; mSecurityViolation = false; @@ -303,8 +302,8 @@ public final class LoadedApk { mDataDir = aInfo.dataDir; mLibDir = aInfo.nativeLibraryDir; mDataDirFile = FileUtils.newFileOrNull(aInfo.dataDir); - mDeviceEncryptedDataDirFile = FileUtils.newFileOrNull(aInfo.deviceEncryptedDataDir); - mCredentialEncryptedDataDirFile = FileUtils.newFileOrNull(aInfo.credentialEncryptedDataDir); + mDeviceProtectedDataDirFile = FileUtils.newFileOrNull(aInfo.deviceProtectedDataDir); + mCredentialProtectedDataDirFile = FileUtils.newFileOrNull(aInfo.credentialProtectedDataDir); } public static void makePaths(ActivityThread activityThread, ApplicationInfo aInfo, @@ -651,12 +650,12 @@ public final class LoadedApk { return mDataDirFile; } - public File getDeviceEncryptedDataDirFile() { - return mDeviceEncryptedDataDirFile; + public File getDeviceProtectedDataDirFile() { + return mDeviceProtectedDataDirFile; } - public File getCredentialEncryptedDataDirFile() { - return mCredentialEncryptedDataDirFile; + public File getCredentialProtectedDataDirFile() { + return mCredentialProtectedDataDirFile; } public AssetManager getAssets(ActivityThread mainThread) { diff --git a/core/java/android/app/backup/BackupAgent.java b/core/java/android/app/backup/BackupAgent.java index aeb315611686..801c9517b64d 100644 --- a/core/java/android/app/backup/BackupAgent.java +++ b/core/java/android/app/backup/BackupAgent.java @@ -18,7 +18,6 @@ package android.app.backup; import android.app.IBackupAgent; import android.app.QueuedWork; -import android.app.backup.IBackupManager; import android.content.Context; import android.content.ContextWrapper; import android.content.pm.ApplicationInfo; @@ -36,18 +35,17 @@ import android.system.StructStat; import android.util.ArraySet; import android.util.Log; +import org.xmlpull.v1.XmlPullParserException; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Collection; import java.util.LinkedList; -import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.CountDownLatch; -import org.xmlpull.v1.XmlPullParserException; - /** * Provides the central interface between an * application and Android's data backup infrastructure. An application that wishes @@ -310,7 +308,7 @@ public abstract class BackupAgent extends ContextWrapper { // System apps have control over where their default storage context // is pointed, so we're always explicit when building paths. - final Context ceContext = createCredentialEncryptedStorageContext(); + final Context ceContext = createCredentialProtectedStorageContext(); final String rootDir = ceContext.getDataDir().getCanonicalPath(); final String filesDir = ceContext.getFilesDir().getCanonicalPath(); final String noBackupDir = ceContext.getNoBackupFilesDir().getCanonicalPath(); @@ -321,7 +319,7 @@ public abstract class BackupAgent extends ContextWrapper { final String cacheDir = ceContext.getCacheDir().getCanonicalPath(); final String codeCacheDir = ceContext.getCodeCacheDir().getCanonicalPath(); - final Context deContext = createDeviceEncryptedStorageContext(); + final Context deContext = createDeviceProtectedStorageContext(); final String deviceRootDir = deContext.getDataDir().getCanonicalPath(); final String deviceFilesDir = deContext.getFilesDir().getCanonicalPath(); final String deviceNoBackupDir = deContext.getNoBackupFilesDir().getCanonicalPath(); @@ -516,7 +514,7 @@ public abstract class BackupAgent extends ContextWrapper { try { // System apps have control over where their default storage context // is pointed, so we're always explicit when building paths. - final Context ceContext = createCredentialEncryptedStorageContext(); + final Context ceContext = createCredentialProtectedStorageContext(); rootDir = ceContext.getDataDir().getCanonicalPath(); filesDir = ceContext.getFilesDir().getCanonicalPath(); nbFilesDir = ceContext.getNoBackupFilesDir().getCanonicalPath(); @@ -525,7 +523,7 @@ public abstract class BackupAgent extends ContextWrapper { cacheDir = ceContext.getCacheDir().getCanonicalPath(); codeCacheDir = ceContext.getCodeCacheDir().getCanonicalPath(); - final Context deContext = createDeviceEncryptedStorageContext(); + final Context deContext = createDeviceProtectedStorageContext(); deviceRootDir = deContext.getDataDir().getCanonicalPath(); deviceFilesDir = deContext.getFilesDir().getCanonicalPath(); deviceNbFilesDir = deContext.getNoBackupFilesDir().getCanonicalPath(); diff --git a/core/java/android/app/backup/FullBackup.java b/core/java/android/app/backup/FullBackup.java index cdc80e3ba3c1..478024d7d27c 100644 --- a/core/java/android/app/backup/FullBackup.java +++ b/core/java/android/app/backup/FullBackup.java @@ -19,7 +19,7 @@ package android.app.backup; import android.content.Context; import android.content.pm.PackageManager; import android.content.res.XmlResourceParser; -import android.os.*; +import android.os.ParcelFileDescriptor; import android.os.Process; import android.system.ErrnoException; import android.system.Os; @@ -31,16 +31,15 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.util.List; import java.util.Map; import java.util.Set; -import org.xmlpull.v1.XmlPullParserException; /** * Global constant definitions et cetera related to the full-backup-to-fd * binary format. Nothing in this namespace is part of any API; it's all @@ -289,7 +288,7 @@ public class FullBackup { // System apps have control over where their default storage context // is pointed, so we're always explicit when building paths. - final Context ceContext = context.createCredentialEncryptedStorageContext(); + final Context ceContext = context.createCredentialProtectedStorageContext(); FILES_DIR = ceContext.getFilesDir(); DATABASE_DIR = ceContext.getDatabasePath("foo").getParentFile(); ROOT_DIR = ceContext.getDataDir(); @@ -297,7 +296,7 @@ public class FullBackup { CACHE_DIR = ceContext.getCacheDir(); NOBACKUP_DIR = ceContext.getNoBackupFilesDir(); - final Context deContext = context.createDeviceEncryptedStorageContext(); + final Context deContext = context.createDeviceProtectedStorageContext(); DEVICE_FILES_DIR = deContext.getFilesDir(); DEVICE_DATABASE_DIR = deContext.getDatabasePath("foo").getParentFile(); DEVICE_ROOT_DIR = deContext.getDataDir(); diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index c4dfdcf10405..ca19b9bc668e 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -695,20 +695,26 @@ public abstract class Context { public abstract SharedPreferences getSharedPreferences(File file, int mode); /** - * Migrate an existing shared preferences file from the given source storage + * Move an existing shared preferences file from the given source storage * context to this context. This is typically used to migrate data between - * storage locations after an upgrade, such as migrating from credential - * encrypted to device encrypted storage. + * storage locations after an upgrade, such as moving to device protected + * storage. * * @param sourceContext The source context which contains the existing - * shared preferences to migrate. + * shared preferences to move. * @param name The name of the shared preferences file. - * @return {@code true} if the migration was successful or if the shared + * @return {@code true} if the move was successful or if the shared * preferences didn't exist in the source context, otherwise * {@code false}. - * @see #createDeviceEncryptedStorageContext() + * @see #createDeviceProtectedStorageContext() */ - public abstract boolean migrateSharedPreferencesFrom(Context sourceContext, String name); + public abstract boolean moveSharedPreferencesFrom(Context sourceContext, String name); + + /** @removed */ + @Deprecated + public boolean migrateSharedPreferencesFrom(Context sourceContext, String name) { + return moveSharedPreferencesFrom(sourceContext, name); + } /** * Delete an existing shared preferences file. @@ -1397,19 +1403,25 @@ public abstract class Context { @Nullable DatabaseErrorHandler errorHandler); /** - * Migrate an existing database file from the given source storage context - * to this context. This is typically used to migrate data between storage - * locations after an upgrade, such as migrating from credential encrypted - * to device encrypted storage. + * Move an existing database file from the given source storage context to + * this context. This is typically used to migrate data between storage + * locations after an upgrade, such as migrating to device protected + * storage. * * @param sourceContext The source context which contains the existing - * database to migrate. + * database to move. * @param name The name of the database file. - * @return {@code true} if the migration was successful or if the database - * didn't exist in the source context, otherwise {@code false}. - * @see #createDeviceEncryptedStorageContext() + * @return {@code true} if the move was successful or if the database didn't + * exist in the source context, otherwise {@code false}. + * @see #createDeviceProtectedStorageContext() */ - public abstract boolean migrateDatabaseFrom(Context sourceContext, String name); + public abstract boolean moveDatabaseFrom(Context sourceContext, String name); + + /** @removed */ + @Deprecated + public boolean migrateDatabaseFrom(Context sourceContext, String name) { + return moveDatabaseFrom(sourceContext, name); + } /** * Delete an existing private SQLiteDatabase associated with this Context's @@ -4038,19 +4050,19 @@ public abstract class Context { /** * Flag for use with {@link #createPackageContext}: point all file APIs at - * device-encrypted storage. + * device-protected storage. * * @hide */ - public static final int CONTEXT_DEVICE_ENCRYPTED_STORAGE = 0x00000008; + public static final int CONTEXT_DEVICE_PROTECTED_STORAGE = 0x00000008; /** * Flag for use with {@link #createPackageContext}: point all file APIs at - * credential-encrypted storage. + * credential-protected storage. * * @hide */ - public static final int CONTEXT_CREDENTIAL_ENCRYPTED_STORAGE = 0x00000010; + public static final int CONTEXT_CREDENTIAL_PROTECTED_STORAGE = 0x00000010; /** * @hide Used to indicate we should tell the activity manager about the process @@ -4154,53 +4166,73 @@ public abstract class Context { /** * Return a new Context object for the current Context but whose storage - * APIs are backed by device-encrypted storage. + * APIs are backed by device-protected storage. + * <p> + * When a device is encrypted, data stored in this location is encrypted + * with a key tied to the physical device, and it can be accessed + * immediately after the device has booted successfully, both + * <em>before and after</em> the user has authenticated with their + * credentials (such as a lock pattern or PIN). * <p> - * Data stored in device-encrypted storage is typically encrypted with a key - * tied to the physical device, and it can be accessed when the device has - * booted successfully, both <em>before and after</em> the user has - * authenticated with their credentials (such as a lock pattern or PIN). - * Because device-encrypted data is available before user authentication, - * you should carefully consider what data you store using this Context. + * Because device-protected data is available without user authentication, + * you should carefully limit the data you store using this Context. For + * example, storing sensitive authentication tokens or passwords in the + * device-protected area is strongly discouraged. * <p> * If the underlying device does not have the ability to store - * device-encrypted and credential-encrypted data using different keys, then - * both storage areas will become available at the same time. They remain - * two distinct storage areas, and only the window of availability changes. + * device-protected and credential-protected data using different keys, then + * both storage areas will become available at the same time. They remain as + * two distinct storage locations on disk, and only the window of + * availability changes. * <p> * Each call to this method returns a new instance of a Context object; * Context objects are not shared, however common state (ClassLoader, other * Resources for the same configuration) may be so the Context itself can be * fairly lightweight. * - * @see #isDeviceEncryptedStorage() + * @see #isDeviceProtectedStorage() */ - public abstract Context createDeviceEncryptedStorageContext(); + public abstract Context createDeviceProtectedStorageContext(); + + /** @removed */ + @Deprecated + public Context createDeviceEncryptedStorageContext() { + return createDeviceProtectedStorageContext(); + } /** * Return a new Context object for the current Context but whose storage - * APIs are backed by credential-encrypted storage. + * APIs are backed by credential-protected storage. This is the default + * storage area for apps unless + * {@link android.R.attr#defaultToDeviceProtectedStorage} was requested. * <p> - * Data stored in credential-encrypted storage is typically encrypted with a - * key tied to user credentials, and they can be accessed + * When a device is encrypted, data stored in this location is encrypted + * with a key tied to user credentials, which can be accessed * <em>only after</em> the user has entered their credentials (such as a * lock pattern or PIN). * <p> * If the underlying device does not have the ability to store - * device-encrypted and credential-encrypted data using different keys, then - * both storage areas will become available at the same time. They remain - * two distinct storage areas, and only the window of availability changes. + * device-protected and credential-protected data using different keys, then + * both storage areas will become available at the same time. They remain as + * two distinct storage locations on disk, and only the window of + * availability changes. * <p> * Each call to this method returns a new instance of a Context object; * Context objects are not shared, however common state (ClassLoader, other * Resources for the same configuration) may be so the Context itself can be * fairly lightweight. * - * @see #isCredentialEncryptedStorage() + * @see #isCredentialProtectedStorage() * @hide */ @SystemApi - public abstract Context createCredentialEncryptedStorageContext(); + public abstract Context createCredentialProtectedStorageContext(); + + /** @removed */ + @Deprecated + public Context createCredentialEncryptedStorageContext() { + return createCredentialProtectedStorageContext(); + } /** * Gets the display adjustments holder for this context. This information @@ -4226,19 +4258,31 @@ public abstract class Context { /** * Indicates if the storage APIs of this Context are backed by - * device-encrypted storage. + * device-protected storage. * - * @see #createDeviceEncryptedStorageContext() + * @see #createDeviceProtectedStorageContext() */ - public abstract boolean isDeviceEncryptedStorage(); + public abstract boolean isDeviceProtectedStorage(); + + /** @removed */ + @Deprecated + public boolean isDeviceEncryptedStorage() { + return isDeviceProtectedStorage(); + } /** * Indicates if the storage APIs of this Context are backed by - * credential-encrypted storage. + * credential-protected storage. * - * @see #createCredentialEncryptedStorageContext() + * @see #createCredentialProtectedStorageContext() * @hide */ @SystemApi - public abstract boolean isCredentialEncryptedStorage(); + public abstract boolean isCredentialProtectedStorage(); + + /** @removed */ + @Deprecated + public boolean isCredentialEncryptedStorage() { + return isCredentialProtectedStorage(); + } } diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java index 323c9bfe8099..b2df207f8eb1 100644 --- a/core/java/android/content/ContextWrapper.java +++ b/core/java/android/content/ContextWrapper.java @@ -33,8 +33,8 @@ import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.UserHandle; -import android.view.DisplayAdjustments; import android.view.Display; +import android.view.DisplayAdjustments; import java.io.File; import java.io.FileInputStream; @@ -170,8 +170,8 @@ public class ContextWrapper extends Context { } @Override - public boolean migrateSharedPreferencesFrom(Context sourceContext, String name) { - return mBase.migrateSharedPreferencesFrom(sourceContext, name); + public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { + return mBase.moveSharedPreferencesFrom(sourceContext, name); } @Override @@ -288,8 +288,8 @@ public class ContextWrapper extends Context { } @Override - public boolean migrateDatabaseFrom(Context sourceContext, String name) { - return mBase.migrateDatabaseFrom(sourceContext, name); + public boolean moveDatabaseFrom(Context sourceContext, String name) { + return mBase.moveDatabaseFrom(sourceContext, name); } @Override @@ -818,26 +818,26 @@ public class ContextWrapper extends Context { } @Override - public Context createDeviceEncryptedStorageContext() { - return mBase.createDeviceEncryptedStorageContext(); + public Context createDeviceProtectedStorageContext() { + return mBase.createDeviceProtectedStorageContext(); } /** {@hide} */ @SystemApi @Override - public Context createCredentialEncryptedStorageContext() { - return mBase.createCredentialEncryptedStorageContext(); + public Context createCredentialProtectedStorageContext() { + return mBase.createCredentialProtectedStorageContext(); } @Override - public boolean isDeviceEncryptedStorage() { - return mBase.isDeviceEncryptedStorage(); + public boolean isDeviceProtectedStorage() { + return mBase.isDeviceProtectedStorage(); } /** {@hide} */ @SystemApi @Override - public boolean isCredentialEncryptedStorage() { - return mBase.isCredentialEncryptedStorage(); + public boolean isCredentialProtectedStorage() { + return mBase.isCredentialProtectedStorage(); } } diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index 58d75f761c8e..104feb5dc7cd 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -16,7 +16,9 @@ package android.content.pm; +import android.annotation.SystemApi; import android.annotation.TestApi; +import android.content.Context; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.graphics.drawable.Drawable; @@ -24,7 +26,6 @@ import android.os.Environment; import android.os.Parcel; import android.os.Parcelable; import android.os.UserHandle; -import android.os.storage.StorageManager; import android.text.TextUtils; import android.util.Printer; @@ -109,8 +110,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { * include/exclude criteria. * <p>If android:allowBackup is set to false, this attribute is ignored. * - * @see {@link android.content.Context#getNoBackupFilesDir} - * @see {@link #FLAG_ALLOW_BACKUP} + * @see android.content.Context#getNoBackupFilesDir() + * @see #FLAG_ALLOW_BACKUP * * @hide */ @@ -469,20 +470,20 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { public static final int PRIVATE_FLAG_HAS_DOMAIN_URLS = 1<<4; /** - * When set, default data storage directory for given app is pointed at - * device-encrypted location. + * When set, the default data storage directory for this app is pointed at + * the device-protected location. * * @hide */ - public static final int PRIVATE_FLAG_FORCE_DEVICE_ENCRYPTED = 1 << 5; + public static final int PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = 1 << 5; /** - * When set, assume that all components under the given app are encryption + * When set, assume that all components under the given app are direct boot * aware, unless otherwise specified. * * @hide */ - public static final int PRIVATE_FLAG_ENCRYPTION_AWARE = 1 << 6; + public static final int PRIVATE_FLAG_DIRECT_BOOT_AWARE = 1 << 6; /** * Value for {@link #privateFlags}: set to {@code true} if the application @@ -493,11 +494,12 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { public static final int PRIVATE_FLAG_AUTOPLAY = 1 << 7; /** - * When set, at least one component inside this application is encryption aware. + * When set, at least one component inside this application is direct boot + * aware. * * @hide */ - public static final int PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE = 1 << 8; + public static final int PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE = 1 << 8; /** * Value for {@link #flags}: {@code true} if the application is blocked via restrictions @@ -627,15 +629,28 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { public String dataDir; /** - * Full path to the device-encrypted directory assigned to the package for + * Full path to the device-protected directory assigned to the package for * its persistent data. + * + * @see Context#createDeviceProtectedStorageContext() */ + public String deviceProtectedDataDir; + + /** @removed */ + @Deprecated public String deviceEncryptedDataDir; /** - * Full path to the credential-encrypted directory assigned to the package + * Full path to the credential-protected directory assigned to the package * for its persistent data. + * + * @hide */ + @SystemApi + public String credentialProtectedDataDir; + + /** @removed */ + @Deprecated public String credentialEncryptedDataDir; /** @@ -790,8 +805,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { } pw.println(prefix + "dataDir=" + dataDir); if ((flags&DUMP_FLAG_DETAILS) != 0) { - pw.println(prefix + "deviceEncryptedDataDir=" + deviceEncryptedDataDir); - pw.println(prefix + "credentialEncryptedDataDir=" + credentialEncryptedDataDir); + pw.println(prefix + "deviceProtectedDataDir=" + deviceProtectedDataDir); + pw.println(prefix + "credentialProtectedDataDir=" + credentialProtectedDataDir); if (sharedLibraryFiles != null) { pw.println(prefix + "sharedLibraryFiles=" + Arrays.toString(sharedLibraryFiles)); } @@ -889,8 +904,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { seinfo = orig.seinfo; sharedLibraryFiles = orig.sharedLibraryFiles; dataDir = orig.dataDir; - deviceEncryptedDataDir = orig.deviceEncryptedDataDir; - credentialEncryptedDataDir = orig.credentialEncryptedDataDir; + deviceEncryptedDataDir = deviceProtectedDataDir = orig.deviceProtectedDataDir; + credentialEncryptedDataDir = credentialProtectedDataDir = orig.credentialProtectedDataDir; uid = orig.uid; minSdkVersion = orig.minSdkVersion; targetSdkVersion = orig.targetSdkVersion; @@ -944,8 +959,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { dest.writeString(seinfo); dest.writeStringArray(sharedLibraryFiles); dest.writeString(dataDir); - dest.writeString(deviceEncryptedDataDir); - dest.writeString(credentialEncryptedDataDir); + dest.writeString(deviceProtectedDataDir); + dest.writeString(credentialProtectedDataDir); dest.writeInt(uid); dest.writeString(minSdkVersion); dest.writeInt(targetSdkVersion); @@ -999,8 +1014,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { seinfo = source.readString(); sharedLibraryFiles = source.readStringArray(); dataDir = source.readString(); - deviceEncryptedDataDir = source.readString(); - credentialEncryptedDataDir = source.readString(); + deviceEncryptedDataDir = deviceProtectedDataDir = source.readString(); + credentialEncryptedDataDir = credentialProtectedDataDir = source.readString(); uid = source.readInt(); minSdkVersion = source.readString(); targetSdkVersion = source.readInt(); @@ -1056,18 +1071,18 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { return; } - deviceEncryptedDataDir = Environment + deviceEncryptedDataDir = deviceProtectedDataDir = Environment .getDataUserDePackageDirectory(volumeUuid, userId, packageName) .getAbsolutePath(); - credentialEncryptedDataDir = Environment + credentialEncryptedDataDir = credentialProtectedDataDir = Environment .getDataUserCePackageDirectory(volumeUuid, userId, packageName) .getAbsolutePath(); - if ((privateFlags & PRIVATE_FLAG_FORCE_DEVICE_ENCRYPTED) != 0 - && PackageManager.APPLY_FORCE_DEVICE_ENCRYPTED) { - dataDir = deviceEncryptedDataDir; + if ((privateFlags & PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) != 0 + && PackageManager.APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) { + dataDir = deviceProtectedDataDir; } else { - dataDir = credentialEncryptedDataDir; + dataDir = credentialProtectedDataDir; } } @@ -1134,18 +1149,19 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { } /** @hide */ - public boolean isForceDeviceEncrypted() { - return (privateFlags & ApplicationInfo.PRIVATE_FLAG_FORCE_DEVICE_ENCRYPTED) != 0; + public boolean isDefaultToDeviceProtectedStorage() { + return (privateFlags + & ApplicationInfo.PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) != 0; } /** @hide */ - public boolean isEncryptionAware() { - return (privateFlags & ApplicationInfo.PRIVATE_FLAG_ENCRYPTION_AWARE) != 0; + public boolean isDirectBootAware() { + return (privateFlags & ApplicationInfo.PRIVATE_FLAG_DIRECT_BOOT_AWARE) != 0; } /** @hide */ - public boolean isPartiallyEncryptionAware() { - return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE) != 0; + public boolean isPartiallyDirectBootAware() { + return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE) != 0; } /** diff --git a/core/java/android/content/pm/ComponentInfo.java b/core/java/android/content/pm/ComponentInfo.java index 63a163dd3b80..5cd15ddd2faa 100644 --- a/core/java/android/content/pm/ComponentInfo.java +++ b/core/java/android/content/pm/ComponentInfo.java @@ -66,10 +66,14 @@ public class ComponentInfo extends PackageItemInfo { public boolean exported = false; /** - * Indicate if this component is aware of encryption lifecycle, and can be + * Indicates if this component is aware of direct boot lifecycle, and can be * safely run before the user has entered their credentials (such as a lock * pattern or PIN). */ + public boolean directBootAware = false; + + /** @removed */ + @Deprecated public boolean encryptionAware = false; public ComponentInfo() { @@ -82,7 +86,7 @@ public class ComponentInfo extends PackageItemInfo { descriptionRes = orig.descriptionRes; enabled = orig.enabled; exported = orig.exported; - encryptionAware = orig.encryptionAware; + encryptionAware = directBootAware = orig.directBootAware; } @Override public CharSequence loadLabel(PackageManager pm) { @@ -160,7 +164,7 @@ public class ComponentInfo extends PackageItemInfo { pw.println(prefix + "processName=" + processName); } pw.println(prefix + "enabled=" + enabled + " exported=" + exported - + " encryptionAware=" + encryptionAware); + + " directBootAware=" + directBootAware); if (descriptionRes != 0) { pw.println(prefix + "description=" + descriptionRes); } @@ -194,7 +198,7 @@ public class ComponentInfo extends PackageItemInfo { dest.writeInt(descriptionRes); dest.writeInt(enabled ? 1 : 0); dest.writeInt(exported ? 1 : 0); - dest.writeInt(encryptionAware ? 1 : 0); + dest.writeInt(directBootAware ? 1 : 0); } protected ComponentInfo(Parcel source) { @@ -207,9 +211,9 @@ public class ComponentInfo extends PackageItemInfo { descriptionRes = source.readInt(); enabled = (source.readInt() != 0); exported = (source.readInt() != 0); - encryptionAware = (source.readInt() != 0); + encryptionAware = directBootAware = (source.readInt() != 0); } - + /** * @hide */ diff --git a/core/java/android/content/pm/InstrumentationInfo.java b/core/java/android/content/pm/InstrumentationInfo.java index 44bdf4e3d075..cbeed357224a 100644 --- a/core/java/android/content/pm/InstrumentationInfo.java +++ b/core/java/android/content/pm/InstrumentationInfo.java @@ -62,9 +62,9 @@ public class InstrumentationInfo extends PackageItemInfo implements Parcelable { public String dataDir; /** {@hide} */ - public String deviceEncryptedDataDir; + public String deviceProtectedDataDir; /** {@hide} */ - public String credentialEncryptedDataDir; + public String credentialProtectedDataDir; /** * Full path to the directory where the native JNI libraries are stored. @@ -92,8 +92,8 @@ public class InstrumentationInfo extends PackageItemInfo implements Parcelable { splitSourceDirs = orig.splitSourceDirs; splitPublicSourceDirs = orig.splitPublicSourceDirs; dataDir = orig.dataDir; - deviceEncryptedDataDir = orig.deviceEncryptedDataDir; - credentialEncryptedDataDir = orig.credentialEncryptedDataDir; + deviceProtectedDataDir = orig.deviceProtectedDataDir; + credentialProtectedDataDir = orig.credentialProtectedDataDir; nativeLibraryDir = orig.nativeLibraryDir; handleProfiling = orig.handleProfiling; functionalTest = orig.functionalTest; @@ -117,8 +117,8 @@ public class InstrumentationInfo extends PackageItemInfo implements Parcelable { dest.writeStringArray(splitSourceDirs); dest.writeStringArray(splitPublicSourceDirs); dest.writeString(dataDir); - dest.writeString(deviceEncryptedDataDir); - dest.writeString(credentialEncryptedDataDir); + dest.writeString(deviceProtectedDataDir); + dest.writeString(credentialProtectedDataDir); dest.writeString(nativeLibraryDir); dest.writeInt((handleProfiling == false) ? 0 : 1); dest.writeInt((functionalTest == false) ? 0 : 1); @@ -142,8 +142,8 @@ public class InstrumentationInfo extends PackageItemInfo implements Parcelable { splitSourceDirs = source.readStringArray(); splitPublicSourceDirs = source.readStringArray(); dataDir = source.readString(); - deviceEncryptedDataDir = source.readString(); - credentialEncryptedDataDir = source.readString(); + deviceProtectedDataDir = source.readString(); + credentialProtectedDataDir = source.readString(); nativeLibraryDir = source.readString(); handleProfiling = source.readInt() != 0; functionalTest = source.readInt() != 0; @@ -157,8 +157,8 @@ public class InstrumentationInfo extends PackageItemInfo implements Parcelable { ai.splitSourceDirs = splitSourceDirs; ai.splitPublicSourceDirs = splitPublicSourceDirs; ai.dataDir = dataDir; - ai.deviceEncryptedDataDir = deviceEncryptedDataDir; - ai.credentialEncryptedDataDir = credentialEncryptedDataDir; + ai.deviceProtectedDataDir = deviceProtectedDataDir; + ai.credentialProtectedDataDir = credentialProtectedDataDir; ai.nativeLibraryDir = nativeLibraryDir; } } diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index c179596a13b0..1079f974732f 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -48,6 +48,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.RemoteException; import android.os.UserHandle; +import android.os.UserManager; import android.os.storage.VolumeInfo; import android.util.AndroidException; import android.util.Log; @@ -69,7 +70,7 @@ public abstract class PackageManager { private static final String TAG = "PackageManager"; /** {@hide} */ - public static final boolean APPLY_FORCE_DEVICE_ENCRYPTED = true; + public static final boolean APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = true; /** * This exception is thrown when a given package, application, or component @@ -154,9 +155,8 @@ public abstract class PackageManager { MATCH_DEFAULT_ONLY, MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, - MATCH_ENCRYPTION_AWARE, - MATCH_ENCRYPTION_AWARE_AND_UNAWARE, - MATCH_ENCRYPTION_UNAWARE, + MATCH_DIRECT_BOOT_AWARE, + MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY, MATCH_UNINSTALLED_PACKAGES, }) @@ -173,9 +173,8 @@ public abstract class PackageManager { MATCH_DISABLED_COMPONENTS, MATCH_DISABLED_UNTIL_USED_COMPONENTS, MATCH_DEFAULT_ONLY, - MATCH_ENCRYPTION_AWARE, - MATCH_ENCRYPTION_AWARE_AND_UNAWARE, - MATCH_ENCRYPTION_UNAWARE, + MATCH_DIRECT_BOOT_AWARE, + MATCH_DIRECT_BOOT_UNAWARE, MATCH_SYSTEM_ONLY, MATCH_UNINSTALLED_PACKAGES, }) @@ -365,21 +364,47 @@ public abstract class PackageManager { public static final int MATCH_ALL = 0x00020000; /** - * Querying flag: include only components which are encryption unaware in + * Querying flag: match components which are direct boot <em>unaware</em> in * the returned info, regardless of the current user state. + * <p> + * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor + * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is + * to match only runnable components based on the user state. For example, + * when a user is started but credentials have not been presented yet, the + * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE} + * components are returned. Once the user credentials have been presented, + * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE} + * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned. + * + * @see UserManager#isUserUnlocked() */ - public static final int MATCH_ENCRYPTION_UNAWARE = 0x00040000; - - /** - * Querying flag: include only components which are encryption aware in the - * returned info, regardless of the current user state. - */ - public static final int MATCH_ENCRYPTION_AWARE = 0x00080000; + public static final int MATCH_DIRECT_BOOT_UNAWARE = 0x00040000; /** - * Querying flag: include both encryption aware and unaware components in + * Querying flag: match components which are direct boot <em>aware</em> in * the returned info, regardless of the current user state. + * <p> + * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor + * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is + * to match only runnable components based on the user state. For example, + * when a user is started but credentials have not been presented yet, the + * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE} + * components are returned. Once the user credentials have been presented, + * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE} + * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned. + * + * @see UserManager#isUserUnlocked() */ + public static final int MATCH_DIRECT_BOOT_AWARE = 0x00080000; + + /** @removed */ + @Deprecated + public static final int MATCH_ENCRYPTION_UNAWARE = 0x00040000; + /** @removed */ + @Deprecated + public static final int MATCH_ENCRYPTION_AWARE = 0x00080000; + /** @removed */ + @Deprecated public static final int MATCH_ENCRYPTION_AWARE_AND_UNAWARE = MATCH_ENCRYPTION_AWARE | MATCH_ENCRYPTION_UNAWARE; @@ -401,7 +426,8 @@ public abstract class PackageManager { * </ul> * * @see #MATCH_UNINSTALLED_PACKAGES - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @hide */ public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000; @@ -2742,21 +2768,21 @@ public abstract class PackageManager { * class. * * @param component The full component name (i.e. - * com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity - * class. + * com.google.apps.contacts/com.google.apps.contacts. + * ContactsList) of an Activity class. * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, - * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, - * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} - * {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. - * - * @return An {@link ActivityInfo} containing information about the activity. + * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, + * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. + * @return An {@link ActivityInfo} containing information about the + * activity. * @throws NameNotFoundException if a package with the given name cannot be * found on the system. - * * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES * @see #MATCH_ALL @@ -2764,9 +2790,8 @@ public abstract class PackageManager { * @see #MATCH_DEFAULT_ONLY * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ @@ -2778,21 +2803,21 @@ public abstract class PackageManager { * class. * * @param component The full component name (i.e. - * com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver - * class. + * com.google.apps.calendar/com.google.apps.calendar. + * CalendarAlarm) of a Receiver class. * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, - * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, - * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} - * {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. - * - * @return An {@link ActivityInfo} containing information about the receiver. + * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, + * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. + * @return An {@link ActivityInfo} containing information about the + * receiver. * @throws NameNotFoundException if a package with the given name cannot be * found on the system. - * * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES * @see #MATCH_ALL @@ -2800,9 +2825,8 @@ public abstract class PackageManager { * @see #MATCH_DEFAULT_ONLY * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ @@ -2810,25 +2834,24 @@ public abstract class PackageManager { @ComponentInfoFlags int flags) throws NameNotFoundException; /** - * Retrieve all of the information we know about a particular service - * class. + * Retrieve all of the information we know about a particular service class. * * @param component The full component name (i.e. - * com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service - * class. + * com.google.apps.media/com.google.apps.media. + * BackgroundPlayback) of a Service class. * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, - * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, - * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} - * {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. - * - * @return A {@link ServiceInfo} object containing information about the service. + * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, + * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. + * @return A {@link ServiceInfo} object containing information about the + * service. * @throws NameNotFoundException if a package with the given name cannot be * found on the system. - * * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES * @see #MATCH_ALL @@ -2836,9 +2859,8 @@ public abstract class PackageManager { * @see #MATCH_DEFAULT_ONLY * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ @@ -2850,21 +2872,21 @@ public abstract class PackageManager { * provider class. * * @param component The full component name (i.e. - * com.google.providers.media/com.google.providers.media.MediaProvider) of a - * ContentProvider class. + * com.google.providers.media/com.google.providers.media. + * MediaProvider) of a ContentProvider class. * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, - * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, - * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} - * {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. - * - * @return A {@link ProviderInfo} object containing information about the provider. + * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, + * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. + * @return A {@link ProviderInfo} object containing information about the + * provider. * @throws NameNotFoundException if a package with the given name cannot be * found on the system. - * * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES * @see #MATCH_ALL @@ -2872,9 +2894,8 @@ public abstract class PackageManager { * @see #MATCH_DEFAULT_ONLY * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ @@ -3499,36 +3520,37 @@ public abstract class PackageManager { public abstract boolean hasSystemFeature(String name, int version); /** - * Determine the best action to perform for a given Intent. This is how - * {@link Intent#resolveActivity} finds an activity if a class has not - * been explicitly specified. - * - * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName - * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY} - * only flag. You need to do so to resolve the activity in the same way - * that {@link android.content.Context#startActivity(Intent)} and + * Determine the best action to perform for a given Intent. This is how + * {@link Intent#resolveActivity} finds an activity if a class has not been + * explicitly specified. + * <p> + * <em>Note:</em> if using an implicit Intent (without an explicit + * ComponentName specified), be sure to consider whether to set the + * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the + * activity in the same way that + * {@link android.content.Context#startActivity(Intent)} and * {@link android.content.Intent#resolveActivity(PackageManager) - * Intent.resolveActivity(PackageManager)} do.</p> + * Intent.resolveActivity(PackageManager)} do. + * </p> * * @param intent An intent containing all of the desired specification - * (action, data, type, category, and/or component). + * (action, data, type, category, and/or component). * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, - * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, - * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, - * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. The most important is - * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only - * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. - * + * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, + * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. The most important is {@link #MATCH_DEFAULT_ONLY}, + * to limit the resolution to only those activities that support + * the {@link android.content.Intent#CATEGORY_DEFAULT}. * @return Returns a ResolveInfo object containing the final activity intent - * that was determined to be the best action. Returns null if no + * that was determined to be the best action. Returns null if no * matching activity was found. If multiple matching activities are * found and there is no default set, returns a ResolveInfo object * containing something else, such as the activity resolver. - * * @see #GET_META_DATA * @see #GET_RESOLVED_FILTER * @see #GET_SHARED_LIBRARY_FILES @@ -3536,46 +3558,46 @@ public abstract class PackageManager { * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS * @see #MATCH_DEFAULT_ONLY - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags); /** - * Determine the best action to perform for a given Intent for a given user. This - * is how {@link Intent#resolveActivity} finds an activity if a class has not - * been explicitly specified. - * - * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName - * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY} - * only flag. You need to do so to resolve the activity in the same way - * that {@link android.content.Context#startActivity(Intent)} and + * Determine the best action to perform for a given Intent for a given user. + * This is how {@link Intent#resolveActivity} finds an activity if a class + * has not been explicitly specified. + * <p> + * <em>Note:</em> if using an implicit Intent (without an explicit + * ComponentName specified), be sure to consider whether to set the + * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the + * activity in the same way that + * {@link android.content.Context#startActivity(Intent)} and * {@link android.content.Intent#resolveActivity(PackageManager) - * Intent.resolveActivity(PackageManager)} do.</p> + * Intent.resolveActivity(PackageManager)} do. + * </p> * * @param intent An intent containing all of the desired specification - * (action, data, type, category, and/or component). + * (action, data, type, category, and/or component). * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, - * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, - * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, - * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. The most important is - * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only - * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. + * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, + * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. The most important is {@link #MATCH_DEFAULT_ONLY}, + * to limit the resolution to only those activities that support + * the {@link android.content.Intent#CATEGORY_DEFAULT}. * @param userId The user id. - * * @return Returns a ResolveInfo object containing the final activity intent - * that was determined to be the best action. Returns null if no + * that was determined to be the best action. Returns null if no * matching activity was found. If multiple matching activities are * found and there is no default set, returns a ResolveInfo object * containing something else, such as the activity resolver. - * * @see #GET_META_DATA * @see #GET_RESOLVED_FILTER * @see #GET_SHARED_LIBRARY_FILES @@ -3583,12 +3605,10 @@ public abstract class PackageManager { * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS * @see #MATCH_DEFAULT_ONLY - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES - * * @hide */ public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags, @@ -3599,22 +3619,22 @@ public abstract class PackageManager { * * @param intent The desired intent as per resolveActivity(). * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, - * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, - * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, - * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. The most important is - * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only - * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. - * Or, set {@link #MATCH_ALL} to prevent any filtering of the results. - * - * @return Returns a List of ResolveInfo objects containing one entry for each - * matching activity, ordered from best to worst. In other words, the - * first item is what would be returned by {@link #resolveActivity}. - * If there are no matching activities, an empty list is returned. - * + * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, + * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. The most important is {@link #MATCH_DEFAULT_ONLY}, + * to limit the resolution to only those activities that support + * the {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set + * {@link #MATCH_ALL} to prevent any filtering of the results. + * @return Returns a List of ResolveInfo objects containing one entry for + * each matching activity, ordered from best to worst. In other + * words, the first item is what would be returned by + * {@link #resolveActivity}. If there are no matching activities, an + * empty list is returned. * @see #GET_META_DATA * @see #GET_RESOLVED_FILTER * @see #GET_SHARED_LIBRARY_FILES @@ -3622,9 +3642,8 @@ public abstract class PackageManager { * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS * @see #MATCH_DEFAULT_ONLY - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ @@ -3632,26 +3651,27 @@ public abstract class PackageManager { @ResolveInfoFlags int flags); /** - * Retrieve all activities that can be performed for the given intent, for a specific user. + * Retrieve all activities that can be performed for the given intent, for a + * specific user. * * @param intent The desired intent as per resolveActivity(). * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, - * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, - * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, - * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. The most important is - * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only - * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. - * Or, set {@link #MATCH_ALL} to prevent any filtering of the results. - * - * @return Returns a List of ResolveInfo objects containing one entry for each - * matching activity, ordered from best to worst. In other words, the - * first item is what would be returned by {@link #resolveActivity}. - * If there are no matching activities, an empty list is returned. - * + * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, + * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. The most important is {@link #MATCH_DEFAULT_ONLY}, + * to limit the resolution to only those activities that support + * the {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set + * {@link #MATCH_ALL} to prevent any filtering of the results. + * @return Returns a List of ResolveInfo objects containing one entry for + * each matching activity, ordered from best to worst. In other + * words, the first item is what would be returned by + * {@link #resolveActivity}. If there are no matching activities, an + * empty list is returned. * @see #GET_META_DATA * @see #GET_RESOLVED_FILTER * @see #GET_SHARED_LIBRARY_FILES @@ -3659,12 +3679,10 @@ public abstract class PackageManager { * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS * @see #MATCH_DEFAULT_ONLY - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES - * * @hide */ public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, @@ -3672,36 +3690,35 @@ public abstract class PackageManager { /** * Retrieve a set of activities that should be presented to the user as - * similar options. This is like {@link #queryIntentActivities}, except it + * similar options. This is like {@link #queryIntentActivities}, except it * also allows you to supply a list of more explicit Intents that you would * like to resolve to particular options, and takes care of returning the * final ResolveInfo list in a reasonable order, with no duplicates, based * on those inputs. * - * @param caller The class name of the activity that is making the - * request. This activity will never appear in the output - * list. Can be null. - * @param specifics An array of Intents that should be resolved to the - * first specific results. Can be null. + * @param caller The class name of the activity that is making the request. + * This activity will never appear in the output list. Can be + * null. + * @param specifics An array of Intents that should be resolved to the first + * specific results. Can be null. * @param intent The desired intent as per resolveActivity(). * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, - * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, - * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, - * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. The most important is - * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only - * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. - * - * @return Returns a List of ResolveInfo objects containing one entry for each - * matching activity. The list is ordered first by all of the intents resolved - * in <var>specifics</var> and then any additional activities that - * can handle <var>intent</var> but did not get included by one of - * the <var>specifics</var> intents. If there are no matching - * activities, an empty list is returned. - * + * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, + * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. The most important is {@link #MATCH_DEFAULT_ONLY}, + * to limit the resolution to only those activities that support + * the {@link android.content.Intent#CATEGORY_DEFAULT}. + * @return Returns a List of ResolveInfo objects containing one entry for + * each matching activity. The list is ordered first by all of the + * intents resolved in <var>specifics</var> and then any additional + * activities that can handle <var>intent</var> but did not get + * included by one of the <var>specifics</var> intents. If there are + * no matching activities, an empty list is returned. * @see #GET_META_DATA * @see #GET_RESOLVED_FILTER * @see #GET_SHARED_LIBRARY_FILES @@ -3709,9 +3726,8 @@ public abstract class PackageManager { * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS * @see #MATCH_DEFAULT_ONLY - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ @@ -3723,18 +3739,17 @@ public abstract class PackageManager { * * @param intent The desired intent as per resolveActivity(). * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, - * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, - * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, - * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. - * - * @return Returns a List of ResolveInfo objects containing one entry for each - * matching receiver, ordered from best to worst. If there are no matching - * receivers, an empty list or null is returned. - * + * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, + * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. + * @return Returns a List of ResolveInfo objects containing one entry for + * each matching receiver, ordered from best to worst. If there are + * no matching receivers, an empty list or null is returned. * @see #GET_META_DATA * @see #GET_RESOLVED_FILTER * @see #GET_SHARED_LIBRARY_FILES @@ -3742,9 +3757,8 @@ public abstract class PackageManager { * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS * @see #MATCH_DEFAULT_ONLY - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ @@ -3752,24 +3766,23 @@ public abstract class PackageManager { @ResolveInfoFlags int flags); /** - * Retrieve all receivers that can handle a broadcast of the given intent, for a specific - * user. + * Retrieve all receivers that can handle a broadcast of the given intent, + * for a specific user. * * @param intent The desired intent as per resolveActivity(). * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, - * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, - * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, - * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. + * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, + * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. * @param userHandle UserHandle of the user being queried. - * - * @return Returns a List of ResolveInfo objects containing one entry for each - * matching receiver, ordered from best to worst. If there are no matching - * receivers, an empty list or null is returned. - * + * @return Returns a List of ResolveInfo objects containing one entry for + * each matching receiver, ordered from best to worst. If there are + * no matching receivers, an empty list or null is returned. * @see #GET_META_DATA * @see #GET_RESOLVED_FILTER * @see #GET_SHARED_LIBRARY_FILES @@ -3777,12 +3790,10 @@ public abstract class PackageManager { * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS * @see #MATCH_DEFAULT_ONLY - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES - * * @hide */ @SystemApi @@ -3810,20 +3821,19 @@ public abstract class PackageManager { * Determine the best service to handle for a given Intent. * * @param intent An intent containing all of the desired specification - * (action, data, type, category, and/or component). + * (action, data, type, category, and/or component). * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, - * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, - * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, - * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. - * + * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, + * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. * @return Returns a ResolveInfo object containing the final service intent - * that was determined to be the best action. Returns null if no + * that was determined to be the best action. Returns null if no * matching service was found. - * * @see #GET_META_DATA * @see #GET_RESOLVED_FILTER * @see #GET_SHARED_LIBRARY_FILES @@ -3831,9 +3841,8 @@ public abstract class PackageManager { * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS * @see #MATCH_DEFAULT_ONLY - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ @@ -3844,19 +3853,19 @@ public abstract class PackageManager { * * @param intent The desired intent as per resolveService(). * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, - * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, - * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, - * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. - * - * @return Returns a List of ResolveInfo objects containing one entry for each - * matching service, ordered from best to worst. In other words, the first - * item is what would be returned by {@link #resolveService}. If there are - * no matching services, an empty list or null is returned. - * + * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, + * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. + * @return Returns a List of ResolveInfo objects containing one entry for + * each matching service, ordered from best to worst. In other + * words, the first item is what would be returned by + * {@link #resolveService}. If there are no matching services, an + * empty list or null is returned. * @see #GET_META_DATA * @see #GET_RESOLVED_FILTER * @see #GET_SHARED_LIBRARY_FILES @@ -3864,9 +3873,8 @@ public abstract class PackageManager { * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS * @see #MATCH_DEFAULT_ONLY - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ @@ -3878,20 +3886,20 @@ public abstract class PackageManager { * * @param intent The desired intent as per resolveService(). * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, - * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, - * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, - * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. + * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, + * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. * @param userId The user id. - * - * @return Returns a List of ResolveInfo objects containing one entry for each - * matching service, ordered from best to worst. In other words, the first - * item is what would be returned by {@link #resolveService}. If there are - * no matching services, an empty list or null is returned. - * + * @return Returns a List of ResolveInfo objects containing one entry for + * each matching service, ordered from best to worst. In other + * words, the first item is what would be returned by + * {@link #resolveService}. If there are no matching services, an + * empty list or null is returned. * @see #GET_META_DATA * @see #GET_RESOLVED_FILTER * @see #GET_SHARED_LIBRARY_FILES @@ -3899,12 +3907,10 @@ public abstract class PackageManager { * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS * @see #MATCH_DEFAULT_ONLY - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES - * * @hide */ public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent, @@ -3916,19 +3922,18 @@ public abstract class PackageManager { * @param intent An intent containing all of the desired specification * (action, data, type, category, and/or component). * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, - * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, - * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, - * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. + * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, + * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. * @param userId The user id. - * - * @return Returns a List of ResolveInfo objects containing one entry for each - * matching provider, ordered from best to worst. If there are no - * matching services, an empty list or null is returned. - * + * @return Returns a List of ResolveInfo objects containing one entry for + * each matching provider, ordered from best to worst. If there are + * no matching services, an empty list or null is returned. * @see #GET_META_DATA * @see #GET_RESOLVED_FILTER * @see #GET_SHARED_LIBRARY_FILES @@ -3936,12 +3941,10 @@ public abstract class PackageManager { * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS * @see #MATCH_DEFAULT_ONLY - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES - * * @hide */ public abstract List<ResolveInfo> queryIntentContentProvidersAsUser( @@ -3953,18 +3956,17 @@ public abstract class PackageManager { * @param intent An intent containing all of the desired specification * (action, data, type, category, and/or component). * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, - * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE}, - * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE}, - * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. - * - * @return Returns a List of ResolveInfo objects containing one entry for each - * matching provider, ordered from best to worst. If there are no - * matching services, an empty list or null is returned. - * + * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER}, + * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. + * @return Returns a List of ResolveInfo objects containing one entry for + * each matching provider, ordered from best to worst. If there are + * no matching services, an empty list or null is returned. * @see #GET_META_DATA * @see #GET_RESOLVED_FILTER * @see #GET_SHARED_LIBRARY_FILES @@ -3972,9 +3974,8 @@ public abstract class PackageManager { * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS * @see #MATCH_DEFAULT_ONLY - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ @@ -3986,17 +3987,16 @@ public abstract class PackageManager { * * @param name The name of the provider to find. * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, - * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, - * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} - * {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. - * - * @return A {@link ProviderInfo} object containing information about the provider. - * If a provider was not found, returns null. - * + * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, + * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. + * @return A {@link ProviderInfo} object containing information about the + * provider. If a provider was not found, returns null. * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES * @see #MATCH_ALL @@ -4004,9 +4004,8 @@ public abstract class PackageManager { * @see #MATCH_DEFAULT_ONLY * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ @@ -4018,18 +4017,17 @@ public abstract class PackageManager { * * @param name The name of the provider to find. * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, - * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, - * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} - * {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. + * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, + * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. * @param userId The user id. - * - * @return A {@link ProviderInfo} object containing information about the provider. - * If a provider was not found, returns null. - * + * @return A {@link ProviderInfo} object containing information about the + * provider. If a provider was not found, returns null. * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES * @see #MATCH_ALL @@ -4037,12 +4035,10 @@ public abstract class PackageManager { * @see #MATCH_DEFAULT_ONLY * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES - * * @hide */ public abstract ProviderInfo resolveContentProviderAsUser(String name, @@ -4050,29 +4046,28 @@ public abstract class PackageManager { /** * Retrieve content provider information. - * - * <p><em>Note: unlike most other methods, an empty result set is indicated + * <p> + * <em>Note: unlike most other methods, an empty result set is indicated * by a null return instead of an empty list.</em> * * @param processName If non-null, limits the returned providers to only - * those that are hosted by the given process. If null, - * all content providers are returned. + * those that are hosted by the given process. If null, all + * content providers are returned. * @param uid If <var>processName</var> is non-null, this is the required - * uid owning the requested content providers. + * uid owning the requested content providers. * @param flags Additional option flags. Use any combination of - * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, - * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, - * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, - * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, - * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} - * {@link #MATCH_UNINSTALLED_PACKAGES} - * to modify the data returned. - * + * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, + * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY}, + * {@link #MATCH_DISABLED_COMPONENTS}, + * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}, + * {@link #MATCH_DIRECT_BOOT_AWARE}, + * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY} + * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data + * returned. * @return A list of {@link ProviderInfo} objects containing one entry for * each provider either matching <var>processName</var> or, if * <var>processName</var> is null, all known content providers. * <em>If there are no matching providers, null is returned.</em> - * * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES * @see #MATCH_ALL @@ -4080,9 +4075,8 @@ public abstract class PackageManager { * @see #MATCH_DEFAULT_ONLY * @see #MATCH_DISABLED_COMPONENTS * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS - * @see #MATCH_ENCRYPTION_AWARE - * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE - * @see #MATCH_ENCRYPTION_UNAWARE + * @see #MATCH_DIRECT_BOOT_AWARE + * @see #MATCH_DIRECT_BOOT_UNAWARE * @see #MATCH_SYSTEM_ONLY * @see #MATCH_UNINSTALLED_PACKAGES */ @@ -4618,13 +4612,13 @@ public abstract class PackageManager { final PackageParser parser = new PackageParser(); final File apkFile = new File(archiveFilePath); try { - if ((flags & (MATCH_ENCRYPTION_UNAWARE | MATCH_ENCRYPTION_AWARE)) != 0) { + if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWARE)) != 0) { // Caller expressed an explicit opinion about what encryption // aware/unaware components they want to see, so fall through and // give them what they want } else { // Caller expressed no opinion, so match everything - flags |= MATCH_ENCRYPTION_AWARE_AND_UNAWARE; + flags |= MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE; } PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0); diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 7d7be9abbb90..db7ca2af80e3 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -2865,13 +2865,13 @@ public class PackageParser { ai.flags |= ApplicationInfo.FLAG_EXTRACT_NATIVE_LIBS; } - if (sa.getBoolean(R.styleable.AndroidManifestApplication_forceDeviceEncrypted, false) - && (flags & PARSE_IS_SYSTEM) != 0) { - ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_FORCE_DEVICE_ENCRYPTED; + if (sa.getBoolean(R.styleable.AndroidManifestApplication_defaultToDeviceProtectedStorage, + false) && (flags & PARSE_IS_SYSTEM) != 0) { + ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE; } - if (sa.getBoolean(R.styleable.AndroidManifestApplication_encryptionAware, false) + if (sa.getBoolean(R.styleable.AndroidManifestApplication_directBootAware, false) && (flags & PARSE_IS_SYSTEM) != 0) { - ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_ENCRYPTION_AWARE; + ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_DIRECT_BOOT_AWARE; } if (sa.getBoolean(R.styleable.AndroidManifestApplication_resizeableActivity, @@ -3493,9 +3493,9 @@ public class PackageParser { a.info.lockTaskLaunchMode = sa.getInt(R.styleable.AndroidManifestActivity_lockTaskMode, 0); - a.info.encryptionAware = sa.getBoolean( - R.styleable.AndroidManifestActivity_encryptionAware, - owner.applicationInfo.isEncryptionAware()); + a.info.encryptionAware = a.info.directBootAware = sa.getBoolean( + R.styleable.AndroidManifestActivity_directBootAware, + owner.applicationInfo.isDirectBootAware()); } else { a.info.launchMode = ActivityInfo.LAUNCH_MULTIPLE; a.info.configChanges = 0; @@ -3511,14 +3511,14 @@ public class PackageParser { } } - a.info.encryptionAware = sa.getBoolean( - R.styleable.AndroidManifestActivity_encryptionAware, - owner.applicationInfo.isEncryptionAware()); + a.info.encryptionAware = a.info.directBootAware = sa.getBoolean( + R.styleable.AndroidManifestActivity_directBootAware, + owner.applicationInfo.isDirectBootAware()); } - if (a.info.encryptionAware) { + if (a.info.directBootAware) { owner.applicationInfo.privateFlags |= - ApplicationInfo.PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE; + ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE; } sa.recycle(); @@ -3732,7 +3732,7 @@ public class PackageParser { info.maxRecents = target.info.maxRecents; info.layout = target.info.layout; info.resizeMode = target.info.resizeMode; - info.encryptionAware = target.info.encryptionAware; + info.encryptionAware = info.directBootAware = target.info.directBootAware; Activity a = new Activity(mParseActivityAliasArgs, info); if (outError[0] != null) { @@ -3921,12 +3921,12 @@ public class PackageParser { } } - p.info.encryptionAware = sa.getBoolean( - R.styleable.AndroidManifestProvider_encryptionAware, - owner.applicationInfo.isEncryptionAware()); - if (p.info.encryptionAware) { + p.info.encryptionAware = p.info.directBootAware = sa.getBoolean( + R.styleable.AndroidManifestProvider_directBootAware, + owner.applicationInfo.isDirectBootAware()); + if (p.info.directBootAware) { owner.applicationInfo.privateFlags |= - ApplicationInfo.PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE; + ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE; } sa.recycle(); @@ -4213,12 +4213,12 @@ public class PackageParser { } } - s.info.encryptionAware = sa.getBoolean( - R.styleable.AndroidManifestService_encryptionAware, - owner.applicationInfo.isEncryptionAware()); - if (s.info.encryptionAware) { + s.info.encryptionAware = s.info.directBootAware = sa.getBoolean( + R.styleable.AndroidManifestService_directBootAware, + owner.applicationInfo.isDirectBootAware()); + if (s.info.directBootAware) { owner.applicationInfo.privateFlags |= - ApplicationInfo.PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE; + ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE; } sa.recycle(); diff --git a/core/java/android/content/pm/PackageUserState.java b/core/java/android/content/pm/PackageUserState.java index 38e0044ea74c..e85311d6c887 100644 --- a/core/java/android/content/pm/PackageUserState.java +++ b/core/java/android/content/pm/PackageUserState.java @@ -23,8 +23,8 @@ import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED; import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS; import static android.content.pm.PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS; -import static android.content.pm.PackageManager.MATCH_ENCRYPTION_AWARE; -import static android.content.pm.PackageManager.MATCH_ENCRYPTION_UNAWARE; +import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE; +import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE; import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; import android.util.ArraySet; @@ -98,10 +98,10 @@ public class PackageUserState { } } - final boolean matchesUnaware = ((flags & MATCH_ENCRYPTION_UNAWARE) != 0) - && !componentInfo.encryptionAware; - final boolean matchesAware = ((flags & MATCH_ENCRYPTION_AWARE) != 0) - && componentInfo.encryptionAware; + final boolean matchesUnaware = ((flags & MATCH_DIRECT_BOOT_UNAWARE) != 0) + && !componentInfo.directBootAware; + final boolean matchesAware = ((flags & MATCH_DIRECT_BOOT_AWARE) != 0) + && componentInfo.directBootAware; return matchesUnaware || matchesAware; } diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java index bb28bde6bb6f..6162d1aeeceb 100644 --- a/core/java/android/content/pm/RegisteredServicesCache.java +++ b/core/java/android/content/pm/RegisteredServicesCache.java @@ -365,7 +365,8 @@ public abstract class RegisteredServicesCache<V> { protected List<ResolveInfo> queryIntentServices(int userId) { final PackageManager pm = mContext.getPackageManager(); return pm.queryIntentServicesAsUser(new Intent(mInterfaceName), - PackageManager.GET_META_DATA | PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, + PackageManager.GET_META_DATA | PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, userId); } diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index e2675b1b1863..92e18622269b 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package android.os; import android.Manifest; @@ -882,25 +883,13 @@ public class UserManager { } } - /** - * Return whether the calling user is running in a "locked" state. A user is - * unlocked only after they've entered their credentials (such as a lock - * pattern or PIN), and credential-encrypted private app data storage is - * available. - */ + /** @removed */ @Deprecated public boolean isUserRunningAndLocked() { return isUserRunningAndLocked(Process.myUserHandle()); } - /** - * Return whether the given user is running in a "locked" state. A user - * is unlocked only after they've entered their credentials (such as a lock - * pattern or PIN), and credential-encrypted private app data storage is - * available. - * - * @param user to retrieve the unlocked state for. - */ + /** @removed */ @Deprecated public boolean isUserRunningAndLocked(UserHandle user) { try { @@ -911,25 +900,13 @@ public class UserManager { } } - /** - * Return whether the calling user is running in an "unlocked" state. A user - * is unlocked only after they've entered their credentials (such as a lock - * pattern or PIN), and credential-encrypted private app data storage is - * available. - */ + /** @removed */ @Deprecated public boolean isUserRunningAndUnlocked() { return isUserRunningAndUnlocked(Process.myUserHandle()); } - /** - * Return whether the given user is running in an "unlocked" state. A user - * is unlocked only after they've entered their credentials (such as a lock - * pattern or PIN), and credential-encrypted private app data storage is - * available. - * - * @param user to retrieve the unlocked state for. - */ + /** @removed */ @Deprecated public boolean isUserRunningAndUnlocked(UserHandle user) { try { @@ -944,7 +921,11 @@ public class UserManager { * Return whether the calling user is running in an "unlocked" state. A user * is unlocked only after they've entered their credentials (such as a lock * pattern or PIN), and credential-encrypted private app data storage is + * available. When a user is locked, only device-protected data storage is * available. + * + * @see Intent#ACTION_USER_UNLOCKED + * @see Context#createDeviceProtectedStorageContext() */ public boolean isUserUnlocked() { return isUserUnlocked(Process.myUserHandle()); @@ -953,10 +934,13 @@ public class UserManager { /** * Return whether the given user is running in an "unlocked" state. A user * is unlocked only after they've entered their credentials (such as a lock - * pattern or PIN), and credential-encrypted private app data storage is + * pattern or PIN), and credential-protected private app data storage is + * available. When a user is locked, only device-protected data storage is * available. * * @param user to retrieve the unlocked state for. + * @see Intent#ACTION_USER_UNLOCKED + * @see Context#createDeviceProtectedStorageContext() */ public boolean isUserUnlocked(UserHandle user) { return isUserUnlocked(user.getIdentifier()); diff --git a/core/java/android/preference/PreferenceManager.java b/core/java/android/preference/PreferenceManager.java index ebb12fd1291d..c36680cdb210 100644 --- a/core/java/android/preference/PreferenceManager.java +++ b/core/java/android/preference/PreferenceManager.java @@ -113,8 +113,8 @@ public class PreferenceManager { private int mSharedPreferencesMode; private static final int STORAGE_DEFAULT = 0; - private static final int STORAGE_DEVICE_ENCRYPTED = 1; - private static final int STORAGE_CREDENTIAL_ENCRYPTED = 2; + private static final int STORAGE_DEVICE_PROTECTED = 1; + private static final int STORAGE_CREDENTIAL_PROTECTED = 2; private int mStorage = STORAGE_DEFAULT; @@ -360,35 +360,58 @@ public class PreferenceManager { /** * Explicitly set the storage location used internally by this class to be - * device-encrypted storage. + * device-protected storage. * <p> - * Data stored in device-encrypted storage is typically encrypted with a key - * tied to the physical device, and it can be accessed when the device has - * booted successfully, both <em>before and after</em> the user has - * authenticated with their credentials (such as a lock pattern or PIN). - * Because device-encrypted data is available before user authentication, - * you should carefully consider what data you store using this mode. + * <p> + * When a device is encrypted, data stored in this location is encrypted + * with a key tied to the physical device, and it can be accessed + * immediately after the device has booted successfully, both + * <em>before and after</em> the user has authenticated with their + * credentials (such as a lock pattern or PIN). + * <p> + * Because device-protected data is available without user authentication, + * you should carefully limit the data you store using this Context. For + * example, storing sensitive authentication tokens or passwords in the + * device-protected area is strongly discouraged. * - * @see Context#createDeviceEncryptedStorageContext() + * @see Context#createDeviceProtectedStorageContext() */ - public void setStorageDeviceEncrypted() { - mStorage = STORAGE_DEVICE_ENCRYPTED; + public void setStorageDeviceProtected() { + mStorage = STORAGE_DEVICE_PROTECTED; mSharedPreferences = null; } + /** @removed */ + @Deprecated + public void setStorageDeviceEncrypted() { + setStorageDeviceProtected(); + } + /** * Explicitly set the storage location used internally by this class to be - * credential-encrypted storage. + * credential-protected storage. This is the default storage area for apps + * unless {@code forceDeviceProtectedStorage} was requested. + * <p> + * When a device is encrypted, data stored in this location is encrypted + * with a key tied to user credentials, which can be accessed + * <em>only after</em> the user has entered their credentials (such as a + * lock pattern or PIN). * - * @see Context#createCredentialEncryptedStorageContext() + * @see Context#createCredentialProtectedStorageContext() * @hide */ @SystemApi - public void setStorageCredentialEncrypted() { - mStorage = STORAGE_CREDENTIAL_ENCRYPTED; + public void setStorageCredentialProtected() { + mStorage = STORAGE_CREDENTIAL_PROTECTED; mSharedPreferences = null; } + /** @removed */ + @Deprecated + public void setStorageCredentialEncrypted() { + setStorageCredentialProtected(); + } + /** * Gets a SharedPreferences instance that preferences managed by this will * use. @@ -400,11 +423,11 @@ public class PreferenceManager { if (mSharedPreferences == null) { final Context storageContext; switch (mStorage) { - case STORAGE_DEVICE_ENCRYPTED: - storageContext = mContext.createDeviceEncryptedStorageContext(); + case STORAGE_DEVICE_PROTECTED: + storageContext = mContext.createDeviceProtectedStorageContext(); break; - case STORAGE_CREDENTIAL_ENCRYPTED: - storageContext = mContext.createCredentialEncryptedStorageContext(); + case STORAGE_CREDENTIAL_PROTECTED: + storageContext = mContext.createCredentialProtectedStorageContext(); break; default: storageContext = mContext; diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 091a46ad09b5..ff8028b332ad 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2959,8 +2959,8 @@ android:icon="@drawable/ic_launcher_android" android:supportsRtl="true" android:theme="@style/Theme.Material.DayNight.DarkActionBar" - android:forceDeviceEncrypted="true" - android:encryptionAware="true"> + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> <activity android:name="com.android.internal.app.ChooserActivity" android:theme="@style/Theme.DeviceDefault.Resolver" android:finishOnCloseSystemDialogs="true" diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index d0d1d5a0b694..57168235b208 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -109,13 +109,6 @@ included in the system image. Third-party apps cannot use it.</em> --> <attr name="allowClearUserData" format="boolean" /> - <!-- Option to let applications specify that user data should - never be encrypted if an Encrypted File System solution - is enabled. Specifically, this is an "opt-out" feature, meaning - that, by default, user data will be encrypted if the EFS feature - is enabled. --> - <attr name="neverEncrypt" format="boolean" /> - <!-- Option to indicate this application is only for testing purposes. For example, it may expose functionality or data outside of itself that would cause a security hole, but is useful for testing. This @@ -579,10 +572,10 @@ single integer, with higher numbers considered to be better. --> <attr name="priority" format="integer" /> - <!-- Indicate if this component is aware of encryption lifecycle, and can be + <!-- Indicate if this component is aware of direct boot lifecycle, and can be safely run before the user has entered their credentials (such as a lock pattern or PIN). --> - <attr name="encryptionAware" format="boolean" /> + <attr name="directBootAware" format="boolean" /> <!-- Specify how an activity should be launched. See the <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back @@ -1262,7 +1255,6 @@ <attr name="restoreNeedsApplication" /> <attr name="restoreAnyVersion" /> <attr name="backupInForeground" /> - <attr name="neverEncrypt" /> <!-- Request that your application's processes be created with a large Dalvik heap. This applies to <em>all</em> processes created for the application. It only applies to the first @@ -1306,8 +1298,8 @@ <attr name="usesCleartextTraffic" /> <attr name="multiArch" /> <attr name="extractNativeLibs" /> - <attr name="forceDeviceEncrypted" format="boolean" /> - <attr name="encryptionAware" /> + <attr name="defaultToDeviceProtectedStorage" format="boolean" /> + <attr name="directBootAware" /> <attr name="resizeableActivity" /> </declare-styleable> <!-- The <code>permission</code> tag declares a security permission that can be @@ -1686,7 +1678,7 @@ <attr name="enabled" /> <attr name="exported" /> <attr name="singleUser" /> - <attr name="encryptionAware" /> + <attr name="directBootAware" /> </declare-styleable> <!-- Attributes that can be supplied in an AndroidManifest.xml @@ -1770,7 +1762,7 @@ with it is through the Service API (binding and starting). --> <attr name="isolatedProcess" format="boolean" /> <attr name="singleUser" /> - <attr name="encryptionAware" /> + <attr name="directBootAware" /> <!-- If the service is an {@link android.R.attr#isolatedProcess} service, this permits a client to bind to the service as if it were running it its own package. The service must also be {@link android.R.attr#exported} if this flag is set. --> @@ -1810,7 +1802,7 @@ <attr name="enabled" /> <attr name="exported" /> <attr name="singleUser" /> - <attr name="encryptionAware" /> + <attr name="directBootAware" /> </declare-styleable> <!-- The <code>activity</code> tag declares an @@ -1883,7 +1875,7 @@ <attr name="supportsPictureInPicture" /> <attr name="lockTaskMode" /> <attr name="showForAllUsers" /> - <attr name="encryptionAware" /> + <attr name="directBootAware" /> <!-- @hide This activity is always focusable regardless of if it is in a task/stack whose activities are normally not focusable. For example, {@link android.R.attr#supportsPictureInPicture} activities are placed diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 4e8740a52fb5..3c5b4c0042bd 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2679,8 +2679,8 @@ <public type="attr" name="contextPopupMenuStyle" /> <public type="attr" name="textAppearancePopupMenuHeader" /> <public type="attr" name="windowBackgroundFallback" /> - <public type="attr" name="forceDeviceEncrypted" /> - <public type="attr" name="encryptionAware" /> + <public type="attr" name="defaultToDeviceProtectedStorage" /> + <public type="attr" name="directBootAware" /> <public type="attr" name="preferenceFragmentStyle" /> <public type="attr" name="canControlMagnification" /> <public type="attr" name="languageTag" /> diff --git a/packages/DefaultContainerService/AndroidManifest.xml b/packages/DefaultContainerService/AndroidManifest.xml index ccf1501602fe..55d000c14ad1 100644 --- a/packages/DefaultContainerService/AndroidManifest.xml +++ b/packages/DefaultContainerService/AndroidManifest.xml @@ -13,8 +13,8 @@ <application android:label="@string/service_name" android:allowBackup="false" - android:forceDeviceEncrypted="true" - android:encryptionAware="true"> + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> <service android:name=".DefaultContainerService" android:enabled="true" diff --git a/packages/ExtServices/AndroidManifest.xml b/packages/ExtServices/AndroidManifest.xml index 519db66cf910..c2ca9989689c 100644 --- a/packages/ExtServices/AndroidManifest.xml +++ b/packages/ExtServices/AndroidManifest.xml @@ -22,8 +22,8 @@ coreApp="true"> <application android:label="@string/app_name" - android:forceDeviceEncrypted="true" - android:encryptionAware="true"> + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> <library android:name="android.ext.services"/> diff --git a/packages/ExtShared/AndroidManifest.xml b/packages/ExtShared/AndroidManifest.xml index e2e81d08c747..04d865e14588 100644 --- a/packages/ExtShared/AndroidManifest.xml +++ b/packages/ExtShared/AndroidManifest.xml @@ -22,8 +22,8 @@ <application android:label="@string/app_name" android:allowBackup="false" - android:forceDeviceEncrypted="true" - android:encryptionAware="true"> + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> <library android:name="android.ext.shared"/> diff --git a/packages/FakeOemFeatures/AndroidManifest.xml b/packages/FakeOemFeatures/AndroidManifest.xml index fe74ad87ac1d..a66521d98822 100644 --- a/packages/FakeOemFeatures/AndroidManifest.xml +++ b/packages/FakeOemFeatures/AndroidManifest.xml @@ -12,8 +12,8 @@ android:allowBackup="false" android:hardwareAccelerated="true" android:label="Fake OEM Features" - android:forceDeviceEncrypted="true" - android:encryptionAware="true"> + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> <service android:name=".FakeCoreService" android:process=":core" android:label="Fake OEM Core Service" /> diff --git a/packages/FusedLocation/AndroidManifest.xml b/packages/FusedLocation/AndroidManifest.xml index ed84c0d3126c..a8319ab233ac 100644 --- a/packages/FusedLocation/AndroidManifest.xml +++ b/packages/FusedLocation/AndroidManifest.xml @@ -29,8 +29,8 @@ <application android:label="@string/app_label" android:process="system" - android:forceDeviceEncrypted="true" - android:encryptionAware="true"> + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> <uses-library android:name="com.android.location.provider" /> diff --git a/packages/InputDevices/AndroidManifest.xml b/packages/InputDevices/AndroidManifest.xml index 07885ea6f04b..9507c9f5a199 100644 --- a/packages/InputDevices/AndroidManifest.xml +++ b/packages/InputDevices/AndroidManifest.xml @@ -7,8 +7,8 @@ android:allowClearUserData="false" android:label="@string/app_label" android:process="system" - android:forceDeviceEncrypted="true" - android:encryptionAware="true"> + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> <receiver android:name=".InputDeviceReceiver" android:label="@string/keyboard_layouts_label"> diff --git a/packages/Keyguard/AndroidManifest.xml b/packages/Keyguard/AndroidManifest.xml index 54972b4bae29..165fe05628d6 100644 --- a/packages/Keyguard/AndroidManifest.xml +++ b/packages/Keyguard/AndroidManifest.xml @@ -46,8 +46,8 @@ android:process="com.android.systemui" android:persistent="true" android:supportsRtl="true" - android:forceDeviceEncrypted="true" - android:encryptionAware="true"> + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> </application> </manifest> diff --git a/packages/SettingsProvider/AndroidManifest.xml b/packages/SettingsProvider/AndroidManifest.xml index ba991fbe44f8..6c06d05e100b 100644 --- a/packages/SettingsProvider/AndroidManifest.xml +++ b/packages/SettingsProvider/AndroidManifest.xml @@ -9,8 +9,8 @@ android:backupAgent="SettingsBackupAgent" android:killAfterRestore="false" android:icon="@mipmap/ic_launcher_settings" - android:forceDeviceEncrypted="true" - android:encryptionAware="true"> + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> <provider android:name="SettingsProvider" android:authorities="settings" diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml index 5b865f97281b..0c35573b9ee4 100644 --- a/packages/Shell/AndroidManifest.xml +++ b/packages/Shell/AndroidManifest.xml @@ -113,8 +113,8 @@ <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" /> <application android:label="@string/app_label" - android:forceDeviceEncrypted="true" - android:encryptionAware="true"> + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.android.shell" diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index 334035cb5dff..073cf14d8b59 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -167,8 +167,8 @@ android:process="com.android.systemui" android:supportsRtl="true" android:theme="@style/systemui_theme" - android:forceDeviceEncrypted="true" - android:encryptionAware="true"> + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> <!-- Keep theme in sync with SystemUIApplication.onCreate(). Setting the theme on the application does not affect views inflated by services. The application theme is set again from onCreate to take effect for those views. --> diff --git a/packages/services/Proxy/AndroidManifest.xml b/packages/services/Proxy/AndroidManifest.xml index 88f83813fe7f..51531e3e1d02 100644 --- a/packages/services/Proxy/AndroidManifest.xml +++ b/packages/services/Proxy/AndroidManifest.xml @@ -8,8 +8,8 @@ <application android:label="@string/app_label" android:process="com.android.proxyhandler" - android:forceDeviceEncrypted="true" - android:encryptionAware="true"> + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> <service android:name=".ProxyService" android:exported="true"> diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java index b4b40ae046b4..933b402edf57 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -1013,7 +1013,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { PackageManager.GET_SERVICES | PackageManager.GET_META_DATA | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS - | PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, + | PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, mCurrentUserId); for (int i = 0, count = installedServices.size(); i < count; i++) { diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java index a4f85db949cb..8febecc1ce4e 100644 --- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java @@ -2487,7 +2487,8 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku // from a profile that is still locked, so let them see those // widgets. if (isProfileWithUnlockedParent(userId)) { - flags |= PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE; + flags |= PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE; } // Widgets referencing shared libraries need to have their diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java index 4536e048df9d..65a22b9a29e9 100644 --- a/services/core/java/com/android/server/MountService.java +++ b/services/core/java/com/android/server/MountService.java @@ -809,7 +809,9 @@ class MountService extends IMountService.Stub if (user.isSystemOnly()) continue; final ProviderInfo provider = mPms.resolveContentProvider(MediaStore.AUTHORITY, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, user.id); + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, + user.id); if (provider != null) { final IActivityManager am = ActivityManagerNative.getDefault(); try { diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java index 8310c97de4aa..322df04ee2ac 100644 --- a/services/core/java/com/android/server/accounts/AccountManagerService.java +++ b/services/core/java/com/android/server/accounts/AccountManagerService.java @@ -3825,7 +3825,7 @@ public class AccountManagerService final ActivityManager am = mContext.getSystemService(ActivityManager.class); if (am.isUserRunningAndLocked(mAccounts.userId) - && !authenticatorInfo.componentInfo.encryptionAware) { + && !authenticatorInfo.componentInfo.directBootAware) { Slog.w(TAG, "Blocking binding to authenticator " + authenticatorInfo.componentName + " which isn't encryption aware"); return false; diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 6361db59b0f5..4f0f7704f0b8 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -267,7 +267,7 @@ import static android.content.pm.PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEME import static android.content.pm.PackageManager.FEATURE_PICTURE_IN_PICTURE; import static android.content.pm.PackageManager.GET_PROVIDERS; import static android.content.pm.PackageManager.MATCH_DEBUG_TRIAGED_MISSING; -import static android.content.pm.PackageManager.MATCH_ENCRYPTION_UNAWARE; +import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE; import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES; import static android.content.pm.PackageManager.PERMISSION_GRANTED; @@ -1910,7 +1910,7 @@ public final class ActivityManagerService extends ActivityManagerNative mRecentTasks.loadUserRecentsLocked(userId); } if (userId == UserHandle.USER_SYSTEM) { - startPersistentApps(PackageManager.MATCH_ENCRYPTION_UNAWARE); + startPersistentApps(PackageManager.MATCH_DIRECT_BOOT_UNAWARE); } installEncryptionUnawareProviders(userId); break; @@ -10961,7 +10961,7 @@ public final class ActivityManagerService extends ActivityManagerNative // We're only interested in providers that are encryption unaware, and // we don't care about uninstalled apps, since there's no way they're // running at this point. - final int matchFlags = GET_PROVIDERS | MATCH_ENCRYPTION_UNAWARE; + final int matchFlags = GET_PROVIDERS | MATCH_DIRECT_BOOT_UNAWARE; synchronized (this) { final int NP = mProcessNames.getMap().size(); @@ -12882,7 +12882,7 @@ public final class ActivityManagerService extends ActivityManagerNative synchronized (this) { // Only start up encryption-aware persistent apps; once user is // unlocked we'll come back around and start unaware apps - startPersistentApps(PackageManager.MATCH_ENCRYPTION_AWARE); + startPersistentApps(PackageManager.MATCH_DIRECT_BOOT_AWARE); // Start up initial activity. mBooting = true; diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index fa62c9867168..efa74209afaa 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -620,7 +620,8 @@ class ActivityStarter { && userManager.isUserUnlocked(parent.getUserHandle()) && !userManager.isUserUnlocked(userInfo.getUserHandle())) { rInfo = mSupervisor.resolveIntent(intent, resolvedType, userId, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE); + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE); } } } diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index 033a243d2c3e..3c04b7820549 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -1109,7 +1109,8 @@ public class InputManagerService extends IInputManager.Stub final PackageManager pm = mContext.getPackageManager(); Intent intent = new Intent(InputManager.ACTION_QUERY_KEYBOARD_LAYOUTS); for (ResolveInfo resolveInfo : pm.queryBroadcastReceivers(intent, - PackageManager.GET_META_DATA | PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE)) { + PackageManager.GET_META_DATA | PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE)) { final ActivityInfo activityInfo = resolveInfo.activityInfo; final int priority = resolveInfo.priority; visitKeyboardLayoutsInPackage(pm, activityInfo, null, priority, visitor); @@ -1125,7 +1126,8 @@ public class InputManagerService extends IInputManager.Stub ActivityInfo receiver = pm.getReceiverInfo( new ComponentName(d.packageName, d.receiverName), PackageManager.GET_META_DATA - | PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE); + | PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE); visitKeyboardLayoutsInPackage(pm, receiver, d.keyboardLayoutName, 0, visitor); } catch (NameNotFoundException ex) { } diff --git a/services/core/java/com/android/server/job/JobSchedulerService.java b/services/core/java/com/android/server/job/JobSchedulerService.java index 49eed23c5694..9fd7f90e7e72 100644 --- a/services/core/java/com/android/server/job/JobSchedulerService.java +++ b/services/core/java/com/android/server/job/JobSchedulerService.java @@ -1219,7 +1219,8 @@ public final class JobSchedulerService extends com.android.server.SystemService final ComponentName service = job.getService(); try { ServiceInfo si = pm.getServiceInfo(service, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, UserHandle.getUserId(uid)); if (si == null) { throw new IllegalArgumentException("No such service " + service); diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java index 3acd2cad44af..56edcca7ac0f 100644 --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java @@ -2509,8 +2509,9 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { // update rules for all installed applications final List<UserInfo> users = mUserManager.getUsers(); final List<ApplicationInfo> apps = pm.getInstalledApplications( - PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS - | PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE); + PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_DISABLED_COMPONENTS + | PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE); final int usersSize = users.size(); final int appsSize = apps.size(); diff --git a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java index 27c829318665..13a96ae50cbf 100644 --- a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java +++ b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java @@ -59,7 +59,8 @@ final class DefaultPermissionGrantPolicy { private static final String TAG = "DefaultPermGrantPolicy"; // must be <= 23 chars private static final boolean DEBUG = false; - private static final int DEFAULT_FLAGS = PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE; + private static final int DEFAULT_FLAGS = PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE; private static final String AUDIO_MIME_TYPE = "audio/mpeg"; diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java index 5b0ceca4cb9d..863a5ed802f2 100644 --- a/services/core/java/com/android/server/pm/LauncherAppsService.java +++ b/services/core/java/com/android/server/pm/LauncherAppsService.java @@ -218,7 +218,8 @@ public class LauncherAppsService extends SystemService { int packageUid = -1; try { packageUid = mPm.getPackageUidAsUser(callingPackage, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE | PackageManager.MATCH_UNINSTALLED_PACKAGES, UserHandle.getUserId(getCallingUid())); } catch (NameNotFoundException e) { @@ -256,7 +257,9 @@ public class LauncherAppsService extends SystemService { long ident = Binder.clearCallingIdentity(); try { List<ResolveInfo> apps = mPm.queryIntentActivitiesAsUser(mainIntent, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, user.getIdentifier()); + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, + user.getIdentifier()); return new ParceledListSlice<>(apps); } finally { Binder.restoreCallingIdentity(ident); @@ -274,7 +277,9 @@ public class LauncherAppsService extends SystemService { long ident = Binder.clearCallingIdentity(); try { ResolveInfo app = mPm.resolveActivityAsUser(intent, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, user.getIdentifier()); + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, + user.getIdentifier()); return app; } finally { Binder.restoreCallingIdentity(ident); @@ -293,7 +298,9 @@ public class LauncherAppsService extends SystemService { try { IPackageManager pm = AppGlobals.getPackageManager(); PackageInfo info = pm.getPackageInfo(packageName, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, user.getIdentifier()); + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, + user.getIdentifier()); return info != null && info.applicationInfo.enabled; } finally { Binder.restoreCallingIdentity(ident); @@ -421,7 +428,9 @@ public class LauncherAppsService extends SystemService { try { IPackageManager pm = AppGlobals.getPackageManager(); ActivityInfo info = pm.getActivityInfo(component, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, user.getIdentifier()); + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, + user.getIdentifier()); return info != null; } finally { Binder.restoreCallingIdentity(ident); @@ -445,7 +454,9 @@ public class LauncherAppsService extends SystemService { try { IPackageManager pm = AppGlobals.getPackageManager(); ActivityInfo info = pm.getActivityInfo(component, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, user.getIdentifier()); + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, + user.getIdentifier()); if (!info.exported) { throw new SecurityException("Cannot launch non-exported components " + component); @@ -455,7 +466,9 @@ public class LauncherAppsService extends SystemService { // as calling startActivityAsUser ignores the category and just // resolves based on the component if present. List<ResolveInfo> apps = mPm.queryIntentActivitiesAsUser(launchIntent, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, user.getIdentifier()); + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, + user.getIdentifier()); final int size = apps.size(); for (int i = 0; i < size; ++i) { ActivityInfo activityInfo = apps.get(i).activityInfo; diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 504da47435fd..d98aaaebd631 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -61,10 +61,9 @@ import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATIO import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED; import static android.content.pm.PackageManager.MATCH_ALL; import static android.content.pm.PackageManager.MATCH_DEBUG_TRIAGED_MISSING; +import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE; +import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE; import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS; -import static android.content.pm.PackageManager.MATCH_ENCRYPTION_AWARE; -import static android.content.pm.PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE; -import static android.content.pm.PackageManager.MATCH_ENCRYPTION_UNAWARE; import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES; import static android.content.pm.PackageManager.MOVE_FAILED_DEVICE_ADMIN; @@ -2571,7 +2570,8 @@ public class PackageManagerService extends IPackageManager.Stub { final Intent intent = new Intent(Intent.ACTION_PACKAGE_NEEDS_VERIFICATION); final List<ResolveInfo> matches = queryIntentReceiversInternal(intent, PACKAGE_MIME_TYPE, - MATCH_SYSTEM_ONLY | MATCH_ENCRYPTION_AWARE_AND_UNAWARE, UserHandle.USER_SYSTEM); + MATCH_SYSTEM_ONLY | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, + UserHandle.USER_SYSTEM); if (matches.size() == 1) { return matches.get(0).getComponentInfo().packageName; } else { @@ -2586,7 +2586,8 @@ public class PackageManagerService extends IPackageManager.Stub { intent.setDataAndType(Uri.fromFile(new File("foo.apk")), PACKAGE_MIME_TYPE); final List<ResolveInfo> matches = queryIntentActivitiesInternal(intent, PACKAGE_MIME_TYPE, - MATCH_SYSTEM_ONLY | MATCH_ENCRYPTION_AWARE_AND_UNAWARE, UserHandle.USER_SYSTEM); + MATCH_SYSTEM_ONLY | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, + UserHandle.USER_SYSTEM); if (matches.size() == 1) { return matches.get(0).getComponentInfo().packageName; } else { @@ -2598,7 +2599,8 @@ public class PackageManagerService extends IPackageManager.Stub { final Intent intent = new Intent(Intent.ACTION_INTENT_FILTER_NEEDS_VERIFICATION); final List<ResolveInfo> matches = queryIntentReceiversInternal(intent, PACKAGE_MIME_TYPE, - MATCH_SYSTEM_ONLY | MATCH_ENCRYPTION_AWARE_AND_UNAWARE, UserHandle.USER_SYSTEM); + MATCH_SYSTEM_ONLY | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, + UserHandle.USER_SYSTEM); ResolveInfo best = null; final int N = matches.size(); for (int i = 0; i < N; i++) { @@ -2633,7 +2635,8 @@ public class PackageManagerService extends IPackageManager.Stub { final Intent resolverIntent = new Intent(Intent.ACTION_RESOLVE_EPHEMERAL_PACKAGE); final List<ResolveInfo> resolvers = queryIntentServicesInternal(resolverIntent, null, - MATCH_SYSTEM_ONLY | MATCH_ENCRYPTION_AWARE_AND_UNAWARE, UserHandle.USER_SYSTEM); + MATCH_SYSTEM_ONLY | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, + UserHandle.USER_SYSTEM); final int N = resolvers.size(); if (N == 0) { @@ -2678,7 +2681,8 @@ public class PackageManagerService extends IPackageManager.Stub { intent.setDataAndType(Uri.fromFile(new File("foo.apk")), PACKAGE_MIME_TYPE); final List<ResolveInfo> matches = queryIntentActivitiesInternal(intent, PACKAGE_MIME_TYPE, - MATCH_SYSTEM_ONLY | MATCH_ENCRYPTION_AWARE_AND_UNAWARE, UserHandle.USER_SYSTEM); + MATCH_SYSTEM_ONLY | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, + UserHandle.USER_SYSTEM); if (matches.size() == 0) { return null; } else if (matches.size() == 1) { @@ -2892,8 +2896,8 @@ public class PackageManagerService extends IPackageManager.Stub { throw new SecurityException("Package " + packageName + " is currently frozen!"); } - if (!userKeyUnlocked && !(ps.pkg.applicationInfo.isEncryptionAware() - || ps.pkg.applicationInfo.isPartiallyEncryptionAware())) { + if (!userKeyUnlocked && !(ps.pkg.applicationInfo.isDirectBootAware() + || ps.pkg.applicationInfo.isPartiallyDirectBootAware())) { throw new SecurityException("Package " + packageName + " is not encryption aware!"); } } @@ -3261,17 +3265,17 @@ public class PackageManagerService extends IPackageManager.Stub { * Update given flags based on encryption status of current user. */ private int updateFlags(int flags, int userId) { - if ((flags & (PackageManager.MATCH_ENCRYPTION_UNAWARE - | PackageManager.MATCH_ENCRYPTION_AWARE)) != 0) { + if ((flags & (PackageManager.MATCH_DIRECT_BOOT_UNAWARE + | PackageManager.MATCH_DIRECT_BOOT_AWARE)) != 0) { // Caller expressed an explicit opinion about what encryption // aware/unaware components they want to see, so fall through and // give them what they want } else { // Caller expressed no opinion, so match based on user state if (isUserKeyUnlocked(userId)) { - flags |= PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE; + flags |= PackageManager.MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE; } else { - flags |= PackageManager.MATCH_ENCRYPTION_AWARE; + flags |= PackageManager.MATCH_DIRECT_BOOT_AWARE; } } return flags; @@ -3286,8 +3290,8 @@ public class PackageManagerService extends IPackageManager.Stub { | PackageManager.GET_SERVICES | PackageManager.GET_PROVIDERS)) != 0) { // Caller is asking for component details, so they'd better be // asking for specific encryption matching behavior, or be triaged - if ((flags & (PackageManager.MATCH_ENCRYPTION_UNAWARE - | PackageManager.MATCH_ENCRYPTION_AWARE + if ((flags & (PackageManager.MATCH_DIRECT_BOOT_UNAWARE + | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DEBUG_TRIAGED_MISSING)) == 0) { triaged = false; } @@ -3324,8 +3328,8 @@ public class PackageManagerService extends IPackageManager.Stub { boolean triaged = true; // Caller is asking for component details, so they'd better be // asking for specific encryption matching behavior, or be triaged - if ((flags & (PackageManager.MATCH_ENCRYPTION_UNAWARE - | PackageManager.MATCH_ENCRYPTION_AWARE + if ((flags & (PackageManager.MATCH_DIRECT_BOOT_UNAWARE + | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DEBUG_TRIAGED_MISSING)) == 0) { triaged = false; } @@ -6132,10 +6136,10 @@ public class PackageManagerService extends IPackageManager.Stub { final PackageParser.Package p = i.next(); if (p.applicationInfo == null) continue; - final boolean matchesUnaware = ((flags & MATCH_ENCRYPTION_UNAWARE) != 0) - && !p.applicationInfo.isEncryptionAware(); - final boolean matchesAware = ((flags & MATCH_ENCRYPTION_AWARE) != 0) - && p.applicationInfo.isEncryptionAware(); + final boolean matchesUnaware = ((flags & MATCH_DIRECT_BOOT_UNAWARE) != 0) + && !p.applicationInfo.isDirectBootAware(); + final boolean matchesAware = ((flags & MATCH_DIRECT_BOOT_AWARE) != 0) + && p.applicationInfo.isDirectBootAware(); if ((p.applicationInfo.flags & ApplicationInfo.FLAG_PERSISTENT) != 0 && (!mSafeMode || isSystemApp(p)) @@ -8295,8 +8299,8 @@ public class PackageManagerService extends IPackageManager.Stub { a.info.splitSourceDirs = pkg.applicationInfo.splitSourceDirs; a.info.splitPublicSourceDirs = pkg.applicationInfo.splitPublicSourceDirs; a.info.dataDir = pkg.applicationInfo.dataDir; - a.info.deviceEncryptedDataDir = pkg.applicationInfo.deviceEncryptedDataDir; - a.info.credentialEncryptedDataDir = pkg.applicationInfo.credentialEncryptedDataDir; + a.info.deviceProtectedDataDir = pkg.applicationInfo.deviceProtectedDataDir; + a.info.credentialProtectedDataDir = pkg.applicationInfo.credentialProtectedDataDir; // TODO: Update instrumentation.nativeLibraryDir as well ? Does it // need other information about the application, like the ABI and what not ? @@ -18395,13 +18399,13 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName()); /** * For system apps on non-FBE devices, this method migrates any existing - * CE/DE data to match the {@code forceDeviceEncrypted} flag requested by - * the app. + * CE/DE data to match the {@code defaultToDeviceProtectedStorage} flag + * requested by the app. */ private boolean maybeMigrateAppData(String volumeUuid, int userId, PackageParser.Package pkg) { if (pkg.isSystemApp() && !StorageManager.isFileEncryptedNativeOrEmulated() - && PackageManager.APPLY_FORCE_DEVICE_ENCRYPTED) { - final int storageTarget = pkg.applicationInfo.isForceDeviceEncrypted() + && PackageManager.APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) { + final int storageTarget = pkg.applicationInfo.isDefaultToDeviceProtectedStorage() ? StorageManager.FLAG_STORAGE_DE : StorageManager.FLAG_STORAGE_CE; synchronized (mInstallLock) { try { diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java index 4c77f286a404..e66ec3ccf63f 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -3048,7 +3048,8 @@ final class Settings { tmpPa.dump(new LogPrinter(Log.DEBUG, TAG), " "); } Intent intent = new Intent(); - int flags = PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE; + int flags = PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE; intent.setAction(tmpPa.getAction(0)); for (int i=0; i<tmpPa.countCategories(); i++) { String cat = tmpPa.getCategory(i); @@ -4175,10 +4176,10 @@ final class Settings { ApplicationInfo.PRIVATE_FLAG_FORWARD_LOCK, "FORWARD_LOCK", ApplicationInfo.PRIVATE_FLAG_PRIVILEGED, "PRIVILEGED", ApplicationInfo.PRIVATE_FLAG_HAS_DOMAIN_URLS, "HAS_DOMAIN_URLS", - ApplicationInfo.PRIVATE_FLAG_FORCE_DEVICE_ENCRYPTED, "FORCE_DEVICE_ENCRYPTED", - ApplicationInfo.PRIVATE_FLAG_ENCRYPTION_AWARE, "ENCRYPTION_AWARE", + ApplicationInfo.PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE, "DEFAULT_TO_DEVICE_PROTECTED_STORAGE", + ApplicationInfo.PRIVATE_FLAG_DIRECT_BOOT_AWARE, "DIRECT_BOOT_AWARE", ApplicationInfo.PRIVATE_FLAG_AUTOPLAY, "AUTOPLAY", - ApplicationInfo.PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE, "PARTIALLY_ENCRYPTION_AWARE", + ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE, "PARTIALLY_DIRECT_BOOT_AWARE", ApplicationInfo.PRIVATE_FLAG_EPHEMERAL, "EPHEMERAL", ApplicationInfo.PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER, "REQUIRED_FOR_SYSTEM_USER", ApplicationInfo.PRIVATE_FLAG_RESIZEABLE_ACTIVITIES, "RESIZEABLE_ACTIVITIES", diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java index 197b2faf8236..39aa45532a3c 100644 --- a/services/core/java/com/android/server/pm/ShortcutService.java +++ b/services/core/java/com/android/server/pm/ShortcutService.java @@ -985,12 +985,11 @@ public class ShortcutService extends IShortcutService.Stub { // Test overrides it. int injectGetPackageUid(@NonNull String packageName, @UserIdInt int userId) { try { - - // TODO Is MATCH_UNINSTALLED_PACKAGES correct to get SD card app info? - return mContext.getPackageManager().getPackageUidAsUser(packageName, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE - | PackageManager.MATCH_UNINSTALLED_PACKAGES, userId); + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE + | PackageManager.MATCH_UNINSTALLED_PACKAGES, + userId); } catch (NameNotFoundException e) { return -1; } diff --git a/services/core/java/com/android/server/policy/ShortcutManager.java b/services/core/java/com/android/server/policy/ShortcutManager.java index 57ae52306cce..a47f250feea8 100644 --- a/services/core/java/com/android/server/policy/ShortcutManager.java +++ b/services/core/java/com/android/server/policy/ShortcutManager.java @@ -138,16 +138,18 @@ class ShortcutManager { ComponentName componentName = new ComponentName(packageName, className); try { info = packageManager.getActivityInfo(componentName, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE - | PackageManager.MATCH_UNINSTALLED_PACKAGES); + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE + | PackageManager.MATCH_UNINSTALLED_PACKAGES); } catch (PackageManager.NameNotFoundException e) { String[] packages = packageManager.canonicalToCurrentPackageNames( new String[] { packageName }); componentName = new ComponentName(packages[0], className); try { info = packageManager.getActivityInfo(componentName, - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE - | PackageManager.MATCH_UNINSTALLED_PACKAGES); + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE + | PackageManager.MATCH_UNINSTALLED_PACKAGES); } catch (PackageManager.NameNotFoundException e1) { Log.w(TAG, "Unable to add bookmark: " + packageName + "/" + className, e); diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 6ddc6c83ed23..53022533d69d 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -21,6 +21,9 @@ import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_COMPLEX; import static android.app.admin.DevicePolicyManager.WIPE_EXTERNAL_STORAGE; import static android.app.admin.DevicePolicyManager.WIPE_RESET_PROTECTION_DATA; import static android.content.pm.PackageManager.GET_UNINSTALLED_PACKAGES; +import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE; +import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE; + import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW; import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT; import static org.xmlpull.v1.XmlPullParser.END_TAG; @@ -1272,10 +1275,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { final String adminPackage = aa.info.getPackageName(); if (packageName == null || packageName.equals(adminPackage)) { if (mIPackageManager.getPackageInfo(adminPackage, 0, userHandle) == null - || mIPackageManager.getReceiverInfo( - aa.info.getComponent(), - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, - userHandle) == null) { + || mIPackageManager.getReceiverInfo(aa.info.getComponent(), + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, + userHandle) == null) { removed = true; policy.mAdminList.remove(i); policy.mAdminMap.remove(aa.info.getComponent()); @@ -2096,8 +2099,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { try { ai = mIPackageManager.getReceiverInfo(adminName, PackageManager.GET_META_DATA | - PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS | - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, userHandle); + PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS | + PackageManager.MATCH_DIRECT_BOOT_AWARE | + PackageManager.MATCH_DIRECT_BOOT_UNAWARE, userHandle); } catch (RemoteException e) { // shouldn't happen. } @@ -7193,11 +7197,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { try { int parentUserId = getProfileParentId(userId); - List<ResolveInfo> activitiesToEnable = mIPackageManager.queryIntentActivities( - intent, - intent.resolveTypeIfNeeded(mContext.getContentResolver()), - PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE, - parentUserId).getList(); + List<ResolveInfo> activitiesToEnable = mIPackageManager + .queryIntentActivities(intent, + intent.resolveTypeIfNeeded(mContext.getContentResolver()), + PackageManager.MATCH_DIRECT_BOOT_AWARE + | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, + parentUserId) + .getList(); if (VERBOSE_LOG) { Slog.d(LOG_TAG, "Enabling system activities: " + activitiesToEnable); diff --git a/test-runner/src/android/test/mock/MockContext.java b/test-runner/src/android/test/mock/MockContext.java index 84cffe17d1d2..b739eadc8862 100644 --- a/test-runner/src/android/test/mock/MockContext.java +++ b/test-runner/src/android/test/mock/MockContext.java @@ -151,7 +151,7 @@ public class MockContext extends Context { } @Override - public boolean migrateSharedPreferencesFrom(Context sourceContext, String name) { + public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { throw new UnsupportedOperationException(); } @@ -258,7 +258,7 @@ public class MockContext extends Context { } @Override - public boolean migrateDatabaseFrom(Context sourceContext, String name) { + public boolean moveDatabaseFrom(Context sourceContext, String name) { throw new UnsupportedOperationException(); } @@ -726,26 +726,26 @@ public class MockContext extends Context { } @Override - public Context createDeviceEncryptedStorageContext() { + public Context createDeviceProtectedStorageContext() { throw new UnsupportedOperationException(); } /** {@hide} */ @SystemApi @Override - public Context createCredentialEncryptedStorageContext() { + public Context createCredentialProtectedStorageContext() { throw new UnsupportedOperationException(); } @Override - public boolean isDeviceEncryptedStorage() { + public boolean isDeviceProtectedStorage() { throw new UnsupportedOperationException(); } /** {@hide} */ @SystemApi @Override - public boolean isCredentialEncryptedStorage() { + public boolean isCredentialProtectedStorage() { throw new UnsupportedOperationException(); } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java index c7ae6fc473fd..b3f1ee1fdfdf 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java @@ -1258,7 +1258,7 @@ public final class BridgeContext extends Context { } @Override - public boolean migrateDatabaseFrom(Context sourceContext, String name) { + public boolean moveDatabaseFrom(Context sourceContext, String name) { // pass return false; } @@ -1451,7 +1451,7 @@ public final class BridgeContext extends Context { } @Override - public boolean migrateSharedPreferencesFrom(Context sourceContext, String name) { + public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { // pass return false; } @@ -1838,24 +1838,24 @@ public final class BridgeContext extends Context { } @Override - public Context createDeviceEncryptedStorageContext() { + public Context createDeviceProtectedStorageContext() { // pass return null; } @Override - public Context createCredentialEncryptedStorageContext() { + public Context createCredentialProtectedStorageContext() { // pass return null; } @Override - public boolean isDeviceEncryptedStorage() { + public boolean isDeviceProtectedStorage() { return false; } @Override - public boolean isCredentialEncryptedStorage() { + public boolean isCredentialProtectedStorage() { return false; } } |