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

Commit e35e223a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents e53243cb 57c334d6
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;
@@ -376,7 +377,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");
            }