Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 12 SystemUI 实现左侧导航栏 #2

Open
cnwutianhao opened this issue Jan 5, 2024 · 0 comments
Open

Android 12 SystemUI 实现左侧导航栏 #2

cnwutianhao opened this issue Jan 5, 2024 · 0 comments

Comments

@cnwutianhao
Copy link
Owner

改变 Android 系统导航栏位置的简易教程

效果图:
效果图


修改代码:

frameworks/base/services/core/java/com/android/server/wm/DisplayPolicy.java

找到 navigationBarPosition 方法,原方法的内容:

@NavigationBarPosition
int navigationBarPosition(int displayWidth, int displayHeight, int displayRotation) {
    if (navigationBarCanMove() && displayWidth > displayHeight) {
        if (displayRotation == Surface.ROTATION_270) {
            return NAV_BAR_LEFT;
        } else if (displayRotation == Surface.ROTATION_90) {
            return NAV_BAR_RIGHT;
        }
    }
    return NAV_BAR_BOTTOM;
}

修改后的方法内容:

@NavigationBarPosition
int navigationBarPosition(int displayWidth, int displayHeight, int displayRotation) {
    return NAV_BAR_LEFT;
}

编译:

make services

输出:

.../out/target/product/你的平台/system/framework/services.jar
.../out/target/product/你的平台/system/framework/services.jar.bprof
.../out/target/product/你的平台/system/framework/services.jar.prof

将输出内容替换到板子里:

adb push ...\services.jar /system/framework/
adb push ...\services.jar.bprof /system/framework/
adb push ...\services.jar.prof /system/framework/

重启即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant