高通平台android7.1系统显示旋转180度
?
kernel\msm-3.18\arch\arm\boot\dts\qcom\dsi-panel-lm215w-lvds-1080p-video.dtsi增加qcom,mdss-dsi-panel-orientation = "180";
從內核到進入系統旋轉成功,但是存在一個問題,插入鼠標移動的時候藍屏。初步測試曉龍相機預覽方向是正常的,視頻對講、監控和app方向都正常
據觀察,鼠標移動和顯示的方向,沒有相應對應起來
此方案大家如果大家知道怎么解決插入鼠標移動時顯示藍屏問題,麻煩告知,謝謝了。
下面是高通對我們這種解決方案的回復:
Your change is not suitable. The General solution is change SF init. diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cppindex c166aaa..526feb6 100644--- a/services/surfaceflinger/DisplayDevice.cpp+++ b/services/surfaceflinger/DisplayDevice.cpp@@ -134,6 +134,11 @@ DisplayDevice::DisplayDevice(property_get("persist.panel.orientation", property, "0");panelOrientation = atoi(property) / 90;+ mPanelInverseMounted = false;+ // Check if panel is inverse mounted (contents show up HV flipped)+ property_get("persist.panel.inversemounted", property, "0");+ mPanelInverseMounted = !!atoi(property);+// initialize the display orientation transform.setProjection(panelOrientation, mViewport, mFrame);}@@ -408,6 +413,11 @@ status_t DisplayDevice::orientationToTransfrom(default:return BAD_VALUE;}++ if (DISPLAY_PRIMARY == mHwcDisplayId && isPanelInverseMounted()) {+ flags = flags ^ Transform::ROT_180;+ }+tr->set(flags, w, h);return NO_ERROR;}但找不到mPanelInverseMounted 和isPanelInverseMounted定義,不知道是基于哪個android版本的,經修改驗證,效果是豎向的,而不是我們想要的橫向。
我們簡單的處理方式是直接把圖片倒過來,所以lk階段不做代碼上的旋轉。
1.2.2 persist.panel.orientation=180
device\qcom\msm8937_64\system.prop下增加persist.panel.orientation=180
#bootanimation daemon會讀取這個字符串進行旋轉操作。
?
1.2.3 frameworks\base\cmds\bootanimation\BootAnimation.cpp
status_t BootAnimation::readyToRun()函數增加下面的內容
char value[PROPERTY_VALUE_MAX];property_get("persist.panel.orientation", value,"0");int orient= atoi(value) / 90;ALOGE("kandi BootAnimation::readyToRun111111,orient=%d\n",orient); ?if(orient== 1 || orient == 3) {int temp = dinfo.h;dinfo.h= dinfo.w;dinfo.w= temp;}Rect destRect(dinfo.w, dinfo.h);mSession->setDisplayProjection(dtoken, orient, destRect, destRect);ALOGE("kandi BootAnimation::readyToRun22222222\n");如果沒有加這個,開機動畫剛開始沒有轉過來,后面才轉過來
1.2.4 frameworks\base\core\res\res\values\config.xml
!-- If true, enables auto-rotation features using the accelerometer.Otherwise, auto-rotation is disabled.? Applications may still requestto use specific orientations but the sensor is ignored and sensor-basedorientations are not available.? Furthermore, all auto-rotation relatedsettings are omitted from the system UI.? In certain situations we maystill use the accelerometer to determine the orientation, such as whendocked if the dock is configured to enable the accelerometer. --><bool name="config_supportAutoRotation">true</bool>Frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManagermSupportAutoRotation = mContext.getResources().getBoolean(com.android.internal.R.bool.config_supportAutoRotation);改為false
<!-- The number of degrees to rotate the display when the keyboard is open.A value of -1 means no change in orientation by default. --><integer name="config_lidOpenRotation">-1</integer>改為180
我們設備沒有傳感器,初步測試不需要修改這兩個地方也能夠達到顯示旋轉180度的效果。
1.2.5 frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
rotationForOrientationLw()函數修改
1.2.6 frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
int mRotation = 2;//kandi change from 0 to 2 for rotate 180 by 2018.07.11public int getRotation() {return mRotation;}mmm frameworks/base/services
make snod,然后燒錄驗證,當然對于userdebug版本可以用push方式。
| rotationForOrientationLw() | mRotation | ? |
| ROTATION_180 | 2 | 轉過來 |
| ROTATION0 | 0 | 沒有轉 |
| ROTATION_180 | 0 | 開機動畫后半段沒有轉過來,進入系統后轉過來 攝像頭沒有轉的,退出后,系統也沒有轉過來 |
| ROTATION0 | 2 | 開機動畫階段有轉過來,但是進入系統后沒有轉過來 |
1.2.7 曉龍相機apk屬性修改
AndroidManifest.xml文件android:screenOrientation=“landscape”的值改為"unspecified"activity就會跟隨系統方向了,否則系統旋轉過來后,曉龍相機也沒有相應的旋轉過來。
?
1.2.8 recovery界面也需要相應的旋轉的
主要再bootable/recovery/minui/graphics_fbdev.cpp中實現旋轉
1.2.9 手機app從設備得到的攝像頭圖像是倒過來的(視頻監控)
kernel\msm-3.18\arch\arm\boot\dts\qcom\msm8937-camera-sensor-qrd.dtsi
qcom,mount-angle = <270>;改為90沒效果,重新改回270
?
接著修改下面:
vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/msm8937_camera.xml
<MountAngle>180</MountAngle>
我們項目的情況這里改為0,否則手機app得到的視頻監控圖像是倒過來的
編譯mmm vendor/qcom/proprietary/mm-camera
升級包的方法:system\etc\camera\camera_config.xml
?
2 兼容性
通過基于device\qcom\msm8937_64\system.prop下persist.panel.orientation屬性的值來兼容,此文件最終編譯后匯總到system\build.prop文件中。
?
比如以
frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java的修改,根據persist.panel.orientation屬性的值來做兼容
修改前:
public int getRotation() {
??????? return mRotation;
}
?
修改后:
public int getRotation() {
?????? ??? String property = SystemProperties.get("persist.panel.orientation");
????????????? int rotation = (Integer.parseInt(property))/90;
????????????? Slog.i(TAG, "getRotation()--->property : " + property + "rotation:" +rotation);
?????????????
??? ?????? mRotation = rotation;//2;
??????? return mRotation;
}
?
3 升級包升級
涉及相關的部分
(1) build.prop
(2) system\etc\camera\camera_config.xml
(3) recovery.img
(4) splash.img
?
參考鏈接:
Android 7.1 豎屏轉橫屏全過程實現-基于高通平臺
https://blog.csdn.net/eliot_shao/article/details/70766283
原
android不通過編譯修改build.prop方法
https://blog.csdn.net/nbalichaoq/article/details/44241071
?
參考
總結
以上是生活随笔為你收集整理的高通平台android7.1系统显示旋转180度的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android 使用反射机制获取或设置系
- 下一篇: AndroidStudio编译提示Cou