Reset component enabled settings when clearing app data
Introduces a new attriubte named resetEnabledSettingsOnAppDataCleared for the components in the manifest such as activity, receiver, provider and service. If the value is true, the enabled settings of components in the application will be reset to the default value when the application's user data is cleared. Bug: 148803217 Test: atest PackageManagerTest Test: atest AndroidPackageTest Change-Id: Id10ae9768835b20619122a6435442fbdaefb9318
This commit is contained in:
@@ -362,6 +362,9 @@ public interface ParsingPackage extends ParsingPackageRead {
|
||||
|
||||
ParsingPackage setAttributionsAreUserVisible(boolean attributionsAreUserVisible);
|
||||
|
||||
ParsingPackage setResetEnabledSettingsOnAppDataCleared(
|
||||
boolean resetEnabledSettingsOnAppDataCleared);
|
||||
|
||||
// TODO(b/135203078): This class no longer has access to ParsedPackage, find a replacement
|
||||
// for moving to the next step
|
||||
@CallSuper
|
||||
|
||||
@@ -517,6 +517,7 @@ public class ParsingPackageImpl implements ParsingPackage, ParsingPackageHidden,
|
||||
private static final long DISALLOW_PROFILING = 1L << 45;
|
||||
private static final long REQUEST_FOREGROUND_SERVICE_EXEMPTION = 1L << 46;
|
||||
private static final long ATTRIBUTIONS_ARE_USER_VISIBLE = 1L << 47;
|
||||
private static final long RESET_ENABLED_SETTINGS_ON_APP_DATA_CLEARED = 1L << 48;
|
||||
}
|
||||
|
||||
private ParsingPackageImpl setBoolean(@Booleans.Values long flag, boolean value) {
|
||||
@@ -2215,6 +2216,11 @@ public class ParsingPackageImpl implements ParsingPackage, ParsingPackageHidden,
|
||||
return getBoolean(Booleans.ATTRIBUTIONS_ARE_USER_VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isResetEnabledSettingsOnAppDataCleared() {
|
||||
return getBoolean(Booleans.RESET_ENABLED_SETTINGS_ON_APP_DATA_CLEARED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setBaseRevisionCode(int value) {
|
||||
baseRevisionCode = value;
|
||||
@@ -2771,4 +2777,12 @@ public class ParsingPackageImpl implements ParsingPackage, ParsingPackageHidden,
|
||||
setBoolean(Booleans.ATTRIBUTIONS_ARE_USER_VISIBLE, attributionsAreUserVisible);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackage setResetEnabledSettingsOnAppDataCleared(
|
||||
boolean resetEnabledSettingsOnAppDataCleared) {
|
||||
setBoolean(Booleans.RESET_ENABLED_SETTINGS_ON_APP_DATA_CLEARED,
|
||||
resetEnabledSettingsOnAppDataCleared);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,4 +297,12 @@ public interface ParsingPackageRead extends PkgWithoutStateAppInfo, PkgWithoutSt
|
||||
* @see R.styleable#AndroidManifestService_visibleToInstantApps
|
||||
*/
|
||||
boolean isVisibleToInstantApps();
|
||||
|
||||
/**
|
||||
* Whether the enabled settings of components in the application should be reset to the default,
|
||||
* when the application's user data is cleared.
|
||||
*
|
||||
* @see R.styleable#AndroidManifestApplication_resetEnabledSettingsOnAppDataCleared
|
||||
*/
|
||||
boolean isResetEnabledSettingsOnAppDataCleared();
|
||||
}
|
||||
|
||||
@@ -2288,6 +2288,9 @@ public class ParsingPackageUtils {
|
||||
.setVmSafeMode(bool(false, R.styleable.AndroidManifestApplication_vmSafeMode, sa))
|
||||
.setAutoRevokePermissions(anInt(R.styleable.AndroidManifestApplication_autoRevokePermissions, sa))
|
||||
.setAttributionsAreUserVisible(bool(false, R.styleable.AndroidManifestApplication_attributionsAreUserVisible, sa))
|
||||
.setResetEnabledSettingsOnAppDataCleared(bool(false,
|
||||
R.styleable.AndroidManifestApplication_resetEnabledSettingsOnAppDataCleared,
|
||||
sa))
|
||||
// targetSdkVersion gated
|
||||
.setAllowAudioPlaybackCapture(bool(targetSdk >= Build.VERSION_CODES.Q, R.styleable.AndroidManifestApplication_allowAudioPlaybackCapture, sa))
|
||||
.setBaseHardwareAccelerated(bool(targetSdk >= Build.VERSION_CODES.ICE_CREAM_SANDWICH, R.styleable.AndroidManifestApplication_hardwareAccelerated, sa))
|
||||
|
||||
Reference in New Issue
Block a user