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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
| diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java old mode 100644 new mode 100755 index 5c8d2212cef..ffd22dc73b1 --- a/frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java +++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java @@ -496,4 +496,15 @@ public class NavigationBarController implements mNavigationBars.valueAt(i).dump(pw); } } + +
+ public void removeNavigationBars() { + Display[] displays = mDisplayManager.getDisplays(); + for (Display display : displays) { + removeNavigationBar(display.getDisplayId()); + } + } + } diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index f76470badf1..94cca11834b 100755 --- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -286,6 +286,15 @@ import dagger.Lazy; public class CentralSurfacesImpl extends CoreStartable implements CentralSurfaces { + + private static final String ACTION_HIDE_STATUS_BAR = "com.systemui.statusbar.hide"; + private static final String ACTION_SHOW_STATUS_BAR = "com.systemui.statusbar.show"; + private static final String SYS_PROPERTY_STATUS_BAR = "persist.sys.statusbar.enable"; + private static final String ACTION_HIDE_NAVIGATION_BAR = "com.systemui.navigationbar.hide"; + private static final String ACTION_SHOW_NAVIGATION_BAR = "com.systemui.navigationbar.show"; + private static final String SYS_PROPERTY_NAVIGATION_BAR = "persist.sys.navigationbar.enable"; + private static final String BANNER_ACTION_CANCEL = "com.android.systemui.statusbar.banner_action_cancel"; private static final String BANNER_ACTION_SETUP = @@ -1522,6 +1531,12 @@ public class CentralSurfacesImpl extends CoreStartable implements filter.addAction(UnisocPowerManagerUtil.ACTION_POWEREX_SAVE_MODE_CHANGED); } + + filter.addAction(ACTION_HIDE_STATUS_BAR); + filter.addAction(ACTION_SHOW_STATUS_BAR); + filter.addAction(ACTION_HIDE_NAVIGATION_BAR); + filter.addAction(ACTION_SHOW_NAVIGATION_BAR); + mBroadcastDispatcher.registerReceiver(mBroadcastReceiver, filter, null, UserHandle.ALL); } @@ -2543,8 +2558,8 @@ public class CentralSurfacesImpl extends CoreStartable implements @Override public void createAndAddWindows(@Nullable RegisterStatusBarResult result) { makeStatusBarView(result); - mNotificationShadeWindowController.attach(); mStatusBarWindowController.attach(); + mNotificationShadeWindowController.attach(); } @@ -2870,6 +2885,29 @@ public class CentralSurfacesImpl extends CoreStartable implements && mDataSaverController.isDataSaverEnabled()) { mDataSaverController.setDataSaverEnabled(false); } + + else if(ACTION_HIDE_STATUS_BAR.equals(action)){ + android.util.Log.d("yeruilai","yeruilai:action=" + ACTION_HIDE_STATUS_BAR); + + mStatusBarWindowController.hideStatusBar(); + SystemProperties.set(SYS_PROPERTY_STATUS_BAR, "false"); + } else if(ACTION_SHOW_STATUS_BAR.equals(action)){ + android.util.Log.d("yeruilai","yeruilai:action=" + ACTION_SHOW_STATUS_BAR); + + mStatusBarWindowController.showStatusBar(); + SystemProperties.set(SYS_PROPERTY_STATUS_BAR, "true"); + } else if(ACTION_HIDE_NAVIGATION_BAR.equals(action)){ + android.util.Log.d("yeruilai","yeruilai:action=" + ACTION_HIDE_NAVIGATION_BAR); + + mNavigationBarController.removeNavigationBars(); + SystemProperties.set(SYS_PROPERTY_NAVIGATION_BAR, "false"); + } else if(ACTION_SHOW_NAVIGATION_BAR.equals(action)){ + android.util.Log.d("yeruilai","yeruilai:action=" + ACTION_SHOW_NAVIGATION_BAR); + + createNavigationBar(null); + SystemProperties.set(SYS_PROPERTY_NAVIGATION_BAR, "true"); + } + Trace.endSection(); } diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/window/StatusBarWindowController.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/window/StatusBarWindowController.java old mode 100644 new mode 100755 index e0d780a5fcd..08b4628f4c5 --- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/window/StatusBarWindowController.java +++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/window/StatusBarWindowController.java @@ -316,4 +316,42 @@ public class StatusBarWindowController { mLpChanged.privateFlags &= ~PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR; } } + +
+ private void apply(State state,boolean isHideStatus) { + if (!mIsAttached) { + return; + } + applyForceStatusBarVisibleFlag(state); + if (!isHideStatus){ + applyHeight(state); + } + if (mLp != null && mLp.copyFrom(mLpChanged) != 0) { + mWindowManager.updateViewLayout(mStatusBarWindowView, mLp); + } + } + +
+ public void showStatusBar(){ + apply(mCurrentState); + mStatusBarWindowView.setVisibility(View.VISIBLE); + } + +
+ public void hideStatusBar(){ + mStatusBarWindowView.setVisibility(View.GONE); + mLpChanged.height = 0; + for (int rot = Surface.ROTATION_0; rot <= Surface.ROTATION_270; rot++) { + mLpChanged.paramsForRotation[rot].height = 0; + } + apply(mCurrentState,true); + } + }
|