Android 13 大屏显示时关于SystemUI和Launcher3问题
1.Android 11 -- 强制清理app后台,关于权限引发的问题2.Android 11 (MTK)状态栏图标反色-->跟随当前应用变化代码流程3.Android 11 --关于Toast的异常4.Android 11 -- 关于dialog和悬浮窗导致SystemUI状态栏下拉频繁闪烁(窗口焦点问题)5.Android 11 下拉菜单长按WiFi图标SystemUI ANR6.Android 11 sim卡来电不弹出悬浮通知,默认来电默认全屏7.Android Bluetooth 蓝牙开发/蓝牙协议 小结8.Android11 —— 自定义添加一个System Services9.Android系统——AOSP相关-->随记10.Android11 , Launcher3 切换阿拉伯语,最近应用(后台)不能滑动11.Android 底层问题日志记录12.Android 11 -- app 服务保活13.Android11 - 添加自定义服务注意事项14.Android 11 导航栏添加一个虚拟按钮--问题合集15.Android 11--设置第三方Launcher并默认 与 如何预置apk16.Android11 系统修改 AOSP输入法的默认输入键盘布局17.Settings里面切换不同Launcher的代码流程18.关于Android`系统默认屏保`19.关于Android 11 Settings添加新的选项界面的细节20.Android 11 自由窗口模式 || 全屏模式启动app21.强制app横屏显示或者竖屏显示(动态)22.Android 11 禁止从SD卡上安装第三方应用23.实体物理音量键替换为home键24.AMS- kill Launcher进程的代码流程25.Android 11 recovery恢复出厂设置保留某些文件26.Android 11 禁用 adb root (userdebug版本)27.Android11 应用默认获取通知使用权限(可以获取系统所有通知信息)28.Android 11 UsbDebug 关于adb RSA 认证29.Android 11 NavigationBar && Status Bar 如果改变背景颜色30.Anroid 11 关于NotificationManager && NotificationManagerService -- 衍生到权限管理31.Android13 控制设置界面 双栏显示或单栏显示
32.Android 13 大屏显示时关于SystemUI和Launcher3问题
33.Android 系统适配无源码app34.Android 11 关于app的权限重置35.Android 11.0 关于app进程保活36.Android 11 关于按键拦截/按键事件处理分享37.Android R Settings关于屏保/PowerManagerService欺骗系统不让其进入休眠状态38.Android13 关于SystemUI更新/Nav Bar add volume button&&other button39.Android 13 移植EthernetSettings/Ethernet更新40.Anrdoir 13 关于设置静态IP后,突然断电,在上电开机卡动画41.Android T(13) The app is granted permissions by default42.Android T 关于屏幕旋转 (一)43.Android T about screen rotation(二)44.Android 13 about launcher3 (1)45.Android T don't abort background activity starts46.Android T adout replace bootanimation47.Launcher start App WINDOWING_MODE_FREEFORM48.Android 11 About SleepToken / (Settings)Screen timeout49.Settings.System数据监听/prop&SystemProperties数据监听当系统运行在大屏上时,原来显示SystemUI导航栏的位置会变成Launcher3的任务栏,然后导航栏的3个按键显示靠右下角显示
1.先看SystemUI的导航栏为什么会消失,移动
./frameworks/base/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
public void createNavigationBars(final boolean includeDefaultDisplay,
RegisterStatusBarResult result) {
//更新辅助功能按钮模式
updateAccessibilityButtonModeIfNeeded();
// 判断是否初始化TaskBar,不需要TaskBar就默认显示上创建导航栏
final boolean shouldCreateDefaultNavbar = includeDefaultDisplay
&& !initializeTaskbarIfNecessary();
Display[] displays = mDisplayManager.getDisplays();
for (Display display : displays) {
if (shouldCreateDefaultNavbar || display.getDisplayId() != DEFAULT_DISPLAY) {
createNavigationBar(display, null /* savedState */, result);
}
}
}
/** @return {@code true} if taskbar is enabled, false otherwise */
private boolean initializeTaskbarIfNecessary() {
//判断是否是平板
if (mIsTablet) {
// Remove navigation bar when taskbar is showing
//移除导航栏的时候任务栏显示
Trace.beginSection("NavigationBarController#initializeTaskbarIfNecessary");
removeNavigationBar(mContext.getDisplayId());
mTaskbarDelegate.init(mContext.getDisplayId());
Trace.endSection();
} else {
mTaskbarDelegate.destroy();
}
return mIsTablet;
}
...
{
mIsTablet = isTablet(mContext);//如果判断它是平板
}
/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java
/** @return whether or not {@param context} represents that of a large screen device or not */
@TargetApi(Build.VERSION_CODES.R)
//如果屏幕的(最小边长度*160/dpi值)< 600,就会判断为设备是平板设备 //isLargeScreen()
public static boolean isTablet(Context context) {
final WindowManager windowManager = context.getSystemService(WindowManager.class);
final Rect bounds = windowManager.getCurrentWindowMetrics().getBounds();
float smallestWidth = dpiFromPx(Math.min(bounds.width(), bounds.height()),
context.getResources().getConfiguration().densityDpi);
//add text
return false;//smallestWidth >= TABLET_MIN_DPS; 如果想要显示导航栏,直接返回false
//add text
}
//判断屏幕dpi
public static float dpiFromPx(float size, int densityDpi) {
float densityRatio = (float) densityDpi / DisplayMetrics.DENSITY_DEFAULT;
return (size / densityRatio);
}
补充:系统dpi也会影响导航栏的显示,不同的分辨率会走不同的布局,不同的配置config_navBarLayout
frameworks/base/packages/SystemUI/res/values-sw900dp/config.xml
<!-- Nav bar button default ordering/layout -->
<string name="config_navBarLayout" translatable="false">back,home,left;space;right,recent</string>
./frameworks/base/packages/SystemUI/res/values/config.xml
<string name="config_navBarLayout" translatable="false">left[.5W];volume_sub,back,home,recent,volume_add,screenshot;right[.5W]</string>
然后还有一个属性:导航栏是否跟随屏幕旋转移动
frameworks/base/core/res/res/values/config.xml
<!-- Controls whether the nav bar can move from the bottom to the side in landscape.
Only applies if the device display is not square. -->
<bool name="config_navBarCanMove">true</bool>
2.找到Launcher3显示任务栏的部分,也做类似的修改不让任务栏显示
/packages/apps/Launcher3/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
private void recreateTaskbar() {
destroyExistingTaskbar();
DeviceProfile dp =
mUserUnlocked ? LauncherAppState.getIDP(mContext).getDeviceProfile(mContext) : null;
//add text
boolean isTaskBarEnabled = false;//dp != null && dp.isTaskbarPresent;
//add text
if (!isTaskBarEnabled) {
SystemUiProxy.INSTANCE.get(mContext)
.notifyTaskbarStatus(/* visible */ false, /* stashed */ false);
return;
}
...
}
/Launcher3/src/com/android/launcher3/states/RotationHelper.java
//控制是否旋转
public static boolean getAllowRotationDefaultValue(DeviceProfile deviceProfile) {
// If the device's pixel density was scaled (usually via settings for A11y), use the
// original dimensions to determine if rotation is allowed of not.
float originalSmallestWidth = dpiFromPx(
Math.min(deviceProfile.widthPx, deviceProfile.heightPx), DENSITY_DEVICE_STABLE);
//add text
return false;//originalSmallestWidth >= MIN_TABLET_WIDTH;
//add text
}
/Launcher3/src/com/android/launcher3/util/DisplayController.java
/**
* Returns {@code true} if the bounds represent a tablet.
*/
public boolean isTablet(WindowBounds bounds) {
//add text
return false;//smallestSizeDp(bounds) >= MIN_TABLET_WIDTH;
//add text
}
/Launcher3/src/com/android/launcher3/util/window/WindowManagerProxy.java
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;
- boolean isTablet = swDp >= MIN_TABLET_WIDTH;
+ boolean isTablet = false;//swDp >= MIN_TABLET_WIDTH;
boolean isTabletOrGesture = isTablet
|| (Utilities.ATLEAST_R && isGestureNav(context));
分类:
Android
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· 【.NET】调用本地 Deepseek 模型
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库