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

Commit d9503db9 authored by Dave Mankoff's avatar Dave Mankoff
Browse files

Remove SystemUIDialog subclasses from RecordingController

RecordingController doesn't actually subclass SystemUIDialog, but
two of the dialogs it uses do (or did): ScreenRecordDialog and
ScreenCaptureDisabledDialog.

Flag: NA
Bug: 219008720
Test: atest SystemUITests
Change-Id: I8dad77ceafaf804bf29c530b2d4b9a4b812b873d
parent c534686c
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -3554,10 +3554,6 @@
    <string name="config_keyguardComponent" translatable="false"
            >com.android.systemui/com.android.systemui.keyguard.KeyguardService</string>

    <!-- Screen record dialog component -->
    <string name="config_screenRecorderComponent" translatable="false"
            >com.android.systemui/com.android.systemui.screenrecord.ScreenRecordDialog</string>

    <!-- The component name of a special dock app that merely launches a dream.
         We don't want to launch this app when docked because it causes an unnecessary
         activity transition.  We just want to start the dream. -->
+0 −1
Original line number Diff line number Diff line
@@ -375,7 +375,6 @@
  <java-symbol type="string" name="config_recentsComponentName" />
  <java-symbol type="string" name="config_systemUIServiceComponent" />
  <java-symbol type="string" name="config_controlsPackage" />
  <java-symbol type="string" name="config_screenRecorderComponent" />
  <java-symbol type="string" name="config_somnambulatorComponent" />
  <java-symbol type="string" name="config_screenshotAppClipsServiceComponent" />
  <java-symbol type="string" name="config_screenshotServiceComponent" />
+44 −0
Original line number Diff line number Diff line
@@ -15,19 +15,30 @@
 */
package com.android.systemui.mediaprojection.devicepolicy

import android.content.Context
import android.content.DialogInterface.BUTTON_POSITIVE
import android.content.res.Resources
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.res.R
import com.android.systemui.statusbar.phone.SystemUIDialog
import javax.inject.Inject

/** Dialog that shows that screen capture is disabled on this device. */
class ScreenCaptureDisabledDialog(context: Context) : SystemUIDialog(context) {
class ScreenCaptureDisabledDialogDelegate @Inject constructor(
        @Main private val resources: Resources,
        private val systemUIDialogFactory: SystemUIDialog.Factory
) : SystemUIDialog.Delegate {

    init {
        setTitle(context.getString(R.string.screen_capturing_disabled_by_policy_dialog_title))
        setMessage(
            context.getString(R.string.screen_capturing_disabled_by_policy_dialog_description)
    override fun createDialog(): SystemUIDialog {
        val dialog = systemUIDialogFactory.create(this)
        dialog.setTitle(resources.getString(R.string.screen_capturing_disabled_by_policy_dialog_title))
        dialog.setMessage(
            resources.getString(R.string.screen_capturing_disabled_by_policy_dialog_description)
        )
        setIcon(R.drawable.ic_cast)
        setButton(BUTTON_POSITIVE, context.getString(android.R.string.ok)) { _, _ -> cancel() }
        dialog.setIcon(R.drawable.ic_cast)
        dialog.setButton(BUTTON_POSITIVE, resources.getString(android.R.string.ok)) {
            _, _ -> dialog.cancel()
        }

        return dialog
    }
}
+8 −7
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ import com.android.systemui.mediaprojection.MediaProjectionServiceHelper;
import com.android.systemui.mediaprojection.SessionCreationSource;
import com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorActivity;
import com.android.systemui.mediaprojection.devicepolicy.ScreenCaptureDevicePolicyResolver;
import com.android.systemui.mediaprojection.devicepolicy.ScreenCaptureDisabledDialog;
import com.android.systemui.mediaprojection.devicepolicy.ScreenCaptureDisabledDialogDelegate;
import com.android.systemui.res.R;
import com.android.systemui.statusbar.phone.AlertDialogWithDelegate;
import com.android.systemui.statusbar.phone.SystemUIDialog;
@@ -79,6 +79,7 @@ public class MediaProjectionPermissionActivity extends Activity
    private final Lazy<ScreenCaptureDevicePolicyResolver> mScreenCaptureDevicePolicyResolver;
    private final StatusBarManager mStatusBarManager;
    private final MediaProjectionMetricsLogger mMediaProjectionMetricsLogger;
    private final ScreenCaptureDisabledDialogDelegate mScreenCaptureDisabledDialogDelegate;

    private String mPackageName;
    private int mUid;
@@ -93,14 +94,17 @@ public class MediaProjectionPermissionActivity extends Activity
    private boolean mUserSelectingTask = false;

    @Inject
    public MediaProjectionPermissionActivity(FeatureFlags featureFlags,
    public MediaProjectionPermissionActivity(
            FeatureFlags featureFlags,
            Lazy<ScreenCaptureDevicePolicyResolver> screenCaptureDevicePolicyResolver,
            StatusBarManager statusBarManager,
            MediaProjectionMetricsLogger mediaProjectionMetricsLogger) {
            MediaProjectionMetricsLogger mediaProjectionMetricsLogger,
            ScreenCaptureDisabledDialogDelegate screenCaptureDisabledDialogDelegate) {
        mFeatureFlags = featureFlags;
        mScreenCaptureDevicePolicyResolver = screenCaptureDevicePolicyResolver;
        mStatusBarManager = statusBarManager;
        mMediaProjectionMetricsLogger = mediaProjectionMetricsLogger;
        mScreenCaptureDisabledDialogDelegate = screenCaptureDisabledDialogDelegate;
    }

    @Override
@@ -315,10 +319,7 @@ public class MediaProjectionPermissionActivity extends Activity
        final UserHandle hostUserHandle = getHostUserHandle();
        if (mScreenCaptureDevicePolicyResolver.get()
                .isScreenCaptureCompletelyDisabled(hostUserHandle)) {
            // 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);
            AlertDialog dialog = mScreenCaptureDisabledDialogDelegate.createDialog();
            setUpDialog(dialog);
            dialog.show();
            return true;
+2 −1
Original line number Diff line number Diff line
@@ -481,7 +481,8 @@ public class InternetDialogDelegate implements
                mSecondaryMobileTitleText.setTextAppearance(
                        R.style.TextAppearance_InternetDialog_Active);

                TextView mSecondaryMobileSummaryText = mDialogView.requireViewById(R.id.secondary_mobile_summary);
                TextView mSecondaryMobileSummaryText =
                        mDialogView.requireViewById(R.id.secondary_mobile_summary);
                summary = getMobileNetworkSummary(autoSwitchNonDdsSubId);
                if (!TextUtils.isEmpty(summary)) {
                    mSecondaryMobileSummaryText.setText(
Loading