Android 11.0 系统设置默认横屏显示

Android 11.0 系统设置默认横屏显示

最近在Android 11.0 版本上做了默认横屏需求,现整理具体修改点如下:

1./frameworks/base/cmds/bootanimation/BootAnimation.cpp:

status_t BootAnimation::readyToRun() { 

中增加:

 //*/ add by jc
    int temp = resolution.height;

    resolution.height= resolution.width;
    resolution.width= temp;

    Rect destRect(resolution.width, resolution.height);

    SurfaceComposerClient::Transaction t;
    t.setDisplayProjection(mDisplayToken, ui::ROTATION_90, destRect, destRect);
    t.apply();
    //*/end

// create the native surface
    sp control = session()->createSurface(String8("BootAnimation"),
            resolution.getWidth(), resolution.getHeight(), PIXEL_FORMAT_RGB_565);

下增加:
 

    /*/ add by jc
    SurfaceComposerClient::Transaction t;
    //*/end

2./frameworks/base/core/java/com/android/internal/view/RotationPolicy.java:

public final class RotationPolicy {

中的

public static final int NATURAL_ROTATION = Surface.ROTATION_0;

修改为

public static final int NATURAL_ROTATION = Surface.ROTATION_90;

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

在 navigationBarPosition 方法中注释以下代码:


        if (navigationBarCanMove() && displayWidth > displayHeight) {
            if (displayRotation == Surface.ROTATION_270) {
                return NAV_BAR_LEFT;
            } else if (displayRotation == Surface.ROTATION_90) {
                return NAV_BAR_RIGHT;
            }
        }

4./frameworks/base/services/core/java/com/android/server/wm/DisplayRotation.java:

public class DisplayRotation { 

中将

private int mRotation;

改为
 

private int mRotation = 1;

private int mUserRotation = Surface.ROTATION_0;

改为

private int mUserRotation = Surface.ROTATION_90;

int rotationForOrientation(@ScreenOrientation int orientation,
            @Surface.Rotation int lastRotation) {

中Switch的default中的

return Surface.ROTATION_0;

改为

return Surface.ROTATION_90;

5./frameworks/native/services/surfaceflinger/DisplayDevice.cpp:

setProjection(ui::ROTATION_0, Rect::INVALID_RECT, Rect::INVALID_RECT);

改为

setProjection(ui::ROTATION_90, Rect::INVALID_RECT, Rect::INVALID_RECT);

6./vendor/mediatek/proprietary/bootable/bootloader/lk/platform/对应平台/mt_logo.c:

phical_screen.rotation = 0;

改为

phical_screen.rotation = 90;

7./vendor/mediatek/proprietary/external/libshowlogo/charging_animation.cpp:
 

if(ORIENTATION_270 == rotation){//270
        phical_screen.rotation = 270;
    } else if(ORIENTATION_90 == rotation){//90
        phical_screen.rotation = 90;
    } else if((ORIENTATION_180 == rotation) && (phical_screen.need180Adjust == 1)){//180
        phical_screen.rotation = 180;
    } else {
        //*/ start
        phical_screen.rotation = 90;
        /*/
        phical_screen.rotation = 0;
        //*/ end
    }

8./vendor/mediatek/proprietary/external/libshowlogo/show_animation_common.c:

void init_charging_animation_ui_dimension() {

中的

int rotation = getRotation();

改为

int rotation = ORIENTATION_90;

9./vendor/mediatek/proprietary/packages/apps/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java:

private void loadSystemSettings(SQLiteDatabase db) {

的try{ 中增加

//*/ start
loadSetting(stmt, Settings.System.USER_ROTATION,1);
//*/ end

你可能感兴趣的:(Android,framework,android)