Snap for 7519874 from a9523d6dbeb3d70535fb201a7559047d61c918e8 to sc-d1-release
Change-Id: I2a5cd4506290691a9a7a8eea88f7d8bcebde4f22
diff --git a/res/layout/car_top_system_bar.xml b/res/layout/car_top_system_bar.xml
index 408e5ea..c01132c 100644
--- a/res/layout/car_top_system_bar.xml
+++ b/res/layout/car_top_system_bar.xml
@@ -126,8 +126,8 @@
android:layout_height="match_parent"
android:gravity="center_vertical"
android:textAppearance="@style/TextAppearance.SystemBar.Username"
- android:maxLines="1"
- android:maxLength="10"
+ android:singleLine="true"
+ android:maxWidth="@dimen/car_system_bar_user_name_max_width"
android:layout_marginEnd="@dimen/system_bar_user_icon_padding"
/>
</LinearLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 66b39f5..b17016f 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -210,6 +210,7 @@
<dimen name="car_system_bar_button_width">64dp</dimen>
<dimen name="car_system_bar_button_icon_height">44dp</dimen>
<dimen name="car_system_bar_width">760dp</dimen>
+ <dimen name="car_system_bar_user_name_max_width">176dp</dimen>
<dimen name="car_left_system_bar_width">96dp</dimen>
<dimen name="car_right_system_bar_width">96dp</dimen>
<!-- In order to change the height of the bottom nav bar, overlay system_bar_height in
diff --git a/res/values/overlayable.xml b/res/values/overlayable.xml
index 4135352..e13c34f 100644
--- a/res/values/overlayable.xml
+++ b/res/values/overlayable.xml
@@ -137,6 +137,7 @@
<item type="dimen" name="car_right_system_bar_width"/>
<item type="dimen" name="car_system_bar_button_icon_height"/>
<item type="dimen" name="car_system_bar_button_width"/>
+ <item type="dimen" name="car_system_bar_user_name_max_width"/>
<item type="dimen" name="car_system_bar_width"/>
<item type="dimen" name="car_title2_size"/>
<item type="dimen" name="car_title_size"/>
diff --git a/src/com/android/systemui/car/systembar/CarSystemBarView.java b/src/com/android/systemui/car/systembar/CarSystemBarView.java
index 8ac35c6..3936d0a 100644
--- a/src/com/android/systemui/car/systembar/CarSystemBarView.java
+++ b/src/com/android/systemui/car/systembar/CarSystemBarView.java
@@ -23,9 +23,9 @@
import android.view.View;
import android.widget.LinearLayout;
-import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.car.systembar.CarSystemBarController.NotificationsShadeController;
+import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.phone.StatusBarIconController;
import java.lang.annotation.ElementType;
@@ -75,20 +75,23 @@
if (mNotificationsButton != null) {
mNotificationsButton.setOnClickListener(this::onNotificationsClick);
}
+ // Needs to be clickable so that it will receive ACTION_MOVE events.
+ setClickable(true);
+ // Needs to not be focusable so rotary won't highlight the entire nav bar.
+ setFocusable(false);
+ }
+
+ void setupIconController(FeatureFlags featureFlags, StatusBarIconController iconController) {
View mStatusIcons = findViewById(R.id.statusIcons);
if (mStatusIcons != null) {
// Attach the controllers for Status icons such as wifi and bluetooth if the standard
// container is in the view.
StatusBarIconController.DarkIconManager mDarkIconManager =
new StatusBarIconController.DarkIconManager(
- mStatusIcons.findViewById(R.id.statusIcons));
+ mStatusIcons.findViewById(R.id.statusIcons), featureFlags);
mDarkIconManager.setShouldLog(true);
- Dependency.get(StatusBarIconController.class).addIconGroup(mDarkIconManager);
+ iconController.addIconGroup(mDarkIconManager);
}
- // Needs to be clickable so that it will receive ACTION_MOVE events.
- setClickable(true);
- // Needs to not be focusable so rotary won't highlight the entire nav bar.
- setFocusable(false);
}
// Used to forward touch events even if the touch was initiated from a child component
diff --git a/src/com/android/systemui/car/systembar/CarSystemBarViewFactory.java b/src/com/android/systemui/car/systembar/CarSystemBarViewFactory.java
index 2478710..ea7acf5 100644
--- a/src/com/android/systemui/car/systembar/CarSystemBarViewFactory.java
+++ b/src/com/android/systemui/car/systembar/CarSystemBarViewFactory.java
@@ -27,6 +27,8 @@
import com.android.car.ui.FocusParkingView;
import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton;
+import com.android.systemui.statusbar.FeatureFlags;
+import com.android.systemui.statusbar.phone.StatusBarIconController;
import javax.inject.Inject;
@@ -54,6 +56,8 @@
private final ArrayMap<Type, CarSystemBarView> mCachedViewMap = new ArrayMap<>(
Type.values().length);
private final ArrayMap<Type, ViewGroup> mCachedContainerMap = new ArrayMap<>();
+ private final FeatureFlags mFeatureFlags;
+ private final StatusBarIconController mIconController;
/** Type of navigation bar to be created. */
private enum Type {
@@ -68,8 +72,14 @@
}
@Inject
- public CarSystemBarViewFactory(Context context) {
+ public CarSystemBarViewFactory(
+ Context context,
+ FeatureFlags featureFlags,
+ StatusBarIconController iconController
+ ) {
mContext = context;
+ mFeatureFlags = featureFlags;
+ mIconController = iconController;
}
/** Gets the top window. */
@@ -148,6 +158,8 @@
CarSystemBarView view = (CarSystemBarView) View.inflate(mContext, barLayout,
/* root= */ null);
+ view.setupIconController(mFeatureFlags, mIconController);
+
// Include a FocusParkingView at the beginning. The rotary controller "parks" the focus here
// when the user navigates to another window. This is also used to prevent wrap-around.
view.addView(new FocusParkingView(mContext), 0);
diff --git a/tests/src/com/android/systemui/car/systembar/CarSystemBarControllerTest.java b/tests/src/com/android/systemui/car/systembar/CarSystemBarControllerTest.java
index afe0fa8..80df675 100644
--- a/tests/src/com/android/systemui/car/systembar/CarSystemBarControllerTest.java
+++ b/tests/src/com/android/systemui/car/systembar/CarSystemBarControllerTest.java
@@ -35,6 +35,7 @@
import com.android.systemui.car.hvac.HvacController;
import com.android.systemui.car.statusbar.UserNameViewController;
import com.android.systemui.plugins.DarkIconDispatcher;
+import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.phone.StatusBarIconController;
import org.junit.Before;
@@ -67,11 +68,16 @@
private UserNameViewController mUserNameViewController;
@Mock
private PrivacyChipViewController mPrivacyChipViewController;
+ @Mock
+ private FeatureFlags mFeatureFlags;
+ @Mock
+ private StatusBarIconController mIconController;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- mCarSystemBarViewFactory = new CarSystemBarViewFactory(mContext);
+ mCarSystemBarViewFactory = new CarSystemBarViewFactory(
+ mContext, mFeatureFlags, mIconController);
mTestableResources = mContext.getOrCreateTestableResources();
// Needed to inflate top navigation bar.