Android P 270度横屏(有navigationbar情况)

一:frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java

1)navigationBarPosition()函数return NAV_BAR_BOTTOM;

2)rotationForOrientationLw()函数中:

if (mForceDefaultOrientation) {

        return Surface.ROTATION_270; //return Surface.ROTATION_0; //改成270

}

本函数末尾default里的两个return都改成return Surface.ROTATION_270;

二:vendor/...../SystemUI/....NavigationBarView.java中改成如下

private void updateRotatedViews() {

        mRotatedViews[Surface.ROTATION_0] =

                mRotatedViews[Surface.ROTATION_180] = findViewById(R.id.rot0);

+//add by mini

+        if (SystemProperties.getInt("ro.screen.orientation.270", 0) == 1){

+            mRotatedViews[Surface.ROTATION_270] = findViewById(R.id.rot0);

+            mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot90);

+        }

+        else

+//add end   

        mRotatedViews[Surface.ROTATION_270] =

                mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot90);

你可能感兴趣的:(Android P 270度横屏(有navigationbar情况))