Android 13大屏设备时底下显示任务栏以及虚拟按键靠右的问题,
当前需求是去掉底部任务栏的显示,并把虚拟按键导航栏居中显示。
通过查看源码逻辑,可以发现只需把isTablet相关的逻辑和配置修改为false即可。
涉及修改的文件目录如下:
modified: vendor/mediatek/proprietary/packages/apps/Launcher3/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
modified: vendor/mediatek/proprietary/packages/apps/Launcher3/res/layout/launcher.xml
modified: vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/states/RotationHelper.java
modified: vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/util/DisplayController.java
modified: vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/util/window/WindowManagerProxy.java
modified: vendor/mediatek/proprietary/packages/apps/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java
具体修改如下:
1.把TaskbarManager.java中isTaskBarEnabled直接修改为false
--- a/mtk/vendor/mediatek/proprietary/packages/apps/Launcher3/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
+++ b/mtk/vendor/mediatek/proprietary/packages/apps/Launcher3/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
@@ -266,7 +266,7 @@ public class TaskbarManager {
DeviceProfile dp =
mUserUnlocked ? LauncherAppState.getIDP(mContext).getDeviceProfile(mContext) : null;
- boolean isTaskBarEnabled = dp != null && dp.isTaskbarPresent;
+ boolean isTaskBarEnabled = false;//dp != null && dp.isTaskbarPresent;
if (!isTaskBarEnabled) {
SystemUiProxy.INSTANCE.get(mContext)
2.把RotationHelper.java中的getAllowRotationDefaultValue方法直接返回false
--- a/mtk/vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/states/RotationHelper.java
+++ b/mtk/vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/states/RotationHelper.java
@@ -49,7 +49,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener,
// original dimensions to determine if rotation is allowed of not.
float originalSmallestWidth = dpiFromPx(
Math.min(deviceProfile.widthPx, deviceProfile.heightPx), DENSITY_DEVICE_STABLE);
- return originalSmallestWidth >= MIN_TABLET_WIDTH;
+ return false;//originalSmallestWidth >= MIN_TABLET_WIDTH;
}
3.把DisplayController.java中isTablet方法直接返回false
--- a/mtk/vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/util/DisplayController.java
+++ b/mtk/vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/util/DisplayController.java
@@ -348,7 +348,7 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
* Returns {@code true} if the bounds represent a tablet.
*/
public boolean isTablet(WindowBounds bounds) {
- return smallestSizeDp(bounds) >= MIN_TABLET_WIDTH;
+ return false;//smallestSizeDp(bounds) >= MIN_TABLET_WIDTH;
}
/**
4.把WindowManagerProxy.java中isTablet直接修改为false
--- a/mtk/vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/util/window/WindowManagerProxy.java
+++ b/mtk/vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/util/window/WindowManagerProxy.java
@@ -153,7 +153,7 @@ public class WindowManagerProxy implements ResourceBasedOverride {
Resources systemRes = context.getResources();
Configuration config = systemRes.getConfiguration();
- boolean isTablet = config.smallestScreenWidthDp > MIN_TABLET_WIDTH;
+ boolean isTablet = false;//config.smallestScreenWidthDp > MIN_TABLET_WIDTH;
boolean isGesture = isGestureNav(context);
boolean isPortrait = config.screenHeightDp > config.screenWidthDp;
@@ -226,7 +226,7 @@ public class WindowManagerProxy implements ResourceBasedOverride {
systemRes = context.createConfigurationContext(conf).getResources();
}
- boolean isTablet = swDp >= MIN_TABLET_WIDTH;
+ boolean isTablet = false;//swDp >= MIN_TABLET_WIDTH;
boolean isTabletOrGesture = isTablet
|| (Utilities.ATLEAST_R && isGestureNav(context));
5.把Utilities.java中的isTablet方法直接false
--- a/mtk/vendor/mediatek/proprietary/packages/apps/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java
+++ b/mtk/vendor/mediatek/proprietary/packages/apps/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java
@@ -133,7 +133,7 @@ public class Utilities {
float smallestWidth = dpiFromPx(Math.min(bounds.width(), bounds.height()),
context.getResources().getConfiguration().densityDpi);
- return smallestWidth >= TABLET_MIN_DPS;
+ return false;//smallestWidth >= TABLET_MIN_DPS;
}
6.修复Launcher3界面与导航栏重叠的问题
--- a/mtk/vendor/mediatek/proprietary/packages/apps/Launcher3/res/layout/launcher.xml
+++ b/mtk/vendor/mediatek/proprietary/packages/apps/Launcher3/res/layout/launcher.xml
@@ -25,7 +25,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
+ android:layout_marginBottom="@*android:dimen/navigation_bar_height"
android:importantForAccessibility="no">
<com.android.launcher3.views.AccessibilityActionsView