Android9.0 MTK 平板横屏方案修改(强制app横屏 + 开机logo/动画+关机充电横屏 + RecoveryUI 横屏) | 您所在的位置:网站首页 › 安卓横屏动画制作软件 › Android9.0 MTK 平板横屏方案修改(强制app横屏 + 开机logo/动画+关机充电横屏 + RecoveryUI 横屏) |
文章较长建议先收藏再看 拆解步骤1、app 强制横屏显示,无视 android:screenOrientation=“portrait” 属性 2、屏幕触摸坐标修改为横屏 3、开机动画横屏 4、开机logo、关机充电动画横屏 5、RecoveryUI 横屏 上代码##1、app 强制横屏显示 修改 rotationForOrientationLw(), 默认返回 270 frameworks\base\services\core\java\com\android\server\policy\PhoneWindowManager.java @Override public int rotationForOrientationLw(int orientation, int lastRotation, boolean defaultDisplay) { .... synchronized (mLock) { ... default: // For USER, UNSPECIFIED, NOSENSOR, SENSOR and FULL_SENSOR, // just return the preferred orientation we already calculated. if (preferredRotation >= 0) { return preferredRotation; } // return Surface.ROTATION_0; return Surface.ROTATION_270;//cczheng add for land scap } } }activity 默认强制属性为 SCREEN_ORIENTATION_LANDSCAPE frameworks\base\services\core\java\com\android\server\wm\WindowManagerService.java boolean updateOrientationFromAppTokensLocked(int displayId, boolean forceUpdate) { long ident = Binder.clearCallingIdentity(); try { final DisplayContent dc = mRoot.getDisplayContent(displayId); // final int req = dc.getOrientation(); int req = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;//cczheng add for land scap if (req != dc.getLastOrientation() || forceUpdate) { if (DEBUG_ORIENTATION) { Slog.v(TAG, "updateOrientation: req= " + req + ", mLastOrientation= " + dc.getLastOrientation(), new Throwable("updateOrientation")); } dc.setLastOrientation(req); //send a message to Policy indicating orientation change to take //action like disabling/enabling sensors etc., // TODO(multi-display): Implement policy for secondary displays. if (dc.isDefaultDisplay) { mPolicy.setCurrentOrientationLw(req); } return dc.updateRotationUnchecked(forceUpdate); } return false; } finally { Binder.restoreCallingIdentity(ident); } }DisPlayContent 显示 mRotation 默认改为 3 (270) frameworks\base\services\core\java\com\android\server\wm\DisplayContent.java /** * Current rotation of the display. * Constants as per {@link android.view.Surface.Rotation}. * * @see #updateRotationUnchecked() */ // private int mRotation = 0; private int mRotation = 3;//cczheng add for land scap修改默认值 config_reverseDefaultRotation 为 true,翻转显示角度 frameworks\base\core\res\res\values\config.xml |
CopyRight 2018-2019 实验室设备网 版权所有 |