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

Commit d06805e6 authored by Naomi Musgrave's avatar Naomi Musgrave Committed by Automerger Merge Worker
Browse files

Merge "(4/N)[MediaProjection] Don't send result to server until setup ends"...

Merge "(4/N)[MediaProjection] Don't send result to server until setup ends" into udc-dev am: 5029af7c am: c69f38a9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22822436



Change-Id: Id30042fb856b44d6017f2963d88a4ea05644b8bd
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a0dc6829 c69f38a9
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -79,6 +79,9 @@ public class MediaProjectionPermissionActivity extends Activity
    // Indicates if user must review already-granted consent that the MediaProjection app is
    // attempting to re-use.
    private boolean mReviewGrantedConsentRequired = false;
    // Indicates if the user has consented to record, but is continuing in another activity to
    // select a particular task to capture.
    private boolean mUserSelectingTask = false;

    @Inject
    public MediaProjectionPermissionActivity(FeatureFlags featureFlags,
@@ -296,6 +299,7 @@ public class MediaProjectionPermissionActivity extends Activity
                // Start activity from the current foreground user to avoid creating a separate
                // SystemUI process without access to recent tasks because it won't have
                // WM Shell running inside.
                mUserSelectingTask = true;
                startActivityAsUser(intent, UserHandle.of(ActivityManager.getCurrentUser()));
            }
        } catch (RemoteException e) {
@@ -316,8 +320,11 @@ public class MediaProjectionPermissionActivity extends Activity
    @Override
    public void finish() {
        // Default to cancelling recording when user needs to review consent.
        // Don't send cancel if the user has moved on to the next activity.
        if (!mUserSelectingTask) {
            finish(RECORD_CANCEL, /* projection= */ null);
        }
    }

    private void finish(@ReviewGrantedConsentResult int consentResult,
            @Nullable IMediaProjection projection) {
@@ -328,7 +335,7 @@ public class MediaProjectionPermissionActivity extends Activity

    private void onDialogDismissedOrCancelled(DialogInterface dialogInterface) {
        if (!isFinishing()) {
            finish(RECORD_CANCEL, /* projection= */ null);
            finish();
        }
    }