android 10 系统源码 (屏幕物理竖屏)默认开机动画横屏显示

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

@@ -278,13 +278,18 @@ status_t BootAnimation::readyToRun() {
     status_t status = SurfaceComposerClient::getDisplayInfo(mDisplayToken, &dinfo);
     if (status)
         return -1;

+    int orientation = 1; // landscape
+    if (orientation) {
+        if (dinfo.h > dinfo.w) {
+            int temp = dinfo.h;
+            dinfo.h= dinfo.w;
+            dinfo.w= temp;
+        }
+    }
+
     // create the native surface
     SurfaceComposerClient::Transaction t;
     sp<SurfaceControl> control = session()->createSurface(String8("BootAnimation"),
             dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565);

2.frameworks/native/services/surfaceflinger/DisplayDevice.cpp

@@ -90,7 +90,7 @@ DisplayDevice::DisplayDevice(DisplayDeviceCreationArgs&& args)
     setPowerMode(args.initialPowerMode);
 
     // initialize the display orientation transform.
-    setProjection(DisplayState::eOrientationDefault, Rect::INVALID_RECT, Rect::INVALID_RECT);
+    setProjection(DisplayState::eOrientation90, Rect::INVALID_RECT, Rect::INVALID_RECT);
 }
 
 DisplayDevice::~DisplayDevice() = default;
@@ -248,6 +248,12 @@ void DisplayDevice::setProjection(int orientation,
         // the destination frame can be invalid if it has never been set,
         // in that case we assume the whole display frame.
         frame = Rect(w, h);
+        int orient = 1; // landscape
+        if (orient) {
+            if (h > w) {
+                frame = Rect(h, w);
+            }
+        }
     }
 
     if (viewport.isEmpty()) {

3.frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
@@ -5210,7 +5210,7 @@ void SurfaceFlinger::onInitializeDisplays() {
              DisplayState::eLayerStackChanged;
     d.token = token;
     d.layerStack = 0;
-    d.orientation = DisplayState::eOrientationDefault;
+    d.orientation = DisplayState::eOrientation90;
     d.frame.makeInvalid();
     d.viewport.makeInvalid();
     d.width = 0;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值