Loading src/com/android/settings/accessibility/RestrictedPreferenceHelper.java +26 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,32 @@ public class RestrictedPreferenceHelper { // permittedServices null means all accessibility services are allowed. boolean serviceAllowed = permittedServices == null || permittedServices.contains( preference.getPackageName()); if (android.security.Flags.extendEcmToAllSettings()) { preference.checkEcmRestrictionAndSetDisabled( AppOpsManager.OPSTR_BIND_ACCESSIBILITY_SERVICE, preference.getPackageName(), preference.getUid()); if (preference.isDisabledByEcm()) { serviceAllowed = false; } if (serviceAllowed || serviceEnabled) { preference.setEnabled(true); } else { // Disable accessibility service that are not permitted. final RestrictedLockUtils.EnforcedAdmin admin = RestrictedLockUtilsInternal.checkIfAccessibilityServiceDisallowed( mContext, preference.getPackageName(), UserHandle.myUserId()); if (admin != null) { preference.setDisabledByAdmin(admin); } else if (!preference.isDisabledByEcm()) { preference.setEnabled(false); } } return; } boolean appOpsAllowed; if (serviceAllowed) { try { Loading src/com/android/settings/applications/specialaccess/notificationaccess/ApprovalPreferenceController.java +24 −2 Original line number Diff line number Diff line Loading @@ -41,6 +41,8 @@ public class ApprovalPreferenceController extends BasePreferenceController { private PreferenceFragmentCompat mParent; private NotificationManager mNm; private PackageManager mPm; // The appOp representing this preference private String mAppOpStr; public ApprovalPreferenceController(Context context, String key) { super(context, key); Loading Loading @@ -71,6 +73,14 @@ public class ApprovalPreferenceController extends BasePreferenceController { return this; } /** * Set the associated appOp for the Setting */ public ApprovalPreferenceController setAppOpStr(String appOpStr) { mAppOpStr = appOpStr; return this; } @Override public int getAvailabilityStatus() { return AVAILABLE; Loading Loading @@ -107,9 +117,21 @@ public class ApprovalPreferenceController extends BasePreferenceController { return false; } }); if (android.security.Flags.extendEcmToAllSettings()) { if (!isAllowedCn && !isEnabled) { preference.setEnabled(false); } else if (isEnabled) { preference.setEnabled(true); } else { preference.checkEcmRestrictionAndSetDisabled(mAppOpStr, mCn.getPackageName(), mPkgInfo.applicationInfo.uid); } } else { preference.updateState( mCn.getPackageName(), mPkgInfo.applicationInfo.uid, isAllowedCn, isEnabled); } } public void disable(final ComponentName cn) { logSpecialPermissionChange(true, cn.getPackageName()); Loading src/com/android/settings/applications/specialaccess/notificationaccess/NotificationAccessDetails.java +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static com.android.settings.applications.AppInfoBase.ARG_PACKAGE_NAME; import android.Manifest; import android.app.AppOpsManager; import android.app.NotificationManager; import android.app.settings.SettingsEnums; import android.companion.ICompanionDeviceManager; Loading Loading @@ -102,6 +103,7 @@ public class NotificationAccessDetails extends DashboardFragment { .setCn(mComponentName) .setNm(context.getSystemService(NotificationManager.class)) .setPm(mPm) .setAppOpStr(AppOpsManager.OPSTR_ACCESS_NOTIFICATIONS) .setParent(this); use(HeaderPreferenceController.class) .setFragment(this) Loading Loading
src/com/android/settings/accessibility/RestrictedPreferenceHelper.java +26 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,32 @@ public class RestrictedPreferenceHelper { // permittedServices null means all accessibility services are allowed. boolean serviceAllowed = permittedServices == null || permittedServices.contains( preference.getPackageName()); if (android.security.Flags.extendEcmToAllSettings()) { preference.checkEcmRestrictionAndSetDisabled( AppOpsManager.OPSTR_BIND_ACCESSIBILITY_SERVICE, preference.getPackageName(), preference.getUid()); if (preference.isDisabledByEcm()) { serviceAllowed = false; } if (serviceAllowed || serviceEnabled) { preference.setEnabled(true); } else { // Disable accessibility service that are not permitted. final RestrictedLockUtils.EnforcedAdmin admin = RestrictedLockUtilsInternal.checkIfAccessibilityServiceDisallowed( mContext, preference.getPackageName(), UserHandle.myUserId()); if (admin != null) { preference.setDisabledByAdmin(admin); } else if (!preference.isDisabledByEcm()) { preference.setEnabled(false); } } return; } boolean appOpsAllowed; if (serviceAllowed) { try { Loading
src/com/android/settings/applications/specialaccess/notificationaccess/ApprovalPreferenceController.java +24 −2 Original line number Diff line number Diff line Loading @@ -41,6 +41,8 @@ public class ApprovalPreferenceController extends BasePreferenceController { private PreferenceFragmentCompat mParent; private NotificationManager mNm; private PackageManager mPm; // The appOp representing this preference private String mAppOpStr; public ApprovalPreferenceController(Context context, String key) { super(context, key); Loading Loading @@ -71,6 +73,14 @@ public class ApprovalPreferenceController extends BasePreferenceController { return this; } /** * Set the associated appOp for the Setting */ public ApprovalPreferenceController setAppOpStr(String appOpStr) { mAppOpStr = appOpStr; return this; } @Override public int getAvailabilityStatus() { return AVAILABLE; Loading Loading @@ -107,9 +117,21 @@ public class ApprovalPreferenceController extends BasePreferenceController { return false; } }); if (android.security.Flags.extendEcmToAllSettings()) { if (!isAllowedCn && !isEnabled) { preference.setEnabled(false); } else if (isEnabled) { preference.setEnabled(true); } else { preference.checkEcmRestrictionAndSetDisabled(mAppOpStr, mCn.getPackageName(), mPkgInfo.applicationInfo.uid); } } else { preference.updateState( mCn.getPackageName(), mPkgInfo.applicationInfo.uid, isAllowedCn, isEnabled); } } public void disable(final ComponentName cn) { logSpecialPermissionChange(true, cn.getPackageName()); Loading
src/com/android/settings/applications/specialaccess/notificationaccess/NotificationAccessDetails.java +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static com.android.settings.applications.AppInfoBase.ARG_PACKAGE_NAME; import android.Manifest; import android.app.AppOpsManager; import android.app.NotificationManager; import android.app.settings.SettingsEnums; import android.companion.ICompanionDeviceManager; Loading Loading @@ -102,6 +103,7 @@ public class NotificationAccessDetails extends DashboardFragment { .setCn(mComponentName) .setNm(context.getSystemService(NotificationManager.class)) .setPm(mPm) .setAppOpStr(AppOpsManager.OPSTR_ACCESS_NOTIFICATIONS) .setParent(this); use(HeaderPreferenceController.class) .setFragment(this) Loading