Add nullable annotation

It looks like from the stack trace that there is an NPE during the setApps() call. So adding nullable and null checking
to make sure mApps is not null.

bug: 296920692
test: presubmit
flag: n/a
Change-Id: If402c0b68db159f7a698e8e2e139d9bd5041b1c1
This commit is contained in:
Brandon Dayauon
2023-08-24 15:01:27 -07:00
parent dddd60e84f
commit 75d8994e6f
2 changed files with 10 additions and 8 deletions
@@ -61,7 +61,7 @@ public class AllAppsStore<T extends Context & ActivityContext> {
private PackageUserKey mTempKey = new PackageUserKey(null, null);
private AppInfo mTempInfo = new AppInfo();
private AppInfo[] mApps = EMPTY_ARRAY;
private @NonNull AppInfo[] mApps = EMPTY_ARRAY;
private final List<OnUpdateListener> mUpdateListeners = new CopyOnWriteArrayList<>();
private final ArrayList<ViewGroup> mIconContainers = new ArrayList<>();
@@ -85,8 +85,8 @@ public class AllAppsStore<T extends Context & ActivityContext> {
* Sets the current set of apps and sets mapping for {@link PackageUserKey} to Uid for
* the current set of apps.
*/
public void setApps(AppInfo[] apps, int flags, Map<PackageUserKey, Integer> map) {
mApps = apps;
public void setApps(@Nullable AppInfo[] apps, int flags, Map<PackageUserKey, Integer> map) {
mApps = apps == null ? EMPTY_ARRAY : apps;
mModelFlags = flags;
notifyUpdate();
mPackageUserKeytoUidMap = map;