Guard against NPE

Test: manual, launching screen from locked lock screen
Fixes: 153569405
Change-Id: Idb546f58623792d94a43ca6659f7498de3beec94
This commit is contained in:
Julia Reynolds
2020-05-19 12:29:24 -04:00
parent a1c0269027
commit 663cc934d9

View File

@@ -31,6 +31,7 @@ import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.IconDrawableFactory;
import android.util.Slog;
import com.android.settings.R;
import com.android.settings.Utils;
@@ -294,6 +295,7 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
List<NotifyingApp> displayableApps = new ArrayList<>(SHOW_RECENT_APP_COUNT);
int count = 0;
for (NotifyingApp app : mApps) {
try {
final ApplicationsState.AppEntry appEntry = mApplicationsState.getEntry(
app.getPackage(), app.getUserId());
if (appEntry == null) {
@@ -304,6 +306,9 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
if (count >= SHOW_RECENT_APP_COUNT) {
break;
}
} catch (Exception e) {
Slog.e(TAG, "Failed to find app " + app.getPackage() + "/" + app.getUserId(), e);
}
}
return displayableApps;
}