Loading core/java/android/app/ActivityManager.java +2 −20 Original line number Diff line number Diff line Loading @@ -3430,6 +3430,8 @@ public class ActivityManager { public static final int FLAG_AND_LOCKED = 1 << 1; /** {@hide} */ public static final int FLAG_AND_UNLOCKED = 1 << 2; /** {@hide} */ public static final int FLAG_AND_UNLOCKING_OR_UNLOCKED = 1 << 3; /** * Return whether the given user is actively running. This means that Loading @@ -3448,26 +3450,6 @@ public class ActivityManager { } } /** {@hide} */ public boolean isUserRunningAndLocked(int userId) { try { return ActivityManagerNative.getDefault().isUserRunning(userId, ActivityManager.FLAG_AND_LOCKED); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** {@hide} */ public boolean isUserRunningAndUnlocked(int userId) { try { return ActivityManagerNative.getDefault().isUserRunning(userId, ActivityManager.FLAG_AND_UNLOCKED); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** {@hide} */ public boolean isVrModePackageEnabled(ComponentName component) { try { Loading core/java/android/os/UserManager.java +21 −5 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ 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.telephony.TelephonyManager; import android.view.WindowManager.LayoutParams; Loading Loading @@ -984,10 +983,27 @@ public class UserManager { /** {@hide} */ public boolean isUserUnlocked(@UserIdInt int userId) { // 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); try { return ActivityManagerNative.getDefault().isUserRunning(userId, ActivityManager.FLAG_AND_UNLOCKED); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** {@hide} */ public boolean isUserUnlockingOrUnlocked(UserHandle user) { return isUserUnlockingOrUnlocked(user.getIdentifier()); } /** {@hide} */ public boolean isUserUnlockingOrUnlocked(@UserIdInt int userId) { try { return ActivityManagerNative.getDefault().isUserRunning(userId, ActivityManager.FLAG_AND_UNLOCKING_OR_UNLOCKED); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** Loading core/java/android/os/storage/StorageManager.java +13 −3 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.content.ContentResolver; import android.content.Context; import android.content.pm.IPackageMoveObserver; import android.content.pm.PackageManager; import android.os.Binder; import android.os.Environment; import android.os.FileUtils; import android.os.Handler; Loading Loading @@ -1062,11 +1063,20 @@ public class StorageManager { } /** {@hide} */ public boolean isUserKeyUnlocked(int userId) { public static boolean isUserKeyUnlocked(int userId) { final IMountService mount = IMountService.Stub .asInterface(ServiceManager.getService("mount")); if (mount == null) { Slog.w(TAG, "Early during boot, assuming locked"); return false; } final long token = Binder.clearCallingIdentity(); try { return mMountService.isUserKeyUnlocked(userId); return mount.isUserKeyUnlocked(userId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowAsRuntimeException(); } finally { Binder.restoreCallingIdentity(token); } } Loading core/java/android/provider/CallLog.java +2 −0 Original line number Diff line number Diff line Loading @@ -824,6 +824,8 @@ public class CallLog { UserHandle user, ContentValues values) { final ContentResolver resolver = context.getContentResolver(); // Since we're doing this operation on behalf of an app, we only // want to use the actual "unlocked" state. final Uri uri = ContentProvider.maybeAddUserId( userManager.isUserUnlocked(user) ? CONTENT_URI : SHADOW_CONTENT_URI, user.getIdentifier()); Loading core/res/res/values/symbols.xml +3 −0 Original line number Diff line number Diff line Loading @@ -2530,6 +2530,9 @@ <java-symbol type="string" name="profile_encrypted_message" /> <java-symbol type="drawable" name="ic_user_secure" /> <java-symbol type="string" name="android_upgrading_notification_title" /> <java-symbol type="string" name="android_upgrading_notification_body" /> <java-symbol type="string" name="usb_mtp_launch_notification_title" /> <java-symbol type="string" name="usb_mtp_launch_notification_description" /> Loading Loading
core/java/android/app/ActivityManager.java +2 −20 Original line number Diff line number Diff line Loading @@ -3430,6 +3430,8 @@ public class ActivityManager { public static final int FLAG_AND_LOCKED = 1 << 1; /** {@hide} */ public static final int FLAG_AND_UNLOCKED = 1 << 2; /** {@hide} */ public static final int FLAG_AND_UNLOCKING_OR_UNLOCKED = 1 << 3; /** * Return whether the given user is actively running. This means that Loading @@ -3448,26 +3450,6 @@ public class ActivityManager { } } /** {@hide} */ public boolean isUserRunningAndLocked(int userId) { try { return ActivityManagerNative.getDefault().isUserRunning(userId, ActivityManager.FLAG_AND_LOCKED); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** {@hide} */ public boolean isUserRunningAndUnlocked(int userId) { try { return ActivityManagerNative.getDefault().isUserRunning(userId, ActivityManager.FLAG_AND_UNLOCKED); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** {@hide} */ public boolean isVrModePackageEnabled(ComponentName component) { try { Loading
core/java/android/os/UserManager.java +21 −5 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ 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.telephony.TelephonyManager; import android.view.WindowManager.LayoutParams; Loading Loading @@ -984,10 +983,27 @@ public class UserManager { /** {@hide} */ public boolean isUserUnlocked(@UserIdInt int userId) { // 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); try { return ActivityManagerNative.getDefault().isUserRunning(userId, ActivityManager.FLAG_AND_UNLOCKED); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** {@hide} */ public boolean isUserUnlockingOrUnlocked(UserHandle user) { return isUserUnlockingOrUnlocked(user.getIdentifier()); } /** {@hide} */ public boolean isUserUnlockingOrUnlocked(@UserIdInt int userId) { try { return ActivityManagerNative.getDefault().isUserRunning(userId, ActivityManager.FLAG_AND_UNLOCKING_OR_UNLOCKED); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** Loading
core/java/android/os/storage/StorageManager.java +13 −3 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.content.ContentResolver; import android.content.Context; import android.content.pm.IPackageMoveObserver; import android.content.pm.PackageManager; import android.os.Binder; import android.os.Environment; import android.os.FileUtils; import android.os.Handler; Loading Loading @@ -1062,11 +1063,20 @@ public class StorageManager { } /** {@hide} */ public boolean isUserKeyUnlocked(int userId) { public static boolean isUserKeyUnlocked(int userId) { final IMountService mount = IMountService.Stub .asInterface(ServiceManager.getService("mount")); if (mount == null) { Slog.w(TAG, "Early during boot, assuming locked"); return false; } final long token = Binder.clearCallingIdentity(); try { return mMountService.isUserKeyUnlocked(userId); return mount.isUserKeyUnlocked(userId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowAsRuntimeException(); } finally { Binder.restoreCallingIdentity(token); } } Loading
core/java/android/provider/CallLog.java +2 −0 Original line number Diff line number Diff line Loading @@ -824,6 +824,8 @@ public class CallLog { UserHandle user, ContentValues values) { final ContentResolver resolver = context.getContentResolver(); // Since we're doing this operation on behalf of an app, we only // want to use the actual "unlocked" state. final Uri uri = ContentProvider.maybeAddUserId( userManager.isUserUnlocked(user) ? CONTENT_URI : SHADOW_CONTENT_URI, user.getIdentifier()); Loading
core/res/res/values/symbols.xml +3 −0 Original line number Diff line number Diff line Loading @@ -2530,6 +2530,9 @@ <java-symbol type="string" name="profile_encrypted_message" /> <java-symbol type="drawable" name="ic_user_secure" /> <java-symbol type="string" name="android_upgrading_notification_title" /> <java-symbol type="string" name="android_upgrading_notification_body" /> <java-symbol type="string" name="usb_mtp_launch_notification_title" /> <java-symbol type="string" name="usb_mtp_launch_notification_description" /> Loading