Put dismiss end target at navigation bar
This makes the animation when exiting docked mode a bit nicer
when you fling the divider towards to the navigation bar. However,
since the divider ends at the navigation bar, we need to immediately
dismiss it instead of fading out when the divider is fully occluded
by the navigation bar.
Change-Id: Ic5432fd118cb71be36485667b2c537caf5065ce5
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index a92cc31..c046ba6 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -2645,11 +2645,7 @@
}
}
} else if (win.getAttrs().type == TYPE_DOCK_DIVIDER) {
- if (transit == TRANSIT_ENTER || transit == TRANSIT_SHOW) {
- return R.anim.fade_in;
- } else if (transit == TRANSIT_EXIT) {
- return R.anim.fade_out;
- }
+ return selectDockedDividerAnimationLw(win, transit);
}
if (transit == TRANSIT_PREVIEW_DONE) {
@@ -2669,6 +2665,24 @@
return 0;
}
+ private int selectDockedDividerAnimationLw(WindowState win, int transit) {
+ int insets = mWindowManagerFuncs.getDockedDividerInsetsLw();
+
+ // If the divider is behind the navigation bar, don't animate.
+ if (mNavigationBar != null
+ && (win.getFrameLw().top + insets >= mNavigationBar.getFrameLw().top
+ || win.getFrameLw().left + insets >= mNavigationBar.getFrameLw().left)) {
+ return 0;
+ }
+ if (transit == TRANSIT_ENTER || transit == TRANSIT_SHOW) {
+ return R.anim.fade_in;
+ } else if (transit == TRANSIT_EXIT) {
+ return R.anim.fade_out;
+ } else {
+ return 0;
+ }
+ }
+
@Override
public void selectRotationAnimationLw(int anim[]) {
if (PRINT_ANIM) Slog.i(TAG, "selectRotationAnimation mTopFullscreen="
diff --git a/services/core/java/com/android/server/wm/DockedStackDividerController.java b/services/core/java/com/android/server/wm/DockedStackDividerController.java
index 7295318..412a455 100644
--- a/services/core/java/com/android/server/wm/DockedStackDividerController.java
+++ b/services/core/java/com/android/server/wm/DockedStackDividerController.java
@@ -72,6 +72,10 @@
return mDividerWindowWidth - 2 * mDividerInsets;
}
+ int getContentInsets() {
+ return mDividerInsets;
+ }
+
void setResizing(boolean resizing) {
mResizing = resizing;
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 1b041cb..d1ffaa0 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -9619,6 +9619,11 @@
&& !appWindow.mTask.inFreeformWorkspace();
}
+ @Override
+ public int getDockedDividerInsetsLw() {
+ return getDefaultDisplayContentLocked().getDockedDividerController().getContentInsets();
+ }
+
void dumpPolicyLocked(PrintWriter pw, String[] args, boolean dumpAll) {
pw.println("WINDOW MANAGER POLICY STATE (dumpsys window policy)");
mPolicy.dump(" ", pw, args);