Fixing MainThreadInitializedObject
> Making SafeCloseable implementation mandatory, to prevent leaks during test and preview > Removing getNoCreate method and defining executeIfCreated to avoid null pointer exceptions > Fixing sandbox value leaking into main, by Checking sandbox against App context > Converting sanbox to an interface instead a class Bug: 335280439 Test: Presubmit Flag: None Change-Id: I951dcde871898e745ff6490a1c4f8fd1512888f5
This commit is contained in:
1 parent
1f40fa0e7f
commit
10fa016352
35 files changed
+233
-245
No files matched your search
@@ -427,12 +427,10 @@ public class ItemInfo {
|
||||
@NonNull
|
||||
protected LauncherAtom.ItemInfo.Builder getDefaultItemInfoBuilder() {
|
||||
LauncherAtom.ItemInfo.Builder itemBuilder = LauncherAtom.ItemInfo.newBuilder();
|
||||
UserIconInfo info = getUserInfo();
|
||||
itemBuilder.setIsWork(info != null && info.isWork());
|
||||
itemBuilder.setUserType(getUserType(info));
|
||||
SettingsCache settingsCache = SettingsCache.INSTANCE.getNoCreate();
|
||||
boolean isKidsMode = settingsCache != null && settingsCache.getValue(NAV_BAR_KIDS_MODE, 0);
|
||||
itemBuilder.setIsKidsMode(isKidsMode);
|
||||
SettingsCache.INSTANCE.executeIfCreated(cache ->
|
||||
itemBuilder.setIsKidsMode(cache.getValue(NAV_BAR_KIDS_MODE, 0)));
|
||||
UserCache.INSTANCE.executeIfCreated(cache ->
|
||||
itemBuilder.setUserType(getUserType(cache.getUserInfo(user))));
|
||||
itemBuilder.setRank(rank);
|
||||
return itemBuilder;
|
||||
}
|
||||
@@ -526,15 +524,6 @@ public class ItemInfo {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
private UserIconInfo getUserInfo() {
|
||||
UserCache userCache = UserCache.INSTANCE.getNoCreate();
|
||||
if (userCache == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return userCache.getUserInfo(user);
|
||||
}
|
||||
|
||||
private int getUserType(UserIconInfo info) {
|
||||
if (info == null) {
|
||||
return SysUiStatsLog.LAUNCHER_UICHANGED__USER_TYPE__TYPE_UNKNOWN;
|
||||
|
||||
Reference in new issue
Block a user