问题的描述:
1.从第三方相机缩略图界面进入图库(photos 或者 gallery)返回相机后横屏,界面强制横屏然后旋转恢复
2. 从系统相机缩略图界面进入图库(photos 或者 gallery)横屏,然后返回相机,界面强制横屏然后旋转恢复
首先来说这是一个谷歌已知的问题,在安卓8.0和8.1上都会出现的。
https://issuetracker.google.com/issues/69168442
直接上解决办法了
在frameworks\base\services\core\java\com\android\server\wm\WindowCotaint.java
在getorientation()的方法中,请在对应位置加下///M:包起来的这一段:
if (orientation == SCREEN_ORIENTATION_UNSET) {
continue;
}
/// M: We ignore any hidden applications on the top.
/// Just like N. @{
if (wc instanceof AppWindowToken) {
AppWindowToken atoken = (AppWindowToken) wc;
Slog.v("WindowContainer", "WindowContainer atoken.hiddenRequested=" +atoken.hiddenRequested);
if (atoken.hiddenRequested) {
Slog.v("WindowContainer", "WindowContainer" +
"Skipping " + atoken + " -- going to hide");
continue;
}
}
/// M: @}
if (wc.fillsParent() || orientation != SCREEN_ORIENTATION_UNSPECIFIED) {
// Use the orientation if the container fills its parent or requested an explicit
// orientation that isn't SCREEN_ORIENTATION_UNSPECIFIED.
return orientation;
}