summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuncheol Heo <ycheo@google.com>2021-12-02 09:58:42 -0800
committerYuncheol Heo <ycheo@google.com>2021-12-02 19:34:10 +0000
commit56935517488b6964a9205fcc8e18a31f2db4451f (patch)
tree4fa138c2a3f56cfe3ce5eaf6bb585c85bf286a40
parent192c570e834ad5f611f9b0d9ffa8ba672aca594c (diff)
downloadCluster-56935517488b6964a9205fcc8e18a31f2db4451f.tar.gz
Ignore UserLifecyleEvent from non-current user.
Bug: 208833874 Test: switch user and change ClusterActivity. Change-Id: Id806ef6e16e16afc5bde48ee35d0b6b65caf89c6
-rw-r--r--ClusterHomeSample/src/com/android/car/cluster/home/ClusterHomeApplication.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/ClusterHomeSample/src/com/android/car/cluster/home/ClusterHomeApplication.java b/ClusterHomeSample/src/com/android/car/cluster/home/ClusterHomeApplication.java
index f37eb0e..528a0d4 100644
--- a/ClusterHomeSample/src/com/android/car/cluster/home/ClusterHomeApplication.java
+++ b/ClusterHomeSample/src/com/android/car/cluster/home/ClusterHomeApplication.java
@@ -253,6 +253,10 @@ public final class ClusterHomeApplication extends Application {
}
private final UserLifecycleListener mUserLifecycleListener = (event) -> {
+ if (DBG) Log.d(TAG, "UserLifecycleListener.onEvent: event=" + event);
+ if (event.getUserId() != ActivityManager.getCurrentUser()) {
+ return;
+ }
mUserLifeCycleEvent = event.getEventType();
if (mUserLifeCycleEvent == USER_LIFECYCLE_EVENT_TYPE_STARTING) {
startClusterActivity(UI_TYPE_HOME);
@@ -271,6 +275,7 @@ public final class ClusterHomeApplication extends Application {
};
private void onKeyEvent(KeyEvent keyEvent) {
+ if (DBG) Log.d(TAG, "onKeyEvent: " + keyEvent);
if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_MENU) {
if (keyEvent.getAction() != KeyEvent.ACTION_DOWN) return;
int nextUiType = (mLastLaunchedUiType + 1) % mUiAvailability.length;