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

Commit f4a8eb66 authored by Tony Mak's avatar Tony Mak Committed by android-build-merger
Browse files

Merge "Relax the sharedpreference check to look at...

Merge "Relax the sharedpreference check to look at StorageManager.isUserKeyUnlocked" into oc-dev am: e35e223a
am: dc37e525

Change-Id: Iea2d49976f7608cf63809060d6857cd61d42ca2f
parents 2ad3219b dc37e525
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ import android.os.Trace;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
@@ -375,7 +376,9 @@ class ContextImpl extends Context {
        checkMode(mode);
        if (getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.O) {
            if (isCredentialProtectedStorage()
                    && !getSystemService(UserManager.class).isUserUnlocked() && !isBuggy()) {
                    && !getSystemService(StorageManager.class).isUserKeyUnlocked(
                            UserHandle.myUserId())
                    && !isBuggy()) {
                throw new IllegalStateException("SharedPreferences in credential encrypted "
                        + "storage are not available until after user is unlocked");
            }