Fix NPE on guest user

Test: RoboTests
Fixes: 187548511
Change-Id: I86219bc5e2cf285fcc86f5c8456d7d2afcbe2c0f
This commit is contained in:
Julia Reynolds
2021-05-11 15:08:57 -04:00
parent 3772f9137a
commit 748b61ce2e
2 changed files with 43 additions and 30 deletions

View File

@@ -29,7 +29,6 @@ import android.os.UserManager;
import android.service.notification.NotifyingApp;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.IconDrawableFactory;
import android.util.Slog;
@@ -56,8 +55,6 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* This controller displays a list of recently used apps and a "See all" button. If there is
@@ -149,9 +146,12 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
@VisibleForTesting
void refreshUi(Context prefContext) {
((PrimarySwitchPreference) mCategory.findPreference(KEY_PLACEHOLDER + 1)).setChecked(true);
((PrimarySwitchPreference) mCategory.findPreference(KEY_PLACEHOLDER + 2)).setChecked(true);
((PrimarySwitchPreference) mCategory.findPreference(KEY_PLACEHOLDER + 3)).setChecked(true);
for (int i = 1; i <= SHOW_RECENT_APP_COUNT; i++) {
PrimarySwitchPreference app = mCategory.findPreference(KEY_PLACEHOLDER + i);
if (app != null) {
app.setChecked(true);
}
}
ThreadUtils.postOnBackgroundThread(() -> {
reloadData();
final List<NotifyingApp> recentApps = getDisplayableRecentAppList();