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

Commit c4b27ab6 authored by Erin Yan's avatar Erin Yan Committed by Android (Google) Code Review
Browse files

Merge "Check screenlock for unlock dialog"

parents 47bc789b 3b7cddc1
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.view.ViewStub;

import androidx.recyclerview.widget.GridLayoutManager;

import com.android.internal.widget.LockPatternUtils;
import com.android.systemui.R;
import com.android.systemui.car.CarServiceProvider;
import com.android.systemui.dagger.qualifiers.MainResources;
@@ -135,8 +136,9 @@ public class FullscreenUserSwitcher {
                /* isAddUser= */ false,
                /* isForeground= */ true);

        // If the initial user has trusted device, display the unlock dialog on the keyguard.
        if (hasTrustedDevice(initialUser)) {
        // If the initial user has screen lock and trusted device, display the unlock dialog on the
        // keyguard.
        if (hasScreenLock(initialUser) && hasTrustedDevice(initialUser)) {
            mUnlockDialogHelper.showUnlockDialogAfterDelay(initialUser,
                    mOnHideListener);
        } else {
@@ -178,7 +180,7 @@ public class FullscreenUserSwitcher {
     */
    private void onUserSelected(UserGridRecyclerView.UserRecord record) {
        mSelectedUser = record;
        if (hasTrustedDevice(record.mInfo.id)) {
        if (hasScreenLock(record.mInfo.id) && hasTrustedDevice(record.mInfo.id)) {
            mUnlockDialogHelper.showUnlockDialog(record.mInfo.id, mOnHideListener);
            return;
        }
@@ -216,6 +218,12 @@ public class FullscreenUserSwitcher {

    }

    private boolean hasScreenLock(int uid) {
        LockPatternUtils lockPatternUtils = new LockPatternUtils(mContext);
        return lockPatternUtils.getCredentialTypeForUser(uid)
                != LockPatternUtils.CREDENTIAL_TYPE_NONE;
    }

    private boolean hasTrustedDevice(int uid) {
        if (mEnrollmentManager == null) { // car service not ready, so it cannot be available.
            return false;