Merge "Change hasRequestRawExternalStorageAccess() to return integer" into sc-dev

This commit is contained in:
Sahana Rao
2021-05-04 19:19:17 +00:00
committed by Android (Google) Code Review
3 changed files with 53 additions and 15 deletions

View File

@@ -11920,6 +11920,7 @@ package android.content.pm {
method public int getGwpAsanMode(); method public int getGwpAsanMode();
method public int getMemtagMode(); method public int getMemtagMode();
method public int getNativeHeapZeroInitialized(); method public int getNativeHeapZeroInitialized();
method public int getRequestRawExternalStorageAccess();
method public boolean isProfileable(); method public boolean isProfileable();
method public boolean isProfileableByShell(); method public boolean isProfileableByShell();
method public boolean isResourceOverlay(); method public boolean isResourceOverlay();
@@ -11975,6 +11976,9 @@ package android.content.pm {
field public static final int MEMTAG_DEFAULT = -1; // 0xffffffff field public static final int MEMTAG_DEFAULT = -1; // 0xffffffff
field public static final int MEMTAG_OFF = 0; // 0x0 field public static final int MEMTAG_OFF = 0; // 0x0
field public static final int MEMTAG_SYNC = 2; // 0x2 field public static final int MEMTAG_SYNC = 2; // 0x2
field public static final int RAW_EXTERNAL_STORAGE_ACCESS_DEFAULT = 0; // 0x0
field public static final int RAW_EXTERNAL_STORAGE_ACCESS_NOT_REQUESTED = 2; // 0x2
field public static final int RAW_EXTERNAL_STORAGE_ACCESS_REQUESTED = 1; // 0x1
field public static final int ZEROINIT_DEFAULT = -1; // 0xffffffff field public static final int ZEROINIT_DEFAULT = -1; // 0xffffffff
field public static final int ZEROINIT_DISABLED = 0; // 0x0 field public static final int ZEROINIT_DISABLED = 0; // 0x0
field public static final int ZEROINIT_ENABLED = 1; // 0x1 field public static final int ZEROINIT_ENABLED = 1; // 0x1

View File

@@ -2520,7 +2520,6 @@ package android.content.om {
package android.content.pm { package android.content.pm {
public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable { public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
method @Nullable public Boolean hasRequestRawExternalStorageAccess();
method public boolean isEncryptionAware(); method public boolean isEncryptionAware();
method public boolean isInstantApp(); method public boolean isInstantApp();
method public boolean isOem(); method public boolean isOem();

View File

@@ -2141,22 +2141,57 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
} }
/** /**
* @return * Use default value for
* <ul> * {@link android.R.styleable#AndroidManifestApplication_requestRawExternalStorageAccess}.
* <li>{@code true} if this app requested raw external storage access */
* <li>{@code false} if this app requests to disable raw external storage access. public static final int RAW_EXTERNAL_STORAGE_ACCESS_DEFAULT = 0;
* <li>{@code null} if the app didn't specify
* {@link android.R.styleable#AndroidManifestApplication_requestRawExternalStorageAccess} /**
* in its manifest file. * Raw external storage was requested by this app.
* </ul> */
* public static final int RAW_EXTERNAL_STORAGE_ACCESS_REQUESTED = 1;
/**
* Raw external storage was not requested by this app.
*/
public static final int RAW_EXTERNAL_STORAGE_ACCESS_NOT_REQUESTED = 2;
/**
* These constants need to match the value of
* {@link android.R.styleable#AndroidManifestApplication_requestRawExternalStorageAccess}.
* in application manifest.
* @hide * @hide
*/ */
@SuppressWarnings("AutoBoxing") @IntDef(prefix = {"RAW_EXTERNAL_STORAGE_"}, value = {
@SystemApi RAW_EXTERNAL_STORAGE_ACCESS_DEFAULT,
@Nullable RAW_EXTERNAL_STORAGE_ACCESS_REQUESTED,
public Boolean hasRequestRawExternalStorageAccess() { RAW_EXTERNAL_STORAGE_ACCESS_NOT_REQUESTED,
return requestRawExternalStorageAccess; })
@Retention(RetentionPolicy.SOURCE)
public @interface RawExternalStorage {}
/**
* @return
* <ul>
* <li>{@link ApplicationInfo#RAW_EXTERNAL_STORAGE_ACCESS_DEFAULT} if app didn't specify
* {@link android.R.styleable#AndroidManifestApplication_requestRawExternalStorageAccess}
* attribute in the manifest.
* <li>{@link ApplicationInfo#RAW_EXTERNAL_STORAGE_ACCESS_REQUESTED} if this app requested raw
* external storage access.
* <li>{@link ApplicationInfo#RAW_EXTERNAL_STORAGE_ACCESS_NOT_REQUESTED} if this app requests to
* disable raw external storage access
* </ul
* <p>
* Note that this doesn't give any hints on whether the app gets raw external storage access or
* not. Also, apps may get raw external storage access by default in some cases, see
* {@link android.R.styleable#AndroidManifestApplication_requestRawExternalStorageAccess}.
*/
public @RawExternalStorage int getRequestRawExternalStorageAccess() {
if (requestRawExternalStorageAccess == null) {
return RAW_EXTERNAL_STORAGE_ACCESS_DEFAULT;
}
return requestRawExternalStorageAccess ? RAW_EXTERNAL_STORAGE_ACCESS_REQUESTED
: RAW_EXTERNAL_STORAGE_ACCESS_NOT_REQUESTED;
} }
/** /**