20251105在荣品RD-RK3588-MID开发板的Android13系统的导航栏左右两边增加音量+-按钮
2025/11/4 20:51
缘起:有同事需要给MID的Android13系统的导航栏左右两边增加音量+-按钮。
开干吧!
RK3588/RK3566的Android13,在 最下面的菜单栏 左右 想显示 音量 + - 快捷键。【我司没有 物理音量+-按键】请问如何配置?
Android13 rk sdk默认没有配置的;你这边可以参考网上的一些教程配置
这个是这边之前给客户做过配置,你可以参考一下
你们 PRO-RK3566的buildroot有加入QT?
加入QT之后会增加功耗吗?[疑问]
请问如何关闭QT?[破涕为笑]
默认有加入qt ,是否增加功耗未测试过,可以自行测试 ; 关闭可以看发你的buildroot 配置 搜索QT 配置项修改,注意修改完删除前面output文件中已经编译过的qt
1、增加xml格式音量+-的矢量图标:
Z:\rk-android13-20250818RD-RK3588-MID\frameworks\base\packages\SystemUI\res\drawable\ic_sysbar_volume_add_button.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="?attr/singleToneColor"
android:pathData="M3,9v6h4l5,5L12,4L7,9L3,9zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14,3.23v2.06c2.89,0.86 5,3.54 5,6.71s-2.11,5.85 -5,6.71v2.06c4.01,-0.91 7,-4.49 7,-8.77s-2.99,-7.86 -7,-8.77z"/>
</vector>
Z:\rk-android13-20250818RD-RK3588-MID\frameworks\base\packages\SystemUI\res\drawable\ic_sysbar_volume_sub_button.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="28dp"
android:height="28dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="?attr/singleToneColor"
android:pathData="M18.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM5,9v6h4l5,5V4L9,9H5z"/>
</vector>

2、音量+-的布局文件:
Z:\rk-android13-20250818RD-RK3588-MID\frameworks\base\packages\SystemUI\res\layout\volume_add.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.
-->
<com.android.systemui.navigationbar.buttons.KeyButtonView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:id="@+id/volume_add"
android:layout_width="@dimen/navigation_key_width"
android:layout_height="match_parent"
android:layout_weight="0"
systemui:keyCode="24"
android:scaleType="center"
android:paddingStart="@dimen/navigation_key_padding"
android:paddingEnd="@dimen/navigation_key_padding"
/>
Z:\rk-android13-20250818RD-RK3588-MID\frameworks\base\packages\SystemUI\res\layout\volume_sub.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.
-->
<com.android.systemui.navigationbar.buttons.KeyButtonView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:id="@+id/volume_sub"
android:layout_width="@dimen/navigation_key_width"
android:layout_height="match_parent"
android:layout_weight="0"
systemui:keyCode="25"
android:scaleType="center"
android:paddingStart="@dimen/navigation_key_padding"
android:paddingEnd="@dimen/navigation_key_padding"
/>


3、在导航栏的左右增加音量+-的图标:
Y:\MID_MX_RK3588_android13-20250818\frameworks\base\packages\SystemUI\res\values-sw600dp\config.xml
Z:\rk-android13-20250818RD-RK3588-MID\frameworks\base\packages\SystemUI\res\values-sw600dp\config.xml
<!-- Nav bar button default ordering/layout -->
<string name="config_navBarLayout" translatable="false">left;back,home,recent;right</string>
修改为:
<!-- Nav bar button default ordering/layout -->
<string name="config_navBarLayout" translatable="false">left;volume_sub,power,back,home,recent,screenshot,volume_add;right</string>
Y:\MID_MX_RK3588_android13-20250818\frameworks\base\packages\SystemUI\res\values\config.xml
Z:\rk-android13-20250818RD-RK3588-MID\frameworks\base\packages\SystemUI\res\values\config.xml
<!-- Nav bar button default ordering/layout -->
<string name="config_navBarLayout" translatable="false">left[.5W],back[1WC];home;recent[1WC],right[.5W]</string>
<string name="config_navBarLayoutQuickstep" translatable="false">back[1.7WC];home;contextual[1.7WC]</string>
<string name="config_navBarLayoutHandle" translatable="false">back[70AC];home_handle;ime_switcher[70AC]</string>
修改为:
<!-- Nav bar button default ordering/layout -->
<string name="config_navBarLayout" translatable="false">left[.5W];volume_sub,power,back,home,recent,screenshot,volume_add;right[.5W]</string>
<string name="config_navBarLayoutQuickstep" translatable="false">back[1.7WC];home;contextual[1.7WC]</string>
<string name="config_navBarLayoutHandle" translatable="false">back[70AC];home_handle;ime_switcher[70AC]</string>



4、响应截图按钮的点击:
Y:\MID_MX_RK3588_android13-20250818\frameworks\base\packages\SystemUI\src\com\android\systemui\navigationbar\NavigationBarInflaterView.java
Z:\rk-android13-20250818RD-RK3588-MID\frameworks\base\packages\SystemUI\src\com\android\systemui\navigationbar\NavigationBarInflaterView.java
public static final String MENU_IME_ROTATE = "menu_ime";
public static final String BACK = "back";
public static final String HOME = "home";
public static final String RECENT = "recent";
public static final String NAVSPACE = "space";
public static final String CLIPBOARD = "clipboard";
public static final String HOME_HANDLE = "home_handle";
public static final String KEY = "key";
public static final String LEFT = "left";
public static final String RIGHT = "right";
public static final String CONTEXTUAL = "contextual";
public static final String IME_SWITCHER = "ime_switcher";
public static final String VOLUME_ADD = "volume_add";
public static final String VOLUME_SUB = "volume_sub";
public static final String POWER = "power";


View createView(String buttonSpec, ViewGroup parent, LayoutInflater inflater) {
View v = null;
String button = extractButton(buttonSpec);
if (LEFT.equals(button)) {
button = extractButton(NAVSPACE);
} else if (RIGHT.equals(button)) {
button = extractButton(MENU_IME_ROTATE);
}
if (HOME.equals(button)) {
v = inflater.inflate(R.layout.home, parent, false);
} else if (BACK.equals(button)) {
v = inflater.inflate(R.layout.back, parent, false);
} else if (RECENT.equals(button)) {
v = inflater.inflate(R.layout.recent_apps, parent, false);
} else if (MENU_IME_ROTATE.equals(button)) {
v = inflater.inflate(R.layout.menu_ime, parent, false);
} else if (NAVSPACE.equals(button)) {
v = inflater.inflate(R.layout.nav_key_space, parent, false);
} else if (CLIPBOARD.equals(button)) {
v = inflater.inflate(R.layout.clipboard, parent, false);
} else if (CONTEXTUAL.equals(button)) {
v = inflater.inflate(R.layout.contextual, parent, false);
} else if (HOME_HANDLE.equals(button)) {
v = inflater.inflate(R.layout.home_handle, parent, false);
} else if (IME_SWITCHER.equals(button)) {
v = inflater.inflate(R.layout.ime_switcher, parent, false);
} else if (VOLUME_ADD.equals(button)) {
v = inflater.inflate(R.layout.volume_add, parent, false);
} else if (VOLUME_SUB.equals(button)) {
v = inflater.inflate(R.layout.volume_sub, parent, false);
} else if (POWER.equals(button)) {
v = inflater.inflate(R.layout.power, parent, false);
} else if (button.startsWith(KEY)) {
String uri = extractImage(button);
int code = extractKeycode(button);
v = inflater.inflate(R.layout.custom_key, parent, false);
((KeyButtonView) v).setCode(code);
if (uri != null) {
if (uri.contains(":")) {
((KeyButtonView) v).loadAsync(Icon.createWithContentUri(uri));
} else if (uri.contains("/")) {
int index = uri.indexOf('/');
String pkg = uri.substring(0, index);
int id = Integer.parseInt(uri.substring(index + 1));
((KeyButtonView) v).loadAsync(Icon.createWithResource(pkg, id));
}
}
}
return v;
}


5、响应截图按钮的点击:
Y:\MID_MX_RK3588_android13-20250818\frameworks\base\packages\SystemUI\src\com\android\systemui\navigationbar\NavigationBarView.java
Z:\rk-android13-20250818RD-RK3588-MID\frameworks\base\packages\SystemUI\src\com\android\systemui\navigationbar\NavigationBarView.java
private KeyButtonDrawable mBackIcon;
private KeyButtonDrawable mHomeDefaultIcon;
private KeyButtonDrawable mRecentIcon;
private KeyButtonDrawable mDockedIcon;
private KeyButtonDrawable mVolumeAddIcon;
private KeyButtonDrawable mVolumeSubIcon;
private KeyButtonDrawable mPowerIcon;
private Context mLightContext;
private int mLightIconColor;
private int mDarkIconColor;

public NavigationBarView(Context context, AttributeSet attrs) {
super(context, attrs);
final Context darkContext = new ContextThemeWrapper(context,
Utils.getThemeAttr(context, R.attr.darkIconTheme));
mLightContext = new ContextThemeWrapper(context,
Utils.getThemeAttr(context, R.attr.lightIconTheme));
mLightIconColor = Utils.getColorAttrDefaultColor(mLightContext, R.attr.singleToneColor);
mDarkIconColor = Utils.getColorAttrDefaultColor(darkContext, R.attr.singleToneColor);
mIsVertical = false;
mLongClickableAccessibilityButton = false;
// Set up the context group of buttons
mContextualButtonGroup = new ContextualButtonGroup(R.id.menu_container);
final ContextualButton imeSwitcherButton = new ContextualButton(R.id.ime_switcher,
mLightContext, R.drawable.ic_ime_switcher_default);
final ContextualButton accessibilityButton =
new ContextualButton(R.id.accessibility_button, mLightContext,
R.drawable.ic_sysbar_accessibility_button);
mContextualButtonGroup.addButton(imeSwitcherButton);
mContextualButtonGroup.addButton(accessibilityButton);
mRotationContextButton = new RotationContextButton(R.id.rotate_suggestion,
mLightContext, R.drawable.ic_sysbar_rotate_button_ccw_start_0);
mFloatingRotationButton = new FloatingRotationButton(mContext,
R.string.accessibility_rotate_button,
R.layout.rotate_suggestion,
R.id.rotate_suggestion,
R.dimen.floating_rotation_button_min_margin,
R.dimen.rounded_corner_content_padding,
R.dimen.floating_rotation_button_taskbar_left_margin,
R.dimen.floating_rotation_button_taskbar_bottom_margin,
R.dimen.floating_rotation_button_diameter,
R.dimen.key_button_ripple_max_width,
R.bool.floating_rotation_button_position_left);
mRotationButtonController = new RotationButtonController(mLightContext, mLightIconColor,
mDarkIconColor, R.drawable.ic_sysbar_rotate_button_ccw_start_0,
R.drawable.ic_sysbar_rotate_button_ccw_start_90,
R.drawable.ic_sysbar_rotate_button_cw_start_0,
R.drawable.ic_sysbar_rotate_button_cw_start_90,
() -> mCurrentRotation);
mConfiguration = new Configuration();
mTmpLastConfiguration = new Configuration();
mConfiguration.updateFrom(context.getResources().getConfiguration());
mScreenPinningNotify = new ScreenPinningNotify(mContext);
mButtonDispatchers.put(R.id.back, new ButtonDispatcher(R.id.back));
mButtonDispatchers.put(R.id.home, new ButtonDispatcher(R.id.home));
mButtonDispatchers.put(R.id.home_handle, new ButtonDispatcher(R.id.home_handle));
mButtonDispatchers.put(R.id.recent_apps, new ButtonDispatcher(R.id.recent_apps));
mButtonDispatchers.put(R.id.ime_switcher, imeSwitcherButton);
mButtonDispatchers.put(R.id.accessibility_button, accessibilityButton);
mButtonDispatchers.put(R.id.menu_container, mContextualButtonGroup);
mButtonDispatchers.put(R.id.volume_add, new ButtonDispatcher(R.id.volume_add));
mButtonDispatchers.put(R.id.volume_sub, new ButtonDispatcher(R.id.volume_sub));
mButtonDispatchers.put(R.id.power, new ButtonDispatcher(R.id.power));
mDeadZone = new DeadZone(this);
}

public ButtonDispatcher getAccessibilityButton() {
return mButtonDispatchers.get(R.id.accessibility_button);
}
public ButtonDispatcher getVolumeAddButton() {
return mButtonDispatchers.get(R.id.volume_add);
}
public ButtonDispatcher getVolumeSubButton() {
return mButtonDispatchers.get(R.id.volume_sub);
}
public ButtonDispatcher getPowerButton() {
return mButtonDispatchers.get(R.id.power);
}
public RotationContextButton getRotateSuggestionButton() {
return (RotationContextButton) mButtonDispatchers.get(R.id.rotate_suggestion);
}

private void updateIcons(Configuration oldConfig) {
final boolean orientationChange = oldConfig.orientation != mConfiguration.orientation;
final boolean densityChange = oldConfig.densityDpi != mConfiguration.densityDpi;
final boolean dirChange = oldConfig.getLayoutDirection() != mConfiguration.getLayoutDirection();
if (orientationChange || densityChange) {
mDockedIcon = getDrawable(R.drawable.ic_sysbar_docked);
mHomeDefaultIcon = getHomeDrawable();
}
if (densityChange || dirChange) {
mRecentIcon = getDrawable(R.drawable.ic_sysbar_recent);
mContextualButtonGroup.updateIcons(mLightIconColor, mDarkIconColor);
}
if (orientationChange || densityChange || dirChange) {
mBackIcon = getBackDrawable();
}
mVolumeAddIcon = getDrawable(R.drawable.ic_sysbar_volume_add_button);
mVolumeSubIcon = getDrawable(R.drawable.ic_sysbar_volume_sub_button);
mPowerIcon = getDrawable(R.drawable.ic_power);
}

public void updateNavButtonIcons() {
// We have to replace or restore the back and home button icons when exiting or entering
// carmode, respectively. Recents are not available in CarMode in nav bar so change
// to recent icon is not required.
final boolean useAltBack =
(mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0;
KeyButtonDrawable backIcon = mBackIcon;
orientBackButton(backIcon);
KeyButtonDrawable homeIcon = mHomeDefaultIcon;
if (!mUseCarModeUi) {
orientHomeButton(homeIcon);
}
getHomeButton().setImageDrawable(homeIcon);
getBackButton().setImageDrawable(backIcon);
getVolumeAddButton().setImageDrawable(mVolumeAddIcon);
getVolumeSubButton().setImageDrawable(mVolumeSubIcon);
getPowerButton().setImageDrawable(mPowerIcon);
updateRecentsIcon();
// Update IME button visibility, a11y and rotate button always overrides the appearance
boolean disableImeSwitcher =
(mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_SHOWN) == 0
|| isImeRenderingNavButtons();
mContextualButtonGroup.setButtonVisibility(R.id.ime_switcher, !disableImeSwitcher);
mBarTransitions.reapplyDarkIntensity();
boolean disableHome = isGesturalMode(mNavBarMode)
|| ((mDisabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0);
// Always disable recents when alternate car mode UI is active and for secondary displays.
boolean disableRecent = isRecentsButtonDisabled();
// Disable the home handle if both hone and recents are disabled
boolean disableHomeHandle = disableRecent
&& ((mDisabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0);
boolean disableBack = !useAltBack && (mEdgeBackGestureHandler.isHandlingGestures()
|| ((mDisabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0))
|| isImeRenderingNavButtons();
// When screen pinning, don't hide back and home when connected service or back and
// recents buttons when disconnected from launcher service in screen pinning mode,
// as they are used for exiting.
if (mOverviewProxyEnabled) {
// Force disable recents when not in legacy mode
disableRecent |= !QuickStepContract.isLegacyMode(mNavBarMode);
if (mScreenPinningActive && !QuickStepContract.isGesturalMode(mNavBarMode)) {
disableBack = disableHome = false;
}
} else if (mScreenPinningActive) {
disableBack = disableRecent = false;
}
ViewGroup navButtons = getCurrentView().findViewById(R.id.nav_buttons);
if (navButtons != null) {
LayoutTransition lt = navButtons.getLayoutTransition();
if (lt != null) {
if (!lt.getTransitionListeners().contains(mTransitionListener)) {
lt.addTransitionListener(mTransitionListener);
}
}
}
getBackButton().setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
getHomeButton().setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
getHomeHandle().setVisibility(disableHomeHandle ? View.INVISIBLE : View.VISIBLE);
notifyActiveTouchRegions();
}

效果图:

参考资料:
【这个会多一点】
https://blog.csdn.net/wzh048503/article/details/140020452
Android13系统导航栏添加音量加减键按钮功能
0001-custom-navigationbar-add-volume-button.patch
From 0b025933ed06b14e6eb5db5fd5183b108cd4d6d6 Mon Sep 17 00:00:00 2001
From: liyj <976704119@qq.com>
Date: Wed, 4 Jun 2025 11:30:17 +0800
Subject: [PATCH 1/2] custom: navigationbar add volume+- button
.../drawable/ic_sysbar_volume_add_button.xml | 9 ++++++
.../drawable/ic_sysbar_volume_sub_button.xml | 9 ++++++
.../SystemUI/res/layout/volume_add.xml | 28 +++++++++++++++++++
.../SystemUI/res/layout/volume_sub.xml | 28 +++++++++++++++++++
.../SystemUI/res/values-sw600dp/config.xml | 2 +-
.../packages/SystemUI/res/values/config.xml | 2 +-
.../NavigationBarInflaterView.java | 6 ++++
.../navigationbar/NavigationBarView.java | 17 +++++++++++
8 files changed, 99 insertions(+), 2 deletions(-)
create mode 100755 frameworks/base/packages/SystemUI/res/drawable/ic_sysbar_volume_add_button.xml
create mode 100755 frameworks/base/packages/SystemUI/res/drawable/ic_sysbar_volume_sub_button.xml
create mode 100755 frameworks/base/packages/SystemUI/res/layout/volume_add.xml
create mode 100755 frameworks/base/packages/SystemUI/res/layout/volume_sub.xml
diff --git a/frameworks/base/packages/SystemUI/res/drawable/ic_sysbar_volume_add_button.xml b/frameworks/base/packages/SystemUI/res/drawable/ic_sysbar_volume_add_button.xml
new file mode 100755
index 0000000000..76a145eff0
--- /dev/null
+++ b/frameworks/base/packages/SystemUI/res/drawable/ic_sysbar_volume_add_button.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
-
android:width="24dp"
-
android:height="24dp"
-
android:viewportWidth="24.0"
-
android:viewportHeight="24.0">
-
<path
-
android:fillColor="?attr/singleToneColor"
-
android:pathData="M3,9v6h4l5,5L12,4L7,9L3,9zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14,3.23v2.06c2.89,0.86 5,3.54 5,6.71s-2.11,5.85 -5,6.71v2.06c4.01,-0.91 7,-4.49 7,-8.77s-2.99,-7.86 -7,-8.77z"/>
+</vector>
diff --git a/frameworks/base/packages/SystemUI/res/drawable/ic_sysbar_volume_sub_button.xml b/frameworks/base/packages/SystemUI/res/drawable/ic_sysbar_volume_sub_button.xml
new file mode 100755
index 0000000000..69d86071ce
--- /dev/null
+++ b/frameworks/base/packages/SystemUI/res/drawable/ic_sysbar_volume_sub_button.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
-
android:width="28dp"
-
android:height="28dp"
-
android:viewportWidth="24.0"
-
android:viewportHeight="24.0">
-
<path
-
android:fillColor="?attr/singleToneColor"
-
android:pathData="M18.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM5,9v6h4l5,5V4L9,9H5z"/>
+</vector>
diff --git a/frameworks/base/packages/SystemUI/res/layout/volume_add.xml b/frameworks/base/packages/SystemUI/res/layout/volume_add.xml
new file mode 100755
index 0000000000..882c855a3a
--- /dev/null
+++ b/frameworks/base/packages/SystemUI/res/layout/volume_add.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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
-
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.
+-->
+<com.android.systemui.navigationbar.buttons.KeyButtonView
-
xmlns:android="http://schemas.android.com/apk/res/android"
-
xmlns:systemui="http://schemas.android.com/apk/res-auto"
-
android:id="@+id/volume_add"
-
android:layout_width="@dimen/navigation_key_width"
-
android:layout_height="match_parent"
-
android:layout_weight="0"
-
systemui:keyCode="24"
-
android:scaleType="center"
-
android:paddingStart="@dimen/navigation_key_padding"
-
android:paddingEnd="@dimen/navigation_key_padding"
-
/>
diff --git a/frameworks/base/packages/SystemUI/res/layout/volume_sub.xml b/frameworks/base/packages/SystemUI/res/layout/volume_sub.xml
new file mode 100755
index 0000000000..4b687bd520
--- /dev/null
+++ b/frameworks/base/packages/SystemUI/res/layout/volume_sub.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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
-
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.
+-->
+<com.android.systemui.navigationbar.buttons.KeyButtonView
-
xmlns:android="http://schemas.android.com/apk/res/android"
-
xmlns:systemui="http://schemas.android.com/apk/res-auto"
-
android:id="@+id/volume_sub"
-
android:layout_width="@dimen/navigation_key_width"
-
android:layout_height="match_parent"
-
android:layout_weight="0"
-
systemui:keyCode="25"
-
android:scaleType="center"
-
android:paddingStart="@dimen/navigation_key_padding"
-
android:paddingEnd="@dimen/navigation_key_padding"
-
/>
diff --git a/frameworks/base/packages/SystemUI/res/values-sw600dp/config.xml b/frameworks/base/packages/SystemUI/res/values-sw600dp/config.xml
index ea3c012afc..c07b00f744 100644
--- a/frameworks/base/packages/SystemUI/res/values-sw600dp/config.xml
+++ b/frameworks/base/packages/SystemUI/res/values-sw600dp/config.xml
@@ -27,7 +27,7 @@
<bool name="config_quickSettingsMediaLandscapeCollapsed">false</bool>
<!-- Nav bar button default ordering/layout -->
- <string name="config_navBarLayout" translatable="false">left;back,home,recent;right</string>
- <string name="config_navBarLayout" translatable="false">left;volume_sub,back,home,recent,volume_add;right</string>
<!-- orientation of the dead zone when touches have recently occurred elsewhere on screen -->
<integer name="navigation_bar_deadzone_orientation">0</integer>
diff --git a/frameworks/base/packages/SystemUI/res/values/config.xml b/frameworks/base/packages/SystemUI/res/values/config.xml
index 9fae4d3e08..9ab93da3cb 100644
--- a/frameworks/base/packages/SystemUI/res/values/config.xml
+++ b/frameworks/base/packages/SystemUI/res/values/config.xml
@@ -301,7 +301,7 @@
</string-array>
<!-- Nav bar button default ordering/layout -->
- <string name="config_navBarLayout" translatable="false">left[.5W],back[1WC];home;recent[1WC],right[.5W]</string>
- <string name="config_navBarLayout" translatable="false">left[.5W];volume_sub,back,home,recent,volume_add;right[.5W]</string>
<string name="config_navBarLayoutQuickstep" translatable="false">back[1.7WC];home;contextual[1.7WC]</string>
<string name="config_navBarLayoutHandle" translatable="false">back[70AC];home_handle;ime_switcher[70AC]</string>
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
index 59bb2278ed..01480ae42e 100644
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
@@ -68,6 +68,8 @@ public class NavigationBarInflaterView extends FrameLayout
public static final String RIGHT = "right";
public static final String CONTEXTUAL = "contextual";
public static final String IME_SWITCHER = "ime_switcher";
-
public static final String VOLUME_ADD = "volume_add";
-
public static final String VOLUME_SUB = "volume_sub";
public static final String GRAVITY_SEPARATOR = ";";
public static final String BUTTON_SEPARATOR = ",";
@@ -387,6 +389,10 @@ public class NavigationBarInflaterView extends FrameLayout
v = inflater.inflate(R.layout.home_handle, parent, false);
} else if (IME_SWITCHER.equals(button)) {
v = inflater.inflate(R.layout.ime_switcher, parent, false);
-
} else if (VOLUME_ADD.equals(button)) {
-
v = inflater.inflate(R.layout.volume_add, parent, false);
-
} else if (VOLUME_SUB.equals(button)) {
-
v = inflater.inflate(R.layout.volume_sub, parent, false);
} else if (button.startsWith(KEY)) {
String uri = extractImage(button);
int code = extractKeycode(button);
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
index 5d598e8dc7..8287f03d6a 100644
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
@@ -119,6 +119,8 @@ public class NavigationBarView extends FrameLayout {
private KeyButtonDrawable mHomeDefaultIcon;
private KeyButtonDrawable mRecentIcon;
private KeyButtonDrawable mDockedIcon;
-
private KeyButtonDrawable mVolumeAddIcon;
-
private KeyButtonDrawable mVolumeSubIcon;
private Context mLightContext;
private int mLightIconColor;
private int mDarkIconColor;
@@ -323,6 +325,8 @@ public class NavigationBarView extends FrameLayout {
mButtonDispatchers.put(R.id.ime_switcher, imeSwitcherButton);
mButtonDispatchers.put(R.id.accessibility_button, accessibilityButton);
mButtonDispatchers.put(R.id.menu_container, mContextualButtonGroup);
-
mButtonDispatchers.put(R.id.volume_add, new ButtonDispatcher(R.id.volume_add));
-
mButtonDispatchers.put(R.id.volume_sub, new ButtonDispatcher(R.id.volume_sub));
mDeadZone = new DeadZone(this);
}
@@ -427,6 +431,14 @@ public class NavigationBarView extends FrameLayout {
return mButtonDispatchers.get(R.id.accessibility_button);
}
-
public ButtonDispatcher getVolumeAddButton() {
-
return mButtonDispatchers.get(R.id.volume_add);
-
}
-
public ButtonDispatcher getVolumeSubButton() {
-
return mButtonDispatchers.get(R.id.volume_sub);
-
}
public RotationContextButton getRotateSuggestionButton() {
return (RotationContextButton) mButtonDispatchers.get(R.id.rotate_suggestion);
}
@@ -471,6 +483,9 @@ public class NavigationBarView extends FrameLayout {
if (orientationChange || densityChange || dirChange) {
mBackIcon = getBackDrawable();
}
-
mVolumeAddIcon = getDrawable(R.drawable.ic_sysbar_volume_add_button);
-
mVolumeSubIcon = getDrawable(R.drawable.ic_sysbar_volume_sub_button);
}
/**
@@ -615,6 +630,8 @@ public class NavigationBarView extends FrameLayout {
}
getHomeButton().setImageDrawable(homeIcon);
getBackButton().setImageDrawable(backIcon);
-
getVolumeAddButton().setImageDrawable(mVolumeAddIcon);
-
getVolumeSubButton().setImageDrawable(mVolumeSubIcon);
updateRecentsIcon();
--
2.25.1