[ECM] Legacy code: treat DEFAULT as ALLOWED (st)

This modifies pre-flag behavior so that MODE_DEFAULT (of
OP_ACCESS_RESTRICTED_SETTINGS) is treated the
same as MODE_ALLOWED.

The reason is that we've change the default op mode (of
OP_ACCESS_RESTRICTED_SETTINGS) to MODE_DEFAULT. Since legacy code
doesn't understand what MODE_DEFAULT means, we need to mitigate the
impact of reverted flags.

Bug: 329488185
Test: atest SpaPrivilegedLibTests
Test: atest
com.android.settings.applications.specialaccess.notificationaccess
Test: atest com.android.settings.datausage
Test: atest PremiumSmsAccessTest
Test: atest RestrictedPreferenceHelperTest
Test: atest
CtsPermissionUiTestCases:android.permissionui.cts.EnhancedConfirmationManagerTest

Change-Id: I957c75870018a9d4d2d2e122ee3bb2252b338cb2
This commit is contained in:
Jay Thomas Sullivan
2024-03-21 20:24:29 -07:00
parent dd5b4d3d31
commit f8b405462a

View File

@@ -267,7 +267,8 @@ public class RestrictedPreferenceHelper {
preference.getUid(), preference.getPackageName()); preference.getUid(), preference.getPackageName());
final boolean ecmEnabled = mContext.getResources().getBoolean( final boolean ecmEnabled = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_enhancedConfirmationModeEnabled); com.android.internal.R.bool.config_enhancedConfirmationModeEnabled);
appOpsAllowed = !ecmEnabled || mode == AppOpsManager.MODE_ALLOWED; appOpsAllowed = !ecmEnabled || mode == AppOpsManager.MODE_ALLOWED
|| mode == AppOpsManager.MODE_DEFAULT;
serviceAllowed = appOpsAllowed; serviceAllowed = appOpsAllowed;
} catch (Exception e) { } catch (Exception e) {
// Allow service in case if app ops is not available in testing. // Allow service in case if app ops is not available in testing.