Adds user id on exception thrown by getSharedPreferences()

Test: m
Bug: 263264229

Change-Id: I3cd2f7213c88fd59aa69c0d4c40fd77d898345e8
This commit is contained in:
Felipe Leme
2022-12-20 10:36:45 -08:00
parent d741b93f4b
commit 7fa150d568

View File

@@ -573,7 +573,8 @@ class ContextImpl extends Context {
&& !getSystemService(UserManager.class)
.isUserUnlockingOrUnlocked(UserHandle.myUserId())) {
throw new IllegalStateException("SharedPreferences in credential encrypted "
+ "storage are not available until after user is unlocked");
+ "storage are not available until after user (id "
+ UserHandle.myUserId() + ") is unlocked");
}
}
sp = new SharedPreferencesImpl(file, mode);
@@ -3193,7 +3194,6 @@ class ContextImpl extends Context {
@Nullable String splitName, @Nullable IBinder token, @Nullable UserHandle user,
int flags, @Nullable ClassLoader classLoader, @Nullable String overrideOpPackageName) {
mOuterContext = this;
// If creator didn't specify which storage to use, use the default
// location for application.
if ((flags & (Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE