Wired remaining SpecialAppAccess for ECM.
This change enables the remaining settings for ECM, and adds tests for both this and previous ECM changes. Bug: 297372999 Test: Tested on device Test: atest SpaPrivilegedLibTests Test: atest com.android.settings.applications.specialaccess.notificationaccess Test: atest com.android.settings.datausage Test: atest PremiumSmsAccessTest Test: atest RestrictedPreferenceHelperTest Change-Id: I73d39d765dba0c1a75111c37b29ccf1c85d2cdd8
This commit is contained in:
@@ -72,10 +72,18 @@ public class RestrictedAppPreference extends AppPreference {
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
if (isDisabledByAdmin() && enabled) {
|
||||
return;
|
||||
boolean changed = false;
|
||||
if (enabled && isDisabledByAdmin()) {
|
||||
mHelper.setDisabledByAdmin(null);
|
||||
changed = true;
|
||||
}
|
||||
if (enabled && isDisabledByEcm()) {
|
||||
mHelper.setDisabledByEcm(null);
|
||||
changed = true;
|
||||
}
|
||||
if (!changed) {
|
||||
super.setEnabled(enabled);
|
||||
}
|
||||
super.setEnabled(enabled);
|
||||
}
|
||||
|
||||
public void setDisabledByAdmin(RestrictedLockUtils.EnforcedAdmin admin) {
|
||||
@@ -88,6 +96,10 @@ public class RestrictedAppPreference extends AppPreference {
|
||||
return mHelper.isDisabledByAdmin();
|
||||
}
|
||||
|
||||
public boolean isDisabledByEcm() {
|
||||
return mHelper.isDisabledByEcm();
|
||||
}
|
||||
|
||||
public void useAdminDisabledSummary(boolean useSummary) {
|
||||
mHelper.useAdminDisabledSummary(useSummary);
|
||||
}
|
||||
@@ -112,4 +124,15 @@ public class RestrictedAppPreference extends AppPreference {
|
||||
public void checkRestrictionAndSetDisabled(String userRestriction, int userId) {
|
||||
mHelper.checkRestrictionAndSetDisabled(userRestriction, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given setting is subject to Enhanced Confirmation Mode restrictions for this
|
||||
* package. Marks the preference as disabled if so.
|
||||
* @param restriction The key identifying the setting
|
||||
* @param packageName the package to check the restriction for
|
||||
* @param uid the uid of the package
|
||||
*/
|
||||
public void checkEcmRestrictionAndSetDisabled(String restriction, String packageName, int uid) {
|
||||
mHelper.checkEcmRestrictionAndSetDisabled(restriction, packageName, uid);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user