Fixed UserSwitchingDialog theme.

It didn't set windowAnimationStyle, and hence
ViewTreeObserver.OnWindowShownListener.onWindowShown() was never called.

Fixes: 145021634
Bug: 145211062
Test: manual verification switching users

Change-Id: I7f995dbe21922422f678f460d69fa37a3b4357d1
(cherry picked from commit 2a30fe59626060277398f93aaf754a12b873d7d0)
This commit is contained in:
Felipe Leme
2019-11-26 10:22:56 -08:00
parent 141ffdc564
commit ee02c4258f
3 changed files with 4 additions and 4 deletions

View File

@@ -1733,6 +1733,7 @@ easier.
<item name="colorBackground">@color/background_device_default_light</item>
<item name="colorBackgroundFloating">@color/background_device_default_light</item>
<item name="layout_gravity">center</item>
<item name="windowAnimationStyle">@style/Animation.DeviceDefault.Dialog</item>
</style>
<style name="Theme.DeviceDefault.Notification" parent="@style/Theme.Material.Notification">

View File

@@ -66,9 +66,7 @@ final class CarUserSwitchingDialog extends UserSwitchingDialog {
setCancelable(false);
Resources res = getContext().getResources();
// Custom view due to alignment and font size requirements
// TODO (b/145021634): disabled because it's delaying user switch by 3 seconds
// getContext()
// .setTheme(R.style.Theme_DeviceDefault_Light_Dialog_Alert_UserSwitchingDialog);
getContext().setTheme(R.style.Theme_DeviceDefault_Light_Dialog_Alert_UserSwitchingDialog);
View view = LayoutInflater.from(getContext()).inflate(
R.layout.car_user_switching_dialog,
null);

View File

@@ -47,7 +47,8 @@ class UserSwitchingDialog extends AlertDialog
// Time to wait for the onWindowShown() callback before continuing the user switch
private static final int WINDOW_SHOWN_TIMEOUT_MS = 3000;
private static final boolean DEBUG = false;
// User switching doesn't happen that frequently, so it doesn't hurt to have it always on
protected static final boolean DEBUG = true;
private final ActivityManagerService mService;
private final int mUserId;