Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59a677b5 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Only capture activity snapshot if the app has adapted to onBackInvoked" into main

parents 313b7501 a3b31ed9
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -98,13 +98,18 @@ class SnapshotController {
                final TaskFragment tf = info.mContainer.asTaskFragment();
                final ActivityRecord ar = tf != null ? tf.getTopMostActivity()
                        : info.mContainer.asActivityRecord();
                final boolean taskVis = ar != null && ar.getTask().isVisibleRequested();
                if (ar != null && !ar.isVisibleRequested() && taskVis) {
                if (ar != null && !ar.isVisibleRequested() && ar.getTask().isVisibleRequested()) {
                    final WindowState mainWindow = ar.findMainWindow(false);
                    // Only capture activity snapshot if this app has adapted to back predict
                    if (mainWindow != null
                            && mainWindow.getOnBackInvokedCallbackInfo() != null
                            && mainWindow.getOnBackInvokedCallbackInfo().isSystemCallback()) {
                        mActivitySnapshotController.recordSnapshot(ar);
                    }
                }
            }
        }
    }

    void onTransitionFinish(@WindowManager.TransitionType int type,
            ArrayList<Transition.ChangeInfo> changeInfos) {