[Predictive Back] Remove OnBackPressedHandler

OnBackPressedHandler was mimicking android.window.OnBackAnimationCallback because later one was hidden API to T.

Now that we have moved to U, we can remove the former handler.

Test: manual
Bug: 272797556
Change-Id: Ic5302cfa0a6fb15c4a64bdf5dc331834b1f06f38
This commit is contained in:
Fengjiang Li
2023-03-15 10:50:50 -07:00
parent 11f873da0b
commit b7860bd85e
7 changed files with 48 additions and 106 deletions

View File

@@ -23,8 +23,6 @@ import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.animation.Interpolator;
import android.window.BackEvent;
import android.window.OnBackAnimationCallback;
import android.window.OnBackInvokedDispatcher;
import com.android.launcher3.DeviceProfile;
@@ -57,28 +55,6 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
mAllAppsCallbacks = callbacks;
}
private final OnBackAnimationCallback mOnBackAnimationCallback = new OnBackAnimationCallback() {
@Override
public void onBackCancelled() {
TaskbarAllAppsSlideInView.this.onBackCancelled();
}
@Override
public void onBackInvoked() {
TaskbarAllAppsSlideInView.this.onBackInvoked();
}
@Override
public void onBackProgressed(BackEvent backEvent) {
TaskbarAllAppsSlideInView.this.onBackProgressed(backEvent.getProgress());
}
@Override
public void onBackStarted(BackEvent backEvent) {
TaskbarAllAppsSlideInView.this.onBackStarted();
}
};
/** Opens the all apps view. */
void show(boolean animate) {
if (mIsOpen || mOpenCloseAnimator.isRunning()) {
@@ -100,7 +76,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
mAppsView.getAppsRecyclerViewContainer().setOutlineProvider(mViewOutlineProvider);
mAppsView.getAppsRecyclerViewContainer().setClipToOutline(true);
findOnBackInvokedDispatcher().registerOnBackInvokedCallback(
OnBackInvokedDispatcher.PRIORITY_DEFAULT, mOnBackAnimationCallback);
OnBackInvokedDispatcher.PRIORITY_DEFAULT, this);
}
}
@@ -113,7 +89,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
protected void handleClose(boolean animate) {
handleClose(animate, mAllAppsCallbacks.getCloseDuration());
if (FeatureFlags.ENABLE_BACK_SWIPE_LAUNCHER_ANIMATION.get()) {
findOnBackInvokedDispatcher().unregisterOnBackInvokedCallback(mOnBackAnimationCallback);
findOnBackInvokedDispatcher().unregisterOnBackInvokedCallback(this);
}
}