Merge "Settings: don't try to allow NLSes with too-long component names" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4d34eb2c7a
@@ -67,7 +67,9 @@ public class NotificationAccessConfirmationActivity extends Activity
|
||||
mUserId = getIntent().getIntExtra(EXTRA_USER_ID, UserHandle.USER_NULL);
|
||||
CharSequence mAppLabel;
|
||||
|
||||
if (mComponentName == null || mComponentName.getPackageName() == null) {
|
||||
if (mComponentName == null || mComponentName.getPackageName() == null
|
||||
|| mComponentName.flattenToString().length()
|
||||
> NotificationManager.MAX_SERVICE_COMPONENT_NAME_LENGTH) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
@@ -66,7 +66,6 @@ public class NotificationAccessSettings extends EmptyTextSettings {
|
||||
private static final String TAG = "NotifAccessSettings";
|
||||
static final String ALLOWED_KEY = "allowed";
|
||||
static final String NOT_ALLOWED_KEY = "not_allowed";
|
||||
private static final int MAX_CN_LENGTH = 500;
|
||||
|
||||
private static final ManagedServiceSettings.Config CONFIG =
|
||||
new ManagedServiceSettings.Config.Builder()
|
||||
@@ -150,7 +149,8 @@ public class NotificationAccessSettings extends EmptyTextSettings {
|
||||
for (ServiceInfo service : services) {
|
||||
final ComponentName cn = new ComponentName(service.packageName, service.name);
|
||||
boolean isAllowed = mNm.isNotificationListenerAccessGranted(cn);
|
||||
if (!isAllowed && cn.flattenToString().length() > MAX_CN_LENGTH) {
|
||||
if (!isAllowed && cn.flattenToString().length()
|
||||
> NotificationManager.MAX_SERVICE_COMPONENT_NAME_LENGTH) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user