From d9f8b1745ba8309f1d860144b8a02a833ef0b652 Mon Sep 17 00:00:00 2001 From: Yuncheol Heo Date: Wed, 8 May 2019 14:52:20 -0700 Subject: [PATCH] Workaround to make CarSystemUi work on the multiple displays. Bug: 132204986 Change-Id: I04af78bd23e1d4983845751535639587396092f5 Test: Check if the facet buttons are properly selected in the multi displays. --- .../statusbar/car/CarFacetButtonController.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButtonController.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButtonController.java index d20038db9151c..5f99e1750bb68 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButtonController.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButtonController.java @@ -22,7 +22,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; -import android.util.Log; +import android.view.Display; import android.view.View; import android.view.ViewGroup; @@ -112,9 +112,11 @@ public class CarFacetButtonController { */ public void taskChanged(List stackInfoList) { ActivityManager.StackInfo validStackInfo = null; - for (ActivityManager.StackInfo stackInfo :stackInfoList) { - // Find the first stack info with a topActivity - if (stackInfo.topActivity != null) { + for (ActivityManager.StackInfo stackInfo : stackInfoList) { + // Find the first stack info with a topActivity in the primary display. + // TODO: We assume that CarFacetButton will launch an app only in the primary display. + // We need to extend the functionality to handle the mutliple display properly. + if (stackInfo.topActivity != null && stackInfo.displayId == Display.DEFAULT_DISPLAY) { validStackInfo = stackInfo; break; }