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

Commit 5b0e5207 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Point "unlocked" logic at lower level.

There is a race when starting a non-encryption-aware launcher before
we've gone through the user lifecycle to enter the "running unlocked"
state.  This can cause the launcher to choke when it's denied access
to widgets that are still considered locked.

For now, relax the notion of a user being unlocked to reflect the
on-disk state, instead of looking at the user lifecycle.

Also add logging of encryption commands.

Bug: 26267450
Change-Id: Ie330d07418cf10413e0b4380f6d6781684f01952
parent 56cd51a7
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.storage.StorageManager;
import android.provider.Settings;
import android.util.Log;
import android.view.WindowManager.LayoutParams;
@@ -857,12 +858,10 @@ public class UserManager {

    /** {@hide} */
    public boolean isUserUnlocked(int userId) {
        try {
            return ActivityManagerNative.getDefault().isUserRunning(userId,
                    ActivityManager.FLAG_AND_UNLOCKED);
        } catch (RemoteException e) {
            return false;
        }
        // TODO: eventually pivot this back to look at ActivityManager state,
        // but there is race where we can start a non-encryption-aware launcher
        // before that lifecycle has entered the running unlocked state.
        return mContext.getSystemService(StorageManager.class).isUserKeyUnlocked(userId);
    }

    /**
+7 −1
Original line number Diff line number Diff line
@@ -3592,11 +3592,17 @@ class MountService extends IMountService.Stub
        }

        pw.println();
        pw.println("mConnection:");
        pw.println("mConnector:");
        pw.increaseIndent();
        mConnector.dump(fd, pw, args);
        pw.decreaseIndent();

        pw.println();
        pw.println("mCryptConnector:");
        pw.increaseIndent();
        mCryptConnector.dump(fd, pw, args);
        pw.decreaseIndent();

        pw.println();
        pw.print("Last maintenance: ");
        pw.println(TimeUtils.formatForLogging(mLastMaintenance));