Loading core/java/android/view/IDockedStackListener.aidl +9 −0 Original line number Diff line number Diff line Loading @@ -33,4 +33,13 @@ oneway interface IDockedStackListener { * Called when the docked stack gets created or removed. */ void onDockedStackExistsChanged(boolean exists); /** * Called when window manager decides to minimize the docked stack. The divider should make * itself not interactable and shrink a bit in this state. * * @param minimized Whether the docked stack is currently minimized. * @param animDuration The duration of the animation for changing the minimized state. */ void onDockedStackMinimizedChanged(boolean minimized, long animDuration); } core/java/com/android/internal/policy/DockedDividerUtils.java +46 −31 Original line number Diff line number Diff line Loading @@ -17,9 +17,9 @@ package com.android.internal.policy; import android.graphics.Rect; import android.view.WindowManager; import static android.view.WindowManager.DOCKED_BOTTOM; import static android.view.WindowManager.DOCKED_INVALID; import static android.view.WindowManager.DOCKED_LEFT; import static android.view.WindowManager.DOCKED_RIGHT; import static android.view.WindowManager.DOCKED_TOP; Loading @@ -35,29 +35,43 @@ public class DockedDividerUtils { int displayWidth, int displayHeight, int dividerSize) { outRect.set(0, 0, displayWidth, displayHeight); switch (dockSide) { case WindowManager.DOCKED_LEFT: case DOCKED_LEFT: outRect.right = position; break; case WindowManager.DOCKED_TOP: case DOCKED_TOP: outRect.bottom = position; break; case WindowManager.DOCKED_RIGHT: case DOCKED_RIGHT: outRect.left = position + dividerSize; break; case WindowManager.DOCKED_BOTTOM: case DOCKED_BOTTOM: outRect.top = position + dividerSize; break; } sanitizeStackBounds(outRect); sanitizeStackBounds(outRect, dockSide == DOCKED_LEFT || dockSide == DOCKED_TOP); } public static void sanitizeStackBounds(Rect bounds) { /** * Makes sure that the bounds are always valid, i. e. they are at least one pixel high and wide. * * @param bounds The bounds to sanitize. * @param topLeft Pass true if the bounds are at the top/left of the screen, false if they are * at the bottom/right. This is used to determine in which direction to extend * the bounds. */ public static void sanitizeStackBounds(Rect bounds, boolean topLeft) { // If the bounds are either on the top or left of the screen, rather move it further to the // left/top to make it more offscreen. If they are on the bottom or right, push them off the // screen by moving it even more to the bottom/right. if (topLeft) { if (bounds.left >= bounds.right) { bounds.left = bounds.right - 1; } if (bounds.top >= bounds.bottom) { bounds.top = bounds.bottom - 1; } } else { if (bounds.right <= bounds.left) { bounds.right = bounds.left + 1; } Loading @@ -65,16 +79,17 @@ public class DockedDividerUtils { bounds.bottom = bounds.top + 1; } } } public static int calculatePositionForBounds(Rect bounds, int dockSide, int dividerSize) { switch (dockSide) { case WindowManager.DOCKED_LEFT: case DOCKED_LEFT: return bounds.right; case WindowManager.DOCKED_TOP: case DOCKED_TOP: return bounds.bottom; case WindowManager.DOCKED_RIGHT: case DOCKED_RIGHT: return bounds.left - dividerSize; case WindowManager.DOCKED_BOTTOM: case DOCKED_BOTTOM: return bounds.top - dividerSize; default: return 0; Loading Loading @@ -109,16 +124,16 @@ public class DockedDividerUtils { public static int invertDockSide(int dockSide) { switch (dockSide) { case WindowManager.DOCKED_LEFT: return WindowManager.DOCKED_RIGHT; case WindowManager.DOCKED_TOP: return WindowManager.DOCKED_BOTTOM; case WindowManager.DOCKED_RIGHT: return WindowManager.DOCKED_LEFT; case WindowManager.DOCKED_BOTTOM: return WindowManager.DOCKED_TOP; case DOCKED_LEFT: return DOCKED_RIGHT; case DOCKED_TOP: return DOCKED_BOTTOM; case DOCKED_RIGHT: return DOCKED_LEFT; case DOCKED_BOTTOM: return DOCKED_TOP; default: return WindowManager.DOCKED_INVALID; return DOCKED_INVALID; } } } core/res/res/values/dimens.xml +4 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,10 @@ calculate the bounds of the stacks--> <dimen name="docked_stack_divider_insets">19dp</dimen> <!-- To how much the docked stack gets reduced when we decide to minimize the docked stack, i.e. when the user opens homescreen. --> <dimen name="docked_stack_minimize_thickness">8dp</dimen> <!-- Min width for a tablet device --> <dimen name="min_xlarge_screen_width">800dp</dimen> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1506,6 +1506,7 @@ <java-symbol type="bool" name="target_honeycomb_needs_options_menu" /> <java-symbol type="dimen" name="docked_stack_divider_thickness" /> <java-symbol type="dimen" name="docked_stack_divider_insets" /> <java-symbol type="dimen" name="docked_stack_minimize_thickness" /> <java-symbol type="integer" name="config_dockedStackDividerSnapMode" /> <java-symbol type="fraction" name="docked_stack_divider_fixed_ratio" /> <java-symbol type="dimen" name="navigation_bar_height" /> Loading packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java +28 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ public class Divider extends SystemUI { private DividerView mView; private DockDividerVisibilityListener mDockDividerVisibilityListener; private boolean mVisible = false; private boolean mMinimized = false; @Override public void start() { Loading Loading @@ -81,6 +82,10 @@ public class Divider extends SystemUI { private void update(Configuration configuration) { removeDivider(); addDivider(configuration); if (mMinimized) { mView.setMinimizedDockStack(true); mWindowManager.setTouchable(false); } } private void updateVisibility(final boolean visible) { Loading @@ -95,6 +100,23 @@ public class Divider extends SystemUI { }); } private void updateMinimizedDockedStack(final boolean minimized, final long animDuration) { mView.post(new Runnable() { @Override public void run() { if (mMinimized != minimized) { mMinimized = minimized; mWindowManager.setTouchable(!minimized); if (animDuration > 0) { mView.setMinimizedDockStack(minimized, animDuration); } else { mView.setMinimizedDockStack(minimized); } } } }); } class DockDividerVisibilityListener extends IDockedStackListener.Stub { @Override Loading @@ -105,5 +127,11 @@ public class Divider extends SystemUI { @Override public void onDockedStackExistsChanged(boolean exists) throws RemoteException { } @Override public void onDockedStackMinimizedChanged(boolean minimized, long animDuration) throws RemoteException { updateMinimizedDockedStack(minimized, animDuration); } } } Loading
core/java/android/view/IDockedStackListener.aidl +9 −0 Original line number Diff line number Diff line Loading @@ -33,4 +33,13 @@ oneway interface IDockedStackListener { * Called when the docked stack gets created or removed. */ void onDockedStackExistsChanged(boolean exists); /** * Called when window manager decides to minimize the docked stack. The divider should make * itself not interactable and shrink a bit in this state. * * @param minimized Whether the docked stack is currently minimized. * @param animDuration The duration of the animation for changing the minimized state. */ void onDockedStackMinimizedChanged(boolean minimized, long animDuration); }
core/java/com/android/internal/policy/DockedDividerUtils.java +46 −31 Original line number Diff line number Diff line Loading @@ -17,9 +17,9 @@ package com.android.internal.policy; import android.graphics.Rect; import android.view.WindowManager; import static android.view.WindowManager.DOCKED_BOTTOM; import static android.view.WindowManager.DOCKED_INVALID; import static android.view.WindowManager.DOCKED_LEFT; import static android.view.WindowManager.DOCKED_RIGHT; import static android.view.WindowManager.DOCKED_TOP; Loading @@ -35,29 +35,43 @@ public class DockedDividerUtils { int displayWidth, int displayHeight, int dividerSize) { outRect.set(0, 0, displayWidth, displayHeight); switch (dockSide) { case WindowManager.DOCKED_LEFT: case DOCKED_LEFT: outRect.right = position; break; case WindowManager.DOCKED_TOP: case DOCKED_TOP: outRect.bottom = position; break; case WindowManager.DOCKED_RIGHT: case DOCKED_RIGHT: outRect.left = position + dividerSize; break; case WindowManager.DOCKED_BOTTOM: case DOCKED_BOTTOM: outRect.top = position + dividerSize; break; } sanitizeStackBounds(outRect); sanitizeStackBounds(outRect, dockSide == DOCKED_LEFT || dockSide == DOCKED_TOP); } public static void sanitizeStackBounds(Rect bounds) { /** * Makes sure that the bounds are always valid, i. e. they are at least one pixel high and wide. * * @param bounds The bounds to sanitize. * @param topLeft Pass true if the bounds are at the top/left of the screen, false if they are * at the bottom/right. This is used to determine in which direction to extend * the bounds. */ public static void sanitizeStackBounds(Rect bounds, boolean topLeft) { // If the bounds are either on the top or left of the screen, rather move it further to the // left/top to make it more offscreen. If they are on the bottom or right, push them off the // screen by moving it even more to the bottom/right. if (topLeft) { if (bounds.left >= bounds.right) { bounds.left = bounds.right - 1; } if (bounds.top >= bounds.bottom) { bounds.top = bounds.bottom - 1; } } else { if (bounds.right <= bounds.left) { bounds.right = bounds.left + 1; } Loading @@ -65,16 +79,17 @@ public class DockedDividerUtils { bounds.bottom = bounds.top + 1; } } } public static int calculatePositionForBounds(Rect bounds, int dockSide, int dividerSize) { switch (dockSide) { case WindowManager.DOCKED_LEFT: case DOCKED_LEFT: return bounds.right; case WindowManager.DOCKED_TOP: case DOCKED_TOP: return bounds.bottom; case WindowManager.DOCKED_RIGHT: case DOCKED_RIGHT: return bounds.left - dividerSize; case WindowManager.DOCKED_BOTTOM: case DOCKED_BOTTOM: return bounds.top - dividerSize; default: return 0; Loading Loading @@ -109,16 +124,16 @@ public class DockedDividerUtils { public static int invertDockSide(int dockSide) { switch (dockSide) { case WindowManager.DOCKED_LEFT: return WindowManager.DOCKED_RIGHT; case WindowManager.DOCKED_TOP: return WindowManager.DOCKED_BOTTOM; case WindowManager.DOCKED_RIGHT: return WindowManager.DOCKED_LEFT; case WindowManager.DOCKED_BOTTOM: return WindowManager.DOCKED_TOP; case DOCKED_LEFT: return DOCKED_RIGHT; case DOCKED_TOP: return DOCKED_BOTTOM; case DOCKED_RIGHT: return DOCKED_LEFT; case DOCKED_BOTTOM: return DOCKED_TOP; default: return WindowManager.DOCKED_INVALID; return DOCKED_INVALID; } } }
core/res/res/values/dimens.xml +4 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,10 @@ calculate the bounds of the stacks--> <dimen name="docked_stack_divider_insets">19dp</dimen> <!-- To how much the docked stack gets reduced when we decide to minimize the docked stack, i.e. when the user opens homescreen. --> <dimen name="docked_stack_minimize_thickness">8dp</dimen> <!-- Min width for a tablet device --> <dimen name="min_xlarge_screen_width">800dp</dimen> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1506,6 +1506,7 @@ <java-symbol type="bool" name="target_honeycomb_needs_options_menu" /> <java-symbol type="dimen" name="docked_stack_divider_thickness" /> <java-symbol type="dimen" name="docked_stack_divider_insets" /> <java-symbol type="dimen" name="docked_stack_minimize_thickness" /> <java-symbol type="integer" name="config_dockedStackDividerSnapMode" /> <java-symbol type="fraction" name="docked_stack_divider_fixed_ratio" /> <java-symbol type="dimen" name="navigation_bar_height" /> Loading
packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java +28 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ public class Divider extends SystemUI { private DividerView mView; private DockDividerVisibilityListener mDockDividerVisibilityListener; private boolean mVisible = false; private boolean mMinimized = false; @Override public void start() { Loading Loading @@ -81,6 +82,10 @@ public class Divider extends SystemUI { private void update(Configuration configuration) { removeDivider(); addDivider(configuration); if (mMinimized) { mView.setMinimizedDockStack(true); mWindowManager.setTouchable(false); } } private void updateVisibility(final boolean visible) { Loading @@ -95,6 +100,23 @@ public class Divider extends SystemUI { }); } private void updateMinimizedDockedStack(final boolean minimized, final long animDuration) { mView.post(new Runnable() { @Override public void run() { if (mMinimized != minimized) { mMinimized = minimized; mWindowManager.setTouchable(!minimized); if (animDuration > 0) { mView.setMinimizedDockStack(minimized, animDuration); } else { mView.setMinimizedDockStack(minimized); } } } }); } class DockDividerVisibilityListener extends IDockedStackListener.Stub { @Override Loading @@ -105,5 +127,11 @@ public class Divider extends SystemUI { @Override public void onDockedStackExistsChanged(boolean exists) throws RemoteException { } @Override public void onDockedStackMinimizedChanged(boolean minimized, long animDuration) throws RemoteException { updateMinimizedDockedStack(minimized, animDuration); } } }