Remove legacy callbacks between recents and split screen

Removes legacy recents callbacks between recents and split screen since
there's no need to interact with RecentsActivityStartingEvent and
RecentGrowingEvent after deprecated legacy recents implmentaton.

Bug: 161116823
Test: atest SystemUITests
Test: manual check recents behavior while in split screen mode
Change-Id: Iee1546d41ae2b1a8e4162cbb2fa599162a5b308f
This commit is contained in:
Jerry Chang
2020-07-31 16:55:21 +08:00
parent f5abcaa486
commit 4fb0877a92
7 changed files with 8 additions and 74 deletions

View File

@@ -161,10 +161,6 @@
<!-- The number of milliseconds to extend ambient pulse by when prompted (e.g. on touch) -->
<integer name="ambient_notification_extension_time">10000</integer>
<!-- In multi-window, determines whether the stack where recents lives should grow from
the smallest position when being launched. -->
<bool name="recents_grow_in_multiwindow">true</bool>
<!-- Animation duration when using long press on recents to dock -->
<integer name="long_press_dock_anim_duration">250</integer>

View File

@@ -65,10 +65,6 @@ public class Recents extends SystemUI implements CommandQueue.Callbacks {
}
}
public void growRecents() {
mImpl.growRecents();
}
@Override
public void showRecentApps(boolean triggeredFromAltTab) {
// Ensure the device has been provisioned before allowing the user to interact with

View File

@@ -23,20 +23,16 @@ import android.content.Context;
import android.window.WindowContainerToken;
import com.android.systemui.SystemUI;
import com.android.systemui.recents.Recents;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.Optional;
import java.util.function.Consumer;
import javax.inject.Singleton;
import dagger.Lazy;
/**
* Controls the docked stack divider.
*/
@@ -44,15 +40,12 @@ import dagger.Lazy;
public class Divider extends SystemUI {
private final KeyguardStateController mKeyguardStateController;
private final DividerController mDividerController;
private final Optional<Lazy<Recents>> mRecentsOptionalLazy;
Divider(Context context, DividerController dividerController,
KeyguardStateController keyguardStateController,
Optional<Lazy<Recents>> recentsOptionalLazy) {
KeyguardStateController keyguardStateController) {
super(context);
mDividerController = dividerController;
mKeyguardStateController = keyguardStateController;
mRecentsOptionalLazy = recentsOptionalLazy;
}
@Override
@@ -113,8 +106,7 @@ public class Divider extends SystemUI {
}
public void onRecentsDrawn() {
mDividerController.onRecentsDrawn(() -> mRecentsOptionalLazy.ifPresent(
recentsLazy -> recentsLazy.get().growRecents()));
mDividerController.onRecentsDrawn();
}
public void onDockedFirstAnimationFrame() {

View File

@@ -391,9 +391,9 @@ public class DividerController implements DividerView.DividerCallbacks,
* subscriber, or DividerView, which has been removed and prevented from resizing. Instead,
* register the event handler here and proxy the event to the current DividerView.
*/
public void onRecentsDrawn(DividerView.RecentDrawnCallback callback) {
public void onRecentsDrawn() {
if (mView != null) {
mView.onRecentsDrawn(callback);
mView.onRecentsDrawn();
}
}

View File

@@ -20,18 +20,14 @@ import android.content.Context;
import android.os.Handler;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.recents.Recents;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.DisplayImeController;
import com.android.wm.shell.common.SystemWindows;
import com.android.wm.shell.common.TransactionPool;
import java.util.Optional;
import javax.inject.Singleton;
import dagger.Lazy;
import dagger.Module;
import dagger.Provides;
@@ -42,14 +38,12 @@ import dagger.Provides;
public class DividerModule {
@Singleton
@Provides
static Divider provideDivider(Context context, Optional<Lazy<Recents>> recentsOptionalLazy,
DisplayController displayController, SystemWindows systemWindows,
DisplayImeController imeController, @Main Handler handler,
static Divider provideDivider(Context context, DisplayController displayController,
SystemWindows systemWindows, DisplayImeController imeController, @Main Handler handler,
KeyguardStateController keyguardStateController, TransactionPool transactionPool) {
// TODO(b/161116823): fetch DividerProxy from WM shell lib.
DividerController dividerController = new DividerController(context, displayController,
systemWindows, imeController, handler, transactionPool);
return new Divider(context, dividerController, keyguardStateController,
recentsOptionalLazy);
return new Divider(context, dividerController, keyguardStateController);
}
}

View File

@@ -21,6 +21,5 @@ package com.android.systemui.stackdivider;
*/
public class DividerState {
public boolean animateAfterRecentsDrawn;
public boolean growAfterRecentsDrawn;
public float mRatioPositionBeforeMinimized;
}

View File

@@ -83,10 +83,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
void onDraggingEnd();
}
interface RecentDrawnCallback {
void growRecents();
}
static final long TOUCH_ANIMATION_DURATION = 150;
static final long TOUCH_RELEASE_ANIMATION_DURATION = 200;
@@ -151,7 +147,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
private DividerCallbacks mCallback;
private final AnimationHandler mAnimationHandler = new AnimationHandler();
private boolean mGrowRecents;
private ValueAnimator mCurrentAnimator;
private boolean mEntranceAnimationRunning;
private boolean mExitAnimationRunning;
@@ -307,7 +302,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
R.dimen.docked_stack_divider_lift_elevation);
mLongPressEntraceAnimDuration = getResources().getInteger(
R.integer.long_press_dock_anim_duration);
mGrowRecents = getResources().getBoolean(R.bool.recents_grow_in_multiwindow);
mTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
mFlingAnimationUtils = new FlingAnimationUtils(getResources().getDisplayMetrics(), 0.3f);
boolean landscape = getResources().getConfiguration().orientation
@@ -1322,39 +1316,11 @@ public class DividerView extends FrameLayout implements OnTouchListener,
mBackground.getRight(), mBackground.getBottom(), Op.UNION);
}
/**
* Checks whether recents will grow when invoked. This happens in multi-window when recents is
* very small. When invoking recents, we shrink the docked stack so recents has more space.
*
* @return the position of the divider when recents grows, or
* {@link #INVALID_RECENTS_GROW_TARGET} if recents won't grow
*/
public int growsRecents() {
boolean result = mGrowRecents
&& mDockSide == WindowManager.DOCKED_TOP
&& getCurrentPosition() == getSnapAlgorithm().getLastSplitTarget().position;
if (result) {
return getSnapAlgorithm().getMiddleTarget().position;
} else {
return INVALID_RECENTS_GROW_TARGET;
}
}
void onRecentsActivityStarting() {
if (mGrowRecents && mDockSide == WindowManager.DOCKED_TOP
&& getSnapAlgorithm().getMiddleTarget() != getSnapAlgorithm().getLastSplitTarget()
&& getCurrentPosition() == getSnapAlgorithm().getLastSplitTarget().position) {
mState.growAfterRecentsDrawn = true;
startDragging(false /* animate */, false /* touching */);
}
}
void onDockedFirstAnimationFrame() {
saveSnapTargetBeforeMinimized(mSplitLayout.getSnapAlgorithm().getMiddleTarget());
}
void onDockedTopTask() {
mState.growAfterRecentsDrawn = false;
mState.animateAfterRecentsDrawn = true;
startDragging(false /* animate */, false /* touching */);
updateDockSide();
@@ -1366,7 +1332,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
null /* transaction */);
}
void onRecentsDrawn(RecentDrawnCallback callback) {
void onRecentsDrawn() {
updateDockSide();
final int position = calculatePositionForInsetBounds();
if (mState.animateAfterRecentsDrawn) {
@@ -1380,15 +1346,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
200 /* endDelay */);
});
}
if (mState.growAfterRecentsDrawn) {
mState.growAfterRecentsDrawn = false;
updateDockSide();
if (callback != null) {
callback.growRecents();
}
stopDragging(position, getSnapAlgorithm().getMiddleTarget(), 336,
Interpolators.FAST_OUT_SLOW_IN);
}
}
void onUndockingTask() {