相关修改:
Luncher
AndroidManifest.xml
android:name="com.android.launcher3.Launcher"
....
android:screenOrientation="sensor"
....
src/com/android/launcher3/DeviceProfile.java
float originalSmallestWidth = dpiFromPx(Math.min(widthPx, heightPx), DENSITY_DEVICE_STABLE);
// allowRotation = originalSmallestWidth >= MIN_TABLET_WIDTH;
allowRotation = true;
// Tablet UI does not support emulated landscape.
isTablet = allowRotation && info.isTablet(windowBounds);
.....
public boolean isVerticalBarLayout() {
return isLandscape && false;
}
framework
base/core/res/res/values/config.xml
锁屏旋转和导航栏旋转
<!-- Disable lockscreen rotation by default -->
<bool name="config_enableLockScreenRotation">true</bool>
....
<bool name="config_navBarCanMove">false</bool>
解决锁屏旋转卡顿问题
base/services/core/java/com/android/server/policy/PhoneWindowManager.java
static final int WAITING_FOR_DRAWN_TIMEOUT = 500;
.....
private long getKeyguardDrawnTimeout() {
final boolean bootCompleted =
LocalServices.getService(SystemServiceManager.class).isBootCompleted();
// Set longer timeout if it has not booted yet to prevent showing empty window.
return bootCompleted ? 500 : 5000;
}
.....
if (mKeyguardDelegate != null && mKeyguardDelegate.hasKeyguard()) {
mHandler.removeMessages(MSG_KEYGUARD_DRAWN_TIMEOUT);
mHandler.sendEmptyMessageDelayed(MSG_KEYGUARD_DRAWN_TIMEOUT,
getKeyguardDrawnTimeout());
// mKeyguardDelegate.onScreenTurningOn(mKeyguardDrawnCallback);
} else {
if (DEBUG_WAKEUP) Slog.d(TAG,
"null mKeyguardDelegate: setting mKeyguardDrawComplete.");
mHandler.sendEmptyMessage(MSG_KEYGUARD_DRAWN_COMPLETE);
}