android13修改系统Launcher不跟随重力感应旋转

android13系统中需要修改系统原生Launcher不跟随重力感应旋转。

通过代码查找发现packages/apps/Launcher3/src/com/android/launcher3/states/RotationHelper.java中存在一个函数getAllowRotationDefaultValue,用于获取是否允许旋转的默认值。

java 复制代码
    public static boolean getAllowRotationDefaultValue(DisplayController.Info info) {
        // 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(info.currentSize.x, info.currentSize.y),
                DENSITY_DEVICE_STABLE);
        return originalSmallestWidth >= MIN_TABLET_WIDTH;
    }

这个函数主要根据屏幕dpi和尺寸来决定是否允许Luancher允许旋转。如果要禁止旋转直接返回false即可。

相关推荐
CYRUS_STUDIO19 分钟前
使用 AndroidNativeEmu 调用 JNI 函数
android·逆向·汇编语言
梦否23 分钟前
【Android】类加载器&热修复-随记
android
徒步青云1 小时前
Java内存模型
android
今阳1 小时前
鸿蒙开发笔记-6-装饰器之@Require装饰器,@Reusable装饰器
android·app·harmonyos
-优势在我6 小时前
Android TabLayout 实现随意控制item之间的间距
android·java·ui
Indoraptor7 小时前
Android Fence 同步框架
android
峥嵘life7 小时前
DeepSeek本地搭建 和 Android
android
叶羽西7 小时前
Android14 Camera框架中Jpeg流buffer大小的计算
android·安卓
jiasting7 小时前
Android 中 如何监控 某个磁盘有哪些进程或线程在持续的读写
android