经过调整,使得NavicationBar在手机界面的左侧。主要思路分为两步,调整NavitationBar的位置,二是调整view的起始点。
frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 0468ca5..3dd17ff 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -4670,15 +4670,24 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Landscape screen; nav bar goes to the right.
int left = displayWidth - overscanRight
- getNavigationBarWidth(displayRotation, uiMode);
- mTmpNavigationFrame.set(left, 0, displayWidth - overscanRight, displayHeight);
- mStableRight = mStableFullscreenRight = mTmpNavigationFrame.left;
+ //mTmpNavigationFrame.set(left, 0, displayWidth - overscanRight, displayHeight);
+ // mStableRight = mStableFullscreenRight = mTmpNavigationFrame.left;
+ //modify by xiangzaixiansheng for UI
+ int right = overscanLeft + getNavigationBarWidth(displayRotation, uiMode);//计算导航栏大小和显示位置
+ mTmpNavigationFrame.set(overscanLeft, 0, right, displayHeight);
+ mStableLeft = mStableFullscreenLeft = mTmpNavigationFrame.right;
+
if (transientNavBarShowing) {
mNavigationBarController.setBarShowingLw(true);
} else if (navVisible) {
mNavigationBarController.setBarShowingLw(true);
- mDockRight = mTmpNavigationFrame.left;
- mRestrictedScreenWidth = mDockRight - mRestrictedScreenLeft;
- mRestrictedOverscanScreenWidth = mDockRight - mRestrictedOverscanScreenLeft;
+ // mDockRight = mTmpNavigationFrame.left;
+ // mRestrictedScreenWidth = mDockRight - mRestrictedScreenLeft;
+ // mRestrictedOverscanScreenWidth = mDockRight - mRestrictedOverscanScreenLeft;
+ mDockLeft = mTmpNavigationFrame.right;
+ mRestrictedScreenWidth = displayWidth - mDockLeft;
+ mRestrictedOverscanScreenWidth = displayWidth ;
} else {
// We currently want to hide the navigation UI - unless we expanded the status
// bar.
@@ -4690,7 +4699,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// If the nav bar is currently requested to be visible,
// and not in the process of animating on or off, then
// we can tell the app that it is covered by it.
- mSystemRight = mTmpNavigationFrame.left;
+ // mSystemRight = mTmpNavigationFrame.left;
+ mSystemLeft = mTmpNavigationFrame.right;
}
} else if (mNavigationBarPosition == NAV_BAR_LEFT) {
// Seascape screen; nav bar goes to the left.
@@ -4729,7 +4739,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mStatusBarLayer = mNavigationBar.getSurfaceLayer();
// And compute the final frame.
mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame,
- mTmpNavigationFrame, mTmpNavigationFrame, mTmpNavigationFrame, dcf,
+ mTmpNavigationFrame, mTmpNavigationFrame,
+ mTmpNavigationFrame, dcf,
mTmpNavigationFrame, mTmpNavigationFrame);
if (DEBUG_LAYOUT) Slog.i(TAG, "mNavigationBar frame: " + mTmpNavigationFrame);
if (mNavigationBarController.checkHiddenLw()) {
@@ -5229,7 +5240,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
pf.bottom = df.bottom = of.bottom = cf.bottom = mUnrestrictedScreenTop
+ mUnrestrictedScreenHeight;
} else if ((sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) != 0) {
- pf.left = df.left = of.left = mRestrictedScreenLeft;
+ // pf.left = df.left = of.left = mRestrictedScreenLeft;
+ //modify by xiangzaixiansheng
+ pf.left = df.left = of.left = cf.left = mRestrictedScreenLeft-mTmpNavigationFrame.right;
pf.top = df.top = of.top = mRestrictedScreenTop;
pf.right = df.right = of.right = mRestrictedScreenLeft + mRestrictedScreenWidth;
pf.bottom = df.bottom = of.bottom = mRestrictedScreenTop