rk3588 安卓13 需要暴露导航栏,状态栏的隐藏与显示接口

rk3588 安卓13 需要暴露导航栏,状态栏的隐藏与显示接口,因为源码使用了taskbar,是launcher3里面的导航栏,需要改成NavigationBar系统原本的导航栏,所以先改回,代码如下:

LQX@szcomplier171:~/test/frameworks/base/packages/SystemUI$ git diff src/com/android/systemui/navigationbar/NavigationBarController.java
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
index 891455249867..de4e16785182 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
@@ -235,7 +235,7 @@ public class NavigationBarController implements
         // Enable for tablet or (phone AND flag is set); assuming phone = !mIsTablet
         boolean taskbarEnabled = mIsTablet || mFeatureFlags.isEnabled(Flags.HIDE_NAVBAR_WINDOW);

-        if (taskbarEnabled) {
+        if (false) {
             Trace.beginSection("NavigationBarController#initializeTaskbarIfNecessary");
             // Remove navigation bar when taskbar is showing
             removeNavigationBar(mContext.getDisplayId());
@@ -244,7 +244,7 @@ public class NavigationBarController implements
         } else {
             mTaskbarDelegate.destroy();
         }
-        return taskbarEnabled;
+        return false;//taskbarEnabled;
     }

     @Override
@@ -321,7 +321,8 @@ public class NavigationBarController implements

         // We may show TaskBar on the default display for large screen device. Don't need to create
         // navigation bar for this case.
-        if (isOnDefaultDisplay && initializeTaskbarIfNecessary()) {
+        //if (isOnDefaultDisplay && initializeTaskbarIfNecessary()) {
+       if (false) {
             return;
         }

LQX@szcomplier171:~/test/packages/apps/Launcher3$ git diff src/com/android/launcher3/DeviceProfile.java
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 25520e1bea..4b3aec7c34 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -286,7 +286,7 @@ public class DeviceProfile {
         isScalableGrid = inv.isScalable && !isVerticalBarLayout() && !isMultiWindowMode;
         // Determine device posture.
         mInfo = info;
-        isTablet = info.isTablet(windowBounds);
+        isTablet = false;//info.isTablet(windowBounds);
         isPhone = !isTablet;
         isTwoPanels = isTablet && isMultiDisplay;
         isTaskbarPresent = isTablet && ApiWrapper.TASKBAR_DRAWN_IN_PROCESS;

然后再按照以下代码操作即可:

LQX@szcomplier171:~/13/android13/frameworks/base$ git diff .
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
index 7e57dd452cb8..24e32a7ad2b4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -272,6 +272,10 @@ import dagger.Lazy;
 public class CentralSurfacesImpl extends CoreStartable implements
         CentralSurfaces {

+    private RegisterStatusBarResult mRegisterStatusBarResult;
+    static final String HIDE_NAVIGATION_BAR = "android.intent.action.HIDE_NAVIGATION_BAR";
+    static final String SHOW_NAVIGATION_BAR = "android.intent.action.SHOW_NAVIGATION_BAR";
+
     private static final String BANNER_ACTION_CANCEL =
             "com.android.systemui.statusbar.banner_action_cancel";
     private static final String BANNER_ACTION_SETUP =
@@ -952,7 +956,8 @@ public class CentralSurfacesImpl extends CoreStartable implements
         } catch (RemoteException ex) {
             ex.rethrowFromSystemServer();
         }
-
+
+        mRegisterStatusBarResult = result;
         createAndAddWindows(result);

         if (mWallpaperSupported) {
@@ -1435,6 +1440,8 @@ public class CentralSurfacesImpl extends CoreStartable implements
         IntentFilter filter = new IntentFilter();
         filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
         filter.addAction(Intent.ACTION_SCREEN_OFF);
+        filter.addAction(HIDE_NAVIGATION_BAR);
+        filter.addAction(SHOW_NAVIGATION_BAR);
         mBroadcastDispatcher.registerReceiver(mBroadcastReceiver, filter, null, UserHandle.ALL);
     }

@@ -2685,11 +2692,49 @@ public class CentralSurfacesImpl extends CoreStartable implements
                 }
                 finishBarAnimations();
                 resetUserExpandedStates();
+            } else if (HIDE_NAVIGATION_BAR.equals(action)) {
+                Log.d(TAG,"LQX  hideNavigation 0");
+                hideNavigation();
+            } else if (SHOW_NAVIGATION_BAR.equals(action)) {
+                Log.d(TAG,"LQX  displayNavigation 1");
+                displayNavigation();
             }
             Trace.endSection();
         }
     };

+
+    public void hideNavigation() {
+        NavigationBarView mNavigationBarView = mNavigationBarController.getDefaultNavigationBarView();
+        Log.d(TAG,"LQX hideNavigation 1");
+        if (mNavigationBarView != null) {
+            Log.d(TAG,"LQX hideNavigation 2");
+            mNavigationBarController.onDisplayRemoved(mDisplayId);
+        }
+        ViewGroup tempStatusBar = mStatusBarWindowController.getStatusBarWindowView();
+        if (tempStatusBar != null){
+            Log.d(TAG,"LQX hideStatusBar 2");
+            tempStatusBar.setVisibility(View.GONE);
+        }
+    }
+
+    public void displayNavigation() {
+        Log.d(TAG,"LQX displayNavigation 1");
+        NavigationBarView mNavigationBarView = mNavigationBarController.getDefaultNavigationBarView();
+        if (mNavigationBarView == null) {
+            Log.d(TAG,"LQX displayNavigation 2");
+            createNavigationBar(mRegisterStatusBarResult);
+        }
+
+        ViewGroup tempStatusBar = mStatusBarWindowController.getStatusBarWindowView();
+        if (tempStatusBar != null){
+            Log.d(TAG,"LQX showStatusBar 2");
+            tempStatusBar.setVisibility(View.VISIBLE);
+            //requestNotificationUpdate("StatusBar state changed");
+            checkBarModes();
+        }
+    }
+
     private final BroadcastReceiver mDemoReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/window/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/window/StatusBarWindowController.java
index e0d780a5fcd5..78c69d2df532 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/window/StatusBarWindowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/window/StatusBarWindowController.java
@@ -316,4 +316,7 @@ public class StatusBarWindowController {
             mLpChanged.privateFlags &= ~PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR;
         }
     }
+    public ViewGroup getStatusBarWindowView() {
+        return mStatusBarWindowView;
+    }
 }

编译烧录后adb发送广播测试:

adb shell am broadcast -a android.intent.action.HIDE_NAVIGATION_BAR
adb shell am broadcast -a android.intent.action.SHOW_NAVIGATION_BAR

相关推荐

  1. rk3568 11双屏异显,隐藏副屏导航

    2024-03-24 04:42:02       63 阅读
  2. rk3588 13 暴露相机开关接口

    2024-03-24 04:42:02       30 阅读
  3. rk3588 13 应用安装黑名单接口

    2024-03-24 04:42:02       58 阅读
  4. android11-隐藏状态栏导航

    2024-03-24 04:42:02       43 阅读
  5. 11系统RK3568 代码控制OTA

    2024-03-24 04:42:02       57 阅读
  6. rk3568 11 修改android id

    2024-03-24 04:42:02       35 阅读
  7. RK3568 12 EC20模块NOCONN没有ip问题(已解决)

    2024-03-24 04:42:02       27 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-24 04:42:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-24 04:42:02       100 阅读
  3. 在Django里面运行非项目文件

    2024-03-24 04:42:02       82 阅读
  4. Python语言-面向对象

    2024-03-24 04:42:02       91 阅读

热门阅读

  1. 华为OD机试 C++ -采样过滤

    2024-03-24 04:42:02       40 阅读
  2. im-system 第八章

    2024-03-24 04:42:02       36 阅读
  3. vue3父组件给子组件传值,并在子组件接受

    2024-03-24 04:42:02       38 阅读
  4. LeetCode hot100-17

    2024-03-24 04:42:02       44 阅读
  5. 食品输送带的材质

    2024-03-24 04:42:02       37 阅读
  6. 【Go】Go语言中的数组与切片

    2024-03-24 04:42:02       40 阅读
  7. QT5.14.2深入剖析Qt反射机制的实现原理

    2024-03-24 04:42:02       40 阅读
  8. 技术创新与产业升级

    2024-03-24 04:42:02       45 阅读
  9. MATLAB:是一款功能强大的商业数学软件

    2024-03-24 04:42:02       44 阅读
  10. npm命令详解

    2024-03-24 04:42:02       39 阅读
  11. 克服大型语言模型幻觉使用检索增强生成(RAG)

    2024-03-24 04:42:02       41 阅读
  12. 【保姆级讲解C语言中的运算符的优先级】

    2024-03-24 04:42:02       36 阅读