Merge "Use UnlockMethodCache#canSkipBouncer in user switcher" into qt-dev am: 57e8d83cab am: 3963e204bb
am: ab7ce8dd0e
Change-Id: Ie987975d9f567b8ab850c3fb2abee6333c0b4f34
This commit is contained in:
@@ -19,7 +19,6 @@ import com.android.systemui.statusbar.policy.KeyguardMonitor.Callback;
|
|||||||
public interface KeyguardMonitor extends CallbackController<Callback> {
|
public interface KeyguardMonitor extends CallbackController<Callback> {
|
||||||
|
|
||||||
boolean isSecure();
|
boolean isSecure();
|
||||||
boolean canSkipBouncer();
|
|
||||||
boolean isShowing();
|
boolean isShowing();
|
||||||
boolean isOccluded();
|
boolean isOccluded();
|
||||||
boolean isKeyguardFadingAway();
|
boolean isKeyguardFadingAway();
|
||||||
|
|||||||
@@ -17,13 +17,11 @@
|
|||||||
package com.android.systemui.statusbar.policy;
|
package com.android.systemui.statusbar.policy;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.app.ActivityManager;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.android.internal.util.Preconditions;
|
import com.android.internal.util.Preconditions;
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||||
import com.android.keyguard.KeyguardUpdateMonitorCallback;
|
import com.android.keyguard.KeyguardUpdateMonitorCallback;
|
||||||
import com.android.systemui.settings.CurrentUserTracker;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -39,14 +37,11 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
|
|||||||
private final ArrayList<Callback> mCallbacks = new ArrayList<>();
|
private final ArrayList<Callback> mCallbacks = new ArrayList<>();
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final CurrentUserTracker mUserTracker;
|
|
||||||
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
||||||
|
|
||||||
private int mCurrentUser;
|
|
||||||
private boolean mShowing;
|
private boolean mShowing;
|
||||||
private boolean mSecure;
|
private boolean mSecure;
|
||||||
private boolean mOccluded;
|
private boolean mOccluded;
|
||||||
private boolean mCanSkipBouncer;
|
|
||||||
|
|
||||||
private boolean mListening;
|
private boolean mListening;
|
||||||
private boolean mKeyguardFadingAway;
|
private boolean mKeyguardFadingAway;
|
||||||
@@ -62,13 +57,6 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
|
|||||||
public KeyguardMonitorImpl(Context context) {
|
public KeyguardMonitorImpl(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
|
mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
|
||||||
mUserTracker = new CurrentUserTracker(mContext) {
|
|
||||||
@Override
|
|
||||||
public void onUserSwitched(int newUserId) {
|
|
||||||
mCurrentUser = newUserId;
|
|
||||||
updateCanSkipBouncerState();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -77,10 +65,7 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
|
|||||||
mCallbacks.add(callback);
|
mCallbacks.add(callback);
|
||||||
if (mCallbacks.size() != 0 && !mListening) {
|
if (mCallbacks.size() != 0 && !mListening) {
|
||||||
mListening = true;
|
mListening = true;
|
||||||
mCurrentUser = ActivityManager.getCurrentUser();
|
|
||||||
updateCanSkipBouncerState();
|
|
||||||
mKeyguardUpdateMonitor.registerCallback(this);
|
mKeyguardUpdateMonitor.registerCallback(this);
|
||||||
mUserTracker.startTracking();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +75,6 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
|
|||||||
if (mCallbacks.remove(callback) && mCallbacks.size() == 0 && mListening) {
|
if (mCallbacks.remove(callback) && mCallbacks.size() == 0 && mListening) {
|
||||||
mListening = false;
|
mListening = false;
|
||||||
mKeyguardUpdateMonitor.removeCallback(this);
|
mKeyguardUpdateMonitor.removeCallback(this);
|
||||||
mUserTracker.stopTracking();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,11 +93,6 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
|
|||||||
return mOccluded;
|
return mOccluded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canSkipBouncer() {
|
|
||||||
return mCanSkipBouncer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void notifyKeyguardState(boolean showing, boolean secure, boolean occluded) {
|
public void notifyKeyguardState(boolean showing, boolean secure, boolean occluded) {
|
||||||
if (mShowing == showing && mSecure == secure && mOccluded == occluded) return;
|
if (mShowing == showing && mSecure == secure && mOccluded == occluded) return;
|
||||||
mShowing = showing;
|
mShowing = showing;
|
||||||
@@ -124,7 +103,6 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTrustChanged(int userId) {
|
public void onTrustChanged(int userId) {
|
||||||
updateCanSkipBouncerState();
|
|
||||||
notifyKeyguardChanged();
|
notifyKeyguardChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,10 +110,6 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
|
|||||||
return mKeyguardUpdateMonitor.isDeviceInteractive();
|
return mKeyguardUpdateMonitor.isDeviceInteractive();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCanSkipBouncerState() {
|
|
||||||
mCanSkipBouncer = mKeyguardUpdateMonitor.getUserCanSkipBouncer(mCurrentUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void notifyKeyguardChanged() {
|
private void notifyKeyguardChanged() {
|
||||||
// Copy the list to allow removal during callback.
|
// Copy the list to allow removal during callback.
|
||||||
new ArrayList<>(mCallbacks).forEach(Callback::onKeyguardShowingChanged);
|
new ArrayList<>(mCallbacks).forEach(Callback::onKeyguardShowingChanged);
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ import com.android.systemui.plugins.ActivityStarter;
|
|||||||
import com.android.systemui.plugins.qs.DetailAdapter;
|
import com.android.systemui.plugins.qs.DetailAdapter;
|
||||||
import com.android.systemui.qs.tiles.UserDetailView;
|
import com.android.systemui.qs.tiles.UserDetailView;
|
||||||
import com.android.systemui.statusbar.phone.SystemUIDialog;
|
import com.android.systemui.statusbar.phone.SystemUIDialog;
|
||||||
|
import com.android.systemui.statusbar.phone.UnlockMethodCache;
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@@ -595,17 +596,19 @@ public class UserSwitcherController implements Dumpable {
|
|||||||
|
|
||||||
final UserSwitcherController mController;
|
final UserSwitcherController mController;
|
||||||
private final KeyguardMonitor mKeyguardMonitor;
|
private final KeyguardMonitor mKeyguardMonitor;
|
||||||
|
private final UnlockMethodCache mUnlockMethodCache;
|
||||||
|
|
||||||
protected BaseUserAdapter(UserSwitcherController controller) {
|
protected BaseUserAdapter(UserSwitcherController controller) {
|
||||||
mController = controller;
|
mController = controller;
|
||||||
mKeyguardMonitor = controller.mKeyguardMonitor;
|
mKeyguardMonitor = controller.mKeyguardMonitor;
|
||||||
|
mUnlockMethodCache = UnlockMethodCache.getInstance(controller.mContext);
|
||||||
controller.addAdapter(new WeakReference<>(this));
|
controller.addAdapter(new WeakReference<>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserCount() {
|
public int getUserCount() {
|
||||||
boolean secureKeyguardShowing = mKeyguardMonitor.isShowing()
|
boolean secureKeyguardShowing = mKeyguardMonitor.isShowing()
|
||||||
&& mKeyguardMonitor.isSecure()
|
&& mKeyguardMonitor.isSecure()
|
||||||
&& !mKeyguardMonitor.canSkipBouncer();
|
&& !mUnlockMethodCache.canSkipBouncer();
|
||||||
if (!secureKeyguardShowing) {
|
if (!secureKeyguardShowing) {
|
||||||
return mController.getUsers().size();
|
return mController.getUsers().size();
|
||||||
}
|
}
|
||||||
@@ -627,7 +630,7 @@ public class UserSwitcherController implements Dumpable {
|
|||||||
public int getCount() {
|
public int getCount() {
|
||||||
boolean secureKeyguardShowing = mKeyguardMonitor.isShowing()
|
boolean secureKeyguardShowing = mKeyguardMonitor.isShowing()
|
||||||
&& mKeyguardMonitor.isSecure()
|
&& mKeyguardMonitor.isSecure()
|
||||||
&& !mKeyguardMonitor.canSkipBouncer();
|
&& !mUnlockMethodCache.canSkipBouncer();
|
||||||
if (!secureKeyguardShowing) {
|
if (!secureKeyguardShowing) {
|
||||||
return mController.getUsers().size();
|
return mController.getUsers().size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,9 +80,4 @@ public class FakeKeyguardMonitor implements KeyguardMonitor {
|
|||||||
public long calculateGoingToFullShadeDelay() {
|
public long calculateGoingToFullShadeDelay() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canSkipBouncer() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user