高通平台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";
從內(nèi)核到進(jìn)入系統(tǒng)旋轉(zhuǎn)成功,但是存在一個(gè)問題,插入鼠標(biāo)移動(dòng)的時(shí)候藍(lán)屏。初步測(cè)試曉龍相機(jī)預(yù)覽方向是正常的,視頻對(duì)講、監(jiān)控和app方向都正常
據(jù)觀察,鼠標(biāo)移動(dòng)和顯示的方向,沒有相應(yīng)對(duì)應(yīng)起來
此方案大家如果大家知道怎么解決插入鼠標(biāo)移動(dòng)時(shí)顯示藍(lán)屏問題,麻煩告知,謝謝了。
下面是高通對(duì)我們這種解決方案的回復(fù):
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定義,不知道是基于哪個(gè)android版本的,經(jīng)修改驗(yàn)證,效果是豎向的,而不是我們想要的橫向。
我們簡單的處理方式是直接把圖片倒過來,所以lk階段不做代碼上的旋轉(zhuǎn)。
1.2.2 persist.panel.orientation=180
device\qcom\msm8937_64\system.prop下增加persist.panel.orientation=180
#bootanimation daemon會(huì)讀取這個(gè)字符串進(jìn)行旋轉(zhuǎn)操作。
?
1.2.3 frameworks\base\cmds\bootanimation\BootAnimation.cpp
status_t BootAnimation::readyToRun()函數(shù)增加下面的內(nèi)容
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");如果沒有加這個(gè),開機(jī)動(dòng)畫剛開始沒有轉(zhuǎn)過來,后面才轉(zhuǎ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
我們?cè)O(shè)備沒有傳感器,初步測(cè)試不需要修改這兩個(gè)地方也能夠達(dá)到顯示旋轉(zhuǎn)180度的效果。
1.2.5 frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
rotationForOrientationLw()函數(shù)修改
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,然后燒錄驗(yàn)證,當(dāng)然對(duì)于userdebug版本可以用push方式。
| rotationForOrientationLw() | mRotation | ? |
| ROTATION_180 | 2 | 轉(zhuǎn)過來 |
| ROTATION0 | 0 | 沒有轉(zhuǎn) |
| ROTATION_180 | 0 | 開機(jī)動(dòng)畫后半段沒有轉(zhuǎn)過來,進(jìn)入系統(tǒng)后轉(zhuǎn)過來 攝像頭沒有轉(zhuǎn)的,退出后,系統(tǒng)也沒有轉(zhuǎn)過來 |
| ROTATION0 | 2 | 開機(jī)動(dòng)畫階段有轉(zhuǎn)過來,但是進(jìn)入系統(tǒng)后沒有轉(zhuǎn)過來 |
1.2.7 曉龍相機(jī)apk屬性修改
AndroidManifest.xml文件android:screenOrientation=“l(fā)andscape”的值改為"unspecified"activity就會(huì)跟隨系統(tǒng)方向了,否則系統(tǒng)旋轉(zhuǎn)過來后,曉龍相機(jī)也沒有相應(yīng)的旋轉(zhuǎn)過來。
?
1.2.8 recovery界面也需要相應(yīng)的旋轉(zhuǎn)的
主要再bootable/recovery/minui/graphics_fbdev.cpp中實(shí)現(xiàn)旋轉(zhuǎn)
1.2.9 手機(jī)app從設(shè)備得到的攝像頭圖像是倒過來的(視頻監(jiān)控)
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>
我們項(xiàng)目的情況這里改為0,否則手機(jī)app得到的視頻監(jiān)控圖像是倒過來的
編譯mmm vendor/qcom/proprietary/mm-camera
升級(jí)包的方法: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的修改,根據(jù)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 升級(jí)包升級(jí)
涉及相關(guān)的部分
(1) build.prop
(2) system\etc\camera\camera_config.xml
(3) recovery.img
(4) splash.img
?
參考鏈接:
Android 7.1 豎屏轉(zhuǎn)橫屏全過程實(shí)現(xiàn)-基于高通平臺(tái)
https://blog.csdn.net/eliot_shao/article/details/70766283
原
android不通過編譯修改build.prop方法
https://blog.csdn.net/nbalichaoq/article/details/44241071
?
參考
總結(jié)
以上是生活随笔為你收集整理的高通平台android7.1系统显示旋转180度的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android 使用反射机制获取或设置系
- 下一篇: android系统底层驱动多个物理按键上