调整diplay size时,虚拟按键一直显示在下方

调整diplay size时,虚拟按键一直显示在下方


在这里插入代码片
diff --git a/frameworks/base/packages/SystemUI/res/layout/nav_bar_tuner_inflater.xml b/frameworks/base/packages/Syst
old mode 100644
new mode 100755
index b237633..982b935
--- a/frameworks/base/packages/SystemUI/res/layout/nav_bar_tuner_inflater.xml
+++ b/frameworks/base/packages/SystemUI/res/layout/nav_bar_tuner_inflater.xml
     <include android:id="@+id/rot0" layout="@layout/navigation_layout" />
-    <include android:id="@+id/rot90" layout="@layout/navigation_layout_rot90" />
+    <include android:id="@+id/rot90" layout="@layout/navigation_layout" />  
 
 --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.ja
old mode 100644
new mode 100755
index 3240489..493485d
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
@@ -86,7 +86,7 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
         Display display = ((WindowManager)
                 context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
         Mode displayMode = display.getMode();
-        isRot0Landscape = displayMode.getPhysicalWidth() < displayMode.getPhysicalHeight();
+        isRot0Landscape = displayMode.getPhysicalWidth() > displayMode.getPhysicalHeight();
     }
 
     private void createInflaters() {
@@ -123,7 +123,7 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
         mRot0 = (FrameLayout) mLayoutInflater.inflate(R.layout.navigation_layout, this, false);
         mRot0.setId(R.id.rot0);
         addView(mRot0);
-        mRot90 = (FrameLayout) mLayoutInflater.inflate(R.layout.navigation_layout_rot90, this,
+        mRot90 = (FrameLayout) mLayoutInflater.inflate(R.layout.navigation_layout, this,
                 false);
         mRot90.setId(R.id.rot90);
         addView(mRot90);
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/fra
index e4eaf7b..4b420f0 100755
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -51,7 +51,7 @@ import com.android.systemui.statusbar.policy.DeadZone;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
-
+import android.view.Display.Mode;
 public class NavigationBarView extends LinearLayout {
     final static boolean DEBUG = false;
     final static String TAG = "StatusBar/NavBarView";
@@ -72,7 +72,7 @@ public class NavigationBarView extends LinearLayout {
     boolean mShowMenu;
     int mDisabledFlags = 0;
     int mNavigationIconHints = 0;
-
+       private boolean mIsRot0Landscape = true;
     private Drawable mBackIcon, mBackLandIcon, mBackAltIcon, mBackAltLandIcon;
     private Drawable mBackCarModeIcon, mBackLandCarModeIcon;
     private Drawable mBackAltCarModeIcon, mBackAltLandCarModeIcon;
@@ -196,7 +196,11 @@ public class NavigationBarView extends LinearLayout {
         mConfiguration = new Configuration();
         mConfiguration.updateFrom(context.getResources().getConfiguration());
         updateIcons(context, Configuration.EMPTY, mConfiguration);
-
+        Display display = ((WindowManager)
+                context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
+        Mode displayMode = display.getMode();
+        mIsRot0Landscape = displayMode.getPhysicalWidth() > displayMode.getPhysicalHeight();
+        Log.v(TAG, "PW=" + displayMode.getPhysicalWidth() + ", PH=" + displayMode.getPhysicalHeight());
         mBarTransitions = new NavigationBarTransitions(this);
 
         mButtonDisatchers.put(R.id.back, new ButtonDispatcher(R.id.back));
@@ -540,6 +544,15 @@ public class NavigationBarView extends LinearLayout {
     }
 
     void updateRotatedViews() {
+        if (mIsRot0Landscape) {
+            Log.w(TAG, "NBV updateRotatedViews mVertical= true, change rot0 rot90");
+            mRotatedViews[Surface.ROTATION_0] =
+                    mRotatedViews[Surface.ROTATION_180] = findViewById(R.id.rot90);
+            mRotatedViews[Surface.ROTATION_270] =
+                    mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot0);
+            updateCurrentView();
+            return;
+        }              
         mRotatedViews[Surface.ROTATION_0] =
                 mRotatedViews[Surface.ROTATION_180] = findViewById(R.id.rot0);
         mRotatedViews[Surface.ROTATION_270] =
diff --git a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/frameworks/base/
index 3e3ebfb..d652d86 100755
--- a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -2086,7 +2086,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
         int longSizeDp = longSize * DisplayMetrics.DENSITY_DEFAULT / density;
 
         // Allow the navigation bar to move on non-square small devices (phones).
-        mNavigationBarCanMove = width != height && shortSizeDp < 600;
+        mNavigationBarCanMove = width != height && shortSizeDp < 0;
 
         mHasNavigationBar = res.getBoolean(com.android.internal.R.bool.config_showNavigationBar);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

心有纤纤结

你的鼓励将是我创作的最大动力

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

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

打赏作者

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

抵扣说明:

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

余额充值