Merge "Relax the sharedpreference check to look at StorageManager.isUserKeyUnlocked" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e35e223a81
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user