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

Commit 9fdb0e80 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[Screen share] Remove WM_ENABLE_PARTIAL_SCREEN_SHARING flag.

Bug: 263964044
Flag: NONE removing old flag
Test: atest changed tests
Change-Id: Ia8b21f2572b2cba42d94a573249206ee37aec1c5
parent 997ed7a2
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -292,15 +292,6 @@ object Flags {
    val WM_ENABLE_SHELL_TRANSITIONS =
        sysPropBooleanFlag("persist.wm.debug.shell_transit", default = true)

    // TODO(b/254513207): Tracking Bug
    @Keep
    @JvmField
    val WM_ENABLE_PARTIAL_SCREEN_SHARING =
        releasedFlag(
            name = "enable_record_task_content",
            namespace = DeviceConfig.NAMESPACE_WINDOW_MANAGER,
        )

    // TODO(b/256873975): Tracking Bug
    @JvmField
    @Keep
+24 −58
Original line number Diff line number Diff line
@@ -187,33 +187,13 @@ public class MediaProjectionPermissionActivity extends Activity
            }
        }

        CharSequence dialogText = null;
        CharSequence dialogTitle = null;

        final String appName = extractAppName(aInfo, packageManager);
        final boolean hasCastingCapabilities =
                Utils.isHeadlessRemoteDisplayProvider(packageManager, mPackageName);

        if (hasCastingCapabilities) {
            dialogText = getString(R.string.media_projection_sys_service_dialog_warning);
            dialogTitle = getString(R.string.media_projection_sys_service_dialog_title);
        } else {
            String actionText = getString(R.string.media_projection_dialog_warning, appName);
            SpannableString message = new SpannableString(actionText);

            int appNameIndex = actionText.indexOf(appName);
            if (appNameIndex >= 0) {
                message.setSpan(new StyleSpan(Typeface.BOLD),
                        appNameIndex, appNameIndex + appName.length(), 0);
            }
            dialogText = message;
            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()) {
        final boolean overrideDisableSingleAppOption =
                CompatChanges.isChangeEnabled(
                        OVERRIDE_DISABLE_MEDIA_PROJECTION_SINGLE_APP_OPTION,
@@ -236,21 +216,11 @@ public class MediaProjectionPermissionActivity extends Activity
        mDialog =
                new AlertDialogWithDelegate(
                        dialogContext, R.style.Theme_SystemUI_Dialog, delegate);
        } else {
            AlertDialog.Builder dialogBuilder =
                    new AlertDialog.Builder(dialogContext, R.style.Theme_SystemUI_Dialog)
                            .setTitle(dialogTitle)
                            .setIcon(R.drawable.ic_media_projection_permission)
                            .setMessage(dialogText)
                            .setPositiveButton(R.string.media_projection_action_text, this)
                            .setNeutralButton(android.R.string.cancel, this);
            mDialog = dialogBuilder.create();
        }

        if (savedInstanceState == null) {
            mMediaProjectionMetricsLogger.notifyProjectionInitiated(
                    mUid,
                    appName == null
                    hasCastingCapabilities
                            ? SessionCreationSource.CAST
                            : SessionCreationSource.APP);
        }
@@ -366,7 +336,7 @@ public class MediaProjectionPermissionActivity extends Activity
                setResult(RESULT_OK, intent);
                finish(RECORD_CONTENT_DISPLAY, projection);
            }
            if (isPartialScreenSharingEnabled() && screenShareMode == SINGLE_APP) {
            if (screenShareMode == SINGLE_APP) {
                IMediaProjection projection = MediaProjectionServiceHelper.createOrReuseProjection(
                        mUid, mPackageName, mReviewGrantedConsentRequired);
                final Intent intent = new Intent(this,
@@ -437,8 +407,4 @@ public class MediaProjectionPermissionActivity extends Activity
        return intent.getParcelableExtra(
                MediaProjectionManager.EXTRA_MEDIA_PROJECTION_CONFIG);
    }

    private boolean isPartialScreenSharingEnabled() {
        return mFeatureFlags.isEnabled(Flags.WM_ENABLE_PARTIAL_SCREEN_SHARING);
    }
}
+1 −5
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import androidx.annotation.WorkerThread
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.flags.FeatureFlagsClassic
import com.android.systemui.flags.Flags
import com.android.systemui.flags.Flags.WM_ENABLE_PARTIAL_SCREEN_SHARING_ENTERPRISE_POLICIES
import com.android.systemui.mediaprojection.MediaProjectionMetricsLogger
import com.android.systemui.mediaprojection.SessionCreationSource
@@ -154,10 +153,7 @@ constructor(
            SessionCreationSource.SYSTEM_UI_SCREEN_RECORDER
        )

        if (
            flags.isEnabled(Flags.WM_ENABLE_PARTIAL_SCREEN_SHARING) &&
                !state.hasUserApprovedScreenRecording
        ) {
        if (!state.hasUserApprovedScreenRecording) {
            mainExecutor.execute {
                ScreenCapturePermissionDialogDelegate(factory, state).createDialog().apply {
                    setOnCancelListener { screenRecordSwitch.isChecked = false }
+2 −5
Original line number Diff line number Diff line
@@ -171,11 +171,8 @@ public class RecordingController
        mMediaProjectionMetricsLogger.notifyProjectionInitiated(
                getHostUid(), SessionCreationSource.SYSTEM_UI_SCREEN_RECORDER);

        return (flags.isEnabled(Flags.WM_ENABLE_PARTIAL_SCREEN_SHARING)
                ? mScreenRecordPermissionDialogDelegateFactory
        return mScreenRecordPermissionDialogDelegateFactory
                .create(this, getHostUserHandle(), getHostUid(), onStartRecordingClicked)
                : mScreenRecordDialogFactory
                    .create(this, onStartRecordingClicked))
                .createDialog();
    }

+0 −10
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@ import android.widget.TextView
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.flags.FeatureFlagsClassic
import com.android.systemui.flags.Flags
import com.android.systemui.mediaprojection.MediaProjectionMetricsLogger
import com.android.systemui.res.R
import com.android.systemui.statusbar.phone.AlertDialogWithDelegate
@@ -34,10 +32,8 @@ import com.android.systemui.statusbar.phone.SystemUIDialog
import com.android.systemui.util.mockito.mock
import junit.framework.Assert.assertEquals
import org.junit.After
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.`when` as whenever

@SmallTest
@RunWith(AndroidJUnit4::class)
@@ -46,7 +42,6 @@ class MediaProjectionPermissionDialogDelegateTest : SysuiTestCase() {

    private lateinit var dialog: AlertDialog

    private val flags = mock<FeatureFlagsClassic>()
    private val appName = "Test App"

    private val resIdSingleApp = R.string.screen_share_permission_dialog_option_single_app
@@ -54,11 +49,6 @@ class MediaProjectionPermissionDialogDelegateTest : SysuiTestCase() {
    private val resIdSingleAppDisabled =
        R.string.media_projection_entry_app_permission_dialog_single_app_disabled

    @Before
    fun setUp() {
        whenever(flags.isEnabled(Flags.WM_ENABLE_PARTIAL_SCREEN_SHARING)).thenReturn(true)
    }

    @After
    fun teardown() {
        if (::dialog.isInitialized) {
Loading