Loading packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java +9 −2 Original line number Original line Diff line number Diff line Loading @@ -79,6 +79,9 @@ public class MediaProjectionPermissionActivity extends Activity // Indicates if user must review already-granted consent that the MediaProjection app is // Indicates if user must review already-granted consent that the MediaProjection app is // attempting to re-use. // attempting to re-use. private boolean mReviewGrantedConsentRequired = false; 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 @Inject public MediaProjectionPermissionActivity(FeatureFlags featureFlags, public MediaProjectionPermissionActivity(FeatureFlags featureFlags, Loading Loading @@ -296,6 +299,7 @@ public class MediaProjectionPermissionActivity extends Activity // Start activity from the current foreground user to avoid creating a separate // Start activity from the current foreground user to avoid creating a separate // SystemUI process without access to recent tasks because it won't have // SystemUI process without access to recent tasks because it won't have // WM Shell running inside. // WM Shell running inside. mUserSelectingTask = true; startActivityAsUser(intent, UserHandle.of(ActivityManager.getCurrentUser())); startActivityAsUser(intent, UserHandle.of(ActivityManager.getCurrentUser())); } } } catch (RemoteException e) { } catch (RemoteException e) { Loading @@ -316,8 +320,11 @@ public class MediaProjectionPermissionActivity extends Activity @Override @Override public void finish() { public void finish() { // Default to cancelling recording when user needs to review consent. // 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); finish(RECORD_CANCEL, /* projection= */ null); } } } private void finish(@ReviewGrantedConsentResult int consentResult, private void finish(@ReviewGrantedConsentResult int consentResult, @Nullable IMediaProjection projection) { @Nullable IMediaProjection projection) { Loading @@ -328,7 +335,7 @@ public class MediaProjectionPermissionActivity extends Activity private void onDialogDismissedOrCancelled(DialogInterface dialogInterface) { private void onDialogDismissedOrCancelled(DialogInterface dialogInterface) { if (!isFinishing()) { if (!isFinishing()) { finish(RECORD_CANCEL, /* projection= */ null); finish(); } } } } Loading Loading
packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java +9 −2 Original line number Original line Diff line number Diff line Loading @@ -79,6 +79,9 @@ public class MediaProjectionPermissionActivity extends Activity // Indicates if user must review already-granted consent that the MediaProjection app is // Indicates if user must review already-granted consent that the MediaProjection app is // attempting to re-use. // attempting to re-use. private boolean mReviewGrantedConsentRequired = false; 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 @Inject public MediaProjectionPermissionActivity(FeatureFlags featureFlags, public MediaProjectionPermissionActivity(FeatureFlags featureFlags, Loading Loading @@ -296,6 +299,7 @@ public class MediaProjectionPermissionActivity extends Activity // Start activity from the current foreground user to avoid creating a separate // Start activity from the current foreground user to avoid creating a separate // SystemUI process without access to recent tasks because it won't have // SystemUI process without access to recent tasks because it won't have // WM Shell running inside. // WM Shell running inside. mUserSelectingTask = true; startActivityAsUser(intent, UserHandle.of(ActivityManager.getCurrentUser())); startActivityAsUser(intent, UserHandle.of(ActivityManager.getCurrentUser())); } } } catch (RemoteException e) { } catch (RemoteException e) { Loading @@ -316,8 +320,11 @@ public class MediaProjectionPermissionActivity extends Activity @Override @Override public void finish() { public void finish() { // Default to cancelling recording when user needs to review consent. // 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); finish(RECORD_CANCEL, /* projection= */ null); } } } private void finish(@ReviewGrantedConsentResult int consentResult, private void finish(@ReviewGrantedConsentResult int consentResult, @Nullable IMediaProjection projection) { @Nullable IMediaProjection projection) { Loading @@ -328,7 +335,7 @@ public class MediaProjectionPermissionActivity extends Activity private void onDialogDismissedOrCancelled(DialogInterface dialogInterface) { private void onDialogDismissedOrCancelled(DialogInterface dialogInterface) { if (!isFinishing()) { if (!isFinishing()) { finish(RECORD_CANCEL, /* projection= */ null); finish(); } } } } Loading