RK Android 8.1强制第三方APK横屏

修改:

frameworks\base\services\core\java\com\android\server\policy\PhoneWindowManager.java

@Override
public int rotationForOrientationLw(int orientation, int lastRotation) {
    if (false) {
        Slog.v(TAG, "rotationForOrientationLw(orient="
                    + orientation + ", last=" + lastRotation
                    + "); user=" + mUserRotation + " "
                    + ((mUserRotationMode == WindowManagerPolicy.USER_ROTATION_LOCKED)
                        ? "USER_ROTATION_LOCKED" : "")
                    );
    }
    
//  if (mForceDefaultOrientation) {     
	if (true) {                     
	 //add pang将mForceDefaultOrientation 改为 true,
	 //默认返回 Surface.ROTATION_0 横屏
     return Surface.ROTATION_0;// 默认横屏
    }

    synchronized (mLock) {
        int sensorRotation = mOrientationListener.getProposedRotation(); // may be -1
        if (sensorRotation < 0) {
            sensorRotation = lastRotation;
        }
将 mForceDefaultOrientation 改为 true,默认返回 Surface.ROTATION_0 横屏

修改:

frameworks\base\services\core\java\com\android\server\wm\DisplayContent.java

px30_android-8.1/frameworks/base/services/core/java/com/android/server/wm$ git diff DisplayContent.java

diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
old mode 100644
new mode 100755
index ba99f38f4c3..8a9cd8c76e4
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -915,6 +915,13 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
      * {@link WindowManagerService#sendNewConfiguration(int)} TO UNFREEZE THE SCREEN.
      */
     boolean updateRotationUnchecked(boolean inTransaction) {
+
+        //add by pang start
+        if (true) {
+            return true;
+        }
+        //add by pang end
+
         if (mService.mDeferredRotationPauseCount > 0) {
             // Rotation updates have been paused temporarily.  Defer the update until
             // updates have been resumed.
@@ -929,7 +936,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
             // animation is still in progress.  Skip this update.  We will try updating
             // again after the animation is finished and the display is unfrozen.
             if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Deferring rotation, animation in progress.");
-            return false;
+             // return false;
+                  return true;   //add pang
         }
         if (mService.mDisplayFrozen) {
             // Even if the screen rotation animation has finished (e.g. isAnimating
@@ -937,7 +945,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
             // the display. We also need to abort rotation here.
             if (DEBUG_ORIENTATION) Slog.v(TAG_WM,
                     "Deferring rotation, still finishing previous rotation");
-            return false;
+           // return false;
+                  return true;   //add pang
         }
 
         if (!mService.mDisplayEnabled) {
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

那肯定是很多年以后!

你的鼓励就我最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值