Remove the explicit callback, not all of them

Test: manual - expand / collapse / switch between bubbles
      works fine
Bug: 181896441
Change-Id: Ib724b2195aeb7748ade669964a65394e61f675a5
This commit is contained in:
Mady Mellor
2021-03-16 15:09:13 -07:00
parent 66072f6b95
commit 8b7afff3ef
5 changed files with 5 additions and 31 deletions

View File

@@ -151,6 +151,7 @@ public class BubbleStackView extends FrameLayout
* starting a new animation.
*/
private final ShellExecutor mDelayedAnimationExecutor;
private Runnable mDelayedAnimation;
/**
* Interface to synchronize {@link View} state and the screen.
@@ -1865,7 +1866,7 @@ public class BubbleStackView extends FrameLayout
mExpandedBubble.getExpandedView().setAlphaAnimating(true);
}
mDelayedAnimationExecutor.executeDelayed(() -> {
mDelayedAnimation = () -> {
mExpandedViewAlphaAnimator.start();
PhysicsAnimator.getInstance(mExpandedViewContainerMatrix).cancel();
@@ -1898,7 +1899,8 @@ public class BubbleStackView extends FrameLayout
}
})
.start();
}, startDelay);
};
mDelayedAnimationExecutor.executeDelayed(mDelayedAnimation, startDelay);
}
private void animateCollapse() {
@@ -2097,7 +2099,7 @@ public class BubbleStackView extends FrameLayout
* animating flags for those animations.
*/
private void cancelDelayedExpandCollapseSwitchAnimations() {
mDelayedAnimationExecutor.removeAllCallbacks();
mDelayedAnimationExecutor.removeCallbacks(mDelayedAnimation);
mIsExpansionAnimating = false;
mIsBubbleSwitchAnimating = false;

View File

@@ -18,7 +18,6 @@ package com.android.wm.shell.common;
import android.annotation.NonNull;
import android.os.Handler;
import android.os.Looper;
/** Executor implementation which is backed by a Handler. */
public class HandlerExecutor implements ShellExecutor {
@@ -46,11 +45,6 @@ public class HandlerExecutor implements ShellExecutor {
}
}
@Override
public void removeAllCallbacks() {
mHandler.removeCallbacksAndMessages(null);
}
@Override
public void removeCallbacks(@NonNull Runnable r) {
mHandler.removeCallbacks(r);

View File

@@ -16,16 +16,10 @@
package com.android.wm.shell.common;
import android.os.Looper;
import android.os.SystemClock;
import android.os.Trace;
import java.lang.reflect.Array;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.function.BooleanSupplier;
import java.util.function.Predicate;
import java.util.function.Supplier;
/**
@@ -93,11 +87,6 @@ public interface ShellExecutor extends Executor {
*/
void executeDelayed(Runnable runnable, long delayMillis);
/**
* Removes all pending callbacks.
*/
void removeAllCallbacks();
/**
* See {@link android.os.Handler#removeCallbacks}.
*/

View File

@@ -16,8 +16,6 @@
package com.android.wm.shell;
import android.os.Looper;
import com.android.wm.shell.common.ShellExecutor;
import java.util.ArrayList;
@@ -39,11 +37,6 @@ public class TestShellExecutor implements ShellExecutor {
mRunnables.add(r);
}
@Override
public void removeAllCallbacks() {
mRunnables.clear();
}
@Override
public void removeCallbacks(Runnable r) {
mRunnables.remove(r);

View File

@@ -33,10 +33,6 @@ public class SyncExecutor implements ShellExecutor {
runnable.run();
}
@Override
public void removeAllCallbacks() {
}
@Override
public void removeCallbacks(Runnable runnable) {
}