做框图的网站,网站开发投票代码,高端摄影网站模板,网站如何添加认证联盟不知道为什么拿到芯片原厂发布给我们的Android13系统源码编译后#xff0c;导航栏没有音量加减键#xff0c;客户有反馈这个问题#xff0c;所以特意加了一下#xff0c;修改记录如下#xff1a;frameworks/base目录下
commit 9cb2244d61a237cab03c540bfcca6e4fac2bea2c
…不知道为什么拿到芯片原厂发布给我们的Android13系统源码编译后导航栏没有音量加减键客户有反馈这个问题所以特意加了一下修改记录如下frameworks/base目录下
commit 9cb2244d61a237cab03c540bfcca6e4fac2bea2c
Author: incar chsincartech.cn
Date: Fri Jun 21 19:05:47 2024 0800导航栏添加音量加减键Change-Id: Ia1811c7a94aa2f9e175b7725f96370925c5055ebdiff --git a/packages/SystemUI/res/drawable/ic_sysbar_volume_add_button.xml b/packages/SystemUI/res/drawable/ic_sysbar_volume_add_button.xml
new file mode 100755
index 000000000000..76a145eff0cb
--- /dev/nullb/packages/SystemUI/res/drawable/ic_sysbar_volume_add_button.xml-0,0 1,9
vector xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:width24dpandroid:height24dpandroid:viewportWidth24.0android:viewportHeight24.0pathandroid:fillColor?attr/singleToneColorandroid:pathDataM3,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/packages/SystemUI/res/drawable/ic_sysbar_volume_sub_button.xml b/packages/SystemUI/res/drawable/ic_sysbar_volume_sub_button.xml
new file mode 100755
index 000000000000..69d86071ce10
--- /dev/nullb/packages/SystemUI/res/drawable/ic_sysbar_volume_sub_button.xml-0,0 1,9
vector xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:width28dpandroid:height28dpandroid:viewportWidth24.0android:viewportHeight24.0pathandroid:fillColor?attr/singleToneColorandroid:pathDataM18.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/packages/SystemUI/res/layout/volume_add.xml b/packages/SystemUI/res/layout/volume_add.xml
new file mode 100755
index 000000000000..882c855a3a03
--- /dev/nullb/packages/SystemUI/res/layout/volume_add.xml-0,0 1,28
?xml version1.0 encodingutf-8?
!-- Copyright (C) 2016 The Android Open Source ProjectLicensed 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 athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License.
--
com.android.systemui.navigationbar.buttons.KeyButtonViewxmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:systemuihttp://schemas.android.com/apk/res-autoandroid:idid/volume_addandroid:layout_widthdimen/navigation_key_widthandroid:layout_heightmatch_parentandroid:layout_weight0systemui:keyCode24android:scaleTypecenterandroid:paddingStartdimen/navigation_key_paddingandroid:paddingEnddimen/navigation_key_padding/diff --git a/packages/SystemUI/res/layout/volume_sub.xml b/packages/SystemUI/res/layout/volume_sub.xml
new file mode 100755
index 000000000000..4b687bd52079
--- /dev/nullb/packages/SystemUI/res/layout/volume_sub.xml-0,0 1,28
?xml version1.0 encodingutf-8?
!-- Copyright (C) 2016 The Android Open Source ProjectLicensed 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 athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License.
--
com.android.systemui.navigationbar.buttons.KeyButtonViewxmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:systemuihttp://schemas.android.com/apk/res-autoandroid:idid/volume_subandroid:layout_widthdimen/navigation_key_widthandroid:layout_heightmatch_parentandroid:layout_weight0systemui:keyCode25android:scaleTypecenterandroid:paddingStartdimen/navigation_key_paddingandroid:paddingEnddimen/navigation_key_padding/diff --git a/packages/SystemUI/res/values-sw400dp/config.xml b/packages/SystemUI/res/values-sw400dp/config.xml
new file mode 100755
index 000000000000..5c37bfb34f68
--- /dev/nullb/packages/SystemUI/res/values-sw400dp/config.xml-0,0 1,27
?xml version1.0 encodingutf-8?
!--
/*
** Copyright 2012, 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.
*/
--!-- These resources are around just to allow their values to be customizedfor different hardware and product builds. --
resources!-- Nav bar button default ordering/layout --string nameconfig_navBarLayout translatablefalseleft;volume_sub,back,home,recent,volume_add;right/string/resources
diff --git a/packages/SystemUI/res/values-sw400dp/dimens.xml b/packages/SystemUI/res/values-sw400dp/dimens.xml
old mode 100644
new mode 100755
index f19335bc6285..340697a37fcb
--- a/packages/SystemUI/res/values-sw400dp/dimens.xmlb/packages/SystemUI/res/values-sw400dp/dimens.xml-17,7 17,8 resources!-- The width of the view containing navigation buttons --
- dimen namenavigation_key_width80dip/dimendimen namenavigation_key_width50dp/dimendimen namenavigation_key_padding30dp/dimen!-- The padding on the side of the navigation bar. Must be greater than or equal tonavigation_extra_key_width --
diff --git a/packages/SystemUI/res/values-sw410dp/dimens.xml b/packages/SystemUI/res/values-sw410dp/dimens.xml
old mode 100644
new mode 100755
index 7da47e5089be..62285f56c45f
--- a/packages/SystemUI/res/values-sw410dp/dimens.xmlb/packages/SystemUI/res/values-sw410dp/dimens.xml-26,5 26,8 dimen nameglobal_actions_grid_item_side_margin12dp/dimendimen nameglobal_actions_grid_item_height72dp/dimendimen namenavigation_key_width55dp/dimendimen namenavigation_key_padding33dp/dimen/resources
diff --git a/packages/SystemUI/res/values-sw600dp-land/dimens.xml b/packages/SystemUI/res/values-sw600dp-land/dimens.xml
old mode 100644
new mode 100755
index b24ce122208f..12973fe351a1
--- a/packages/SystemUI/res/values-sw600dp-land/dimens.xmlb/packages/SystemUI/res/values-sw600dp-land/dimens.xml-77,4 77,7 dimen namelockscreen_shade_keyguard_transition_vertical_offset83dp/dimendimen namenotification_panel_margin_horizontal24dp/dimendimen namenavigation_key_width120dp/dimendimen namenavigation_key_padding50dp/dimen/resources
diff --git a/packages/SystemUI/res/values-sw600dp/config.xml b/packages/SystemUI/res/values-sw600dp/config.xml
old mode 100644
new mode 100755
index 80628f903e76..9ea9eedb3cc5
--- a/packages/SystemUI/res/values-sw600dp/config.xmlb/packages/SystemUI/res/values-sw600dp/config.xml-27,7 27,7 bool nameconfig_quickSettingsMediaLandscapeCollapsedfalse/bool!-- Nav bar button default ordering/layout --
- string nameconfig_navBarLayout translatablefalseleft;back,home,recent;right/stringstring nameconfig_navBarLayout translatablefalseleft;volume_sub,back,home,recent,volume_add;right/string!-- orientation of the dead zone when touches have recently occurred elsewhere on screen --integer namenavigation_bar_deadzone_orientation0/integer
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index df3c8bedf1bb..ccc2b8c6604f 100755
--- a/packages/SystemUI/res/values/config.xmlb/packages/SystemUI/res/values/config.xml-301,7 301,7 /string-array!-- Nav bar button default ordering/layout --
- string nameconfig_navBarLayout translatablefalseleft[.5W],back[1WC];home;recent[1WC],right[.5W]/stringstring nameconfig_navBarLayout translatablefalseleft[.5W];volume_sub,back,home,recent,volume_add;right[.5W]/stringstring nameconfig_navBarLayoutQuickstep translatablefalseback[1.7WC];home;contextual[1.7WC]/stringstring nameconfig_navBarLayoutHandle translatablefalseback[70AC];home_handle;ime_switcher[70AC]/stringdiff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
index 1ef2b3c98859..bf152b112e86 100755
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.javab/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java-1187,6 1187,21 public class NavigationBar extends ViewControllerNavigationBarView implementsaccessibilityButton.setOnClickListener(this::onAccessibilityClick);accessibilityButton.setOnLongClickListener(this::onAccessibilityLongClick);updateAccessibilityStateFlags();ButtonDispatcher volumeAddButtonmView.getVolumeAddButton();ButtonDispatcher volumeSubButtonmView.getVolumeSubButton();//boolean isShowVolumeButton true.equals(SystemProperties.get(ro.rk.systembar.voiceicon,true));boolean isShowVolumeButton true;if(isShowVolumeButton){volumeAddButton.setVisibility(View.VISIBLE);volumeSubButton.setVisibility(View.VISIBLE);}else{volumeAddButton.setVisibility(View.GONE);volumeSubButton.setVisibility(View.GONE);}if (mContext.getResources().getConfiguration().smallestScreenWidthDp 400) {volumeAddButton.setVisibility(View.GONE);volumeSubButton.setVisibility(View.GONE);}ButtonDispatcher imeSwitcherButton mView.getImeSwitchButton();imeSwitcherButton.setOnClickListener(this::onImeSwitcherClick);-1699,6 1714,10 public class NavigationBar extends ViewControllerNavigationBarView implementsupdateButtonLocation(region, touchRegionCache, mView.getAccessibilityButton(), inScreenSpace,useNearestRegion);updateButtonLocation(region, touchRegionCache, mView.getVolumeAddButton(), inScreenSpace,useNearestRegion);updateButtonLocation(region, touchRegionCache, mView.getVolumeSubButton(), inScreenSpace,useNearestRegion);if (includeFloatingButtons mView.getFloatingRotationButton().isVisible()) {// Note: this button is floating so the nearest region doesnt applyupdateButtonLocation(
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
old mode 100644
new mode 100755
index 59bb2278edfe..70fb8a920ca0
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.javab/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java-68,6 68,8 public class NavigationBarInflaterView extends FrameLayoutpublic 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 ,;-99,11 101,13 public class NavigationBarInflaterView extends FrameLayoutprivate boolean mIsVertical;private boolean mAlternativeOrder; private int mDensity;private OverviewProxyService mOverviewProxyService;private int mNavBarMode NAV_BAR_MODE_3BUTTON;public NavigationBarInflaterView(Context context, AttributeSet attrs) {super(context, attrs);mDensity context.getResources().getConfiguration().densityDpi;createInflaters();mOverviewProxyService Dependency.get(OverviewProxyService.class);mNavBarMode Dependency.get(NavigationModeController.class).addListener(this);-118,6 122,16 public class NavigationBarInflaterView extends FrameLayoutmLandscapeInflater LayoutInflater.from(mContext.createConfigurationContext(landscape));} Overrideprotected void onConfigurationChanged(Configuration newConfig) {super.onConfigurationChanged(newConfig);if(mDensity ! newConfig.densityDpi || mDensity 600){mDensity newConfig.densityDpi;clearViews();inflateLayout(mCurrentLayout);}}
Overrideprotected void onFinishInflate() {super.onFinishInflate();-387,6 401,10 public class NavigationBarInflaterView extends FrameLayoutv 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/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
old mode 100644
new mode 100755
index 97024881ca62..8c5c589fdc22
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.javab/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java-45,6 45,7 import android.util.Log;import android.util.SparseArray;import android.view.ContextThemeWrapper;import android.view.Display;
import android.view.Display.Mode;import android.view.MotionEvent;import android.view.Surface;import android.view.View;-120,6 121,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;-159,6 162,7 public class NavigationBarView extends FrameLayout {* fully locked mode we only show that unlocking is blocked.*/private ScreenPinningNotify mScreenPinningNotify;private boolean mIsRot0Landscape true;/*** {code true} if the IME can render the back button and the IME switcher button.-311,6 315,10 public class NavigationBarView extends FrameLayout {mTmpLastConfiguration new Configuration();mConfiguration.updateFrom(context.getResources().getConfiguration()); Display display ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();Mode displayMode display.getMode();mIsRot0Landscape displayMode.getPhysicalWidth() displayMode.getPhysicalHeight();Log.v(TAG, PW displayMode.getPhysicalWidth() , PH displayMode.getPhysicalHeight());mScreenPinningNotify new ScreenPinningNotify(mContext);mButtonDispatchers.put(R.id.back, new ButtonDispatcher(R.id.back));-320,6 328,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);} -420,6 430,13 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);}-464,6 481,8 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);}/**-607,6 626,8 public class NavigationBarView extends FrameLayout {}getHomeButton().setImageDrawable(homeIcon);getBackButton().setImageDrawable(backIcon);getVolumeAddButton().setImageDrawable(mVolumeAddIcon);getVolumeSubButton().setImageDrawable(mVolumeSubIcon);updateRecentsIcon();
涉及到修改的文件如下注意别遗漏了 packages/SystemUI/res/drawable/ic_sysbar_volume_add_button.xml packages/SystemUI/res/drawable/ic_sysbar_volume_sub_button.xml packages/SystemUI/res/layout/volume_add.xml packages/SystemUI/res/layout/volume_sub.xml packages/SystemUI/res/values-sw400dp/config.xml packages/SystemUI/res/values-sw400dp/dimens.xml packages/SystemUI/res/values-sw410dp/dimens.xml packages/SystemUI/res/values-sw600dp-land/dimens.xml packages/SystemUI/res/values-sw600dp/config.xml packages/SystemUI/res/values/config.xml packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java