赞
踩
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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。