mNavigationBarHeightForRotation[mSeascapeRotation] = res.getDimensionPixelSize(
com.android.internal.R.dimen.navigation_bar_height_landscape);
// Width of the navigation bar when presented vertically along one side
mNavigationBarWidthForRotation[mPortraitRotation] =
mNavigationBarWidthForRotation[mUpsideDownRotation] =
mNavigationBarWidthForRotation[mLandscapeRotation] =
mNavigationBarWidthForRotation[mSeascapeRotation] =
res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_width);
// SystemUI (status bar) layout policy
int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / density;
int longSizeDp = longSize * DisplayMetrics.DENSITY_DEFAULT / density;
// Allow the navigation bar to move on small devices (phones).
/// M: read the critical dp from mtk resource @{
//mNavigationBarCanMove = shortSizeDp < 600;
mNavigationBarCanMove = shortSizeDp < mContext.getResources().getInteger(
com.mediatek.internal.R.integer.config_dp_for_rotation);
/// @}
mHasNavigationBar = res.getBoolean(com.android.internal.R.bool.config_showNavigationBar);
/// M:[SmartBook]Don’t show navigation bar if SmartBook plugged in @{
if (FeatureOption.MTK_SMARTBOOK_SUPPORT) {
mNavigationBarCanMove = false;
mHasNavigationBar = mSmartBookPlugIn ? false : mContext.getResources().getBoolean(
com.android.internal.R.bool.config_showNavigationBar);
Slog.d(TAG, “mSmartBookPlugIn:” + mSmartBookPlugIn + “, mHasNavigationBar:” + mHasNavigationBar);
}
/// @}
// Allow a system property to override this. Used by the emulator.
// See also hasNavigationBar().
String navBarOverride = SystemProperties.get(“qemu.hw.mainkeys”);
if (“1”.equals(navBarOverride)) {
mHasNavigationBar = false;
} else if (“0”.equals(navBarOverride)) {
mHasNavigationBar = true;
}
// For demo purposes, allow the rotation of the HDMI display to be controlled.
// By default, HDMI locks rotation to landscape.
if (“portrait”.equals(SystemProperties.get(“persist.demo.hdmirotation”))) {
mDemoHdmiRotation = mPortraitRotation;
} else {
mDemoHdmiRotation = mLandscapeRotation;
}
mDemoHdmiRotationLock = SystemProperties.getBoolean(“persist.demo.hdmirotationlock”, false);
// Only force the default orientation if the screen is xlarge, at least 960dp x 720dp, per
// http://developer.android.com/guide/practices/screens_support.html#range
mForceDefaultOrientation = longSizeDp >= 960 && shortSizeDp >= 720 &&
res.getBoolean(com.android.internal.R.bool.config_forceDefaultOrientation) &&
// For debug purposes the next line turns this feature off with:
// $ adb shell setprop config.override_forced_orient true
// $ adb shell wm size reset
!“true”.equals(SystemProperties.get(“config.override_forced_orient”));
}
修改:frameworks/base/core/res/res/v 《Android学习笔记总结+最新移动架构视频+大厂安卓面试真题+项目实战源码讲义》无偿开源 徽信搜索公众号【编程进阶路】 alues/config.xml
true
2.应用中修改
在对应的Activity中设置orientation为reverseLandscape就可以了。
转载请注明出处:[周木水的CSDN博客](() [http://blog.csdn.net/zhoumushui](()