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

Commit 35c6f6c7 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by android-build-merger
Browse files

Merge "Introduce "unlocking" vs "unlocked" nuance." into nyc-dev

am: 8c2fb9ed

* commit '8c2fb9ed':
  Introduce "unlocking" vs "unlocked" nuance.

Change-Id: I8f54df38e1e165049a87ae505ffaade9de20a21f
parents 5d5d9562 8c2fb9ed
Loading
Loading
Loading
Loading
+2 −20
Original line number Diff line number Diff line
@@ -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
@@ -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 {
+21 −5
Original line number Diff line number Diff line
@@ -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;
@@ -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();
        }
    }

    /**
+13 −3
Original line number Diff line number Diff line
@@ -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;
@@ -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);
        }
    }

+2 −0
Original line number Diff line number Diff line
@@ -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());
+3 −0
Original line number Diff line number Diff line
@@ -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