Merge "Rename requestOptimizedExternalStorageAccess to more precise name" into sc-dev

This commit is contained in:
Sahana Rao
2021-04-08 15:42:12 +00:00
committed by Android (Google) Code Review
9 changed files with 41 additions and 36 deletions

View File

@@ -1182,7 +1182,7 @@ package android {
field public static final int reqNavigation = 16843306; // 0x101022a field public static final int reqNavigation = 16843306; // 0x101022a
field public static final int reqTouchScreen = 16843303; // 0x1010227 field public static final int reqTouchScreen = 16843303; // 0x1010227
field public static final int requestLegacyExternalStorage = 16844291; // 0x1010603 field public static final int requestLegacyExternalStorage = 16844291; // 0x1010603
field public static final int requestOptimizedExternalStorageAccess; field public static final int requestRawExternalStorageAccess;
field public static final int requireDeviceScreenOn; field public static final int requireDeviceScreenOn;
field public static final int requireDeviceUnlock = 16843756; // 0x10103ec field public static final int requireDeviceUnlock = 16843756; // 0x10103ec
field public static final int required = 16843406; // 0x101028e field public static final int required = 16843406; // 0x101028e

View File

@@ -2508,7 +2508,7 @@ 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 hasRequestOptimizedExternalStorageAccess(); 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

@@ -1436,11 +1436,11 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
private @NativeHeapZeroInitialized int nativeHeapZeroInitialized = ZEROINIT_DEFAULT; private @NativeHeapZeroInitialized int nativeHeapZeroInitialized = ZEROINIT_DEFAULT;
/** /**
* If {@code true} this app requests optimized external storage access. * If {@code true} this app requests raw external storage access.
* The request may not be honored due to policy or other reasons. * The request may not be honored due to policy or other reasons.
*/ */
@Nullable @Nullable
private Boolean requestOptimizedExternalStorageAccess; private Boolean requestRawExternalStorageAccess;
/** /**
* Represents the default policy. The actual policy used will depend on other properties of * Represents the default policy. The actual policy used will depend on other properties of
@@ -1598,9 +1598,9 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
if (nativeHeapZeroInitialized != ZEROINIT_DEFAULT) { if (nativeHeapZeroInitialized != ZEROINIT_DEFAULT) {
pw.println(prefix + "nativeHeapZeroInitialized=" + nativeHeapZeroInitialized); pw.println(prefix + "nativeHeapZeroInitialized=" + nativeHeapZeroInitialized);
} }
if (requestOptimizedExternalStorageAccess != null) { if (requestRawExternalStorageAccess != null) {
pw.println(prefix + "requestOptimizedExternalStorageAccess=" pw.println(prefix + "requestRawExternalStorageAccess="
+ requestOptimizedExternalStorageAccess); + requestRawExternalStorageAccess);
} }
} }
super.dumpBack(pw, prefix); super.dumpBack(pw, prefix);
@@ -1829,7 +1829,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
gwpAsanMode = orig.gwpAsanMode; gwpAsanMode = orig.gwpAsanMode;
memtagMode = orig.memtagMode; memtagMode = orig.memtagMode;
nativeHeapZeroInitialized = orig.nativeHeapZeroInitialized; nativeHeapZeroInitialized = orig.nativeHeapZeroInitialized;
requestOptimizedExternalStorageAccess = orig.requestOptimizedExternalStorageAccess; requestRawExternalStorageAccess = orig.requestRawExternalStorageAccess;
} }
public String toString() { public String toString() {
@@ -1918,7 +1918,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
dest.writeInt(gwpAsanMode); dest.writeInt(gwpAsanMode);
dest.writeInt(memtagMode); dest.writeInt(memtagMode);
dest.writeInt(nativeHeapZeroInitialized); dest.writeInt(nativeHeapZeroInitialized);
sForBoolean.parcel(requestOptimizedExternalStorageAccess, dest, parcelableFlags); sForBoolean.parcel(requestRawExternalStorageAccess, dest, parcelableFlags);
} }
public static final @android.annotation.NonNull Parcelable.Creator<ApplicationInfo> CREATOR public static final @android.annotation.NonNull Parcelable.Creator<ApplicationInfo> CREATOR
@@ -2004,7 +2004,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
gwpAsanMode = source.readInt(); gwpAsanMode = source.readInt();
memtagMode = source.readInt(); memtagMode = source.readInt();
nativeHeapZeroInitialized = source.readInt(); nativeHeapZeroInitialized = source.readInt();
requestOptimizedExternalStorageAccess = sForBoolean.unparcel(source); requestRawExternalStorageAccess = sForBoolean.unparcel(source);
} }
/** /**
@@ -2121,10 +2121,10 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
/** /**
* @return * @return
* <ul> * <ul>
* <li>{@code true} if this app requested optimized external storage access * <li>{@code true} if this app requested raw external storage access
* <li>{@code false} if this app requests to disable optimized external storage access. * <li>{@code false} if this app requests to disable raw external storage access.
* <li>{@code null} if the app didn't specify * <li>{@code null} if the app didn't specify
* {@link android.R.styleable#AndroidManifestApplication_requestOptimizedExternalStorageAccess} * {@link android.R.styleable#AndroidManifestApplication_requestRawExternalStorageAccess}
* in its manifest file. * in its manifest file.
* </ul> * </ul>
* *
@@ -2132,8 +2132,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
*/ */
@SystemApi @SystemApi
@Nullable @Nullable
public Boolean hasRequestOptimizedExternalStorageAccess() { public Boolean hasRequestRawExternalStorageAccess() {
return requestOptimizedExternalStorageAccess; return requestRawExternalStorageAccess;
} }
/** /**
@@ -2421,8 +2421,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
nativeHeapZeroInitialized = value; nativeHeapZeroInitialized = value;
} }
/** {@hide} */ /** {@hide} */
public void setRequestOptimizedExternalStorageAccess(@Nullable Boolean value) { public void setRequestRawExternalStorageAccess(@Nullable Boolean value) {
requestOptimizedExternalStorageAccess = value; requestRawExternalStorageAccess = value;
} }
/** {@hide} */ /** {@hide} */

View File

@@ -259,8 +259,8 @@ public interface ParsingPackage extends ParsingPackageRead {
ParsingPackage setNativeHeapZeroInitialized( ParsingPackage setNativeHeapZeroInitialized(
@ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized); @ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized);
ParsingPackage setRequestOptimizedExternalStorageAccess( ParsingPackage setRequestRawExternalStorageAccess(
@Nullable Boolean requestOptimizedExternalStorageAccess); @Nullable Boolean requestRawExternalStorageAccess);
ParsingPackage setCrossProfile(boolean crossProfile); ParsingPackage setCrossProfile(boolean crossProfile);

View File

@@ -400,7 +400,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
@Nullable @Nullable
@DataClass.ParcelWith(ForBoolean.class) @DataClass.ParcelWith(ForBoolean.class)
private Boolean requestOptimizedExternalStorageAccess; private Boolean requestRawExternalStorageAccess;
// TODO(chiuwinson): Non-null // TODO(chiuwinson): Non-null
@Nullable @Nullable
@@ -1086,7 +1086,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
appInfo.setGwpAsanMode(gwpAsanMode); appInfo.setGwpAsanMode(gwpAsanMode);
appInfo.setMemtagMode(memtagMode); appInfo.setMemtagMode(memtagMode);
appInfo.setNativeHeapZeroInitialized(nativeHeapZeroInitialized); appInfo.setNativeHeapZeroInitialized(nativeHeapZeroInitialized);
appInfo.setRequestOptimizedExternalStorageAccess(requestOptimizedExternalStorageAccess); appInfo.setRequestRawExternalStorageAccess(requestRawExternalStorageAccess);
appInfo.setBaseCodePath(mBaseApkPath); appInfo.setBaseCodePath(mBaseApkPath);
appInfo.setBaseResourcePath(mBaseApkPath); appInfo.setBaseResourcePath(mBaseApkPath);
appInfo.setCodePath(mPath); appInfo.setCodePath(mPath);
@@ -1223,7 +1223,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
dest.writeMap(this.mProperties); dest.writeMap(this.mProperties);
dest.writeInt(this.memtagMode); dest.writeInt(this.memtagMode);
dest.writeInt(this.nativeHeapZeroInitialized); dest.writeInt(this.nativeHeapZeroInitialized);
sForBoolean.parcel(this.requestOptimizedExternalStorageAccess, dest, flags); sForBoolean.parcel(this.requestRawExternalStorageAccess, dest, flags);
} }
public ParsingPackageImpl(Parcel in) { public ParsingPackageImpl(Parcel in) {
@@ -1348,7 +1348,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
this.mProperties = in.readHashMap(boot); this.mProperties = in.readHashMap(boot);
this.memtagMode = in.readInt(); this.memtagMode = in.readInt();
this.nativeHeapZeroInitialized = in.readInt(); this.nativeHeapZeroInitialized = in.readInt();
this.requestOptimizedExternalStorageAccess = sForBoolean.unparcel(in); this.requestRawExternalStorageAccess = sForBoolean.unparcel(in);
assignDerivedFields(); assignDerivedFields();
} }
@@ -2131,8 +2131,8 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
@Nullable @Nullable
@Override @Override
public Boolean hasRequestOptimizedExternalStorageAccess() { public Boolean hasRequestRawExternalStorageAccess() {
return requestOptimizedExternalStorageAccess; return requestRawExternalStorageAccess;
} }
@Override @Override
@@ -2586,8 +2586,8 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
} }
@Override @Override
public ParsingPackageImpl setRequestOptimizedExternalStorageAccess(@Nullable Boolean value) { public ParsingPackageImpl setRequestRawExternalStorageAccess(@Nullable Boolean value) {
requestOptimizedExternalStorageAccess = value; requestRawExternalStorageAccess = value;
return this; return this;
} }
@Override @Override

View File

@@ -905,7 +905,7 @@ public interface ParsingPackageRead extends Parcelable {
int getNativeHeapZeroInitialized(); int getNativeHeapZeroInitialized();
@Nullable @Nullable
Boolean hasRequestOptimizedExternalStorageAccess(); Boolean hasRequestRawExternalStorageAccess();
// TODO(b/135203078): Hide and enforce going through PackageInfoUtils // TODO(b/135203078): Hide and enforce going through PackageInfoUtils
ApplicationInfo toAppInfoWithoutState(); ApplicationInfo toAppInfoWithoutState();

View File

@@ -2019,9 +2019,9 @@ public class ParsingPackageUtils {
v ? ApplicationInfo.ZEROINIT_ENABLED : ApplicationInfo.ZEROINIT_DISABLED); v ? ApplicationInfo.ZEROINIT_ENABLED : ApplicationInfo.ZEROINIT_DISABLED);
} }
if (sa.hasValue( if (sa.hasValue(
R.styleable.AndroidManifestApplication_requestOptimizedExternalStorageAccess)) { R.styleable.AndroidManifestApplication_requestRawExternalStorageAccess)) {
pkg.setRequestOptimizedExternalStorageAccess(sa.getBoolean(R.styleable pkg.setRequestRawExternalStorageAccess(sa.getBoolean(R.styleable
.AndroidManifestApplication_requestOptimizedExternalStorageAccess, .AndroidManifestApplication_requestRawExternalStorageAccess,
false)); false));
} }
} finally { } finally {

View File

@@ -1867,16 +1867,21 @@
--> -->
<attr name="preserveLegacyExternalStorage" format="boolean" /> <attr name="preserveLegacyExternalStorage" format="boolean" />
<!-- If {@code true} this app would like optimized external storage access. <!-- If {@code true} this app would like raw external storage access.
<p> This flag can only be used by apps holding <p> This flag can only be used by apps holding
<ul> <ul>
<li>{@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE} permission or <li>{@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE} permission or
<li>{@link android.app.role}#SYSTEM_GALLERY role. <li>{@link android.app.role}#SYSTEM_GALLERY role.
</ul> </ul>
When the flag is set, bulk file path operations will be optimized. <p> When the flag is set, all file path access on external storage will bypass database
operations that update MediaStore collection. Raw external storage access as a side effect
can improve performance of bulk file path operations but can cause unexpected behavior in
apps due to inconsistencies in MediaStore collection and lower file system.
When the flag is set, app should scan the file after file path operations to ensure
consistency of MediaStore collection.
The default value is {@code true} if <p> The default value is {@code true} if
<ul> <ul>
<li>app has {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE} permission and <li>app has {@link android.Manifest.permission#MANAGE_EXTERNAL_STORAGE} permission and
targets targetSDK<=30. targets targetSDK<=30.
@@ -1884,7 +1889,7 @@
</ul> </ul>
{@code false} otherwise. {@code false} otherwise.
--> -->
<attr name="requestOptimizedExternalStorageAccess" format="boolean" /> <attr name="requestRawExternalStorageAccess" format="boolean" />
<!-- If {@code true} this app declares that it should be visible to all other apps on <!-- If {@code true} this app declares that it should be visible to all other apps on
device, regardless of what they declare via the {@code queries} tags in their device, regardless of what they declare via the {@code queries} tags in their

View File

@@ -3092,7 +3092,7 @@
<public name="attributionTags"/> <public name="attributionTags"/>
<public name="suppressesSpellChecker" /> <public name="suppressesSpellChecker" />
<public name="usesPermissionFlags" /> <public name="usesPermissionFlags" />
<public name="requestOptimizedExternalStorageAccess" /> <public name="requestRawExternalStorageAccess" />
<!-- @hide @SystemApi --> <!-- @hide @SystemApi -->
<public name="playHomeTransitionSound" /> <public name="playHomeTransitionSound" />
<public name="lStar" /> <public name="lStar" />