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

Commit 132300bd authored by Eric Biggers's avatar Eric Biggers
Browse files

Use isCeStorageUnlocked() in StrictMode.java

isUserKeyUnlocked() is being renamed to isCeStorageUnlocked() to make it
clear what it does (considering that there are many types of user keys).
Change StrictMode.java to use the new name.  No change in behavior.

Bug: 306204742
Flag: exempt, mechanical refactoring
Test: presubmit
Change-Id: I4616b55cc4a088cfd396cc1b4ad60f3ecfed942b
parent de2637e2
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -2372,14 +2372,14 @@ public final class StrictMode {
    }
    }


    /** Assume locked until we hear otherwise */
    /** Assume locked until we hear otherwise */
    private static volatile boolean sUserKeyUnlocked = false;
    private static volatile boolean sCeStorageUnlocked = false;


    private static boolean isUserKeyUnlocked(int userId) {
    private static boolean isCeStorageUnlocked(int userId) {
        final IStorageManager storage = IStorageManager.Stub
        final IStorageManager storage = IStorageManager.Stub
                .asInterface(ServiceManager.getService("mount"));
                .asInterface(ServiceManager.getService("mount"));
        if (storage != null) {
        if (storage != null) {
            try {
            try {
                return storage.isUserKeyUnlocked(userId);
                return storage.isCeStorageUnlocked(userId);
            } catch (RemoteException ignored) {
            } catch (RemoteException ignored) {
            }
            }
        }
        }
@@ -2392,13 +2392,13 @@ public final class StrictMode {
        // since any relocking of that user will always result in our
        // since any relocking of that user will always result in our
        // process being killed to release any CE FDs we're holding onto.
        // process being killed to release any CE FDs we're holding onto.
        if (userId == UserHandle.myUserId()) {
        if (userId == UserHandle.myUserId()) {
            if (sUserKeyUnlocked) {
            if (sCeStorageUnlocked) {
                return;
                return;
            } else if (isUserKeyUnlocked(userId)) {
            } else if (isCeStorageUnlocked(userId)) {
                sUserKeyUnlocked = true;
                sCeStorageUnlocked = true;
                return;
                return;
            }
            }
        } else if (isUserKeyUnlocked(userId)) {
        } else if (isCeStorageUnlocked(userId)) {
            return;
            return;
        }
        }