Loading packages/SettingsLib/RestrictedLockUtils/src/com/android/settingslib/RestrictedLockUtils.java +31 −20 Original line number Diff line number Diff line Loading @@ -111,26 +111,6 @@ public class RestrictedLockUtils { return intent; } /** * Shows restricted setting dialog. */ @RequiresApi(Build.VERSION_CODES.TIRAMISU) public static void sendShowRestrictedSettingDialogIntent(Context context, String packageName, int uid) { final Intent intent = getShowRestrictedSettingsIntent(packageName, uid); context.startActivity(intent); } /** * Gets restricted settings dialog intent. */ private static Intent getShowRestrictedSettingsIntent(String packageName, int uid) { final Intent intent = new Intent(Settings.ACTION_SHOW_RESTRICTED_SETTING_DIALOG); intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName); intent.putExtra(Intent.EXTRA_UID, uid); return intent; } /** * Checks if current user is profile or not */ Loading Loading @@ -238,4 +218,35 @@ public class RestrictedLockUtils { + '}'; } } /** * Shows restricted setting dialog. * * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated @RequiresApi(Build.VERSION_CODES.TIRAMISU) public static void sendShowRestrictedSettingDialogIntent(Context context, String packageName, int uid) { final Intent intent = getShowRestrictedSettingsIntent(packageName, uid); context.startActivity(intent); } /** * Gets restricted settings dialog intent. * * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated private static Intent getShowRestrictedSettingsIntent(String packageName, int uid) { final Intent intent = new Intent(Settings.ACTION_SHOW_RESTRICTED_SETTING_DIALOG); intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName); intent.putExtra(Intent.EXTRA_UID, uid); return intent; } } packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtilsInternal.java +3 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,9 @@ public class RestrictedLockUtilsInternal extends RestrictedLockUtils { ECM_KEYS.add(AppOpsManager.OPSTR_LOADER_USAGE_STATS); ECM_KEYS.add(Manifest.permission.BIND_DEVICE_ADMIN); } ECM_KEYS.add(AppOpsManager.OPSTR_ACCESS_NOTIFICATIONS); ECM_KEYS.add(AppOpsManager.OPSTR_BIND_ACCESSIBILITY_SERVICE); } /** Loading packages/SettingsLib/src/com/android/settingslib/RestrictedPreference.java +33 −6 Original line number Diff line number Diff line Loading @@ -96,12 +96,29 @@ public class RestrictedPreference extends TwoTargetPreference { 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); } @Override public void setEnabled(boolean enabled) { if (enabled && isDisabledByAdmin()) { mHelper.setDisabledByAdmin(null); return; } if (enabled && isDisabledByEcm()) { mHelper.setDisabledByEcm(null); return; } super.setEnabled(enabled); } Loading @@ -111,16 +128,14 @@ public class RestrictedPreference extends TwoTargetPreference { } } public void setDisabledByAppOps(boolean disabled) { if (mHelper.setDisabledByAppOps(disabled)) { notifyChanged(); } } public boolean isDisabledByAdmin() { return mHelper.isDisabledByAdmin(); } public boolean isDisabledByEcm() { return mHelper.isDisabledByEcm(); } public int getUid() { return mHelper != null ? mHelper.uid : Process.INVALID_UID; } Loading @@ -128,4 +143,16 @@ public class RestrictedPreference extends TwoTargetPreference { public String getPackageName() { return mHelper != null ? mHelper.packageName : null; } /** * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated public void setDisabledByAppOps(boolean disabled) { if (mHelper.setDisabledByAppOps(disabled)) { notifyChanged(); } } } packages/SettingsLib/src/com/android/settingslib/RestrictedPreferenceHelper.java +61 −12 Original line number Diff line number Diff line Loading @@ -17,10 +17,12 @@ package com.android.settingslib; import static android.app.admin.DevicePolicyResources.Strings.Settings.CONTROLLED_BY_ADMIN_SUMMARY; import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; import android.app.admin.DevicePolicyManager; import android.content.Context; import android.content.Intent; import android.content.res.TypedArray; import android.os.Build; import android.os.UserHandle; Loading Loading @@ -52,7 +54,8 @@ public class RestrictedPreferenceHelper { private String mAttrUserRestriction = null; private boolean mDisabledSummary = false; private boolean mDisabledByAppOps; private boolean mDisabledByEcm; private Intent mDisabledByEcmIntent = null; public RestrictedPreferenceHelper(Context context, Preference preference, AttributeSet attrs, String packageName, int uid) { Loading Loading @@ -101,7 +104,7 @@ public class RestrictedPreferenceHelper { * Modify PreferenceViewHolder to add padlock if restriction is disabled. */ public void onBindViewHolder(PreferenceViewHolder holder) { if (mDisabledByAdmin || mDisabledByAppOps) { if (mDisabledByAdmin || mDisabledByEcm) { holder.itemView.setEnabled(true); } if (mDisabledSummary) { Loading @@ -112,7 +115,7 @@ public class RestrictedPreferenceHelper { : mContext.getString(R.string.disabled_by_admin_summary_text); if (mDisabledByAdmin) { summaryView.setText(disabledText); } else if (mDisabledByAppOps) { } else if (mDisabledByEcm) { summaryView.setText(R.string.disabled_by_app_ops_text); } else if (TextUtils.equals(disabledText, summaryView.getText())) { // It's previously set to disabled text, clear it. Loading Loading @@ -144,7 +147,12 @@ public class RestrictedPreferenceHelper { RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mContext, mEnforcedAdmin); return true; } if (mDisabledByAppOps) { if (mDisabledByEcm) { if (android.security.Flags.extendEcmToAllSettings()) { mContext.startActivity(mDisabledByEcmIntent); return true; } RestrictedLockUtilsInternal.sendShowRestrictedSettingDialogIntent(mContext, packageName, uid); return true; Loading Loading @@ -173,6 +181,20 @@ public class RestrictedPreferenceHelper { setDisabledByAdmin(admin); } /** * 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) { updatePackageDetails(packageName, uid); Intent intent = RestrictedLockUtilsInternal.checkIfRequiresEnhancedConfirmation( mContext, restriction, uid, packageName); setDisabledByEcm(intent); } /** * @return EnforcedAdmin if we have been passed the restriction in the xml. */ Loading Loading @@ -211,10 +233,19 @@ public class RestrictedPreferenceHelper { return changed; } public boolean setDisabledByAppOps(boolean disabled) { /** * Disable the preference based on the passed in Intent * @param disabledIntent The intent which is started when the user clicks the disabled * preference. If it is {@code null}, then this preference will be enabled. Otherwise, it will * be disabled. * @return true if the disabled state was changed. */ public boolean setDisabledByEcm(Intent disabledIntent) { boolean disabled = disabledIntent != null; boolean changed = false; if (mDisabledByAppOps != disabled) { mDisabledByAppOps = disabled; if (mDisabledByEcm != disabled) { mDisabledByEcmIntent = disabledIntent; mDisabledByEcm = disabled; changed = true; updateDisabledState(); } Loading @@ -226,8 +257,8 @@ public class RestrictedPreferenceHelper { return mDisabledByAdmin; } public boolean isDisabledByAppOps() { return mDisabledByAppOps; public boolean isDisabledByEcm() { return mDisabledByEcm; } public void updatePackageDetails(String packageName, int uid) { Loading @@ -236,13 +267,31 @@ public class RestrictedPreferenceHelper { } private void updateDisabledState() { boolean isEnabled = !(mDisabledByAdmin || mDisabledByEcm); if (!(mPreference instanceof RestrictedTopLevelPreference)) { mPreference.setEnabled(!(mDisabledByAdmin || mDisabledByAppOps)); mPreference.setEnabled(isEnabled); } if (mPreference instanceof PrimarySwitchPreference) { ((PrimarySwitchPreference) mPreference) .setSwitchEnabled(!(mDisabledByAdmin || mDisabledByAppOps)); ((PrimarySwitchPreference) mPreference).setSwitchEnabled(isEnabled); } } /** * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated public boolean setDisabledByAppOps(boolean disabled) { boolean changed = false; if (mDisabledByEcm != disabled) { mDisabledByEcm = disabled; changed = true; updateDisabledState(); } return changed; } } packages/SettingsLib/src/com/android/settingslib/RestrictedSwitchPreference.java +44 −8 Original line number Diff line number Diff line Loading @@ -197,6 +197,17 @@ public class RestrictedSwitchPreference extends SwitchPreferenceCompat { 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); } @Override public void setEnabled(boolean enabled) { boolean changed = false; Loading @@ -204,8 +215,8 @@ public class RestrictedSwitchPreference extends SwitchPreferenceCompat { mHelper.setDisabledByAdmin(null); changed = true; } if (enabled && isDisabledByAppOps()) { mHelper.setDisabledByAppOps(false); if (enabled && isDisabledByEcm()) { mHelper.setDisabledByEcm(null); changed = true; } if (!changed) { Loading @@ -223,25 +234,50 @@ public class RestrictedSwitchPreference extends SwitchPreferenceCompat { return mHelper.isDisabledByAdmin(); } public boolean isDisabledByEcm() { return mHelper.isDisabledByEcm(); } /** * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated private void setDisabledByAppOps(boolean disabled) { if (mHelper.setDisabledByAppOps(disabled)) { notifyChanged(); } } public boolean isDisabledByAppOps() { return mHelper.isDisabledByAppOps(); } /** * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated public int getUid() { return mHelper != null ? mHelper.uid : Process.INVALID_UID; } /** * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated public String getPackageName() { return mHelper != null ? mHelper.packageName : null; } /** Updates enabled state based on associated package. */ /** * Updates enabled state based on associated package * * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated public void updateState( @NonNull String packageName, int uid, boolean isEnableAllowed, boolean isEnabled) { mHelper.updatePackageDetails(packageName, uid); Loading @@ -258,7 +294,7 @@ public class RestrictedSwitchPreference extends SwitchPreferenceCompat { setEnabled(false); } else if (isEnabled) { setEnabled(true); } else if (appOpsAllowed && isDisabledByAppOps()) { } else if (appOpsAllowed && isDisabledByEcm()) { setEnabled(true); } else if (!appOpsAllowed){ setDisabledByAppOps(true); Loading Loading
packages/SettingsLib/RestrictedLockUtils/src/com/android/settingslib/RestrictedLockUtils.java +31 −20 Original line number Diff line number Diff line Loading @@ -111,26 +111,6 @@ public class RestrictedLockUtils { return intent; } /** * Shows restricted setting dialog. */ @RequiresApi(Build.VERSION_CODES.TIRAMISU) public static void sendShowRestrictedSettingDialogIntent(Context context, String packageName, int uid) { final Intent intent = getShowRestrictedSettingsIntent(packageName, uid); context.startActivity(intent); } /** * Gets restricted settings dialog intent. */ private static Intent getShowRestrictedSettingsIntent(String packageName, int uid) { final Intent intent = new Intent(Settings.ACTION_SHOW_RESTRICTED_SETTING_DIALOG); intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName); intent.putExtra(Intent.EXTRA_UID, uid); return intent; } /** * Checks if current user is profile or not */ Loading Loading @@ -238,4 +218,35 @@ public class RestrictedLockUtils { + '}'; } } /** * Shows restricted setting dialog. * * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated @RequiresApi(Build.VERSION_CODES.TIRAMISU) public static void sendShowRestrictedSettingDialogIntent(Context context, String packageName, int uid) { final Intent intent = getShowRestrictedSettingsIntent(packageName, uid); context.startActivity(intent); } /** * Gets restricted settings dialog intent. * * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated private static Intent getShowRestrictedSettingsIntent(String packageName, int uid) { final Intent intent = new Intent(Settings.ACTION_SHOW_RESTRICTED_SETTING_DIALOG); intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName); intent.putExtra(Intent.EXTRA_UID, uid); return intent; } }
packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtilsInternal.java +3 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,9 @@ public class RestrictedLockUtilsInternal extends RestrictedLockUtils { ECM_KEYS.add(AppOpsManager.OPSTR_LOADER_USAGE_STATS); ECM_KEYS.add(Manifest.permission.BIND_DEVICE_ADMIN); } ECM_KEYS.add(AppOpsManager.OPSTR_ACCESS_NOTIFICATIONS); ECM_KEYS.add(AppOpsManager.OPSTR_BIND_ACCESSIBILITY_SERVICE); } /** Loading
packages/SettingsLib/src/com/android/settingslib/RestrictedPreference.java +33 −6 Original line number Diff line number Diff line Loading @@ -96,12 +96,29 @@ public class RestrictedPreference extends TwoTargetPreference { 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); } @Override public void setEnabled(boolean enabled) { if (enabled && isDisabledByAdmin()) { mHelper.setDisabledByAdmin(null); return; } if (enabled && isDisabledByEcm()) { mHelper.setDisabledByEcm(null); return; } super.setEnabled(enabled); } Loading @@ -111,16 +128,14 @@ public class RestrictedPreference extends TwoTargetPreference { } } public void setDisabledByAppOps(boolean disabled) { if (mHelper.setDisabledByAppOps(disabled)) { notifyChanged(); } } public boolean isDisabledByAdmin() { return mHelper.isDisabledByAdmin(); } public boolean isDisabledByEcm() { return mHelper.isDisabledByEcm(); } public int getUid() { return mHelper != null ? mHelper.uid : Process.INVALID_UID; } Loading @@ -128,4 +143,16 @@ public class RestrictedPreference extends TwoTargetPreference { public String getPackageName() { return mHelper != null ? mHelper.packageName : null; } /** * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated public void setDisabledByAppOps(boolean disabled) { if (mHelper.setDisabledByAppOps(disabled)) { notifyChanged(); } } }
packages/SettingsLib/src/com/android/settingslib/RestrictedPreferenceHelper.java +61 −12 Original line number Diff line number Diff line Loading @@ -17,10 +17,12 @@ package com.android.settingslib; import static android.app.admin.DevicePolicyResources.Strings.Settings.CONTROLLED_BY_ADMIN_SUMMARY; import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; import android.app.admin.DevicePolicyManager; import android.content.Context; import android.content.Intent; import android.content.res.TypedArray; import android.os.Build; import android.os.UserHandle; Loading Loading @@ -52,7 +54,8 @@ public class RestrictedPreferenceHelper { private String mAttrUserRestriction = null; private boolean mDisabledSummary = false; private boolean mDisabledByAppOps; private boolean mDisabledByEcm; private Intent mDisabledByEcmIntent = null; public RestrictedPreferenceHelper(Context context, Preference preference, AttributeSet attrs, String packageName, int uid) { Loading Loading @@ -101,7 +104,7 @@ public class RestrictedPreferenceHelper { * Modify PreferenceViewHolder to add padlock if restriction is disabled. */ public void onBindViewHolder(PreferenceViewHolder holder) { if (mDisabledByAdmin || mDisabledByAppOps) { if (mDisabledByAdmin || mDisabledByEcm) { holder.itemView.setEnabled(true); } if (mDisabledSummary) { Loading @@ -112,7 +115,7 @@ public class RestrictedPreferenceHelper { : mContext.getString(R.string.disabled_by_admin_summary_text); if (mDisabledByAdmin) { summaryView.setText(disabledText); } else if (mDisabledByAppOps) { } else if (mDisabledByEcm) { summaryView.setText(R.string.disabled_by_app_ops_text); } else if (TextUtils.equals(disabledText, summaryView.getText())) { // It's previously set to disabled text, clear it. Loading Loading @@ -144,7 +147,12 @@ public class RestrictedPreferenceHelper { RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mContext, mEnforcedAdmin); return true; } if (mDisabledByAppOps) { if (mDisabledByEcm) { if (android.security.Flags.extendEcmToAllSettings()) { mContext.startActivity(mDisabledByEcmIntent); return true; } RestrictedLockUtilsInternal.sendShowRestrictedSettingDialogIntent(mContext, packageName, uid); return true; Loading Loading @@ -173,6 +181,20 @@ public class RestrictedPreferenceHelper { setDisabledByAdmin(admin); } /** * 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) { updatePackageDetails(packageName, uid); Intent intent = RestrictedLockUtilsInternal.checkIfRequiresEnhancedConfirmation( mContext, restriction, uid, packageName); setDisabledByEcm(intent); } /** * @return EnforcedAdmin if we have been passed the restriction in the xml. */ Loading Loading @@ -211,10 +233,19 @@ public class RestrictedPreferenceHelper { return changed; } public boolean setDisabledByAppOps(boolean disabled) { /** * Disable the preference based on the passed in Intent * @param disabledIntent The intent which is started when the user clicks the disabled * preference. If it is {@code null}, then this preference will be enabled. Otherwise, it will * be disabled. * @return true if the disabled state was changed. */ public boolean setDisabledByEcm(Intent disabledIntent) { boolean disabled = disabledIntent != null; boolean changed = false; if (mDisabledByAppOps != disabled) { mDisabledByAppOps = disabled; if (mDisabledByEcm != disabled) { mDisabledByEcmIntent = disabledIntent; mDisabledByEcm = disabled; changed = true; updateDisabledState(); } Loading @@ -226,8 +257,8 @@ public class RestrictedPreferenceHelper { return mDisabledByAdmin; } public boolean isDisabledByAppOps() { return mDisabledByAppOps; public boolean isDisabledByEcm() { return mDisabledByEcm; } public void updatePackageDetails(String packageName, int uid) { Loading @@ -236,13 +267,31 @@ public class RestrictedPreferenceHelper { } private void updateDisabledState() { boolean isEnabled = !(mDisabledByAdmin || mDisabledByEcm); if (!(mPreference instanceof RestrictedTopLevelPreference)) { mPreference.setEnabled(!(mDisabledByAdmin || mDisabledByAppOps)); mPreference.setEnabled(isEnabled); } if (mPreference instanceof PrimarySwitchPreference) { ((PrimarySwitchPreference) mPreference) .setSwitchEnabled(!(mDisabledByAdmin || mDisabledByAppOps)); ((PrimarySwitchPreference) mPreference).setSwitchEnabled(isEnabled); } } /** * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated public boolean setDisabledByAppOps(boolean disabled) { boolean changed = false; if (mDisabledByEcm != disabled) { mDisabledByEcm = disabled; changed = true; updateDisabledState(); } return changed; } }
packages/SettingsLib/src/com/android/settingslib/RestrictedSwitchPreference.java +44 −8 Original line number Diff line number Diff line Loading @@ -197,6 +197,17 @@ public class RestrictedSwitchPreference extends SwitchPreferenceCompat { 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); } @Override public void setEnabled(boolean enabled) { boolean changed = false; Loading @@ -204,8 +215,8 @@ public class RestrictedSwitchPreference extends SwitchPreferenceCompat { mHelper.setDisabledByAdmin(null); changed = true; } if (enabled && isDisabledByAppOps()) { mHelper.setDisabledByAppOps(false); if (enabled && isDisabledByEcm()) { mHelper.setDisabledByEcm(null); changed = true; } if (!changed) { Loading @@ -223,25 +234,50 @@ public class RestrictedSwitchPreference extends SwitchPreferenceCompat { return mHelper.isDisabledByAdmin(); } public boolean isDisabledByEcm() { return mHelper.isDisabledByEcm(); } /** * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated private void setDisabledByAppOps(boolean disabled) { if (mHelper.setDisabledByAppOps(disabled)) { notifyChanged(); } } public boolean isDisabledByAppOps() { return mHelper.isDisabledByAppOps(); } /** * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated public int getUid() { return mHelper != null ? mHelper.uid : Process.INVALID_UID; } /** * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated public String getPackageName() { return mHelper != null ? mHelper.packageName : null; } /** Updates enabled state based on associated package. */ /** * Updates enabled state based on associated package * * @deprecated TODO(b/308921175): This will be deleted with the * {@link android.security.Flags#extendEcmToAllSettings} feature flag. Do not use for any new * code. */ @Deprecated public void updateState( @NonNull String packageName, int uid, boolean isEnableAllowed, boolean isEnabled) { mHelper.updatePackageDetails(packageName, uid); Loading @@ -258,7 +294,7 @@ public class RestrictedSwitchPreference extends SwitchPreferenceCompat { setEnabled(false); } else if (isEnabled) { setEnabled(true); } else if (appOpsAllowed && isDisabledByAppOps()) { } else if (appOpsAllowed && isDisabledByEcm()) { setEnabled(true); } else if (!appOpsAllowed){ setDisabledByAppOps(true); Loading