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

Commit a3b31ed9 authored by wilsonshih's avatar wilsonshih
Browse files

Only capture activity snapshot if the app has adapted to onBackInvoked

Since back navigation is the only one user for activity snapshot.

Bug: 259497289
Test: enable activity snapshot, verify only record activity snapshot
for adapted apps.

Change-Id: I44067b9fec2c380105d9b1a35d6f57e253d5deef
parent 2ef3c463
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) {