Loading packages/SystemUI/res/values/config_car.xml +1 −0 Original line number Diff line number Diff line Loading @@ -27,4 +27,5 @@ <bool name="config_enableLeftNavigationBar">false</bool> <bool name="config_enableRightNavigationBar">false</bool> <bool name="config_enableBottomNavigationBar">true</bool> <bool name="config_hideNavWhenKeyguardBouncerShown">true</bool> </resources> packages/SystemUI/res/values/ids_car.xml 0 → 100644 +22 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2018 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License --> <resources> <!-- Values used for finding elements on the system ui nav bars --> <item type="id" name="lock_screen_nav_buttons"/> <item type="id" name="nav_buttons"/> </resources> No newline at end of file packages/SystemUI/src/com/android/systemui/car/CarSystemUIFactory.java +12 −0 Original line number Diff line number Diff line Loading @@ -17,17 +17,29 @@ package com.android.systemui.car; import android.content.Context; import android.util.ArrayMap; import android.view.View; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.Dependency.DependencyProvider; import com.android.systemui.SystemUIFactory; import com.android.systemui.statusbar.NotificationEntryManager; import com.android.systemui.statusbar.car.CarFacetButtonController; import com.android.systemui.statusbar.car.CarStatusBar; import com.android.systemui.statusbar.car.CarStatusBarKeyguardViewManager; import com.android.systemui.statusbar.car.hvac.HvacController; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; /** * Class factory to provide car specific SystemUI components. */ public class CarSystemUIFactory extends SystemUIFactory { public StatusBarKeyguardViewManager createStatusBarKeyguardViewManager(Context context, ViewMediatorCallback viewMediatorCallback, LockPatternUtils lockPatternUtils) { return new CarStatusBarKeyguardViewManager(context, viewMediatorCallback, lockPatternUtils); } @Override public void injectDependencies(ArrayMap<Object, DependencyProvider> providers, Context context) { Loading packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButtonController.java +30 −22 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.view.Display; import android.view.View; import java.util.HashMap; import java.util.List; Loading Loading @@ -73,19 +74,27 @@ public class CarFacetButtonController { */ public void taskChanged(List<ActivityManager.StackInfo> stackInfoList) { int displayId = getDisplayId(); ActivityManager.StackInfo validStackInfo = null; for (ActivityManager.StackInfo stackInfo :stackInfoList) { // if the display id is known and does not match the stack we skip if (displayId != -1 && displayId != stackInfo.displayId || stackInfo.topActivity == null) { continue; // If the display id is unknown or it matches the stack, it's valid for use if ((displayId == -1 || displayId == stackInfo.displayId) && stackInfo.topActivity != null) { validStackInfo = stackInfo; break; } } if (validStackInfo == null) { // No stack was found that was on the same display as the facet buttons thus return return; } if (mSelectedFacetButton != null) { mSelectedFacetButton.setSelected(false); } String packageName = stackInfo.topActivity.getPackageName(); CarFacetButton facetButton = findFacetButtongByComponentName(stackInfo.topActivity); String packageName = validStackInfo.topActivity.getPackageName(); CarFacetButton facetButton = findFacetButtongByComponentName(validStackInfo.topActivity); if (facetButton == null) { facetButton = mButtonsByPackage.get(packageName); } Loading @@ -97,12 +106,11 @@ public class CarFacetButtonController { } } if (facetButton != null) { if (facetButton != null && facetButton.getVisibility() == View.VISIBLE) { facetButton.setSelected(true); mSelectedFacetButton = facetButton; return; } } } private int getDisplayId() { Loading packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java +27 −1 Original line number Diff line number Diff line Loading @@ -36,10 +36,11 @@ import com.android.systemui.statusbar.phone.StatusBarIconController; * in a linear layout. */ class CarNavigationBarView extends LinearLayout { private LinearLayout mNavButtons; private View mNavButtons; private AlphaOptimizedImageButton mNotificationsButton; private CarStatusBar mCarStatusBar; private Context mContext; private View mLockScreenButtons; public CarNavigationBarView(Context context, AttributeSet attrs) { super(context, attrs); Loading @@ -49,6 +50,7 @@ class CarNavigationBarView extends LinearLayout { @Override public void onFinishInflate() { mNavButtons = findViewById(R.id.nav_buttons); mLockScreenButtons = findViewById(R.id.lock_screen_nav_buttons); mNotificationsButton = findViewById(R.id.notifications); if (mNotificationsButton != null) { Loading @@ -74,4 +76,28 @@ class CarNavigationBarView extends LinearLayout { protected void onNotificationsClick(View v) { mCarStatusBar.togglePanel(); } /** * If there are buttons declared in the layout they will be shown and the normal * Nav buttons will be hidden. */ public void showKeyguardButtons() { if (mLockScreenButtons == null) { return; } mLockScreenButtons.setVisibility(View.VISIBLE); mNavButtons.setVisibility(View.GONE); } /** * If there are buttons declared in the layout they will be hidden and the normal * Nav buttons will be shown. */ public void hideKeyguardButtons() { if (mLockScreenButtons == null) { return; } mNavButtons.setVisibility(View.VISIBLE); mLockScreenButtons.setVisibility(View.GONE); } } Loading
packages/SystemUI/res/values/config_car.xml +1 −0 Original line number Diff line number Diff line Loading @@ -27,4 +27,5 @@ <bool name="config_enableLeftNavigationBar">false</bool> <bool name="config_enableRightNavigationBar">false</bool> <bool name="config_enableBottomNavigationBar">true</bool> <bool name="config_hideNavWhenKeyguardBouncerShown">true</bool> </resources>
packages/SystemUI/res/values/ids_car.xml 0 → 100644 +22 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2018 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License --> <resources> <!-- Values used for finding elements on the system ui nav bars --> <item type="id" name="lock_screen_nav_buttons"/> <item type="id" name="nav_buttons"/> </resources> No newline at end of file
packages/SystemUI/src/com/android/systemui/car/CarSystemUIFactory.java +12 −0 Original line number Diff line number Diff line Loading @@ -17,17 +17,29 @@ package com.android.systemui.car; import android.content.Context; import android.util.ArrayMap; import android.view.View; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.Dependency.DependencyProvider; import com.android.systemui.SystemUIFactory; import com.android.systemui.statusbar.NotificationEntryManager; import com.android.systemui.statusbar.car.CarFacetButtonController; import com.android.systemui.statusbar.car.CarStatusBar; import com.android.systemui.statusbar.car.CarStatusBarKeyguardViewManager; import com.android.systemui.statusbar.car.hvac.HvacController; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; /** * Class factory to provide car specific SystemUI components. */ public class CarSystemUIFactory extends SystemUIFactory { public StatusBarKeyguardViewManager createStatusBarKeyguardViewManager(Context context, ViewMediatorCallback viewMediatorCallback, LockPatternUtils lockPatternUtils) { return new CarStatusBarKeyguardViewManager(context, viewMediatorCallback, lockPatternUtils); } @Override public void injectDependencies(ArrayMap<Object, DependencyProvider> providers, Context context) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButtonController.java +30 −22 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.view.Display; import android.view.View; import java.util.HashMap; import java.util.List; Loading Loading @@ -73,19 +74,27 @@ public class CarFacetButtonController { */ public void taskChanged(List<ActivityManager.StackInfo> stackInfoList) { int displayId = getDisplayId(); ActivityManager.StackInfo validStackInfo = null; for (ActivityManager.StackInfo stackInfo :stackInfoList) { // if the display id is known and does not match the stack we skip if (displayId != -1 && displayId != stackInfo.displayId || stackInfo.topActivity == null) { continue; // If the display id is unknown or it matches the stack, it's valid for use if ((displayId == -1 || displayId == stackInfo.displayId) && stackInfo.topActivity != null) { validStackInfo = stackInfo; break; } } if (validStackInfo == null) { // No stack was found that was on the same display as the facet buttons thus return return; } if (mSelectedFacetButton != null) { mSelectedFacetButton.setSelected(false); } String packageName = stackInfo.topActivity.getPackageName(); CarFacetButton facetButton = findFacetButtongByComponentName(stackInfo.topActivity); String packageName = validStackInfo.topActivity.getPackageName(); CarFacetButton facetButton = findFacetButtongByComponentName(validStackInfo.topActivity); if (facetButton == null) { facetButton = mButtonsByPackage.get(packageName); } Loading @@ -97,12 +106,11 @@ public class CarFacetButtonController { } } if (facetButton != null) { if (facetButton != null && facetButton.getVisibility() == View.VISIBLE) { facetButton.setSelected(true); mSelectedFacetButton = facetButton; return; } } } private int getDisplayId() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java +27 −1 Original line number Diff line number Diff line Loading @@ -36,10 +36,11 @@ import com.android.systemui.statusbar.phone.StatusBarIconController; * in a linear layout. */ class CarNavigationBarView extends LinearLayout { private LinearLayout mNavButtons; private View mNavButtons; private AlphaOptimizedImageButton mNotificationsButton; private CarStatusBar mCarStatusBar; private Context mContext; private View mLockScreenButtons; public CarNavigationBarView(Context context, AttributeSet attrs) { super(context, attrs); Loading @@ -49,6 +50,7 @@ class CarNavigationBarView extends LinearLayout { @Override public void onFinishInflate() { mNavButtons = findViewById(R.id.nav_buttons); mLockScreenButtons = findViewById(R.id.lock_screen_nav_buttons); mNotificationsButton = findViewById(R.id.notifications); if (mNotificationsButton != null) { Loading @@ -74,4 +76,28 @@ class CarNavigationBarView extends LinearLayout { protected void onNotificationsClick(View v) { mCarStatusBar.togglePanel(); } /** * If there are buttons declared in the layout they will be shown and the normal * Nav buttons will be hidden. */ public void showKeyguardButtons() { if (mLockScreenButtons == null) { return; } mLockScreenButtons.setVisibility(View.VISIBLE); mNavButtons.setVisibility(View.GONE); } /** * If there are buttons declared in the layout they will be hidden and the normal * Nav buttons will be shown. */ public void hideKeyguardButtons() { if (mLockScreenButtons == null) { return; } mNavButtons.setVisibility(View.VISIBLE); mLockScreenButtons.setVisibility(View.GONE); } }