Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7fa150d5 authored by Felipe Leme's avatar Felipe Leme
Browse files

Adds user id on exception thrown by getSharedPreferences()

Test: m
Bug: 263264229

Change-Id: I3cd2f7213c88fd59aa69c0d4c40fd77d898345e8
parent d741b93f
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -573,7 +573,8 @@ class ContextImpl extends Context {
                            && !getSystemService(UserManager.class)
                            && !getSystemService(UserManager.class)
                                    .isUserUnlockingOrUnlocked(UserHandle.myUserId())) {
                                    .isUserUnlockingOrUnlocked(UserHandle.myUserId())) {
                        throw new IllegalStateException("SharedPreferences in credential encrypted "
                        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);
                sp = new SharedPreferencesImpl(file, mode);
@@ -3193,7 +3194,6 @@ class ContextImpl extends Context {
            @Nullable String splitName, @Nullable IBinder token, @Nullable UserHandle user,
            @Nullable String splitName, @Nullable IBinder token, @Nullable UserHandle user,
            int flags, @Nullable ClassLoader classLoader, @Nullable String overrideOpPackageName) {
            int flags, @Nullable ClassLoader classLoader, @Nullable String overrideOpPackageName) {
        mOuterContext = this;
        mOuterContext = this;

        // If creator didn't specify which storage to use, use the default
        // If creator didn't specify which storage to use, use the default
        // location for application.
        // location for application.
        if ((flags & (Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE
        if ((flags & (Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE