diff options
| author | Abhijeet Kaur <abkaur@google.com> | 2020-03-04 17:34:10 +0000 |
|---|---|---|
| committer | Abhijeet Kaur <abkaur@google.com> | 2020-03-17 12:54:17 +0000 |
| commit | 14c5d83597f9246c003058b3100290e30a5976f2 (patch) | |
| tree | 24e89971dac40749186f7fec44fb337ff1f5823b /core/java | |
| parent | 3cfc4d0450d3da619e57d57aadf70d396f4b7fe2 (diff) | |
Move Scoped Storage compat flags definition to frameworks/base
Currently the flags definition is in MediaProvider, which is an
apex module (updatable), and the flags values are now used in
frameworks/base as well (non-updatable).
Good to have flags definition in the constant component.
Bug: 150593967
Test: atest ExternalStorageHostTest
Test: atest com.android.providers.media
Test: manual
Merged-In: I0b06c068cb3957a7db8af5e14598724f72122736
Change-Id: I0b06c068cb3957a7db8af5e14598724f72122736
(cherry picked from commit 4a989379e84d75e4970c3a7b77a1ea64f2fb59b5)
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/os/Environment.java | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java index 09ccb7238b34..ae65f1d0bd05 100644 --- a/core/java/android/os/Environment.java +++ b/core/java/android/os/Environment.java @@ -24,6 +24,8 @@ import android.app.AppGlobals; import android.app.AppOpsManager; import android.app.admin.DevicePolicyManager; import android.compat.Compatibility; +import android.compat.annotation.ChangeId; +import android.compat.annotation.Disabled; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.Intent; @@ -90,13 +92,43 @@ public class Environment { "/apex"); /** - * See definition in com.android.providers.media.LocalCallingIdentity + * Scoped Storage is on by default. However, it is not strictly enforced and there are multiple + * ways to opt out of scoped storage: + * <ul> + * <li>Target Sdk < Q</li> + * <li>Target Sdk = Q and has `requestLegacyExternalStorage` set in AndroidManifest.xml</li> + * <li>Target Sdk > Q: Upgrading from an app that was opted out of scoped storage and has + * `preserveLegacyExternalStorage` set in AndroidManifest.xml</li> + * </ul> + * This flag is enabled for all apps by default as Scoped Storage is enabled by default. + * Developers can disable this flag to opt out of Scoped Storage and have legacy storage + * workflow. + * + * Note: {@code FORCE_ENABLE_SCOPED_STORAGE} should also be disabled for apps to opt out of + * scoped storage. + * Note: This flag is also used in {@code com.android.providers.media.LocalCallingIdentity}. + * Any modifications to this flag should be reflected there as well. + * See https://developer.android.com/training/data-storage#scoped-storage for more information. */ + @ChangeId private static final long DEFAULT_SCOPED_STORAGE = 149924527L; /** - * See definition in com.android.providers.media.LocalCallingIdentity - */ + * Setting this flag strictly enforces Scoped Storage regardless of: + * <ul> + * <li>The value of Target Sdk</li> + * <li>The value of `requestLegacyExternalStorage` in AndroidManifest.xml</li> + * <li>The value of `preserveLegacyExternalStorage` in AndroidManifest.xml</li> + * </ul> + * + * Note: {@code DEFAULT_SCOPED_STORAGE} should also be enabled for apps to be enforced into + * scoped storage. + * Note: This flag is also used in {@code com.android.providers.media.LocalCallingIdentity}. + * Any modifications to this flag should be reflected there as well. + * See https://developer.android.com/training/data-storage#scoped-storage for more information. + */ + @ChangeId + @Disabled private static final long FORCE_ENABLE_SCOPED_STORAGE = 132649864L; @UnsupportedAppUsage |
