Loading core/java/android/view/IDockedStackListener.aidl +9 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,15 @@ oneway interface IDockedStackListener { */ void onDockedStackMinimizedChanged(boolean minimized, long animDuration); /** * Called when window manager decides to adjust the divider for IME. Like the minimized state, * the divider should make itself not interactable and shrink a bit, but in a different way.s * * @param minimized Whether the stacks are currently adjusted for the IME * @param animDuration The duration of the animation for changing the adjusted state. */ void onAdjustedForImeChanged(boolean adjustedForIme, long animDuration); /** * Called when window manager repositioned the docked stack after a screen rotation change. */ Loading packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java +23 −2 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ public class Divider extends SystemUI { private DockDividerVisibilityListener mDockDividerVisibilityListener; private boolean mVisible = false; private boolean mMinimized = false; private boolean mAdjustedForIme = false; private ForcedResizableInfoActivityController mForcedResizableController; @Override Loading Loading @@ -84,7 +85,7 @@ public class Divider extends SystemUI { addDivider(configuration); if (mMinimized) { mView.setMinimizedDockStack(true); mWindowManager.setTouchable(false); updateTouchable(); } } Loading @@ -109,7 +110,7 @@ public class Divider extends SystemUI { public void run() { if (mMinimized != minimized) { mMinimized = minimized; mWindowManager.setTouchable(!minimized); updateTouchable(); if (animDuration > 0) { mView.setMinimizedDockStack(minimized, animDuration); } else { Loading @@ -129,6 +130,10 @@ public class Divider extends SystemUI { }); } private void updateTouchable() { mWindowManager.setTouchable(!mMinimized && !mAdjustedForIme); } class DockDividerVisibilityListener extends IDockedStackListener.Stub { @Override Loading @@ -147,6 +152,22 @@ public class Divider extends SystemUI { updateMinimizedDockedStack(minimized, animDuration); } @Override public void onAdjustedForImeChanged(boolean adjustedForIme, long animDuration) throws RemoteException { mView.post(() -> { if (mAdjustedForIme != adjustedForIme) { mAdjustedForIme = adjustedForIme; updateTouchable(); if (animDuration > 0) { mView.setAdjustedForIme(adjustedForIme, animDuration); } else { mView.setAdjustedForIme(adjustedForIme); } } }); } @Override public void onDockSideChanged(final int newDockSide) throws RemoteException { mView.post(() -> mView.notifyDockSideChanged(newDockSide)); Loading packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +36 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import android.graphics.Rect; import android.graphics.Region.Op; import android.hardware.display.DisplayManager; import android.os.Bundle; import android.os.Vibrator; import android.util.AttributeSet; import android.view.Display; import android.view.DisplayInfo; Loading Loading @@ -61,7 +60,6 @@ import com.android.internal.policy.DividerSnapAlgorithm.SnapTarget; import com.android.internal.policy.DockedDividerUtils; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.recents.Constants.Metrics; import com.android.systemui.recents.Recents; import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.activity.DockedTopTaskEvent; Loading Loading @@ -98,6 +96,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, * How much the background gets scaled when we are in the minimized dock state. */ private static final float MINIMIZE_DOCK_SCALE = 0f; private static final float ADJUSTED_FOR_IME_SCALE = 0.5f; private static final PathInterpolator SLOWDOWN_INTERPOLATOR = new PathInterpolator(0.5f, 1f, 0.5f, 1f); Loading Loading @@ -147,6 +146,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, private int mExitStartPosition; private GestureDetector mGestureDetector; private boolean mDockedStackMinimized; private boolean mAdjustedForIme; private final AccessibilityDelegate mHandleDelegate = new AccessibilityDelegate() { @Override Loading Loading @@ -657,6 +657,40 @@ public class DividerView extends FrameLayout implements OnTouchListener, mDockedStackMinimized = minimized; } public void setAdjustedForIme(boolean adjustedForIme) { updateDockSide(); mHandle.setAlpha(adjustedForIme ? 0f : 1f); if (!adjustedForIme) { resetBackground(); } else if (mDockSide == WindowManager.DOCKED_TOP) { mBackground.setPivotY(0); mBackground.setScaleY(MINIMIZE_DOCK_SCALE); } mAdjustedForIme = adjustedForIme; } public void setAdjustedForIme(boolean adjustedForIme, long animDuration) { updateDockSide(); mHandle.animate() .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) .setDuration(animDuration) .alpha(adjustedForIme ? 0f : 1f) .start(); if (mDockSide == WindowManager.DOCKED_TOP) { mBackground.setPivotY(0); mBackground.animate() .scaleY(adjustedForIme ? MINIMIZE_DOCK_SCALE : 1f); } if (!adjustedForIme) { mBackground.animate().withEndAction(mResetBackgroundRunnable); } mBackground.animate() .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) .setDuration(animDuration) .start(); mAdjustedForIme = adjustedForIme; } private void resetBackground() { mBackground.setPivotX(mBackground.getWidth() / 2); mBackground.setPivotY(mBackground.getHeight() / 2); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +5 −0 Original line number Diff line number Diff line Loading @@ -530,6 +530,11 @@ public class NavigationBarView extends LinearLayout { throws RemoteException { } @Override public void onAdjustedForImeChanged(boolean adjustedForIme, long animDuration) throws RemoteException { } @Override public void onDockSideChanged(int newDockSide) throws RemoteException { } Loading services/core/java/com/android/server/wm/DockedStackDividerController.java +18 −2 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ public class DockedStackDividerController implements DimLayerUser { private static final Interpolator IME_ADJUST_ENTRY_INTERPOLATOR = new PathInterpolator(0.1f, 0f, 0.1f, 1f); private static final long IME_ADJUST_DURATION = 280; private static final long IME_ADJUST_ANIM_DURATION = 280; private final WindowManagerService mService; private final DisplayContent mDisplayContent; Loading Loading @@ -198,6 +198,7 @@ public class DockedStackDividerController implements DimLayerUser { if (animate) { startImeAdjustAnimation(adjusted ? 0 : 1, adjusted ? 1 : 0); } notifyAdjustedForImeChanged(adjusted, animate ? IME_ADJUST_ANIM_DURATION : 0); } } Loading Loading @@ -291,12 +292,27 @@ public class DockedStackDividerController implements DimLayerUser { mDockedStackListeners.finishBroadcast(); } void notifyAdjustedForImeChanged(boolean adjustedForIme, long animDuration) { final int size = mDockedStackListeners.beginBroadcast(); for (int i = 0; i < size; ++i) { final IDockedStackListener listener = mDockedStackListeners.getBroadcastItem(i); try { listener.onAdjustedForImeChanged(adjustedForIme, animDuration); } catch (RemoteException e) { Slog.e(TAG_WM, "Error delivering adjusted for ime changed event.", e); } } mDockedStackListeners.finishBroadcast(); } void registerDockedStackListener(IDockedStackListener listener) { mDockedStackListeners.register(listener); notifyDockedDividerVisibilityChanged(wasVisible()); notifyDockedStackExistsChanged( mDisplayContent.mService.mStackIdToStack.get(DOCKED_STACK_ID) != null); notifyDockedStackMinimizedChanged(mMinimizedDock, 0 /* animDuration */); notifyAdjustedForImeChanged(mAdjustedForIme, 0 /* animDuration */); } void setResizeDimLayer(boolean visible, int targetStackId, float alpha) { Loading Loading @@ -450,7 +466,7 @@ public class DockedStackDividerController implements DimLayerUser { mAnimationStarted = true; mAnimationStartTime = now; mAnimationDuration = (long) (IME_ADJUST_DURATION * mService.getWindowAnimationScaleLocked()); (IME_ADJUST_ANIM_DURATION * mService.getWindowAnimationScaleLocked()); } float t = Math.min(1f, (float) (now - mAnimationStartTime) / mAnimationDuration); t = (mAnimationTarget == 1f ? IME_ADJUST_ENTRY_INTERPOLATOR : TOUCH_RESPONSE_INTERPOLATOR) Loading Loading
core/java/android/view/IDockedStackListener.aidl +9 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,15 @@ oneway interface IDockedStackListener { */ void onDockedStackMinimizedChanged(boolean minimized, long animDuration); /** * Called when window manager decides to adjust the divider for IME. Like the minimized state, * the divider should make itself not interactable and shrink a bit, but in a different way.s * * @param minimized Whether the stacks are currently adjusted for the IME * @param animDuration The duration of the animation for changing the adjusted state. */ void onAdjustedForImeChanged(boolean adjustedForIme, long animDuration); /** * Called when window manager repositioned the docked stack after a screen rotation change. */ Loading
packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java +23 −2 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ public class Divider extends SystemUI { private DockDividerVisibilityListener mDockDividerVisibilityListener; private boolean mVisible = false; private boolean mMinimized = false; private boolean mAdjustedForIme = false; private ForcedResizableInfoActivityController mForcedResizableController; @Override Loading Loading @@ -84,7 +85,7 @@ public class Divider extends SystemUI { addDivider(configuration); if (mMinimized) { mView.setMinimizedDockStack(true); mWindowManager.setTouchable(false); updateTouchable(); } } Loading @@ -109,7 +110,7 @@ public class Divider extends SystemUI { public void run() { if (mMinimized != minimized) { mMinimized = minimized; mWindowManager.setTouchable(!minimized); updateTouchable(); if (animDuration > 0) { mView.setMinimizedDockStack(minimized, animDuration); } else { Loading @@ -129,6 +130,10 @@ public class Divider extends SystemUI { }); } private void updateTouchable() { mWindowManager.setTouchable(!mMinimized && !mAdjustedForIme); } class DockDividerVisibilityListener extends IDockedStackListener.Stub { @Override Loading @@ -147,6 +152,22 @@ public class Divider extends SystemUI { updateMinimizedDockedStack(minimized, animDuration); } @Override public void onAdjustedForImeChanged(boolean adjustedForIme, long animDuration) throws RemoteException { mView.post(() -> { if (mAdjustedForIme != adjustedForIme) { mAdjustedForIme = adjustedForIme; updateTouchable(); if (animDuration > 0) { mView.setAdjustedForIme(adjustedForIme, animDuration); } else { mView.setAdjustedForIme(adjustedForIme); } } }); } @Override public void onDockSideChanged(final int newDockSide) throws RemoteException { mView.post(() -> mView.notifyDockSideChanged(newDockSide)); Loading
packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +36 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import android.graphics.Rect; import android.graphics.Region.Op; import android.hardware.display.DisplayManager; import android.os.Bundle; import android.os.Vibrator; import android.util.AttributeSet; import android.view.Display; import android.view.DisplayInfo; Loading Loading @@ -61,7 +60,6 @@ import com.android.internal.policy.DividerSnapAlgorithm.SnapTarget; import com.android.internal.policy.DockedDividerUtils; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.recents.Constants.Metrics; import com.android.systemui.recents.Recents; import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.activity.DockedTopTaskEvent; Loading Loading @@ -98,6 +96,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, * How much the background gets scaled when we are in the minimized dock state. */ private static final float MINIMIZE_DOCK_SCALE = 0f; private static final float ADJUSTED_FOR_IME_SCALE = 0.5f; private static final PathInterpolator SLOWDOWN_INTERPOLATOR = new PathInterpolator(0.5f, 1f, 0.5f, 1f); Loading Loading @@ -147,6 +146,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, private int mExitStartPosition; private GestureDetector mGestureDetector; private boolean mDockedStackMinimized; private boolean mAdjustedForIme; private final AccessibilityDelegate mHandleDelegate = new AccessibilityDelegate() { @Override Loading Loading @@ -657,6 +657,40 @@ public class DividerView extends FrameLayout implements OnTouchListener, mDockedStackMinimized = minimized; } public void setAdjustedForIme(boolean adjustedForIme) { updateDockSide(); mHandle.setAlpha(adjustedForIme ? 0f : 1f); if (!adjustedForIme) { resetBackground(); } else if (mDockSide == WindowManager.DOCKED_TOP) { mBackground.setPivotY(0); mBackground.setScaleY(MINIMIZE_DOCK_SCALE); } mAdjustedForIme = adjustedForIme; } public void setAdjustedForIme(boolean adjustedForIme, long animDuration) { updateDockSide(); mHandle.animate() .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) .setDuration(animDuration) .alpha(adjustedForIme ? 0f : 1f) .start(); if (mDockSide == WindowManager.DOCKED_TOP) { mBackground.setPivotY(0); mBackground.animate() .scaleY(adjustedForIme ? MINIMIZE_DOCK_SCALE : 1f); } if (!adjustedForIme) { mBackground.animate().withEndAction(mResetBackgroundRunnable); } mBackground.animate() .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) .setDuration(animDuration) .start(); mAdjustedForIme = adjustedForIme; } private void resetBackground() { mBackground.setPivotX(mBackground.getWidth() / 2); mBackground.setPivotY(mBackground.getHeight() / 2); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +5 −0 Original line number Diff line number Diff line Loading @@ -530,6 +530,11 @@ public class NavigationBarView extends LinearLayout { throws RemoteException { } @Override public void onAdjustedForImeChanged(boolean adjustedForIme, long animDuration) throws RemoteException { } @Override public void onDockSideChanged(int newDockSide) throws RemoteException { } Loading
services/core/java/com/android/server/wm/DockedStackDividerController.java +18 −2 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ public class DockedStackDividerController implements DimLayerUser { private static final Interpolator IME_ADJUST_ENTRY_INTERPOLATOR = new PathInterpolator(0.1f, 0f, 0.1f, 1f); private static final long IME_ADJUST_DURATION = 280; private static final long IME_ADJUST_ANIM_DURATION = 280; private final WindowManagerService mService; private final DisplayContent mDisplayContent; Loading Loading @@ -198,6 +198,7 @@ public class DockedStackDividerController implements DimLayerUser { if (animate) { startImeAdjustAnimation(adjusted ? 0 : 1, adjusted ? 1 : 0); } notifyAdjustedForImeChanged(adjusted, animate ? IME_ADJUST_ANIM_DURATION : 0); } } Loading Loading @@ -291,12 +292,27 @@ public class DockedStackDividerController implements DimLayerUser { mDockedStackListeners.finishBroadcast(); } void notifyAdjustedForImeChanged(boolean adjustedForIme, long animDuration) { final int size = mDockedStackListeners.beginBroadcast(); for (int i = 0; i < size; ++i) { final IDockedStackListener listener = mDockedStackListeners.getBroadcastItem(i); try { listener.onAdjustedForImeChanged(adjustedForIme, animDuration); } catch (RemoteException e) { Slog.e(TAG_WM, "Error delivering adjusted for ime changed event.", e); } } mDockedStackListeners.finishBroadcast(); } void registerDockedStackListener(IDockedStackListener listener) { mDockedStackListeners.register(listener); notifyDockedDividerVisibilityChanged(wasVisible()); notifyDockedStackExistsChanged( mDisplayContent.mService.mStackIdToStack.get(DOCKED_STACK_ID) != null); notifyDockedStackMinimizedChanged(mMinimizedDock, 0 /* animDuration */); notifyAdjustedForImeChanged(mAdjustedForIme, 0 /* animDuration */); } void setResizeDimLayer(boolean visible, int targetStackId, float alpha) { Loading Loading @@ -450,7 +466,7 @@ public class DockedStackDividerController implements DimLayerUser { mAnimationStarted = true; mAnimationStartTime = now; mAnimationDuration = (long) (IME_ADJUST_DURATION * mService.getWindowAnimationScaleLocked()); (IME_ADJUST_ANIM_DURATION * mService.getWindowAnimationScaleLocked()); } float t = Math.min(1f, (float) (now - mAnimationStartTime) / mAnimationDuration); t = (mAnimationTarget == 1f ? IME_ADJUST_ENTRY_INTERPOLATOR : TOUCH_RESPONSE_INTERPOLATOR) Loading