Loading packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java +45 −5 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import android.graphics.Rect; import android.os.Handler; import android.os.RemoteException; import android.provider.Settings; import android.util.Log; import android.util.Slog; import android.view.IWindowContainer; import android.view.LayoutInflater; Loading Loading @@ -73,7 +72,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, DisplayController.OnDisplaysChangedListener { private static final String TAG = "Divider"; static final boolean DEBUG = true; static final boolean DEBUG = false; static final int DEFAULT_APP_TRANSITION_DURATION = 336; static final float ADJUSTED_NONFOCUS_DIM = 0.3f; Loading Loading @@ -211,13 +210,24 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, mTargetShown = imeShouldShow; if (mLastAdjustTop < 0) { mLastAdjustTop = imeShouldShow ? hiddenTop : shownTop; } else { // Check for an "interruption" of an existing animation. In this case, we need to // fake-flip the last-known state direction so that the animation completes in the // other direction. if (mTargetAdjusted != targetAdjusted && targetAdjusted == mAdjusted) { if (mLastAdjustTop != (imeShouldShow ? mShownTop : mHiddenTop)) { mAdjusted = mTargetAdjusted; } } } if (mPaused) { mPausedTargetAdjusted = targetAdjusted; if (DEBUG) Slog.d(TAG, " ime starting but paused " + dumpState()); return; } mTargetAdjusted = targetAdjusted; updateDimTargets(); if (DEBUG) Slog.d(TAG, " ime starting. vis:" + splitIsVisible + " " + dumpState()); if (mAnimation != null || (mImeWasShown && imeShouldShow && mTargetAdjusted != mAdjusted)) { // We need to animate adjustment independently of the IME position, so Loading Loading @@ -356,9 +366,24 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, mAnimation.start(); } private String dumpState() { return "top:" + mHiddenTop + "->" + mShownTop + " adj:" + mAdjusted + "->" + mTargetAdjusted + "(" + mLastAdjustTop + ")" + " shw:" + mImeWasShown + "->" + mTargetShown + " dims:" + mLastPrimaryDim + "," + mLastSecondaryDim + "->" + mTargetPrimaryDim + "," + mTargetSecondaryDim + " shf:" + mSecondaryHasFocus + " desync:" + (mAnimation != null) + " paus:" + mPaused + "[" + mPausedTargetAdjusted + "]"; } /** Completely aborts/resets adjustment state */ public void pause(int displayId) { if (DEBUG) Slog.d(TAG, "ime pause posting " + dumpState()); mHandler.post(() -> { if (DEBUG) Slog.d(TAG, "ime pause run posted " + dumpState()); if (mPaused) { return; } mPaused = true; mPausedTargetAdjusted = mTargetAdjusted; mTargetAdjusted = false; Loading @@ -369,11 +394,16 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, } public void resume(int displayId) { if (DEBUG) Slog.d(TAG, "ime resume posting " + dumpState()); mHandler.post(() -> { if (DEBUG) Slog.d(TAG, "ime resume run posted " + dumpState()); if (!mPaused) { return; } mPaused = false; mTargetAdjusted = mPausedTargetAdjusted; updateDimTargets(); if (mTargetAdjusted && mView != null) { if ((mTargetAdjusted != mAdjusted) && !mMinimized && mView != null) { // End unminimize animations since they conflict with adjustment animations. mView.finishAnimations(); } Loading Loading @@ -532,6 +562,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, } void updateVisibility(final boolean visible) { if (DEBUG) Slog.d(TAG, "Updating visibility " + mVisible + "->" + visible); if (mVisible != visible) { mVisible = visible; mView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); Loading @@ -558,12 +589,21 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, /** Switch to minimized state if appropriate */ public void setMinimized(final boolean minimized) { if (DEBUG) Slog.d(TAG, "posting ext setMinimized " + minimized + " vis:" + mVisible); mHandler.post(() -> { if (DEBUG) Slog.d(TAG, "run posted ext setMinimized " + minimized + " vis:" + mVisible); if (!mVisible) { return; } setHomeMinimized(minimized, mHomeStackResizable); }); } private void setHomeMinimized(final boolean minimized, boolean homeStackResizable) { if (DEBUG) { Slog.d(TAG, "setHomeMinimized min:" + mMinimized + "->" + minimized + " hrsz:" + mHomeStackResizable + "->" + homeStackResizable + " split:" + inSplitMode()); } WindowContainerTransaction wct = new WindowContainerTransaction(); // Update minimized state if (mMinimized != minimized) { Loading Loading @@ -698,7 +738,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, if (!inSplitMode()) { // Wasn't in split-mode yet, so enter now. if (DEBUG) { Log.d(TAG, " entering split mode with minimized=true"); Slog.d(TAG, " entering split mode with minimized=true"); } updateVisibility(true /* visible */); } Loading @@ -709,7 +749,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, if (!inSplitMode()) { // Wasn't in split-mode, so enter now. if (DEBUG) { Log.d(TAG, " enter split mode unminimized "); Slog.d(TAG, " enter split mode unminimized "); } updateVisibility(true /* visible */); } Loading packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +11 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.AttributeSet; import android.util.Slog; import android.view.Choreographer; import android.view.Display; import android.view.InsetsState; Loading Loading @@ -75,6 +76,7 @@ import java.util.function.Consumer; public class DividerView extends FrameLayout implements OnTouchListener, OnComputeInternalInsetsListener { private static final String TAG = "DividerView"; private static final boolean DEBUG = Divider.DEBUG; public interface DividerCallbacks { void onDraggingStart(); Loading Loading @@ -629,6 +631,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, cancelFlingAnimation(); updateDockSide(); } if (DEBUG) Slog.d(TAG, "Getting fling " + position + "->" + snapTarget.position); final boolean taskPositionSameAtEnd = snapTarget.flag == SnapTarget.FLAG_NONE; ValueAnimator anim = ValueAnimator.ofInt(position, snapTarget.position); anim.addUpdateListener(animation -> resizeStackDelayed((int) animation.getAnimatedValue(), Loading @@ -637,6 +640,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, : snapTarget.taskPosition, snapTarget)); Consumer<Boolean> endAction = cancelled -> { if (DEBUG) Slog.d(TAG, "End Fling " + cancelled + " min:" + mIsInMinimizeInteraction); final boolean wasMinimizeInteraction = mIsInMinimizeInteraction; // Reset minimized divider position after unminimized state animation finishes. if (!cancelled && !mDockedStackMinimized && mIsInMinimizeInteraction) { Loading Loading @@ -697,6 +701,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, endAction.accept(mCancelled); } else { final Boolean cancelled = mCancelled; if (DEBUG) Slog.d(TAG, "Posting endFling " + cancelled + " d:" + delay + "ms"); mHandler.postDelayed(() -> endAction.accept(cancelled), delay); } } Loading Loading @@ -894,6 +899,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, public void setMinimizedDockStack(boolean minimized, long animDuration, boolean isHomeStackResizable) { if (DEBUG) Slog.d(TAG, "setMinDock: " + mDockedStackMinimized + "->" + minimized); mHomeStackResizable = isHomeStackResizable; updateDockSide(); if (!isHomeStackResizable) { Loading Loading @@ -1065,6 +1071,11 @@ public class DividerView extends FrameLayout implements OnTouchListener, mDividerPositionX = dockedRect.right; mDividerPositionY = dockedRect.bottom; if (DEBUG) { Slog.d(TAG, "Resizing split surfaces: " + dockedRect + " " + dockedTaskRect + " " + otherRect + " " + otherTaskRect); } t.setPosition(mTiles.mPrimarySurface, dockedTaskRect.left, dockedTaskRect.top); Rect crop = new Rect(dockedRect); crop.offsetTo(-Math.min(dockedTaskRect.left - dockedRect.left, 0), Loading packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java +15 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ import javax.inject.Singleton; public class DisplayImeController implements DisplayController.OnDisplaysChangedListener { private static final String TAG = "DisplayImeController"; private static final boolean DEBUG = false; public static final int ANIMATION_DURATION_SHOW_MS = 275; public static final int ANIMATION_DURATION_HIDE_MS = 340; public static final Interpolator INTERPOLATOR = new PathInterpolator(0.4f, 0f, 0.2f, 1f); Loading Loading @@ -209,6 +211,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged if ((types & WindowInsets.Type.ime()) == 0) { return; } if (DEBUG) Slog.d(TAG, "Got showInsets for ime"); startAnimation(true /* show */); } Loading @@ -217,6 +220,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged if ((types & WindowInsets.Type.ime()) == 0) { return; } if (DEBUG) Slog.d(TAG, "Got hideInsets for ime"); startAnimation(false /* show */); } Loading @@ -241,6 +245,11 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged return; } mHandler.post(() -> { if (DEBUG) { Slog.d(TAG, "Run startAnim show:" + show + " was:" + (mAnimationDirection == DIRECTION_SHOW ? "SHOW" : (mAnimationDirection == DIRECTION_HIDE ? "HIDE" : "NONE"))); } if ((mAnimationDirection == DIRECTION_SHOW && show) || (mAnimationDirection == DIRECTION_HIDE && !show)) { return; Loading Loading @@ -289,6 +298,11 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged public void onAnimationStart(Animator animation) { SurfaceControl.Transaction t = mTransactionPool.acquire(); t.setPosition(mImeSourceControl.getLeash(), x, startY); if (DEBUG) { Slog.d(TAG, "onAnimationStart d:" + mDisplayId + " top:" + imeTop(imeSource, hiddenY) + "->" + imeTop(imeSource, shownY) + " showing:" + (mAnimationDirection == DIRECTION_SHOW)); } dispatchStartPositioning(mDisplayId, imeTop(imeSource, hiddenY), imeTop(imeSource, shownY), mAnimationDirection == DIRECTION_SHOW, t); Loading @@ -304,6 +318,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged } @Override public void onAnimationEnd(Animator animation) { if (DEBUG) Slog.d(TAG, "onAnimationEnd " + mCancelled); SurfaceControl.Transaction t = mTransactionPool.acquire(); if (!mCancelled) { t.setPosition(mImeSourceControl.getLeash(), x, endY); Loading Loading
packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java +45 −5 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import android.graphics.Rect; import android.os.Handler; import android.os.RemoteException; import android.provider.Settings; import android.util.Log; import android.util.Slog; import android.view.IWindowContainer; import android.view.LayoutInflater; Loading Loading @@ -73,7 +72,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, DisplayController.OnDisplaysChangedListener { private static final String TAG = "Divider"; static final boolean DEBUG = true; static final boolean DEBUG = false; static final int DEFAULT_APP_TRANSITION_DURATION = 336; static final float ADJUSTED_NONFOCUS_DIM = 0.3f; Loading Loading @@ -211,13 +210,24 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, mTargetShown = imeShouldShow; if (mLastAdjustTop < 0) { mLastAdjustTop = imeShouldShow ? hiddenTop : shownTop; } else { // Check for an "interruption" of an existing animation. In this case, we need to // fake-flip the last-known state direction so that the animation completes in the // other direction. if (mTargetAdjusted != targetAdjusted && targetAdjusted == mAdjusted) { if (mLastAdjustTop != (imeShouldShow ? mShownTop : mHiddenTop)) { mAdjusted = mTargetAdjusted; } } } if (mPaused) { mPausedTargetAdjusted = targetAdjusted; if (DEBUG) Slog.d(TAG, " ime starting but paused " + dumpState()); return; } mTargetAdjusted = targetAdjusted; updateDimTargets(); if (DEBUG) Slog.d(TAG, " ime starting. vis:" + splitIsVisible + " " + dumpState()); if (mAnimation != null || (mImeWasShown && imeShouldShow && mTargetAdjusted != mAdjusted)) { // We need to animate adjustment independently of the IME position, so Loading Loading @@ -356,9 +366,24 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, mAnimation.start(); } private String dumpState() { return "top:" + mHiddenTop + "->" + mShownTop + " adj:" + mAdjusted + "->" + mTargetAdjusted + "(" + mLastAdjustTop + ")" + " shw:" + mImeWasShown + "->" + mTargetShown + " dims:" + mLastPrimaryDim + "," + mLastSecondaryDim + "->" + mTargetPrimaryDim + "," + mTargetSecondaryDim + " shf:" + mSecondaryHasFocus + " desync:" + (mAnimation != null) + " paus:" + mPaused + "[" + mPausedTargetAdjusted + "]"; } /** Completely aborts/resets adjustment state */ public void pause(int displayId) { if (DEBUG) Slog.d(TAG, "ime pause posting " + dumpState()); mHandler.post(() -> { if (DEBUG) Slog.d(TAG, "ime pause run posted " + dumpState()); if (mPaused) { return; } mPaused = true; mPausedTargetAdjusted = mTargetAdjusted; mTargetAdjusted = false; Loading @@ -369,11 +394,16 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, } public void resume(int displayId) { if (DEBUG) Slog.d(TAG, "ime resume posting " + dumpState()); mHandler.post(() -> { if (DEBUG) Slog.d(TAG, "ime resume run posted " + dumpState()); if (!mPaused) { return; } mPaused = false; mTargetAdjusted = mPausedTargetAdjusted; updateDimTargets(); if (mTargetAdjusted && mView != null) { if ((mTargetAdjusted != mAdjusted) && !mMinimized && mView != null) { // End unminimize animations since they conflict with adjustment animations. mView.finishAnimations(); } Loading Loading @@ -532,6 +562,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, } void updateVisibility(final boolean visible) { if (DEBUG) Slog.d(TAG, "Updating visibility " + mVisible + "->" + visible); if (mVisible != visible) { mVisible = visible; mView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); Loading @@ -558,12 +589,21 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, /** Switch to minimized state if appropriate */ public void setMinimized(final boolean minimized) { if (DEBUG) Slog.d(TAG, "posting ext setMinimized " + minimized + " vis:" + mVisible); mHandler.post(() -> { if (DEBUG) Slog.d(TAG, "run posted ext setMinimized " + minimized + " vis:" + mVisible); if (!mVisible) { return; } setHomeMinimized(minimized, mHomeStackResizable); }); } private void setHomeMinimized(final boolean minimized, boolean homeStackResizable) { if (DEBUG) { Slog.d(TAG, "setHomeMinimized min:" + mMinimized + "->" + minimized + " hrsz:" + mHomeStackResizable + "->" + homeStackResizable + " split:" + inSplitMode()); } WindowContainerTransaction wct = new WindowContainerTransaction(); // Update minimized state if (mMinimized != minimized) { Loading Loading @@ -698,7 +738,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, if (!inSplitMode()) { // Wasn't in split-mode yet, so enter now. if (DEBUG) { Log.d(TAG, " entering split mode with minimized=true"); Slog.d(TAG, " entering split mode with minimized=true"); } updateVisibility(true /* visible */); } Loading @@ -709,7 +749,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks, if (!inSplitMode()) { // Wasn't in split-mode, so enter now. if (DEBUG) { Log.d(TAG, " enter split mode unminimized "); Slog.d(TAG, " enter split mode unminimized "); } updateVisibility(true /* visible */); } Loading
packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +11 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.AttributeSet; import android.util.Slog; import android.view.Choreographer; import android.view.Display; import android.view.InsetsState; Loading Loading @@ -75,6 +76,7 @@ import java.util.function.Consumer; public class DividerView extends FrameLayout implements OnTouchListener, OnComputeInternalInsetsListener { private static final String TAG = "DividerView"; private static final boolean DEBUG = Divider.DEBUG; public interface DividerCallbacks { void onDraggingStart(); Loading Loading @@ -629,6 +631,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, cancelFlingAnimation(); updateDockSide(); } if (DEBUG) Slog.d(TAG, "Getting fling " + position + "->" + snapTarget.position); final boolean taskPositionSameAtEnd = snapTarget.flag == SnapTarget.FLAG_NONE; ValueAnimator anim = ValueAnimator.ofInt(position, snapTarget.position); anim.addUpdateListener(animation -> resizeStackDelayed((int) animation.getAnimatedValue(), Loading @@ -637,6 +640,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, : snapTarget.taskPosition, snapTarget)); Consumer<Boolean> endAction = cancelled -> { if (DEBUG) Slog.d(TAG, "End Fling " + cancelled + " min:" + mIsInMinimizeInteraction); final boolean wasMinimizeInteraction = mIsInMinimizeInteraction; // Reset minimized divider position after unminimized state animation finishes. if (!cancelled && !mDockedStackMinimized && mIsInMinimizeInteraction) { Loading Loading @@ -697,6 +701,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, endAction.accept(mCancelled); } else { final Boolean cancelled = mCancelled; if (DEBUG) Slog.d(TAG, "Posting endFling " + cancelled + " d:" + delay + "ms"); mHandler.postDelayed(() -> endAction.accept(cancelled), delay); } } Loading Loading @@ -894,6 +899,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, public void setMinimizedDockStack(boolean minimized, long animDuration, boolean isHomeStackResizable) { if (DEBUG) Slog.d(TAG, "setMinDock: " + mDockedStackMinimized + "->" + minimized); mHomeStackResizable = isHomeStackResizable; updateDockSide(); if (!isHomeStackResizable) { Loading Loading @@ -1065,6 +1071,11 @@ public class DividerView extends FrameLayout implements OnTouchListener, mDividerPositionX = dockedRect.right; mDividerPositionY = dockedRect.bottom; if (DEBUG) { Slog.d(TAG, "Resizing split surfaces: " + dockedRect + " " + dockedTaskRect + " " + otherRect + " " + otherTaskRect); } t.setPosition(mTiles.mPrimarySurface, dockedTaskRect.left, dockedTaskRect.top); Rect crop = new Rect(dockedRect); crop.offsetTo(-Math.min(dockedTaskRect.left - dockedRect.left, 0), Loading
packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java +15 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ import javax.inject.Singleton; public class DisplayImeController implements DisplayController.OnDisplaysChangedListener { private static final String TAG = "DisplayImeController"; private static final boolean DEBUG = false; public static final int ANIMATION_DURATION_SHOW_MS = 275; public static final int ANIMATION_DURATION_HIDE_MS = 340; public static final Interpolator INTERPOLATOR = new PathInterpolator(0.4f, 0f, 0.2f, 1f); Loading Loading @@ -209,6 +211,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged if ((types & WindowInsets.Type.ime()) == 0) { return; } if (DEBUG) Slog.d(TAG, "Got showInsets for ime"); startAnimation(true /* show */); } Loading @@ -217,6 +220,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged if ((types & WindowInsets.Type.ime()) == 0) { return; } if (DEBUG) Slog.d(TAG, "Got hideInsets for ime"); startAnimation(false /* show */); } Loading @@ -241,6 +245,11 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged return; } mHandler.post(() -> { if (DEBUG) { Slog.d(TAG, "Run startAnim show:" + show + " was:" + (mAnimationDirection == DIRECTION_SHOW ? "SHOW" : (mAnimationDirection == DIRECTION_HIDE ? "HIDE" : "NONE"))); } if ((mAnimationDirection == DIRECTION_SHOW && show) || (mAnimationDirection == DIRECTION_HIDE && !show)) { return; Loading Loading @@ -289,6 +298,11 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged public void onAnimationStart(Animator animation) { SurfaceControl.Transaction t = mTransactionPool.acquire(); t.setPosition(mImeSourceControl.getLeash(), x, startY); if (DEBUG) { Slog.d(TAG, "onAnimationStart d:" + mDisplayId + " top:" + imeTop(imeSource, hiddenY) + "->" + imeTop(imeSource, shownY) + " showing:" + (mAnimationDirection == DIRECTION_SHOW)); } dispatchStartPositioning(mDisplayId, imeTop(imeSource, hiddenY), imeTop(imeSource, shownY), mAnimationDirection == DIRECTION_SHOW, t); Loading @@ -304,6 +318,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged } @Override public void onAnimationEnd(Animator animation) { if (DEBUG) Slog.d(TAG, "onAnimationEnd " + mCancelled); SurfaceControl.Transaction t = mTransactionPool.acquire(); if (!mCancelled) { t.setPosition(mImeSourceControl.getLeash(), x, endY); Loading