Move device management resource retrieval calls to bg thread
Fixes: 217176608 Test: added Assert.isNotMainThread and manually verified it doesn't crash Change-Id: I506123117567128fc4cb0a712d6c8c0ff683d20f
This commit is contained in:
@@ -56,7 +56,9 @@ import com.android.internal.annotations.VisibleForTesting;
|
|||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.animation.Interpolators;
|
import com.android.systemui.animation.Interpolators;
|
||||||
|
import com.android.systemui.dagger.qualifiers.Background;
|
||||||
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
||||||
|
import com.android.systemui.util.concurrency.DelayableExecutor;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
@@ -110,6 +112,8 @@ public class AuthContainerView extends LinearLayout
|
|||||||
@ContainerState private int mContainerState = STATE_UNKNOWN;
|
@ContainerState private int mContainerState = STATE_UNKNOWN;
|
||||||
private final Set<Integer> mFailedModalities = new HashSet<Integer>();
|
private final Set<Integer> mFailedModalities = new HashSet<Integer>();
|
||||||
|
|
||||||
|
private final @Background DelayableExecutor mBackgroundExecutor;
|
||||||
|
|
||||||
// Non-null only if the dialog is in the act of dismissing and has not sent the reason yet.
|
// Non-null only if the dialog is in the act of dismissing and has not sent the reason yet.
|
||||||
@Nullable @AuthDialogCallback.DismissedReason private Integer mPendingCallbackReason;
|
@Nullable @AuthDialogCallback.DismissedReason private Integer mPendingCallbackReason;
|
||||||
// HAT received from LockSettingsService when credential is verified.
|
// HAT received from LockSettingsService when credential is verified.
|
||||||
@@ -192,7 +196,7 @@ public class AuthContainerView extends LinearLayout
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuthContainerView build(int[] sensorIds,
|
public AuthContainerView build(@Background DelayableExecutor bgExecutor, int[] sensorIds,
|
||||||
@Nullable List<FingerprintSensorPropertiesInternal> fpProps,
|
@Nullable List<FingerprintSensorPropertiesInternal> fpProps,
|
||||||
@Nullable List<FaceSensorPropertiesInternal> faceProps,
|
@Nullable List<FaceSensorPropertiesInternal> faceProps,
|
||||||
@NonNull WakefulnessLifecycle wakefulnessLifecycle,
|
@NonNull WakefulnessLifecycle wakefulnessLifecycle,
|
||||||
@@ -200,7 +204,7 @@ public class AuthContainerView extends LinearLayout
|
|||||||
@NonNull LockPatternUtils lockPatternUtils) {
|
@NonNull LockPatternUtils lockPatternUtils) {
|
||||||
mConfig.mSensorIds = sensorIds;
|
mConfig.mSensorIds = sensorIds;
|
||||||
return new AuthContainerView(mConfig, fpProps, faceProps, wakefulnessLifecycle,
|
return new AuthContainerView(mConfig, fpProps, faceProps, wakefulnessLifecycle,
|
||||||
userManager, lockPatternUtils, new Handler(Looper.getMainLooper()));
|
userManager, lockPatternUtils, new Handler(Looper.getMainLooper()), bgExecutor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +257,8 @@ public class AuthContainerView extends LinearLayout
|
|||||||
@NonNull WakefulnessLifecycle wakefulnessLifecycle,
|
@NonNull WakefulnessLifecycle wakefulnessLifecycle,
|
||||||
@NonNull UserManager userManager,
|
@NonNull UserManager userManager,
|
||||||
@NonNull LockPatternUtils lockPatternUtils,
|
@NonNull LockPatternUtils lockPatternUtils,
|
||||||
@NonNull Handler mainHandler) {
|
@NonNull Handler mainHandler,
|
||||||
|
@NonNull @Background DelayableExecutor bgExecutor) {
|
||||||
super(config.mContext);
|
super(config.mContext);
|
||||||
|
|
||||||
mConfig = config;
|
mConfig = config;
|
||||||
@@ -277,6 +282,7 @@ public class AuthContainerView extends LinearLayout
|
|||||||
mBackgroundView = mFrameLayout.findViewById(R.id.background);
|
mBackgroundView = mFrameLayout.findViewById(R.id.background);
|
||||||
mPanelView = mFrameLayout.findViewById(R.id.panel);
|
mPanelView = mFrameLayout.findViewById(R.id.panel);
|
||||||
mPanelController = new AuthPanelController(mContext, mPanelView);
|
mPanelController = new AuthPanelController(mContext, mPanelView);
|
||||||
|
mBackgroundExecutor = bgExecutor;
|
||||||
|
|
||||||
// Inflate biometric view only if necessary.
|
// Inflate biometric view only if necessary.
|
||||||
if (Utils.isBiometricAllowed(mConfig.mPromptInfo)) {
|
if (Utils.isBiometricAllowed(mConfig.mPromptInfo)) {
|
||||||
@@ -384,6 +390,7 @@ public class AuthContainerView extends LinearLayout
|
|||||||
mCredentialView.setPromptInfo(mConfig.mPromptInfo);
|
mCredentialView.setPromptInfo(mConfig.mPromptInfo);
|
||||||
mCredentialView.setPanelController(mPanelController, animatePanel);
|
mCredentialView.setPanelController(mPanelController, animatePanel);
|
||||||
mCredentialView.setShouldAnimateContents(animateContents);
|
mCredentialView.setShouldAnimateContents(animateContents);
|
||||||
|
mCredentialView.setBackgroundExecutor(mBackgroundExecutor);
|
||||||
mFrameLayout.addView(mCredentialView);
|
mFrameLayout.addView(mCredentialView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,11 +64,13 @@ import com.android.internal.widget.LockPatternUtils;
|
|||||||
import com.android.systemui.CoreStartable;
|
import com.android.systemui.CoreStartable;
|
||||||
import com.android.systemui.assist.ui.DisplayUtils;
|
import com.android.systemui.assist.ui.DisplayUtils;
|
||||||
import com.android.systemui.dagger.SysUISingleton;
|
import com.android.systemui.dagger.SysUISingleton;
|
||||||
|
import com.android.systemui.dagger.qualifiers.Background;
|
||||||
import com.android.systemui.dagger.qualifiers.Main;
|
import com.android.systemui.dagger.qualifiers.Main;
|
||||||
import com.android.systemui.doze.DozeReceiver;
|
import com.android.systemui.doze.DozeReceiver;
|
||||||
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
import com.android.systemui.statusbar.CommandQueue;
|
import com.android.systemui.statusbar.CommandQueue;
|
||||||
|
import com.android.systemui.util.concurrency.DelayableExecutor;
|
||||||
import com.android.systemui.util.concurrency.Execution;
|
import com.android.systemui.util.concurrency.Execution;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -139,6 +141,7 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
|
|||||||
private boolean mAllAuthenticatorsRegistered;
|
private boolean mAllAuthenticatorsRegistered;
|
||||||
@NonNull private final UserManager mUserManager;
|
@NonNull private final UserManager mUserManager;
|
||||||
@NonNull private final LockPatternUtils mLockPatternUtils;
|
@NonNull private final LockPatternUtils mLockPatternUtils;
|
||||||
|
private final @Background DelayableExecutor mBackgroundExecutor;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
final TaskStackListener mTaskStackListener = new TaskStackListener() {
|
final TaskStackListener mTaskStackListener = new TaskStackListener() {
|
||||||
@@ -507,13 +510,15 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
|
|||||||
@NonNull UserManager userManager,
|
@NonNull UserManager userManager,
|
||||||
@NonNull LockPatternUtils lockPatternUtils,
|
@NonNull LockPatternUtils lockPatternUtils,
|
||||||
@NonNull StatusBarStateController statusBarStateController,
|
@NonNull StatusBarStateController statusBarStateController,
|
||||||
@Main Handler handler) {
|
@Main Handler handler,
|
||||||
|
@Background DelayableExecutor bgExecutor) {
|
||||||
super(context);
|
super(context);
|
||||||
mExecution = execution;
|
mExecution = execution;
|
||||||
mWakefulnessLifecycle = wakefulnessLifecycle;
|
mWakefulnessLifecycle = wakefulnessLifecycle;
|
||||||
mUserManager = userManager;
|
mUserManager = userManager;
|
||||||
mLockPatternUtils = lockPatternUtils;
|
mLockPatternUtils = lockPatternUtils;
|
||||||
mHandler = handler;
|
mHandler = handler;
|
||||||
|
mBackgroundExecutor = bgExecutor;
|
||||||
mCommandQueue = commandQueue;
|
mCommandQueue = commandQueue;
|
||||||
mActivityTaskManager = activityTaskManager;
|
mActivityTaskManager = activityTaskManager;
|
||||||
mFingerprintManager = fingerprintManager;
|
mFingerprintManager = fingerprintManager;
|
||||||
@@ -839,6 +844,7 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
|
|||||||
|
|
||||||
// Create a new dialog but do not replace the current one yet.
|
// Create a new dialog but do not replace the current one yet.
|
||||||
final AuthDialog newDialog = buildDialog(
|
final AuthDialog newDialog = buildDialog(
|
||||||
|
mBackgroundExecutor,
|
||||||
promptInfo,
|
promptInfo,
|
||||||
requireConfirmation,
|
requireConfirmation,
|
||||||
userId,
|
userId,
|
||||||
@@ -934,9 +940,9 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AuthDialog buildDialog(PromptInfo promptInfo, boolean requireConfirmation,
|
protected AuthDialog buildDialog(@Background DelayableExecutor bgExecutor,
|
||||||
int userId, int[] sensorIds, String opPackageName,
|
PromptInfo promptInfo, boolean requireConfirmation, int userId, int[] sensorIds,
|
||||||
boolean skipIntro, long operationId, long requestId,
|
String opPackageName, boolean skipIntro, long operationId, long requestId,
|
||||||
@BiometricMultiSensorMode int multiSensorConfig,
|
@BiometricMultiSensorMode int multiSensorConfig,
|
||||||
@NonNull WakefulnessLifecycle wakefulnessLifecycle,
|
@NonNull WakefulnessLifecycle wakefulnessLifecycle,
|
||||||
@NonNull UserManager userManager,
|
@NonNull UserManager userManager,
|
||||||
@@ -951,8 +957,8 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
|
|||||||
.setOperationId(operationId)
|
.setOperationId(operationId)
|
||||||
.setRequestId(requestId)
|
.setRequestId(requestId)
|
||||||
.setMultiSensorConfig(multiSensorConfig)
|
.setMultiSensorConfig(multiSensorConfig)
|
||||||
.build(sensorIds, mFpProps, mFaceProps, wakefulnessLifecycle, userManager,
|
.build(bgExecutor, sensorIds, mFpProps, mFaceProps, wakefulnessLifecycle,
|
||||||
lockPatternUtils);
|
userManager, lockPatternUtils);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ import com.android.internal.widget.LockPatternUtils;
|
|||||||
import com.android.internal.widget.VerifyCredentialResponse;
|
import com.android.internal.widget.VerifyCredentialResponse;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.animation.Interpolators;
|
import com.android.systemui.animation.Interpolators;
|
||||||
|
import com.android.systemui.dagger.qualifiers.Background;
|
||||||
|
import com.android.systemui.util.concurrency.DelayableExecutor;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
@@ -99,6 +101,8 @@ public abstract class AuthCredentialView extends LinearLayout {
|
|||||||
protected int mEffectiveUserId;
|
protected int mEffectiveUserId;
|
||||||
protected ErrorTimer mErrorTimer;
|
protected ErrorTimer mErrorTimer;
|
||||||
|
|
||||||
|
protected @Background DelayableExecutor mBackgroundExecutor;
|
||||||
|
|
||||||
interface Callback {
|
interface Callback {
|
||||||
void onCredentialMatched(byte[] attestation);
|
void onCredentialMatched(byte[] attestation);
|
||||||
}
|
}
|
||||||
@@ -217,6 +221,10 @@ public abstract class AuthCredentialView extends LinearLayout {
|
|||||||
mContainerView = containerView;
|
mContainerView = containerView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setBackgroundExecutor(@Background DelayableExecutor bgExecutor) {
|
||||||
|
mBackgroundExecutor = bgExecutor;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onAttachedToWindow() {
|
protected void onAttachedToWindow() {
|
||||||
super.onAttachedToWindow();
|
super.onAttachedToWindow();
|
||||||
@@ -377,27 +385,33 @@ public abstract class AuthCredentialView extends LinearLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showLastAttemptBeforeWipeDialog() {
|
private void showLastAttemptBeforeWipeDialog() {
|
||||||
final AlertDialog alertDialog = new AlertDialog.Builder(mContext)
|
mBackgroundExecutor.execute(() -> {
|
||||||
.setTitle(R.string.biometric_dialog_last_attempt_before_wipe_dialog_title)
|
final AlertDialog alertDialog = new AlertDialog.Builder(mContext)
|
||||||
.setMessage(
|
.setTitle(R.string.biometric_dialog_last_attempt_before_wipe_dialog_title)
|
||||||
getLastAttemptBeforeWipeMessage(getUserTypeForWipe(), mCredentialType))
|
.setMessage(
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
getLastAttemptBeforeWipeMessage(getUserTypeForWipe(), mCredentialType))
|
||||||
.create();
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL);
|
.create();
|
||||||
alertDialog.show();
|
alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL);
|
||||||
|
mHandler.post(alertDialog::show);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showNowWipingDialog() {
|
private void showNowWipingDialog() {
|
||||||
final AlertDialog alertDialog = new AlertDialog.Builder(mContext)
|
mBackgroundExecutor.execute(() -> {
|
||||||
.setMessage(getNowWipingMessage(getUserTypeForWipe()))
|
String nowWipingMessage = getNowWipingMessage(getUserTypeForWipe());
|
||||||
.setPositiveButton(
|
final AlertDialog alertDialog = new AlertDialog.Builder(mContext)
|
||||||
com.android.settingslib.R.string.failed_attempts_now_wiping_dialog_dismiss,
|
.setMessage(nowWipingMessage)
|
||||||
null /* OnClickListener */)
|
.setPositiveButton(
|
||||||
.setOnDismissListener(
|
com.android.settingslib.R.string.failed_attempts_now_wiping_dialog_dismiss,
|
||||||
dialog -> mContainerView.animateAway(AuthDialogCallback.DISMISSED_ERROR))
|
null /* OnClickListener */)
|
||||||
.create();
|
.setOnDismissListener(
|
||||||
alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL);
|
dialog -> mContainerView.animateAway(
|
||||||
alertDialog.show();
|
AuthDialogCallback.DISMISSED_ERROR))
|
||||||
|
.create();
|
||||||
|
alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL);
|
||||||
|
mHandler.post(alertDialog::show);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private @UserType int getUserTypeForWipe() {
|
private @UserType int getUserTypeForWipe() {
|
||||||
@@ -412,6 +426,7 @@ public abstract class AuthCredentialView extends LinearLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This should not be called on the main thread to avoid making an IPC.
|
||||||
private String getLastAttemptBeforeWipeMessage(
|
private String getLastAttemptBeforeWipeMessage(
|
||||||
@UserType int userType, @Utils.CredentialType int credentialType) {
|
@UserType int userType, @Utils.CredentialType int credentialType) {
|
||||||
switch (userType) {
|
switch (userType) {
|
||||||
@@ -442,6 +457,7 @@ public abstract class AuthCredentialView extends LinearLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This should not be called on the main thread to avoid making an IPC.
|
||||||
private String getLastAttemptBeforeWipeProfileMessage(
|
private String getLastAttemptBeforeWipeProfileMessage(
|
||||||
@Utils.CredentialType int credentialType) {
|
@Utils.CredentialType int credentialType) {
|
||||||
return mDevicePolicyManager.getResources().getString(
|
return mDevicePolicyManager.getResources().getString(
|
||||||
|
|||||||
@@ -143,9 +143,10 @@ class QSSecurityFooter extends ViewController<View>
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
QSSecurityFooter(@Named(QS_SECURITY_FOOTER_VIEW) View rootView,
|
QSSecurityFooter(@Named(QS_SECURITY_FOOTER_VIEW) View rootView,
|
||||||
UserTracker userTracker, @Main Handler mainHandler, ActivityStarter activityStarter,
|
UserTracker userTracker, @Main Handler mainHandler,
|
||||||
SecurityController securityController, DialogLaunchAnimator dialogLaunchAnimator,
|
ActivityStarter activityStarter, SecurityController securityController,
|
||||||
@Background Looper bgLooper, BroadcastDispatcher broadcastDispatcher) {
|
DialogLaunchAnimator dialogLaunchAnimator, @Background Looper bgLooper,
|
||||||
|
BroadcastDispatcher broadcastDispatcher) {
|
||||||
super(rootView);
|
super(rootView);
|
||||||
mFooterText = mView.findViewById(R.id.footer_text);
|
mFooterText = mView.findViewById(R.id.footer_text);
|
||||||
mPrimaryFooterIcon = mView.findViewById(R.id.primary_footer_icon);
|
mPrimaryFooterIcon = mView.findViewById(R.id.primary_footer_icon);
|
||||||
@@ -493,21 +494,23 @@ class QSSecurityFooter extends ViewController<View>
|
|||||||
|
|
||||||
private void createDialog() {
|
private void createDialog() {
|
||||||
mShouldUseSettingsButton.set(false);
|
mShouldUseSettingsButton.set(false);
|
||||||
final View view = createDialogView();
|
mHandler.post(() -> {
|
||||||
mMainHandler.post(() -> {
|
String settingsButtonText = getSettingsButton();
|
||||||
mDialog = new SystemUIDialog(mContext, 0); // Use mContext theme
|
final View view = createDialogView();
|
||||||
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
mMainHandler.post(() -> {
|
||||||
mDialog.setButton(DialogInterface.BUTTON_POSITIVE, getPositiveButton(), this);
|
mDialog = new SystemUIDialog(mContext, 0); // Use mContext theme
|
||||||
mDialog.setButton(DialogInterface.BUTTON_NEGATIVE,
|
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
mShouldUseSettingsButton.get() ? getSettingsButton() : getNegativeButton(),
|
mDialog.setButton(DialogInterface.BUTTON_POSITIVE, getPositiveButton(), this);
|
||||||
this);
|
mDialog.setButton(DialogInterface.BUTTON_NEGATIVE, mShouldUseSettingsButton.get()
|
||||||
|
? settingsButtonText : getNegativeButton(), this);
|
||||||
|
|
||||||
mDialog.setView(view);
|
mDialog.setView(view);
|
||||||
if (mView.isAggregatedVisible()) {
|
if (mView.isAggregatedVisible()) {
|
||||||
mDialogLaunchAnimator.showFromView(mDialog, mView);
|
mDialogLaunchAnimator.showFromView(mDialog, mView);
|
||||||
} else {
|
} else {
|
||||||
mDialog.show();
|
mDialog.show();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -650,6 +653,7 @@ class QSSecurityFooter extends ViewController<View>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This should not be called on the main thread to avoid making an IPC.
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
String getSettingsButton() {
|
String getSettingsButton() {
|
||||||
return mDpm.getResources().getString(
|
return mDpm.getResources().getString(
|
||||||
|
|||||||
@@ -292,9 +292,7 @@ public class PhoneStatusBarPolicy
|
|||||||
mIconController.setIconVisibility(mSlotHotspot, mHotspot.isHotspotEnabled());
|
mIconController.setIconVisibility(mSlotHotspot, mHotspot.isHotspotEnabled());
|
||||||
|
|
||||||
// managed profile
|
// managed profile
|
||||||
mIconController.setIcon(mSlotManagedProfile, R.drawable.stat_sys_managed_profile_status,
|
updateManagedProfile();
|
||||||
getManagedProfileAccessibilityString());
|
|
||||||
mIconController.setIconVisibility(mSlotManagedProfile, mManagedProfileIconVisible);
|
|
||||||
|
|
||||||
// data saver
|
// data saver
|
||||||
mIconController.setIcon(mSlotDataSaver, R.drawable.stat_sys_data_saver,
|
mIconController.setIcon(mSlotDataSaver, R.drawable.stat_sys_data_saver,
|
||||||
@@ -521,7 +519,7 @@ public class PhoneStatusBarPolicy
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateManagedProfile() {
|
private void updateManagedProfile() {
|
||||||
// getLastResumedActivityUserId needds to acquire the AM lock, which may be contended in
|
// getLastResumedActivityUserId needs to acquire the AM lock, which may be contended in
|
||||||
// some cases. Since it doesn't really matter here whether it's updated in this frame
|
// some cases. Since it doesn't really matter here whether it's updated in this frame
|
||||||
// or in the next one, we call this method from our UI offload thread.
|
// or in the next one, we call this method from our UI offload thread.
|
||||||
mUiBgExecutor.execute(() -> {
|
mUiBgExecutor.execute(() -> {
|
||||||
@@ -529,6 +527,7 @@ public class PhoneStatusBarPolicy
|
|||||||
try {
|
try {
|
||||||
userId = ActivityTaskManager.getService().getLastResumedActivityUserId();
|
userId = ActivityTaskManager.getService().getLastResumedActivityUserId();
|
||||||
boolean isManagedProfile = mUserManager.isManagedProfile(userId);
|
boolean isManagedProfile = mUserManager.isManagedProfile(userId);
|
||||||
|
String accessibilityString = getManagedProfileAccessibilityString();
|
||||||
mHandler.post(() -> {
|
mHandler.post(() -> {
|
||||||
final boolean showIcon;
|
final boolean showIcon;
|
||||||
if (isManagedProfile && (!mKeyguardStateController.isShowing()
|
if (isManagedProfile && (!mKeyguardStateController.isShowing()
|
||||||
@@ -536,7 +535,7 @@ public class PhoneStatusBarPolicy
|
|||||||
showIcon = true;
|
showIcon = true;
|
||||||
mIconController.setIcon(mSlotManagedProfile,
|
mIconController.setIcon(mSlotManagedProfile,
|
||||||
R.drawable.stat_sys_managed_profile_status,
|
R.drawable.stat_sys_managed_profile_status,
|
||||||
getManagedProfileAccessibilityString());
|
accessibilityString);
|
||||||
} else {
|
} else {
|
||||||
showIcon = false;
|
showIcon = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ import com.android.internal.widget.LockPatternUtils
|
|||||||
import com.android.systemui.R
|
import com.android.systemui.R
|
||||||
import com.android.systemui.SysuiTestCase
|
import com.android.systemui.SysuiTestCase
|
||||||
import com.android.systemui.keyguard.WakefulnessLifecycle
|
import com.android.systemui.keyguard.WakefulnessLifecycle
|
||||||
|
import com.android.systemui.util.concurrency.DelayableExecutor
|
||||||
|
import com.android.systemui.util.concurrency.FakeExecutor
|
||||||
|
import com.android.systemui.util.time.FakeSystemClock
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
@@ -314,7 +317,8 @@ class AuthContainerViewTest : SysuiTestCase() {
|
|||||||
wakefulnessLifecycle,
|
wakefulnessLifecycle,
|
||||||
userManager,
|
userManager,
|
||||||
lockPatternUtils,
|
lockPatternUtils,
|
||||||
Handler(TestableLooper.get(this).looper)
|
Handler(TestableLooper.get(this).looper),
|
||||||
|
FakeExecutor(FakeSystemClock())
|
||||||
)
|
)
|
||||||
|
|
||||||
if (addToView) {
|
if (addToView) {
|
||||||
@@ -331,10 +335,11 @@ class AuthContainerViewTest : SysuiTestCase() {
|
|||||||
wakefulnessLifecycle: WakefulnessLifecycle,
|
wakefulnessLifecycle: WakefulnessLifecycle,
|
||||||
userManager: UserManager,
|
userManager: UserManager,
|
||||||
lockPatternUtils: LockPatternUtils,
|
lockPatternUtils: LockPatternUtils,
|
||||||
mainHandler: Handler
|
mainHandler: Handler,
|
||||||
|
bgExecutor: DelayableExecutor
|
||||||
) : AuthContainerView(
|
) : AuthContainerView(
|
||||||
config, fpProps, faceProps,
|
config, fpProps, faceProps,
|
||||||
wakefulnessLifecycle, userManager, lockPatternUtils, mainHandler
|
wakefulnessLifecycle, userManager, lockPatternUtils, mainHandler, bgExecutor
|
||||||
) {
|
) {
|
||||||
override fun postOnAnimation(runnable: Runnable) {
|
override fun postOnAnimation(runnable: Runnable) {
|
||||||
runnable.run()
|
runnable.run()
|
||||||
|
|||||||
@@ -80,8 +80,11 @@ import com.android.systemui.SysuiTestCase;
|
|||||||
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
import com.android.systemui.statusbar.CommandQueue;
|
import com.android.systemui.statusbar.CommandQueue;
|
||||||
|
import com.android.systemui.util.concurrency.DelayableExecutor;
|
||||||
import com.android.systemui.util.concurrency.Execution;
|
import com.android.systemui.util.concurrency.Execution;
|
||||||
import com.android.systemui.util.concurrency.FakeExecution;
|
import com.android.systemui.util.concurrency.FakeExecution;
|
||||||
|
import com.android.systemui.util.concurrency.FakeExecutor;
|
||||||
|
import com.android.systemui.util.time.FakeSystemClock;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
@@ -156,6 +159,7 @@ public class AuthControllerTest extends SysuiTestCase {
|
|||||||
private Execution mExecution;
|
private Execution mExecution;
|
||||||
private TestableLooper mTestableLooper;
|
private TestableLooper mTestableLooper;
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
|
private DelayableExecutor mBackgroundExecutor;
|
||||||
private TestableAuthController mAuthController;
|
private TestableAuthController mAuthController;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -164,6 +168,7 @@ public class AuthControllerTest extends SysuiTestCase {
|
|||||||
mExecution = new FakeExecution();
|
mExecution = new FakeExecution();
|
||||||
mTestableLooper = TestableLooper.get(this);
|
mTestableLooper = TestableLooper.get(this);
|
||||||
mHandler = new Handler(mTestableLooper.getLooper());
|
mHandler = new Handler(mTestableLooper.getLooper());
|
||||||
|
mBackgroundExecutor = new FakeExecutor(new FakeSystemClock());
|
||||||
|
|
||||||
when(mContextSpy.getPackageManager()).thenReturn(mPackageManager);
|
when(mContextSpy.getPackageManager()).thenReturn(mPackageManager);
|
||||||
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE))
|
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE))
|
||||||
@@ -759,11 +764,12 @@ public class AuthControllerTest extends SysuiTestCase {
|
|||||||
super(context, execution, commandQueue, activityTaskManager, windowManager,
|
super(context, execution, commandQueue, activityTaskManager, windowManager,
|
||||||
fingerprintManager, faceManager, udfpsControllerFactory,
|
fingerprintManager, faceManager, udfpsControllerFactory,
|
||||||
sidefpsControllerFactory, mDisplayManager, mWakefulnessLifecycle,
|
sidefpsControllerFactory, mDisplayManager, mWakefulnessLifecycle,
|
||||||
mUserManager, mLockPatternUtils, statusBarStateController, mHandler);
|
mUserManager, mLockPatternUtils, statusBarStateController, mHandler,
|
||||||
|
mBackgroundExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AuthDialog buildDialog(PromptInfo promptInfo,
|
protected AuthDialog buildDialog(DelayableExecutor bgExecutor, PromptInfo promptInfo,
|
||||||
boolean requireConfirmation, int userId, int[] sensorIds,
|
boolean requireConfirmation, int userId, int[] sensorIds,
|
||||||
String opPackageName, boolean skipIntro, long operationId, long requestId,
|
String opPackageName, boolean skipIntro, long operationId, long requestId,
|
||||||
@BiometricManager.BiometricMultiSensorMode int multiSensorConfig,
|
@BiometricManager.BiometricMultiSensorMode int multiSensorConfig,
|
||||||
|
|||||||
Reference in New Issue
Block a user