44 次浏览
需先完成系统默认横屏显示
path: <source>/frameworks/base/cmds/bootanimation/BootAnimation.cpp
(1)函数status_t BootAnimation::readyToRun()中create the native surface前增加如下代码:
// added by peng
char value[PROPERTY_VALUE_MAX];
property_get("persist.panel.orientation", value,"0");
int orient= atoi(value) / 90;
if(orient== 1 || orient == 3) {
if (dinfo.h > dinfo.w) {
int temp = dinfo.h;
dinfo.h= dinfo.w;
dinfo.w= temp;
}
}
path: <source>/frameworks/base/services/core/java/com/android/server/wm/DisplayContent.java
(1)import android.os.Trace后增加如下代码
// added by peng
import android.os.SystemProperties;
(2)函数class DisplayContent extends WindowContainer中setController(controller)后增加如下代码:
// added by peng
int orient = SystemProperties.getInt("persist.panel.orientation", 0);
if (orient == 90) {
mRotation = Surface.ROTATION_90;
}
path: <source>/frameworks/native/services/surfaceflinger/DisplayDevice.cpp
(1)函数DisplayDevice::DisplayDevice中屏蔽并增加如下代码
// edited by peng
//setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
char value[PROPERTY_VALUE_MAX];
property_get("persist.panel.orientation", value,"0");
int orient= atoi(value) / 90;
if(orient== 1 || orient == 3) {
setProjection(DisplayState::eOrientation90, mViewport, mFrame);
} else {
setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
}
(2)函数void DisplayDevice::setProjection中屏蔽并增加如下代码:
// edited by peng
//frame = Rect(w, h);
char value[PROPERTY_VALUE_MAX];
property_get("persist.panel.orientation", value,"0");
int orient= atoi(value) / 90;
if(orient== 1 || orient == 3) {
if (h > w) {
frame = Rect(h, w);
}
} else {
frame = Rect(w, h);
}
path: <source>/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
(1)函数void SurfaceFlinger::onInitializeDisplays中屏蔽并增加如下代码:
// edited by peng
//d.orientation = DisplayState::eOrientationDefault;
char value[PROPERTY_VALUE_MAX];
property_get("persist.panel.orientation", value,"0");
int orient= atoi(value) / 90;
if(orient== 1 || orient == 3) {
d.orientation = DisplayState::eOrientation90;
} else {
d.orientation = DisplayState::eOrientationDefault;
}