|
发表于 2016-12-14 14:32:27
只看该作者
板凳
修改文件:
WindowManagerService.java (frameworks\base\services\core\java\com\android\server\wm)
中,函数
boolean updateOrientationFromAppTokensLocked(boolean inTransaction) {
long ident = Binder.clearCallingIdentity();
try {
//int req = getOrientationFromWindowsLocked(); //屏蔽原有代码
//写死req变量,可以通过用property,来灵活设置强制或自动旋转
int req = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
if (req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
req = getOrientationFromAppTokensLocked();
}
if (req != mForcedAppOrientation) {
mForcedAppOrientation = req;
//send a message to Policy indicating orientation change to take
//action like disabling/enabling sensors etc.,
mPolicy.setCurrentOrientationLw(req);
if (updateRotationUncheckedLocked(inTransaction)) {
// changed
return true;
}
}
return false;
} finally {
Binder.restoreCallingIdentity(ident);
}
} |
|