Merge "Fix media projection permission dialog too wide when in split screen" into udc-dev am: 0b65773255
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23389500 Change-Id: I571a7beb1086fe05f279b4ea49a23fbf339168cd Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -29,6 +29,7 @@ import android.annotation.Nullable;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
@@ -203,14 +204,17 @@ public class MediaProjectionPermissionActivity extends Activity
|
|||||||
dialogTitle = getString(R.string.media_projection_dialog_title, appName);
|
dialogTitle = getString(R.string.media_projection_dialog_title, appName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Using application context for the dialog, instead of the activity context, so we get
|
||||||
|
// the correct screen width when in split screen.
|
||||||
|
Context dialogContext = getApplicationContext();
|
||||||
if (isPartialScreenSharingEnabled()) {
|
if (isPartialScreenSharingEnabled()) {
|
||||||
mDialog = new MediaProjectionPermissionDialog(this, () -> {
|
mDialog = new MediaProjectionPermissionDialog(dialogContext, () -> {
|
||||||
ScreenShareOption selectedOption =
|
ScreenShareOption selectedOption =
|
||||||
((MediaProjectionPermissionDialog) mDialog).getSelectedScreenShareOption();
|
((MediaProjectionPermissionDialog) mDialog).getSelectedScreenShareOption();
|
||||||
grantMediaProjectionPermission(selectedOption.getMode());
|
grantMediaProjectionPermission(selectedOption.getMode());
|
||||||
}, () -> finish(RECORD_CANCEL, /* projection= */ null), appName);
|
}, () -> finish(RECORD_CANCEL, /* projection= */ null), appName);
|
||||||
} else {
|
} else {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this,
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(dialogContext,
|
||||||
R.style.Theme_SystemUI_Dialog)
|
R.style.Theme_SystemUI_Dialog)
|
||||||
.setTitle(dialogTitle)
|
.setTitle(dialogTitle)
|
||||||
.setIcon(R.drawable.ic_media_projection_permission)
|
.setIcon(R.drawable.ic_media_projection_permission)
|
||||||
@@ -263,7 +267,10 @@ public class MediaProjectionPermissionActivity extends Activity
|
|||||||
final UserHandle hostUserHandle = getHostUserHandle();
|
final UserHandle hostUserHandle = getHostUserHandle();
|
||||||
if (mScreenCaptureDevicePolicyResolver.get()
|
if (mScreenCaptureDevicePolicyResolver.get()
|
||||||
.isScreenCaptureCompletelyDisabled(hostUserHandle)) {
|
.isScreenCaptureCompletelyDisabled(hostUserHandle)) {
|
||||||
AlertDialog dialog = new ScreenCaptureDisabledDialog(this);
|
// Using application context for the dialog, instead of the activity context, so we get
|
||||||
|
// the correct screen width when in split screen.
|
||||||
|
Context dialogContext = getApplicationContext();
|
||||||
|
AlertDialog dialog = new ScreenCaptureDisabledDialog(dialogContext);
|
||||||
setUpDialog(dialog);
|
setUpDialog(dialog);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user