diff options
| author | 2019-12-06 17:01:00 -0800 | |
|---|---|---|
| committer | 2019-12-09 09:42:16 -0800 | |
| commit | 3b7cddc107de6fed5788e005f0c11a76e5ebb0e4 (patch) | |
| tree | 3bbac42bcbb825dd0a3a8178116f41004c171236 | |
| parent | 06768210977e45c3c2cde248e901b72a945c3f6f (diff) | |
Check screenlock for unlock dialog
Only show unlock dialog when the foreground user has screenlock and
trusted device.
Bug:144590810
Bug:140261179
Test: Manually on IHU
Change-Id: I08c7aa677150ca950785428580eee6a39ffadd37
| -rw-r--r-- | packages/CarSystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java index 45430197fdd8..291cdd5ea3d8 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java @@ -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; |