mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
Merge "Predictive back: widget to all apps" into tm-qpr-dev am: e73db2a011 am: c5a715f531
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20968630 Change-Id: I06791cb598cb1be27a285ae98812650fe3ceffec Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -194,7 +194,8 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (event.getAction() == ACTION_UP && event.getKeyCode() == KEYCODE_BACK) {
|
||||
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
|
||||
if (topView != null && topView.onBackPressed()) {
|
||||
if (topView != null && topView.canHandleBack()) {
|
||||
topView.onBackInvoked();
|
||||
// Handled by the floating view.
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,8 @@ public class TaskbarOverlayDragLayer extends
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (event.getAction() == ACTION_UP && event.getKeyCode() == KEYCODE_BACK) {
|
||||
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
|
||||
if (topView != null && topView.onBackPressed()) {
|
||||
if (topView != null && topView.canHandleBack()) {
|
||||
topView.onBackInvoked();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.OnBackPressedHandler;
|
||||
import com.android.launcher3.QuickstepAccessibilityDelegate;
|
||||
import com.android.launcher3.QuickstepTransitionManager;
|
||||
import com.android.launcher3.R;
|
||||
@@ -638,20 +639,49 @@ public class QuickstepLauncher extends Launcher {
|
||||
getOnBackInvokedDispatcher().registerOnBackInvokedCallback(
|
||||
OnBackInvokedDispatcher.PRIORITY_DEFAULT,
|
||||
new OnBackAnimationCallback() {
|
||||
|
||||
@Nullable OnBackPressedHandler mActiveOnBackPressedHandler;
|
||||
|
||||
@Override
|
||||
public void onBackStarted(@NonNull BackEvent backEvent) {
|
||||
if (mActiveOnBackPressedHandler != null) {
|
||||
mActiveOnBackPressedHandler.onBackCancelled();
|
||||
}
|
||||
mActiveOnBackPressedHandler = getOnBackPressedHandler();
|
||||
mActiveOnBackPressedHandler.onBackStarted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackInvoked() {
|
||||
onBackPressed();
|
||||
// Recreate mActiveOnBackPressedHandler if necessary to avoid NPE because:
|
||||
// 1. b/260636433: In 3-button-navigation mode, onBackStarted() is not
|
||||
// called on ACTION_DOWN before onBackInvoked() is called in ACTION_UP.
|
||||
// 2. Launcher#onBackPressed() will call onBackInvoked() without calling
|
||||
// onBackInvoked() beforehand.
|
||||
if (mActiveOnBackPressedHandler == null) {
|
||||
mActiveOnBackPressedHandler = getOnBackPressedHandler();
|
||||
}
|
||||
mActiveOnBackPressedHandler.onBackInvoked();
|
||||
mActiveOnBackPressedHandler = null;
|
||||
TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "onBackInvoked");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackProgressed(@NonNull BackEvent backEvent) {
|
||||
QuickstepLauncher.this.onBackProgressed(backEvent.getProgress());
|
||||
if (!FeatureFlags.IS_STUDIO_BUILD && mActiveOnBackPressedHandler == null) {
|
||||
return;
|
||||
}
|
||||
mActiveOnBackPressedHandler
|
||||
.onBackProgressed(backEvent.getProgress());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackCancelled() {
|
||||
QuickstepLauncher.this.onBackCancelled();
|
||||
if (!FeatureFlags.IS_STUDIO_BUILD && mActiveOnBackPressedHandler == null) {
|
||||
return;
|
||||
}
|
||||
mActiveOnBackPressedHandler.onBackCancelled();
|
||||
mActiveOnBackPressedHandler = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -111,11 +111,6 @@ public class AllAppsEduView extends AbstractFloatingView {
|
||||
return (type & TYPE_ALL_APPS_EDU) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBackPressed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInterceptEventsInSystemGestureRegion() {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user