PiP: Move resetting mAllowTouches into scope of MenuView
Previously we used to reset mAllowTouches backed on callbacks from TaskOrg's animation finish, but there is a race where it's possible the callback from the animation finish happens before the menu state updates, which causes the callback to no-op. Instead, since we only disable allow touches during #showMenu, just keep it in the scope and re-enable it when the same animation has ended (or cancelled). Bug: 188464003 Test: Move PIP to smaller, tap (to cause it to grow larger), and tap on an icon, and expect icon to work and launch Settings, etc. Change-Id: Iea3fff3c279dcdfa7eb922cb59302ea53ac618fd
This commit is contained in:
@@ -173,13 +173,6 @@ public class PhonePipMenuController implements PipMenuController {
|
||||
detachPipMenuView();
|
||||
}
|
||||
|
||||
|
||||
void onPinnedStackAnimationEnded() {
|
||||
if (isMenuVisible()) {
|
||||
mPipMenuView.onPipAnimationEnded();
|
||||
}
|
||||
}
|
||||
|
||||
private void attachPipMenuView() {
|
||||
// In case detach was not called (e.g. PIP unexpectedly closed)
|
||||
if (mPipMenuView != null) {
|
||||
|
||||
@@ -36,7 +36,6 @@ import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.util.Log;
|
||||
@@ -606,7 +605,6 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
||||
// Re-enable touches after the animation completes
|
||||
mTouchHandler.setTouchEnabled(true);
|
||||
mTouchHandler.onPinnedStackAnimationEnded(direction);
|
||||
mMenuController.onPinnedStackAnimationEnded();
|
||||
}
|
||||
|
||||
private void updateMovementBounds(@Nullable Rect toBounds, boolean fromRotation,
|
||||
|
||||
@@ -40,7 +40,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
@@ -279,11 +278,17 @@ public class PipMenuView extends FrameLayout {
|
||||
mMenuContainerAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mAllowTouches = true;
|
||||
notifyMenuStateChangeFinish(menuState);
|
||||
if (allowMenuTimeout) {
|
||||
repostDelayedHide(INITIAL_DISMISS_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
mAllowTouches = true;
|
||||
}
|
||||
});
|
||||
if (withDelay) {
|
||||
// starts the menu container animation after window expansion is completed
|
||||
@@ -326,10 +331,6 @@ public class PipMenuView extends FrameLayout {
|
||||
cancelDelayedHide();
|
||||
}
|
||||
|
||||
void onPipAnimationEnded() {
|
||||
mAllowTouches = true;
|
||||
}
|
||||
|
||||
void updateMenuLayout(Rect bounds) {
|
||||
mPipMenuIconsAlgorithm.onBoundsChanged(bounds);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user