Merge "Fix NPE if keyboard settings is launched by work apps"

This commit is contained in:
Wilson Wu
2022-02-11 06:27:41 +00:00
committed by Android (Google) Code Review
3 changed files with 43 additions and 10 deletions

View File

@@ -44,6 +44,8 @@ public class ShadowUserManager extends org.robolectric.shadows.ShadowUserManager
private static boolean sIsSupportsMultipleUsers;
private static final int PRIMARY_USER_ID = 0;
private final List<String> mBaseRestrictions = new ArrayList<>();
private final List<String> mGuestRestrictions = new ArrayList<>();
private final Map<String, List<EnforcingUser>> mRestrictionSources = new HashMap<>();
@@ -218,4 +220,10 @@ public class ShadowUserManager extends org.robolectric.shadows.ShadowUserManager
mEnabledTypes.remove(type);
}
}
@Implementation
protected UserInfo getPrimaryUser() {
return new UserInfo(PRIMARY_USER_ID, null, null,
UserInfo.FLAG_INITIALIZED | UserInfo.FLAG_ADMIN | UserInfo.FLAG_PRIMARY);
}
}