Android 8/9高通平台客制化虚拟导航按键隐藏

这篇博客介绍了如何在Android 8/9的高通平台上,通过修改SystemUI源代码来实现虚拟导航按键的定制隐藏。主要涉及`config_navBarLayout`配置的更改,新增了`hide`按钮,并在`NavigationBarInflaterView`和`NavigationBarView`中进行相应的布局和点击事件处理。此外,还展示了部分代码变更和编译指令。
摘要由CSDN通过智能技术生成

高通平台源代码更改

diff --git a/frameworks/base/packages/SystemUI/res/values/config.xml b/frameworks/base/packages/SystemUI/res/values/config.xml
index 22180dc..7e6c813 100644
--- a/frameworks/base/packages/SystemUI/res/values/config.xml
+++ b/frameworks/base/packages/SystemUI/res/values/config.xml
@@ -381,7 +381,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],back[1WC];home,recent;hide[1WC],right[.5W]</string>
     <string name="config_navBarLayoutQuickstep" translatable="false">back[1.7WC];home;contextual[1.7WC]</string>
 
     <bool name="quick_settings_show_full_alarm">false</bool>
diff --git a/frameworks/base/packages/SystemUI/res/values/strings.xml b/frameworks/base/packages/SystemUI/res/values/strings.xml
index 79eeaac..bad63a4 100644
--- a/frameworks/base/packages/SystemUI/res/values/strings.xml
+++ b/frameworks/base/packages/SystemUI/res/values/strings.xml
@@ -220,6 +220,7 @@
     <string name="accessibility_home">Home</string>
     <!-- Content description of the menu button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
     <string name="accessibility_menu">Menu</string>
+    <string name="accessibility_hide">Hide</string>
     <!-- Content description of the accessibility button in the navigation bar (not shown on the screen). [CHAR LIMIT=NONE] -->
     <string name="accessibility_accessibility_button">Accessibility</string>
     <!-- Content description of the rotate button in the navigation bar (not shown on the screen). [CHAR LIMIT=NONE] -->
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
index e6f2c33..74c7ada 100644
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
@@ -69,6 +69,7 @@ public class NavigationBarInflaterView extends FrameLayout
     public static final String LEFT = "left";
     public static final String RIGHT = "right";
     public static final String CONTEXTUAL = "contextual";
+    public static final String HIDE = "hide";
 
     public static final String GRAVITY_SEPARATOR = ";";
     public static final String BUTTON_SEPARATOR = ",";
@@ -256,7 +257,7 @@ public class NavigationBarInflaterView extends FrameLayout
         if (newLayout == null) {
             newLayout = getDefaultLayout();
         }
-        String[] sets = newLayout.split(GRAVITY_SEPARATOR, 3);
+        String[] sets = newLayout.split(GRAVITY_SEPARATOR, 3);
         if (sets.length != 3) {
             Log.d(TAG, "Invalid layout.");
             newLayout = getDefaultLayout();
@@ -269,16 +270,17 @@ public class NavigationBarInflaterView extends FrameLayout
         inflateButtons(start, mRot0.findViewById(R.id.ends_group), isRot0Landscape, true);
         inflateButtons(start, mRot90.findViewById(R.id.ends_group), !isRot0Landscape, true);
 
-        inflateButtons(center, mRot0.findViewById(R.id.center_group), isRot0Landscape, false);
-        inflateButtons(center, mRot90.findViewById(R.id.center_group), !isRot0Landscape, false);
+        inflateButtons(center, mRot0.findViewById(R.id.ends_group), isRot0Landscape, false);
+        inflateButtons(center, mRot90.findViewById(R.id.ends_group), !isRot0Landscape, false);
 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值