瑞芯微Rockchip开发者社区
直播中

小黑羊

11年用户 1059经验值
擅长:31274
私信 关注
[问答]

怎样去隐藏Android 8.1定制系统的导航栏和状态栏显呢

怎样去隐藏Android 8.1定制系统的导航栏和状态栏显呢?

回帖(3)

董方帅

2022-2-15 11:50:10
我们的应用程序跑在 RK3399Pro 上面,是一个公共场合使用的代码,所以把菜单底部的返回,HOME,都隐藏,并且参考菜单导航栏下拉功能要取消。
我是 Firefly 的写代码三个
实现功能框架层添加功能
1.导航栏添加手机功能。
2.导航栏支持横屏切换功能。
3.导航栏支持动态和导航显示栏,永久关闭导航栏在框架层提供借用外部使用
不多说,直接上代码

frameworks/base/core/java/android/content/Intent.java


diff --git a/frameworks/base/core/java/android/content/Intent.java b/frameworks/base/core/java/android/content/Intent.java
index 6fd333a0c9..1dc8da6746 100755
--- a/frameworks/base/core/java/android/content/Intent.java
+++ b/frameworks/base/core/java/android/content/Intent.java
@@ -2079,6 +2079,31 @@ public class Intent implements Parcelable, Cloneable {
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS";
+
+     /****/
+     /**firefly_modify_songjf Broadcast Action:Status bar  hidden
+     * @hide
+     */
+    public static final String ACTION_HIDE_BAR = "action.HIDE_STATUSBAR";
+    /****/
+     /**firefly_modify_songjf Broadcast Action:Status bar  show
+     * @hide
+     */
+    public static final String ACTION_SHOW_BAR = "action.SHOW_STATUSBAR";
+
+    /****/
+     /**firefly_modify_songjf Broadcast Action:Status bar  show
+     * @hide
+     */
+    public static final String ACTION_ALWAYS_HIDE_BAR_CHANGE = "action.ALWAYS_HIDE_STATUSBAR_CHENAGE";
+
+
+    /****/
+     /**firefly_modify_songjf Broadcast Action:poweroff
+     * @hide
+     */
+    public static final String ACTION_SYSTEMUI_FIREFLY_POWEROFF = "action.SYSTEMUI_FIREFLY_POWEROFF";
+
     /**
      * Broadcast Action: Trigger the download and eventual installation
      * of a package.


frameworks/base/core/java/android/provider/Settings.java


diff --git a/frameworks/base/core/java/android/provider/Settings.java b/frameworks/base/core/java/android/provider/Settings.java
index d5a9d09ce4..a4fbd2064f 100755
--- a/frameworks/base/core/java/android/provider/Settings.java
+++ b/frameworks/base/core/java/android/provider/Settings.java
@@ -3627,6 +3627,23 @@ public final class Settings {
          */
         public static final String SCREENSHOT_BUTTON_SHOW = "screenshot_button_show";

+       /**
+         *hidebar button wether display
+         * @hide
+         */
+        public static final String HIDEBAR_BUTTON_SHOW = "hidebar_button_show";
+
+       /**
+         *hide status bar
+         * @hide
+         */
+        public static final String ALWAYS_HIDE_BAR="always_hide_bar";
+
+        /**
+         * if enabled while show rotation in SystenUI and Settings-DisplaySettings
+         * @hide
+         */
+        public static final String ENABLE_ROTATION_BY_USER = "enable_rotation_by_user";
         /**
          * Whether the phone vibrates when it is ringing due to an incoming call. This will
          * be used by Phone and Setting apps; it shouldn't affect other apps.
frameworks/base/core/java/com/android/internal/statu***ar/IStatusBar.aidl


diff --git a/frameworks/base/core/java/com/android/internal/statu***ar/IStatusBar.aidl b/frameworks/base/core/java/com/android/internal/statu***ar/IStatusBar.aidl
index bab0306aaf..8da31c5df1 100644
--- a/frameworks/base/core/java/com/android/internal/statu***ar/IStatusBar.aidl
+++ b/frameworks/base/core/java/com/android/internal/statu***ar/IStatusBar.aidl
@@ -55,6 +55,10 @@ oneway interface IStatusBar
             boolean showImeSwitcher);
     void setWindowState(int window, int state);

+
+    //firefly_modify_songjf, add bar interface
+    void addBar();
+
     void showRecentApps(boolean triggeredFromAltTab, boolean fromHome);
     void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey);
     void toggleRecentApps();


frameworks/base/core/java/com/android/internal/statu***ar/IStatusBarService.aidl


diff --git a/frameworks/base/core/java/com/android/internal/statu***ar/IStatusBarService.aidl b/frameworks/base/core/java/com/android/internal/statu***ar/IStatusBarService.aidl
index 82eb1abcba..4f59192186 100644
--- a/frameworks/base/core/java/com/android/internal/statu***ar/IStatusBarService.aidl
+++ b/frameworks/base/core/java/com/android/internal/statu***ar/IStatusBarService.aidl
@@ -73,6 +73,9 @@ interface IStatusBarService
     void shutdown();
     void reboot(boolean safeMode);

+    //firefly_modify_songjf, add bar interface
+    void addBar();
+
     void addTile(in ComponentName tile);
     void remTile(in ComponentName tile);
     void clickTile(in ComponentName tile);


frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml


diff --git a/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml b/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml
new file mode 100644
index 0000000000..53da8c515b
--- /dev/null
+++ b/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml
@@ -0,0 +1,10 @@
+
+
+      
+    true
+   
+    false
+
+   
+    true
+



frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
diff --git a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index d8f3daf1d4..858babef54 100644
--- a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -2339,6 +2339,16 @@ class DatabaseHelper extends SQLiteOpenHelper {
             loadIntegerSetting(stmt, Settings.System.SCREENSHOT_BUTTON_SHOW,
                     R.integer.def_screenshot_button_show);

+           loadBooleanSetting(stmt, Settings.System.HIDEBAR_BUTTON_SHOW,
+                    R.bool.def_hidebar_button_show);
+
+            loadBooleanSetting(stmt, Settings.System.ALWAYS_HIDE_BAR,
+                    R.bool.def_always_hide_bar);
+
+
+            loadBooleanSetting(stmt, Settings.System.ENABLE_ROTATION_BY_USER,
+                    R.bool.def_enable_rotation_by_user);
+
             /*
              * IMPORTANT: Do not add any more upgrade steps here as the global,
              * secure, and system settings are no longer stored in a database
frameworks/base/packages/SystemUI/res/layout/hide_bar.xml
举报

刘珊珊

2022-2-15 11:50:23
diff --git a/frameworks/base/packages/SystemUI/res/layout/hide_bar.xml b/frameworks/base/packages/SystemUI/res/layout/hide_bar.xml
new file mode 100644
index 0000000000..1b2fe27d9e
--- /dev/null
+++ b/frameworks/base/packages/SystemUI/res/layout/hide_bar.xml
@@ -0,0 +1,14 @@
+
+ +      xmlns:android="http://schemas.android.com/apk/res/android"
+      xmlns:systemui="http://schemas.android.com/apk/res-auto"
+      android:id="@+id/hide_bar"
+      android:layout_width="@dimen/navigation_key_width"
+      android:layout_height="match_parent"
+      android:layout_weight="0"
+      systemui:keyCode="-1"
+      android:scaleType="center"
+      android:contentDescription="@string/accessibility_home"
+      android:paddingStart="@dimen/navigation_key_padding"
+      android:paddingEnd="@dimen/navigation_key_padding"
+      />


frameworks/base/packages/SystemUI/res/layout/poweroff.xml
diff --git a/frameworks/base/packages/SystemUI/res/layout/poweroff.xml b/frameworks/base/packages/SystemUI/res/layout/poweroff.xml
new file mode 100644
index 0000000000..487b563103
--- /dev/null
+++ b/frameworks/base/packages/SystemUI/res/layout/poweroff.xml
@@ -0,0 +1,14 @@
+
+ +      xmlns:android="http://schemas.android.com/apk/res/android"
+      xmlns:systemui="http://schemas.android.com/apk/res-auto"
+      android:id="@+id/poweroff"
+      android:layout_width="@dimen/navigation_key_width"
+      android:layout_height="match_parent"
+      android:layout_weight="0"
+      systemui:keyCode="-1"
+      android:scaleType="center"
+      android:contentDescription="@string/accessibility_home"
+      android:paddingStart="@dimen/navigation_key_padding"
+      android:paddingEnd="@dimen/navigation_key_padding"
+      />
No newline at end of file
frameworks/base/packages/SystemUI/res/layout/rotation.xml


diff --git a/frameworks/base/packages/SystemUI/res/layout/rotation.xml b/frameworks/base/packages/SystemUI/res/layout/rotation.xml
new file mode 100644
index 0000000000..20ab401782
--- /dev/null
+++ b/frameworks/base/packages/SystemUI/res/layout/rotation.xml
@@ -0,0 +1,14 @@
+
+ +  xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:systemui="http://schemas.android.com/apk/res-auto"
+  android:id="@+id/rotation"
+  android:layout_width="@dimen/navigation_key_width"
+  android:layout_height="match_parent"
+  android:layout_weight="0"
+  systemui:keyCode="-2"
+  android:scaleType="center"
+  android:contentDescription="@string/accessibility_home"
+  android:paddingStart="@dimen/navigation_key_padding"
+  android:paddingEnd="@dimen/navigation_key_padding"
+  />
No newline at end of file
frameworks/base/packages/SystemUI/res/values-sw600dp/config.xml
diff --git a/frameworks/base/packages/SystemUI/res/values-sw600dp/config.xml b/frameworks/base/packages/SystemUI/res/values-sw600dp/config.xml
index d5c4303003..07ea9ba760 100644
--- a/frameworks/base/packages/SystemUI/res/values-sw600dp/config.xml
+++ b/frameworks/base/packages/SystemUI/res/values-sw600dp/config.xml
@@ -34,7 +34,7 @@
     true

     
-    left;volume_sub,back,home,recent,volume_add,screenshot;right
+    left;poweroff,hide_bar,volume_sub,back,home,recent,volume_add,screenshot,rotation;right

     
     290


frameworks/base/packages/SystemUI/res/values-zh-rCN/custom_strings.xml
diff --git a/frameworks/base/packages/SystemUI/res/values-zh-rCN/custom_strings.xml b/frameworks/base/packages/SystemUI/res/values-zh-rCN/custom_strings.xml
new file mode 100644
index 0000000000..d2d323ef24
--- /dev/null
+++ b/frameworks/base/packages/SystemUI/res/values-zh-rCN/custom_strings.xml
@@ -0,0 +1,9 @@
+
+ +       xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+      
+       "系统栏已经被隐藏n您可以在屏幕下边缘拖拉再次显示它。"
+      
+
+       菜单键更多选项
+

No newline at end of file
frameworks/base/packages/SystemUI/res/values-zh-rHK/custom_strings.xml
diff --git a/frameworks/base/packages/SystemUI/res/values-zh-rHK/custom_strings.xml b/frameworks/base/packages/SystemUI/res/values-zh-rHK/custom_strings.xml
new file mode 100644
index 0000000000..6850f153b3
--- /dev/null
+++ b/frameworks/base/packages/SystemUI/res/values-zh-rHK/custom_strings.xml
@@ -0,0 +1,9 @@
+
+ +       xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+      
+       "系統欄已經被隱藏n您可以在荧幕下邊緣拖拉再次顯示它。"
+      
+
+       選單鍵更多選項
+
s
No newline at end of file
frameworks/base/packages/SystemUI/res/values/config.xml
diff --git a/frameworks/base/packages/SystemUI/res/values/config.xml b/frameworks/base/packages/SystemUI/res/values/config.xml
index 8511fed05c..94eb8a676b 100644
--- a/frameworks/base/packages/SystemUI/res/values/config.xml
+++ b/frameworks/base/packages/SystemUI/res/values/config.xml
@@ -107,12 +107,12 @@

     
     
-        wifi,bt,dnd,flashlight,rotation,battery,cell,airplane,cast
+        wifi,bt,dnd,flashlight,rotation,battery,cell,airplane,cast,screenshot
     


     
     
-        wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,work,cast,night
+        wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,work,cast,screenshot,night
     


     
@@ -320,7 +320,7 @@
     com.android.systemui.SystemUIFactory

     
-    left;volume_sub,back,home,recent,volume_add,screenshot;right
+    left;poweroff,hide_bar,volume_sub,back,home,recent,volume_add,screenshot,rotation;right

     false
举报

孙缅禧

2022-2-15 11:50:25
frameworks/base/packages/SystemUI/res/values/custom_strings.xml
diff --git a/frameworks/base/packages/SystemUI/res/values/custom_strings.xml b/frameworks/base/packages/SystemUI/res/values/custom_strings.xml
new file mode 100644
index 0000000000..3c3fdefe10
--- /dev/null
+++ b/frameworks/base/packages/SystemUI/res/values/custom_strings.xml
@@ -0,0 +1,11 @@
+
+ +       xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+      
+       "System Bar has hiddennyou can swipe from the bottom of screen to show it again."
+      
+
+       Screenshot
+
+       Press Menu Edit
+
s
No newline at end of file
frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/CommandQueue.java
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/CommandQueue.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/CommandQueue.java
index 6349275037..59e738a375 100644
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/CommandQueue.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/CommandQueue.java
@@ -83,6 +83,9 @@ public class CommandQueue extends IStatusBar.Stub {
     private static final int MSG_SHOW_SHUTDOWN_UI              = 36 << MSG_SHIFT;
     private static final int MSG_SET_TOP_APP_HIDES_STATUS_BAR  = 37 << MSG_SHIFT;

+    /**firefly_modify_songjf, add bar interface**/
+    private static final int MSG_ADD_BAR    = 38 << MSG_SHIFT;
+
     public static final int FLAG_EXCLUDE_NONE = 0;
     public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
     public static final int FLAG_EXCLUDE_RECENTS_PANEL = 1 << 1;
@@ -142,6 +145,9 @@ public class CommandQueue extends IStatusBar.Stub {
         default void handleSystemKey(int arg1) { }
         default void handleShowGlobalActionsMenu() { }
         default void handleShowShutdownUi(boolean isReboot, String reason) { }
+
+        /**firefly_modify_songjf, add bar interface **/
+        default void addBar(){ }
     }

     @VisibleForTesting
@@ -343,6 +349,14 @@ public class CommandQueue extends IStatusBar.Stub {
         }
     }

+    /**firefly_modify_songjf, add bar interface **/
+    public void addBar() {
+       synchronized (mLock) {
+           mHandler.removeMessages(MSG_ADD_BAR);
+           mHandler.obtainMessage(MSG_ADD_BAR, 0, 0, null).sendToTarget();
+       }
+    }
+
     public void showScreenPinningRequest(int taskId) {
         synchronized (mLock) {
             mHand
写文章的时候板子不在身边,就找张的状态控制的效果是一样的。图片
在网上发布

/****/
    /** Broadcast Action:Status bar  show
     */
    public static final String ACTION_ALWAYS_HIDE_BAR_CHANGE = "action.ALWAYS_HIDE_STATUSBAR_CHENAGE";
    public static final String CNBOT_ACTION_ALWAYS_HIDE = "cnbot_always_hide_bar";




    /**
     * 系统的状态栏控制
     * @param context
     * @param hide 是否隐藏
     */
    public static void changeBarHideStatus(Context context , boolean hide){
        if (context == null){
            return;
        }
        Intent i = new Intent(ACTION_ALWAYS_HIDE_BAR_CHANGE);
        i.putExtra(CNBOT_ACTION_ALWAYS_HIDE,hide?1:0);
        context.sendBroadcast(i);
    }
举报

更多回帖

发帖
×
20
完善资料,
赚取积分