Settings: don't try to allow NLSes with too-long component names
* NotificationAccessConfirmationActivity (triggered through CompanionDeviceManager) -> Don't show the dialog, bail out early similarly to other invalid inputs. * NotificationAccessSettings (from Special App Access) -> No changes, but use the canonical constant now. * ApprovalPreferenceController (used in NotificationAccessDetails) -> Disable the toggle, unless the NLS was previously approved (in which case it can still be removed). Fixes: 260570119 Fixes: 286043036 Test: atest + manually Change-Id: Ifc048311746c027e3683cdcf65f1079d04cf7c56
This commit is contained in:
@@ -81,6 +81,8 @@ public class ApprovalPreferenceController extends BasePreferenceController {
|
||||
final RestrictedSwitchPreference preference =
|
||||
(RestrictedSwitchPreference) pref;
|
||||
final CharSequence label = mPkgInfo.applicationInfo.loadLabel(mPm);
|
||||
final boolean isAllowedCn = mCn.flattenToShortString().length()
|
||||
<= NotificationManager.MAX_SERVICE_COMPONENT_NAME_LENGTH;
|
||||
final boolean isEnabled = isServiceEnabled(mCn);
|
||||
preference.setChecked(isEnabled);
|
||||
preference.setOnPreferenceChangeListener((p, newValue) -> {
|
||||
@@ -105,7 +107,8 @@ public class ApprovalPreferenceController extends BasePreferenceController {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
preference.updateState(mCn.getPackageName(), mPkgInfo.applicationInfo.uid, isEnabled);
|
||||
preference.updateState(
|
||||
mCn.getPackageName(), mPkgInfo.applicationInfo.uid, isAllowedCn, isEnabled);
|
||||
}
|
||||
|
||||
public void disable(final ComponentName cn) {
|
||||
|
||||
Reference in New Issue
Block a user