summaryrefslogtreecommitdiff
path: root/packages/CarSystemUI/src
diff options
context:
space:
mode:
authorYoungjun Kwak <kwaky@google.com>2020-06-12 22:58:25 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-06-12 22:58:25 +0000
commitd42606d7c4578771e46cd678d99008eb6531977c (patch)
treec505afa337fb6d3de7da49c86795ca84706c9af2 /packages/CarSystemUI/src
parent38694c298c94f8b5d1e9dbbea36371acfdaf28ea (diff)
parent12930e8ddce8620923ec6d887a3bc355fa4b2240 (diff)
Merge "Hide UserSwitchTransitionView if it is not hidden within timeout." into rvc-dev
Diffstat (limited to 'packages/CarSystemUI/src')
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/userswitcher/UserSwitchTransitionViewController.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/packages/CarSystemUI/src/com/android/systemui/car/userswitcher/UserSwitchTransitionViewController.java b/packages/CarSystemUI/src/com/android/systemui/car/userswitcher/UserSwitchTransitionViewController.java
index 8aa7b6389d85..45f3d342fb6e 100644
--- a/packages/CarSystemUI/src/com/android/systemui/car/userswitcher/UserSwitchTransitionViewController.java
+++ b/packages/CarSystemUI/src/com/android/systemui/car/userswitcher/UserSwitchTransitionViewController.java
@@ -33,6 +33,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.settingslib.drawable.CircleFramedDrawable;
import com.android.systemui.R;
import com.android.systemui.car.window.OverlayViewController;
@@ -49,12 +50,22 @@ import javax.inject.Singleton;
public class UserSwitchTransitionViewController extends OverlayViewController {
private static final String TAG = "UserSwitchTransition";
private static final String ENABLE_DEVELOPER_MESSAGE_TRUE = "true";
+ private static final boolean DEBUG = false;
private final Context mContext;
private final Handler mHandler;
private final Resources mResources;
private final UserManager mUserManager;
private final IWindowManager mWindowManagerService;
+ private final int mWindowShownTimeoutMs;
+ private final Runnable mWindowShownTimeoutCallback = () -> {
+ if (DEBUG) {
+ Log.w(TAG, "Window was not hidden within " + getWindowShownTimeoutMs() + " ms, so it"
+ + "was hidden by mWindowShownTimeoutCallback.");
+ }
+
+ handleHide();
+ };
@GuardedBy("this")
private boolean mShowing;
@@ -76,6 +87,8 @@ public class UserSwitchTransitionViewController extends OverlayViewController {
mResources = resources;
mUserManager = userManager;
mWindowManagerService = windowManagerService;
+ mWindowShownTimeoutMs = mResources.getInteger(
+ R.integer.config_userSwitchTransitionViewShownTimeoutMs);
}
/**
@@ -98,6 +111,9 @@ public class UserSwitchTransitionViewController extends OverlayViewController {
populateDialog(mPreviousUserId, newUserId);
// next time a new user is selected, this current new user will be the previous user.
mPreviousUserId = newUserId;
+ // In case the window is still showing after WINDOW_SHOWN_TIMEOUT_MS, then hide the
+ // window and log a warning message.
+ mHandler.postDelayed(mWindowShownTimeoutCallback, mWindowShownTimeoutMs);
});
}
@@ -105,6 +121,12 @@ public class UserSwitchTransitionViewController extends OverlayViewController {
if (!mShowing) return;
mShowing = false;
mHandler.post(this::stop);
+ mHandler.removeCallbacks(mWindowShownTimeoutCallback);
+ }
+
+ @VisibleForTesting
+ int getWindowShownTimeoutMs() {
+ return mWindowShownTimeoutMs;
}
private void populateDialog(@UserIdInt int previousUserId, @UserIdInt int newUserId) {