From ff50e248e509ec74440b59ccf9a4194e9d33a66a Mon Sep 17 00:00:00 2001 From: Jaesung Chung Date: Fri, 20 Oct 2017 10:39:38 +0900 Subject: [PATCH] Make media projection permission dialog configurable This CL introduces the new config_mediaProjectPermissionDialogComponent symbol to specify the dialog component of media project permission dialog. With this CL, IoT devices will be able to use the other dialog in the IoT system UI app instead of the default dialog in the system UI app. Bug: 65864256 Test: android.view.cts.SurfaceViewSyncTest Change-Id: I0684372757a00ddf173fc16e4a29f1e181cc1e8f --- core/res/res/values/config.xml | 3 +++ core/res/res/values/symbols.xml | 3 +++ .../android/media/projection/MediaProjectionManager.java | 9 +++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index dec5fd9461a1b..571aad9bdafaa 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3128,4 +3128,7 @@ + + + com.android.systemui/com.android.systemui.media.MediaProjectionPermissionActivity diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index a42cf42cb905e..0e58fb5031409 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3124,4 +3124,7 @@ + + + diff --git a/media/java/android/media/projection/MediaProjectionManager.java b/media/java/android/media/projection/MediaProjectionManager.java index 9f2c08e5c6aea..aa0d0cc090bcc 100644 --- a/media/java/android/media/projection/MediaProjectionManager.java +++ b/media/java/android/media/projection/MediaProjectionManager.java @@ -20,8 +20,10 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemService; import android.app.Activity; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; import android.media.projection.IMediaProjection; import android.os.Handler; import android.os.IBinder; @@ -71,8 +73,11 @@ public final class MediaProjectionManager { */ public Intent createScreenCaptureIntent() { Intent i = new Intent(); - i.setClassName("com.android.systemui", - "com.android.systemui.media.MediaProjectionPermissionActivity"); + final ComponentName mediaProjectionPermissionDialogComponent = + ComponentName.unflattenFromString(mContext.getResources().getString( + com.android.internal.R.string + .config_mediaProjectionPermissionDialogComponent)); + i.setComponent(mediaProjectionPermissionDialogComponent); return i; }