diff options
| author | Nikita Ioffe <ioffe@google.com> | 2021-12-23 02:51:57 +0000 |
|---|---|---|
| committer | Nikita Ioffe <ioffe@google.com> | 2022-01-04 23:50:50 +0000 |
| commit | a8bc22f0391d0f6d42c8263064f427104f22ee74 (patch) | |
| tree | 99d372da12f61a4f71837330e7862ff63cfbaaf3 /core/java | |
| parent | fb42cf7e451395cffc257ce6cf619f2aa90567c8 (diff) | |
Don't create app data dirs if app requests not to
App can set a android.internal.PROPERTY_NO_APP_DATA_STORAGE property in it's
AndroidManifest.xml which will tell platform to avoid creating data
directories for it.
This property is intentionally not exposed as public API because not
having private app storage is a very niche requirement.
This change also logic to prevent app updates from changing value of the
property, i.e.: if an installed app doesn't specify value of the
PROPERTY_NO_APP_DATA_STORAGE property (or has it set to false), then any
update to this app shouldn't have this property specified (or explicitly
set it to false). If an app has PROPERTY_NO_APP_DATA_STORAGE set to
true, then all updates should keep that property set to true.
Note: this change only takes into account internal storage. Removing
app's external storage will be done in the follow up cl.
Bug: 211761016
Test: atest PackageManagerShellTest
Change-Id: I3e541d947a77f5c050bf706f64009f21c24dcbc9
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/content/pm/PackageManager.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 9a7aeef69ed3..338dfd62f316 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -145,6 +145,20 @@ public abstract class PackageManager { "android.media.PROPERTY_MEDIA_CAPABILITIES"; /** + * Application level property that an app can specify to opt-out from having private data + * directories both on the internal and external storages. + * + * <p>Changing the value of this property during app update is not supported, and such updates + * will be rejected. + * + * <p>This should only be set by platform apps that know what they are doing. + * + * @hide + */ + public static final String PROPERTY_NO_APP_DATA_STORAGE = + "android.internal.PROPERTY_NO_APP_DATA_STORAGE"; + + /** * A property value set within the manifest. * <p> * The value of a property will only have a single type, as defined by |
