Merge "Cleanup nativeHeapZeroInit and memtagMode implementation." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9c1d00870e
@@ -1009,7 +1009,7 @@ package android {
|
||||
field public static final int multiArch = 16843918; // 0x101048e
|
||||
field public static final int multiprocess = 16842771; // 0x1010013
|
||||
field public static final int name = 16842755; // 0x1010003
|
||||
field public static final int nativeHeapZeroInit = 16844325; // 0x1010625
|
||||
field public static final int nativeHeapZeroInitialized = 16844325; // 0x1010625
|
||||
field public static final int navigationBarColor = 16843858; // 0x1010452
|
||||
field public static final int navigationBarDividerColor = 16844141; // 0x101056d
|
||||
field public static final int navigationContentDescription = 16843969; // 0x10104c1
|
||||
@@ -11864,7 +11864,7 @@ package android.content.pm {
|
||||
method public static CharSequence getCategoryTitle(android.content.Context, int);
|
||||
method public int getGwpAsanMode();
|
||||
method public int getMemtagMode();
|
||||
method @Nullable public Boolean isNativeHeapZeroInit();
|
||||
method public int getNativeHeapZeroInitialized();
|
||||
method public boolean isProfileableByShell();
|
||||
method public boolean isResourceOverlay();
|
||||
method public boolean isVirtualPreload();
|
||||
@@ -11919,6 +11919,9 @@ package android.content.pm {
|
||||
field public static final int MEMTAG_DEFAULT = -1; // 0xffffffff
|
||||
field public static final int MEMTAG_OFF = 0; // 0x0
|
||||
field public static final int MEMTAG_SYNC = 2; // 0x2
|
||||
field public static final int ZEROINIT_DEFAULT = -1; // 0xffffffff
|
||||
field public static final int ZEROINIT_DISABLED = 0; // 0x0
|
||||
field public static final int ZEROINIT_ENABLED = 1; // 0x1
|
||||
field public String appComponentFactory;
|
||||
field public String backupAgentName;
|
||||
field public int category;
|
||||
|
||||
@@ -1363,7 +1363,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
* Indicates if the application has requested GWP-ASan to be enabled, disabled, or left
|
||||
* unspecified. Processes can override this setting.
|
||||
*/
|
||||
private @GwpAsanMode int gwpAsanMode;
|
||||
private @GwpAsanMode int gwpAsanMode = GWP_ASAN_DEFAULT;
|
||||
|
||||
/**
|
||||
* Default (unspecified) setting of Memtag.
|
||||
@@ -1402,13 +1402,38 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
* Indicates if the application has requested Memtag to be enabled, disabled, or left
|
||||
* unspecified. Processes can override this setting.
|
||||
*/
|
||||
private @MemtagMode int memtagMode;
|
||||
private @MemtagMode int memtagMode = MEMTAG_DEFAULT;
|
||||
|
||||
/**
|
||||
* Default (unspecified) setting of nativeHeapZeroInitialized.
|
||||
*/
|
||||
public static final int ZEROINIT_DEFAULT = -1;
|
||||
|
||||
/**
|
||||
* Disable zero-initialization of the native heap in this application or process.
|
||||
*/
|
||||
public static final int ZEROINIT_DISABLED = 0;
|
||||
|
||||
/**
|
||||
* Enable zero-initialization of the native heap in this application or process.
|
||||
*/
|
||||
public static final int ZEROINIT_ENABLED = 1;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@IntDef(prefix = {"ZEROINIT_"}, value = {
|
||||
ZEROINIT_DEFAULT,
|
||||
ZEROINIT_DISABLED,
|
||||
ZEROINIT_ENABLED,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface NativeHeapZeroInitialized {}
|
||||
|
||||
/**
|
||||
* Enable automatic zero-initialization of native heap memory allocations.
|
||||
*/
|
||||
@Nullable
|
||||
private Boolean nativeHeapZeroInit;
|
||||
private @NativeHeapZeroInitialized int nativeHeapZeroInitialized = ZEROINIT_DEFAULT;
|
||||
|
||||
/**
|
||||
* If {@code true} this app requests optimized external storage access.
|
||||
@@ -1570,8 +1595,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
if (memtagMode != MEMTAG_DEFAULT) {
|
||||
pw.println(prefix + "memtagMode=" + memtagMode);
|
||||
}
|
||||
if (nativeHeapZeroInit != null) {
|
||||
pw.println(prefix + "nativeHeapZeroInit=" + nativeHeapZeroInit);
|
||||
if (nativeHeapZeroInitialized != ZEROINIT_DEFAULT) {
|
||||
pw.println(prefix + "nativeHeapZeroInitialized=" + nativeHeapZeroInitialized);
|
||||
}
|
||||
if (requestOptimizedExternalStorageAccess != null) {
|
||||
pw.println(prefix + "requestOptimizedExternalStorageAccess="
|
||||
@@ -1686,8 +1711,9 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
if (memtagMode != MEMTAG_DEFAULT) {
|
||||
proto.write(ApplicationInfoProto.Detail.ENABLE_MEMTAG, memtagMode);
|
||||
}
|
||||
if (nativeHeapZeroInit != null) {
|
||||
proto.write(ApplicationInfoProto.Detail.NATIVE_HEAP_ZERO_INIT, nativeHeapZeroInit);
|
||||
if (nativeHeapZeroInitialized != ZEROINIT_DEFAULT) {
|
||||
proto.write(ApplicationInfoProto.Detail.NATIVE_HEAP_ZERO_INIT,
|
||||
nativeHeapZeroInitialized);
|
||||
}
|
||||
proto.end(detailToken);
|
||||
}
|
||||
@@ -1802,7 +1828,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
zygotePreloadName = orig.zygotePreloadName;
|
||||
gwpAsanMode = orig.gwpAsanMode;
|
||||
memtagMode = orig.memtagMode;
|
||||
nativeHeapZeroInit = orig.nativeHeapZeroInit;
|
||||
nativeHeapZeroInitialized = orig.nativeHeapZeroInitialized;
|
||||
requestOptimizedExternalStorageAccess = orig.requestOptimizedExternalStorageAccess;
|
||||
}
|
||||
|
||||
@@ -1891,7 +1917,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
dest.writeString8(zygotePreloadName);
|
||||
dest.writeInt(gwpAsanMode);
|
||||
dest.writeInt(memtagMode);
|
||||
sForBoolean.parcel(nativeHeapZeroInit, dest, parcelableFlags);
|
||||
dest.writeInt(nativeHeapZeroInitialized);
|
||||
sForBoolean.parcel(requestOptimizedExternalStorageAccess, dest, parcelableFlags);
|
||||
}
|
||||
|
||||
@@ -1977,7 +2003,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
zygotePreloadName = source.readString8();
|
||||
gwpAsanMode = source.readInt();
|
||||
memtagMode = source.readInt();
|
||||
nativeHeapZeroInit = sForBoolean.unparcel(source);
|
||||
nativeHeapZeroInitialized = source.readInt();
|
||||
requestOptimizedExternalStorageAccess = sForBoolean.unparcel(source);
|
||||
}
|
||||
|
||||
@@ -2382,7 +2408,9 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
/** {@hide} */ public void setSplitResourcePaths(String[] splitResourcePaths) { splitPublicSourceDirs = splitResourcePaths; }
|
||||
/** {@hide} */ public void setGwpAsanMode(@GwpAsanMode int value) { gwpAsanMode = value; }
|
||||
/** {@hide} */ public void setMemtagMode(@MemtagMode int value) { memtagMode = value; }
|
||||
/** {@hide} */ public void setNativeHeapZeroInit(@Nullable Boolean value) { nativeHeapZeroInit = value; }
|
||||
/** {@hide} */ public void setNativeHeapZeroInitialized(@NativeHeapZeroInitialized int value) {
|
||||
nativeHeapZeroInitialized = value;
|
||||
}
|
||||
/** {@hide} */
|
||||
public void setRequestOptimizedExternalStorageAccess(@Nullable Boolean value) {
|
||||
requestOptimizedExternalStorageAccess = value;
|
||||
@@ -2400,8 +2428,22 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
/** {@hide} */ public String[] getSplitResourcePaths() { return splitPublicSourceDirs; }
|
||||
@GwpAsanMode
|
||||
public int getGwpAsanMode() { return gwpAsanMode; }
|
||||
|
||||
/**
|
||||
* Returns whether the application has requested Memtag to be enabled, disabled, or left
|
||||
* unspecified. Processes can override this setting.
|
||||
*/
|
||||
@MemtagMode
|
||||
public int getMemtagMode() { return memtagMode; }
|
||||
@Nullable
|
||||
public Boolean isNativeHeapZeroInit() { return nativeHeapZeroInit; }
|
||||
public int getMemtagMode() {
|
||||
return memtagMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the application has requested automatic zero-initialization of native heap
|
||||
* memory allocations to be enabled or disabled.
|
||||
*/
|
||||
@NativeHeapZeroInitialized
|
||||
public int getNativeHeapZeroInitialized() {
|
||||
return nativeHeapZeroInitialized;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +62,7 @@ public class ProcessInfo implements Parcelable {
|
||||
/**
|
||||
* Enable automatic zero-initialization of native heap memory allocations.
|
||||
*/
|
||||
@Nullable
|
||||
public Boolean nativeHeapZeroInit;
|
||||
public @ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized;
|
||||
|
||||
@Deprecated
|
||||
public ProcessInfo(@NonNull ProcessInfo orig) {
|
||||
@@ -71,7 +70,7 @@ public class ProcessInfo implements Parcelable {
|
||||
this.deniedPermissions = orig.deniedPermissions;
|
||||
this.gwpAsanMode = orig.gwpAsanMode;
|
||||
this.memtagMode = orig.memtagMode;
|
||||
this.nativeHeapZeroInit = orig.nativeHeapZeroInit;
|
||||
this.nativeHeapZeroInitialized = orig.nativeHeapZeroInitialized;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +100,7 @@ public class ProcessInfo implements Parcelable {
|
||||
* @param memtagMode
|
||||
* Indicates if the process has requested Memtag to be enabled (in sync or async mode),
|
||||
* disabled, or left unspecified.
|
||||
* @param nativeHeapZeroInit
|
||||
* @param nativeHeapZeroInitialized
|
||||
* Enable automatic zero-initialization of native heap memory allocations.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
@@ -110,7 +109,7 @@ public class ProcessInfo implements Parcelable {
|
||||
@Nullable ArraySet<String> deniedPermissions,
|
||||
@ApplicationInfo.GwpAsanMode int gwpAsanMode,
|
||||
@ApplicationInfo.MemtagMode int memtagMode,
|
||||
@Nullable Boolean nativeHeapZeroInit) {
|
||||
@ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized) {
|
||||
this.name = name;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, name);
|
||||
@@ -121,7 +120,9 @@ public class ProcessInfo implements Parcelable {
|
||||
this.memtagMode = memtagMode;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.MemtagMode.class, null, memtagMode);
|
||||
this.nativeHeapZeroInit = nativeHeapZeroInit;
|
||||
this.nativeHeapZeroInitialized = nativeHeapZeroInitialized;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.NativeHeapZeroInitialized.class, null, nativeHeapZeroInitialized);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
@@ -145,13 +146,12 @@ public class ProcessInfo implements Parcelable {
|
||||
|
||||
byte flg = 0;
|
||||
if (deniedPermissions != null) flg |= 0x2;
|
||||
if (nativeHeapZeroInit != null) flg |= 0x10;
|
||||
dest.writeByte(flg);
|
||||
dest.writeString(name);
|
||||
sParcellingForDeniedPermissions.parcel(deniedPermissions, dest, flags);
|
||||
dest.writeInt(gwpAsanMode);
|
||||
dest.writeInt(memtagMode);
|
||||
if (nativeHeapZeroInit != null) dest.writeBoolean(nativeHeapZeroInit);
|
||||
dest.writeInt(nativeHeapZeroInitialized);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,7 +170,7 @@ public class ProcessInfo implements Parcelable {
|
||||
ArraySet<String> _deniedPermissions = sParcellingForDeniedPermissions.unparcel(in);
|
||||
int _gwpAsanMode = in.readInt();
|
||||
int _memtagMode = in.readInt();
|
||||
Boolean _nativeHeapZeroInit = (flg & 0x10) == 0 ? null : (Boolean) in.readBoolean();
|
||||
int _nativeHeapZeroInitialized = in.readInt();
|
||||
|
||||
this.name = _name;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
@@ -182,7 +182,9 @@ public class ProcessInfo implements Parcelable {
|
||||
this.memtagMode = _memtagMode;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.MemtagMode.class, null, memtagMode);
|
||||
this.nativeHeapZeroInit = _nativeHeapZeroInit;
|
||||
this.nativeHeapZeroInitialized = _nativeHeapZeroInitialized;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.NativeHeapZeroInitialized.class, null, nativeHeapZeroInitialized);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
@@ -202,10 +204,10 @@ public class ProcessInfo implements Parcelable {
|
||||
};
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1611614699049L,
|
||||
time = 1615850184524L,
|
||||
codegenVersion = "1.0.22",
|
||||
sourceFile = "frameworks/base/core/java/android/content/pm/ProcessInfo.java",
|
||||
inputSignatures = "public @android.annotation.NonNull java.lang.String name\npublic @android.annotation.Nullable @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedStringArraySet.class) android.util.ArraySet<java.lang.String> deniedPermissions\npublic @android.content.pm.ApplicationInfo.GwpAsanMode int gwpAsanMode\npublic @android.content.pm.ApplicationInfo.MemtagMode int memtagMode\npublic @android.annotation.Nullable java.lang.Boolean nativeHeapZeroInit\nclass ProcessInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genGetters=true, genSetters=false, genParcelable=true, genAidl=false, genBuilder=false)")
|
||||
inputSignatures = "public @android.annotation.NonNull java.lang.String name\npublic @android.annotation.Nullable @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedStringArraySet.class) android.util.ArraySet<java.lang.String> deniedPermissions\npublic @android.content.pm.ApplicationInfo.GwpAsanMode int gwpAsanMode\npublic @android.content.pm.ApplicationInfo.MemtagMode int memtagMode\npublic @android.content.pm.ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized\nclass ProcessInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genGetters=true, genSetters=false, genParcelable=true, genAidl=false, genBuilder=false)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.annotation.CallSuper;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.ConfigurationInfo;
|
||||
import android.content.pm.FeatureGroupInfo;
|
||||
import android.content.pm.FeatureInfo;
|
||||
@@ -251,11 +252,12 @@ public interface ParsingPackage extends ParsingPackageRead {
|
||||
|
||||
ParsingPackage setEnabled(boolean enabled);
|
||||
|
||||
ParsingPackage setGwpAsanMode(int gwpAsanMode);
|
||||
ParsingPackage setGwpAsanMode(@ApplicationInfo.GwpAsanMode int gwpAsanMode);
|
||||
|
||||
ParsingPackage setMemtagMode(int memtagMode);
|
||||
ParsingPackage setMemtagMode(@ApplicationInfo.MemtagMode int memtagMode);
|
||||
|
||||
ParsingPackage setNativeHeapZeroInit(@Nullable Boolean nativeHeapZeroInit);
|
||||
ParsingPackage setNativeHeapZeroInitialized(
|
||||
@ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized);
|
||||
|
||||
ParsingPackage setRequestOptimizedExternalStorageAccess(
|
||||
@Nullable Boolean requestOptimizedExternalStorageAccess);
|
||||
|
||||
@@ -382,12 +382,14 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
|
||||
private int autoRevokePermissions;
|
||||
|
||||
protected int gwpAsanMode;
|
||||
protected int memtagMode;
|
||||
@ApplicationInfo.GwpAsanMode
|
||||
private int gwpAsanMode;
|
||||
|
||||
@Nullable
|
||||
@DataClass.ParcelWith(ForBoolean.class)
|
||||
private Boolean nativeHeapZeroInit;
|
||||
@ApplicationInfo.MemtagMode
|
||||
private int memtagMode;
|
||||
|
||||
@ApplicationInfo.NativeHeapZeroInitialized
|
||||
private int nativeHeapZeroInitialized;
|
||||
|
||||
@Nullable
|
||||
@DataClass.ParcelWith(ForBoolean.class)
|
||||
@@ -1071,7 +1073,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
appInfo.zygotePreloadName = zygotePreloadName;
|
||||
appInfo.setGwpAsanMode(gwpAsanMode);
|
||||
appInfo.setMemtagMode(memtagMode);
|
||||
appInfo.setNativeHeapZeroInit(nativeHeapZeroInit);
|
||||
appInfo.setNativeHeapZeroInitialized(nativeHeapZeroInitialized);
|
||||
appInfo.setRequestOptimizedExternalStorageAccess(requestOptimizedExternalStorageAccess);
|
||||
appInfo.setBaseCodePath(mBaseApkPath);
|
||||
appInfo.setBaseResourcePath(mBaseApkPath);
|
||||
@@ -1207,7 +1209,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
dest.writeLong(this.mBooleans);
|
||||
dest.writeMap(this.mProperties);
|
||||
dest.writeInt(this.memtagMode);
|
||||
sForBoolean.parcel(this.nativeHeapZeroInit, dest, flags);
|
||||
dest.writeInt(this.nativeHeapZeroInitialized);
|
||||
sForBoolean.parcel(this.requestOptimizedExternalStorageAccess, dest, flags);
|
||||
}
|
||||
|
||||
@@ -1331,7 +1333,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
this.mBooleans = in.readLong();
|
||||
this.mProperties = in.createTypedArrayMap(Property.CREATOR);
|
||||
this.memtagMode = in.readInt();
|
||||
this.nativeHeapZeroInit = sForBoolean.unparcel(in);
|
||||
this.nativeHeapZeroInitialized = in.readInt();
|
||||
this.requestOptimizedExternalStorageAccess = sForBoolean.unparcel(in);
|
||||
assignDerivedFields();
|
||||
}
|
||||
@@ -2096,20 +2098,22 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
return getBoolean(Booleans.DIRECT_BOOT_AWARE);
|
||||
}
|
||||
|
||||
@ApplicationInfo.GwpAsanMode
|
||||
@Override
|
||||
public int getGwpAsanMode() {
|
||||
return gwpAsanMode;
|
||||
}
|
||||
|
||||
@ApplicationInfo.MemtagMode
|
||||
@Override
|
||||
public int getMemtagMode() {
|
||||
return memtagMode;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ApplicationInfo.NativeHeapZeroInitialized
|
||||
@Override
|
||||
public Boolean isNativeHeapZeroInit() {
|
||||
return nativeHeapZeroInit;
|
||||
public int getNativeHeapZeroInitialized() {
|
||||
return nativeHeapZeroInitialized;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -2550,20 +2554,21 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setGwpAsanMode(int value) {
|
||||
public ParsingPackageImpl setGwpAsanMode(@ApplicationInfo.GwpAsanMode int value) {
|
||||
gwpAsanMode = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setMemtagMode(int value) {
|
||||
public ParsingPackageImpl setMemtagMode(@ApplicationInfo.MemtagMode int value) {
|
||||
memtagMode = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setNativeHeapZeroInit(@Nullable Boolean value) {
|
||||
nativeHeapZeroInit = value;
|
||||
public ParsingPackageImpl setNativeHeapZeroInitialized(
|
||||
@ApplicationInfo.NativeHeapZeroInitialized int value) {
|
||||
nativeHeapZeroInitialized = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -887,20 +887,22 @@ public interface ParsingPackageRead extends Parcelable {
|
||||
* @see ApplicationInfo#gwpAsanMode
|
||||
* @see R.styleable#AndroidManifest_gwpAsanMode
|
||||
*/
|
||||
@ApplicationInfo.GwpAsanMode
|
||||
int getGwpAsanMode();
|
||||
|
||||
/**
|
||||
* @see ApplicationInfo#memtagMode
|
||||
* @see R.styleable#AndroidManifest_memtagMode
|
||||
*/
|
||||
@ApplicationInfo.MemtagMode
|
||||
int getMemtagMode();
|
||||
|
||||
/**
|
||||
* @see ApplicationInfo#nativeHeapZeroInit
|
||||
* @see R.styleable#AndroidManifest_nativeHeapZeroInit
|
||||
/**
|
||||
* @see ApplicationInfo#nativeHeapZeroInitialized
|
||||
* @see R.styleable#AndroidManifest_nativeHeapZeroInitialized
|
||||
*/
|
||||
@Nullable
|
||||
Boolean isNativeHeapZeroInit();
|
||||
@ApplicationInfo.NativeHeapZeroInitialized
|
||||
int getNativeHeapZeroInitialized();
|
||||
|
||||
@Nullable
|
||||
Boolean hasRequestOptimizedExternalStorageAccess();
|
||||
|
||||
@@ -2008,9 +2008,11 @@ public class ParsingPackageUtils {
|
||||
|
||||
pkg.setGwpAsanMode(sa.getInt(R.styleable.AndroidManifestApplication_gwpAsanMode, -1));
|
||||
pkg.setMemtagMode(sa.getInt(R.styleable.AndroidManifestApplication_memtagMode, -1));
|
||||
if (sa.hasValue(R.styleable.AndroidManifestApplication_nativeHeapZeroInit)) {
|
||||
pkg.setNativeHeapZeroInit(sa.getBoolean(
|
||||
R.styleable.AndroidManifestApplication_nativeHeapZeroInit, false));
|
||||
if (sa.hasValue(R.styleable.AndroidManifestApplication_nativeHeapZeroInitialized)) {
|
||||
Boolean v = sa.getBoolean(
|
||||
R.styleable.AndroidManifestApplication_nativeHeapZeroInitialized, false);
|
||||
pkg.setNativeHeapZeroInitialized(
|
||||
v ? ApplicationInfo.ZEROINIT_ENABLED : ApplicationInfo.ZEROINIT_DISABLED);
|
||||
}
|
||||
if (sa.hasValue(
|
||||
R.styleable.AndroidManifestApplication_requestOptimizedExternalStorageAccess)) {
|
||||
|
||||
@@ -42,10 +42,12 @@ public class ParsedProcess implements Parcelable {
|
||||
@DataClass.ParcelWith(Parcelling.BuiltIn.ForInternedStringSet.class)
|
||||
protected Set<String> deniedPermissions = emptySet();
|
||||
|
||||
@ApplicationInfo.GwpAsanMode
|
||||
protected int gwpAsanMode = ApplicationInfo.GWP_ASAN_DEFAULT;
|
||||
@ApplicationInfo.MemtagMode
|
||||
protected int memtagMode = ApplicationInfo.MEMTAG_DEFAULT;
|
||||
@Nullable
|
||||
protected Boolean nativeHeapZeroInit = null;
|
||||
@ApplicationInfo.NativeHeapZeroInitialized
|
||||
protected int nativeHeapZeroInitialized = ApplicationInfo.ZEROINIT_DEFAULT;
|
||||
|
||||
public ParsedProcess() {
|
||||
}
|
||||
@@ -78,9 +80,9 @@ public class ParsedProcess implements Parcelable {
|
||||
public ParsedProcess(
|
||||
@NonNull String name,
|
||||
@NonNull Set<String> deniedPermissions,
|
||||
int gwpAsanMode,
|
||||
int memtagMode,
|
||||
@Nullable Boolean nativeHeapZeroInit) {
|
||||
@ApplicationInfo.GwpAsanMode int gwpAsanMode,
|
||||
@ApplicationInfo.MemtagMode int memtagMode,
|
||||
@ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized) {
|
||||
this.name = name;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, name);
|
||||
@@ -88,8 +90,14 @@ public class ParsedProcess implements Parcelable {
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, deniedPermissions);
|
||||
this.gwpAsanMode = gwpAsanMode;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.GwpAsanMode.class, null, gwpAsanMode);
|
||||
this.memtagMode = memtagMode;
|
||||
this.nativeHeapZeroInit = nativeHeapZeroInit;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.MemtagMode.class, null, memtagMode);
|
||||
this.nativeHeapZeroInitialized = nativeHeapZeroInitialized;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.NativeHeapZeroInitialized.class, null, nativeHeapZeroInitialized);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
@@ -105,18 +113,18 @@ public class ParsedProcess implements Parcelable {
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public int getGwpAsanMode() {
|
||||
public @ApplicationInfo.GwpAsanMode int getGwpAsanMode() {
|
||||
return gwpAsanMode;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public int getMemtagMode() {
|
||||
public @ApplicationInfo.MemtagMode int getMemtagMode() {
|
||||
return memtagMode;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @Nullable Boolean getNativeHeapZeroInit() {
|
||||
return nativeHeapZeroInit;
|
||||
public @ApplicationInfo.NativeHeapZeroInitialized int getNativeHeapZeroInitialized() {
|
||||
return nativeHeapZeroInitialized;
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
@@ -136,14 +144,11 @@ public class ParsedProcess implements Parcelable {
|
||||
// You can override field parcelling by defining methods like:
|
||||
// void parcelFieldName(Parcel dest, int flags) { ... }
|
||||
|
||||
byte flg = 0;
|
||||
if (nativeHeapZeroInit != null) flg |= 0x10;
|
||||
dest.writeByte(flg);
|
||||
dest.writeString(name);
|
||||
sParcellingForDeniedPermissions.parcel(deniedPermissions, dest, flags);
|
||||
dest.writeInt(gwpAsanMode);
|
||||
dest.writeInt(memtagMode);
|
||||
if (nativeHeapZeroInit != null) dest.writeBoolean(nativeHeapZeroInit);
|
||||
dest.writeInt(nativeHeapZeroInitialized);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,12 +162,11 @@ public class ParsedProcess implements Parcelable {
|
||||
// You can override field unparcelling by defining methods like:
|
||||
// static FieldType unparcelFieldName(Parcel in) { ... }
|
||||
|
||||
byte flg = in.readByte();
|
||||
String _name = in.readString();
|
||||
Set<String> _deniedPermissions = sParcellingForDeniedPermissions.unparcel(in);
|
||||
int _gwpAsanMode = in.readInt();
|
||||
int _memtagMode = in.readInt();
|
||||
Boolean _nativeHeapZeroInit = (flg & 0x10) == 0 ? null : (Boolean) in.readBoolean();
|
||||
int _nativeHeapZeroInitialized = in.readInt();
|
||||
|
||||
this.name = _name;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
@@ -171,8 +175,14 @@ public class ParsedProcess implements Parcelable {
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, deniedPermissions);
|
||||
this.gwpAsanMode = _gwpAsanMode;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.GwpAsanMode.class, null, gwpAsanMode);
|
||||
this.memtagMode = _memtagMode;
|
||||
this.nativeHeapZeroInit = _nativeHeapZeroInit;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.MemtagMode.class, null, memtagMode);
|
||||
this.nativeHeapZeroInitialized = _nativeHeapZeroInitialized;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
ApplicationInfo.NativeHeapZeroInitialized.class, null, nativeHeapZeroInitialized);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
@@ -192,10 +202,10 @@ public class ParsedProcess implements Parcelable {
|
||||
};
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1611615591258L,
|
||||
time = 1615850515058L,
|
||||
codegenVersion = "1.0.22",
|
||||
sourceFile = "frameworks/base/core/java/android/content/pm/parsing/component/ParsedProcess.java",
|
||||
inputSignatures = "protected @android.annotation.NonNull java.lang.String name\nprotected @android.annotation.NonNull @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedStringSet.class) java.util.Set<java.lang.String> deniedPermissions\nprotected int gwpAsanMode\nprotected int memtagMode\nprotected @android.annotation.Nullable java.lang.Boolean nativeHeapZeroInit\npublic void addStateFrom(android.content.pm.parsing.component.ParsedProcess)\nclass ParsedProcess extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genGetters=true, genSetters=false, genParcelable=true, genAidl=false, genBuilder=false)")
|
||||
inputSignatures = "protected @android.annotation.NonNull java.lang.String name\nprotected @android.annotation.NonNull @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedStringSet.class) java.util.Set<java.lang.String> deniedPermissions\nprotected @android.content.pm.ApplicationInfo.GwpAsanMode int gwpAsanMode\nprotected @android.content.pm.ApplicationInfo.MemtagMode int memtagMode\nprotected @android.content.pm.ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized\npublic void addStateFrom(android.content.pm.parsing.component.ParsedProcess)\nclass ParsedProcess extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genGetters=true, genSetters=false, genParcelable=true, genAidl=false, genBuilder=false)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package android.content.pm.parsing.component;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.parsing.ParsingPackage;
|
||||
import android.content.pm.parsing.ParsingUtils;
|
||||
import android.content.pm.parsing.result.ParseInput;
|
||||
@@ -104,9 +105,11 @@ public class ParsedProcessUtils {
|
||||
|
||||
proc.gwpAsanMode = sa.getInt(R.styleable.AndroidManifestProcess_gwpAsanMode, -1);
|
||||
proc.memtagMode = sa.getInt(R.styleable.AndroidManifestProcess_memtagMode, -1);
|
||||
if (sa.hasValue(R.styleable.AndroidManifestProcess_nativeHeapZeroInit)) {
|
||||
proc.nativeHeapZeroInit =
|
||||
sa.getBoolean(R.styleable.AndroidManifestProcess_nativeHeapZeroInit, false);
|
||||
if (sa.hasValue(R.styleable.AndroidManifestProcess_nativeHeapZeroInitialized)) {
|
||||
Boolean v = sa.getBoolean(
|
||||
R.styleable.AndroidManifestProcess_nativeHeapZeroInitialized, false);
|
||||
proc.nativeHeapZeroInitialized =
|
||||
v ? ApplicationInfo.ZEROINIT_ENABLED : ApplicationInfo.ZEROINIT_DISABLED;
|
||||
}
|
||||
} finally {
|
||||
sa.recycle();
|
||||
|
||||
@@ -1595,6 +1595,20 @@
|
||||
<enum name="always" value="1" />
|
||||
</attr>
|
||||
|
||||
<!-- Enable hardware memory tagging (ARM MTE) in this process.
|
||||
When enabled, heap memory bugs like use-after-free and buffer overlow
|
||||
are detected and result in an immediate ("sync" mode) or delayed ("async"
|
||||
mode) crash instead of a silent memory corruption. Sync mode, while slower,
|
||||
provides enhanced bug reports including stack traces at the time of allocation
|
||||
and deallocation of memory, similar to AddressSanitizer.
|
||||
|
||||
See the <a href="https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/enhancing-memory-safety">ARM announcement</a>
|
||||
for more details.
|
||||
|
||||
<p>This attribute can be applied to a
|
||||
{@link android.R.styleable#AndroidManifestProcess process} tag, or to an
|
||||
{@link android.R.styleable#AndroidManifestApplication application} tag (to supply
|
||||
a default setting for all application components). -->
|
||||
<attr name="memtagMode">
|
||||
<enum name="default" value="-1" />
|
||||
<enum name="off" value="0" />
|
||||
@@ -1898,7 +1912,9 @@
|
||||
|
||||
<attr name="memtagMode" />
|
||||
|
||||
<attr name="nativeHeapZeroInit" format="boolean" />
|
||||
<!-- If {@code true} enables automatic zero initialization of all native heap
|
||||
allocations. -->
|
||||
<attr name="nativeHeapZeroInitialized" format="boolean" />
|
||||
|
||||
<!-- @hide no longer used, kept to preserve padding -->
|
||||
<attr name="allowAutoRevokePermissionsExemption" format="boolean" />
|
||||
@@ -2486,7 +2502,7 @@
|
||||
<attr name="process" />
|
||||
<attr name="gwpAsanMode" />
|
||||
<attr name="memtagMode" />
|
||||
<attr name="nativeHeapZeroInit" />
|
||||
<attr name="nativeHeapZeroInitialized" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- The <code>deny-permission</code> tag specifies that a permission is to be denied
|
||||
|
||||
@@ -3059,7 +3059,7 @@
|
||||
<public name="fontProviderSystemFontFamily" />
|
||||
<public name="hand_second" />
|
||||
<public name="memtagMode" />
|
||||
<public name="nativeHeapZeroInit" />
|
||||
<public name="nativeHeapZeroInitialized" />
|
||||
<!-- @hide @SystemApi -->
|
||||
<public name="hotwordDetectionService" />
|
||||
<public name="previewLayout" />
|
||||
|
||||
@@ -1719,12 +1719,13 @@ public final class ProcessList {
|
||||
|
||||
private boolean enableNativeHeapZeroInit(ProcessRecord app) {
|
||||
// Look at the process attribute first.
|
||||
if (app.processInfo != null && app.processInfo.nativeHeapZeroInit != null) {
|
||||
return app.processInfo.nativeHeapZeroInit;
|
||||
if (app.processInfo != null
|
||||
&& app.processInfo.nativeHeapZeroInitialized != ApplicationInfo.ZEROINIT_DEFAULT) {
|
||||
return app.processInfo.nativeHeapZeroInitialized == ApplicationInfo.ZEROINIT_ENABLED;
|
||||
}
|
||||
// Then at the application attribute.
|
||||
if (app.info.isNativeHeapZeroInit() != null) {
|
||||
return app.info.isNativeHeapZeroInit();
|
||||
if (app.info.getNativeHeapZeroInitialized() != ApplicationInfo.ZEROINIT_DEFAULT) {
|
||||
return app.info.getNativeHeapZeroInitialized() == ApplicationInfo.ZEROINIT_ENABLED;
|
||||
}
|
||||
// Compat feature last.
|
||||
if (mPlatformCompat.isChangeEnabled(NATIVE_HEAP_ZERO_INIT, app.info)) {
|
||||
|
||||
@@ -479,7 +479,7 @@ class ProcessRecord implements WindowProcessListener {
|
||||
if (procInfo != null && procInfo.deniedPermissions == null
|
||||
&& procInfo.gwpAsanMode == ApplicationInfo.GWP_ASAN_DEFAULT
|
||||
&& procInfo.memtagMode == ApplicationInfo.MEMTAG_DEFAULT
|
||||
&& procInfo.nativeHeapZeroInit == null) {
|
||||
&& procInfo.nativeHeapZeroInitialized == ApplicationInfo.ZEROINIT_DEFAULT) {
|
||||
// If this process hasn't asked for permissions to be denied, or for a
|
||||
// non-default GwpAsan mode, or any other non-default setting, then we don't
|
||||
// care about it.
|
||||
|
||||
@@ -407,7 +407,7 @@ public class PackageInfoUtils {
|
||||
retProcs.put(proc.getName(),
|
||||
new ProcessInfo(proc.getName(), new ArraySet<>(proc.getDeniedPermissions()),
|
||||
proc.getGwpAsanMode(), proc.getMemtagMode(),
|
||||
proc.getNativeHeapZeroInit()));
|
||||
proc.getNativeHeapZeroInitialized()));
|
||||
}
|
||||
return retProcs;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user