From 175bba9ed9390466f8cc7bae48eae50ac051d408 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Mon, 25 Apr 2016 16:45:49 -0400 Subject: [PATCH] Don't crash on apps only installed for other users. Change-Id: I13d415441aa1c7d09df7adccd4e2d2f9bbd3dbfb Fixes: 28151314 --- .../notification/AppNotificationSettings.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java index 5113dc64b18..b8270e1587f 100644 --- a/src/com/android/settings/notification/AppNotificationSettings.java +++ b/src/com/android/settings/notification/AppNotificationSettings.java @@ -80,21 +80,23 @@ public class AppNotificationSettings extends NotificationSettingsBase { mBlock = (RestrictedSwitchPreference) getPreferenceScreen().findPreference(KEY_BLOCK); mSilent = (RestrictedSwitchPreference) getPreferenceScreen().findPreference(KEY_SILENT); - mAppRow = mBackend.loadAppRow(mContext, mPm, mPkgInfo); + if (mPkgInfo != null) { + mAppRow = mBackend.loadAppRow(mContext, mPm, mPkgInfo); - NotificationManager.Policy policy = - NotificationManager.from(mContext).getNotificationPolicy(); - mDndVisualEffectsSuppressed = policy == null ? false : policy.suppressedVisualEffects != 0; + NotificationManager.Policy policy = + NotificationManager.from(mContext).getNotificationPolicy(); + mDndVisualEffectsSuppressed = policy == null ? false : policy.suppressedVisualEffects != 0; - // load settings intent - ArrayMap rows = new ArrayMap(); - rows.put(mAppRow.pkg, mAppRow); - collectConfigActivities(rows); + // load settings intent + ArrayMap rows = new ArrayMap(); + rows.put(mAppRow.pkg, mAppRow); + collectConfigActivities(rows); - setupImportancePrefs(mAppRow.systemApp, mAppRow.appImportance, mAppRow.banned); - setupPriorityPref(mAppRow.appBypassDnd); - setupVisOverridePref(mAppRow.appVisOverride); - updateDependents(mAppRow.appImportance); + setupImportancePrefs(mAppRow.systemApp, mAppRow.appImportance, mAppRow.banned); + setupPriorityPref(mAppRow.appBypassDnd); + setupVisOverridePref(mAppRow.appVisOverride); + updateDependents(mAppRow.appImportance); + } } @Override