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
This commit is contained in:
Jeff Sharkey
2015-12-18 17:18:09 -07:00
parent 56cd51a704
commit 5b0e5207e1
2 changed files with 12 additions and 7 deletions

View File

@@ -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);
}
/**

View File

@@ -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));