当前位置:   article > 正文

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

rk3588 android13

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;

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48

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

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;
+    }
 }

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98

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

adb shell am broadcast -a android.intent.action.HIDE_NAVIGATION_BAR
adb shell am broadcast -a android.intent.action.SHOW_NAVIGATION_BAR
  • 1
  • 2
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/309370
推荐阅读
相关标签
  

闽ICP备14008679号