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

Commit b00815c2 authored by Andre Le's avatar Andre Le
Browse files

QSDetailedView: Rename screen record view binder to content manager

Changes all the reference of view binder to content manager for screen
recording, to comply with the new naming convention.

Bug: 388924660
Flag: EXEMPT renaming
Test: RecordingControllerTest
Change-Id: I8b3b5b5bc35b1def0151ee7200f9f1c7de6abd66
parent 1b173b29
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import androidx.annotation.LayoutRes
import com.android.systemui.mediaprojection.MediaProjectionMetricsLogger
import com.android.systemui.res.R

open class BaseMediaProjectionPermissionViewBinder(
open class BaseMediaProjectionPermissionContentManager(
    private val screenShareOptions: List<ScreenShareOption>,
    private val appName: String?,
    private val hostUid: Int,
+9 −9
Original line number Diff line number Diff line
@@ -45,14 +45,14 @@ abstract class BaseMediaProjectionPermissionDialogDelegate<T : AlertDialog>(
    private lateinit var cancelButton: TextView
    private lateinit var screenShareModeSpinner: Spinner
    protected lateinit var dialog: AlertDialog
    protected lateinit var viewBinder: BaseMediaProjectionPermissionViewBinder
    protected lateinit var contentManager: BaseMediaProjectionPermissionContentManager

    /**
     * Create the view binder for the permission dialog, this can be override by child classes to
     * support a different type of view binder
     */
    open fun createViewBinder(): BaseMediaProjectionPermissionViewBinder {
        return BaseMediaProjectionPermissionViewBinder(
    open fun createContentManager(): BaseMediaProjectionPermissionContentManager {
        return BaseMediaProjectionPermissionContentManager(
            screenShareOptions,
            appName,
            hostUid,
@@ -63,7 +63,7 @@ abstract class BaseMediaProjectionPermissionDialogDelegate<T : AlertDialog>(

    @CallSuper
    override fun onStop(dialog: T) {
        viewBinder.unbind()
        contentManager.unbind()
    }

    @CallSuper
@@ -75,10 +75,10 @@ abstract class BaseMediaProjectionPermissionDialogDelegate<T : AlertDialog>(
        dialogTitle = dialog.requireViewById(R.id.screen_share_dialog_title)
        cancelButton = dialog.requireViewById(android.R.id.button2)
        updateIcon()
        if (!::viewBinder.isInitialized) {
            viewBinder = createViewBinder()
        if (!::contentManager.isInitialized) {
            contentManager = createContentManager()
        }
        viewBinder.bind(dialog.requireViewById(R.id.screen_share_permission_dialog))
        contentManager.bind(dialog.requireViewById(R.id.screen_share_permission_dialog))
    }

    private fun updateIcon() {
@@ -92,7 +92,7 @@ abstract class BaseMediaProjectionPermissionDialogDelegate<T : AlertDialog>(
    }

    fun getSelectedScreenShareOption(): ScreenShareOption {
        return viewBinder.selectedScreenShareOption
        return contentManager.selectedScreenShareOption
    }

    /** Protected methods for the text updates & functionality */
@@ -102,7 +102,7 @@ abstract class BaseMediaProjectionPermissionDialogDelegate<T : AlertDialog>(
    }

    protected fun setStartButtonOnClickListener(listener: View.OnClickListener?) {
        viewBinder.setStartButtonOnClickListener(listener)
        contentManager.setStartButtonOnClickListener(listener)
    }

    protected fun setCancelButtonOnClickListener(listener: View.OnClickListener?) {
+5 −5
Original line number Diff line number Diff line
@@ -24,12 +24,12 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView
import com.android.systemui.res.R
import com.android.systemui.screenrecord.ScreenRecordPermissionViewBinder
import com.android.systemui.screenrecord.ScreenRecordPermissionContentManager

@Composable
fun ScreenRecordDetailsContent(viewModel: ScreenRecordDetailsViewModel) {
    val viewBinder: ScreenRecordPermissionViewBinder = remember {
        viewModel.recordingController.createScreenRecordPermissionViewBinder(
    val contentManager: ScreenRecordPermissionContentManager = remember {
        viewModel.recordingController.createScreenRecordPermissionContentManager(
            viewModel.onStartRecordingClicked
        )
    }
@@ -39,11 +39,11 @@ fun ScreenRecordDetailsContent(viewModel: ScreenRecordDetailsViewModel) {
        factory = { context ->
            // Inflate with the existing dialog xml layout
            val view = LayoutInflater.from(context).inflate(R.layout.screen_share_dialog, null)
            viewBinder.bind(view)
            contentManager.bind(view)

            view
            // TODO(b/378514473): Revamp the details view according to the spec.
        },
        onRelease = { viewBinder.unbind() },
        onRelease = { contentManager.unbind() },
    )
}
+7 −6
Original line number Diff line number Diff line
@@ -70,8 +70,8 @@ public class RecordingController
    private final ScreenCaptureDisabledDialogDelegate mScreenCaptureDisabledDialogDelegate;
    private final ScreenRecordPermissionDialogDelegate.Factory
            mScreenRecordPermissionDialogDelegateFactory;
    private final ScreenRecordPermissionViewBinder.Factory
            mScreenRecordPermissionViewBinderFactory;
    private final ScreenRecordPermissionContentManager.Factory
            mScreenRecordPermissionContentManagerFactory;

    protected static final String INTENT_UPDATE_STATE =
            "com.android.systemui.screenrecord.UPDATE_STATE";
@@ -121,7 +121,8 @@ public class RecordingController
            ScreenCaptureDisabledDialogDelegate screenCaptureDisabledDialogDelegate,
            ScreenRecordPermissionDialogDelegate.Factory
                    screenRecordPermissionDialogDelegateFactory,
            ScreenRecordPermissionViewBinder.Factory screenRecordPermissionViewBinderFactory) {
            ScreenRecordPermissionContentManager.Factory
                    screenRecordPermissionContentManagerFactory) {
        mMainExecutor = mainExecutor;
        mDevicePolicyResolver = devicePolicyResolver;
        mBroadcastDispatcher = broadcastDispatcher;
@@ -130,7 +131,7 @@ public class RecordingController
        mMediaProjectionMetricsLogger = mediaProjectionMetricsLogger;
        mScreenCaptureDisabledDialogDelegate = screenCaptureDisabledDialogDelegate;
        mScreenRecordPermissionDialogDelegateFactory = screenRecordPermissionDialogDelegateFactory;
        mScreenRecordPermissionViewBinderFactory = screenRecordPermissionViewBinderFactory;
        mScreenRecordPermissionContentManagerFactory = screenRecordPermissionContentManagerFactory;

        BroadcastOptions options = BroadcastOptions.makeBasic();
        options.setInteractive(true);
@@ -172,10 +173,10 @@ public class RecordingController
     * view.
     * @param onStartRecordingClicked the callback that is run when the start button is clicked.
     */
    public ScreenRecordPermissionViewBinder createScreenRecordPermissionViewBinder(
    public ScreenRecordPermissionContentManager createScreenRecordPermissionContentManager(
            @Nullable Runnable onStartRecordingClicked
    ) {
        return mScreenRecordPermissionViewBinderFactory
        return mScreenRecordPermissionContentManagerFactory
                .create(getHostUserHandle(), getHostUid(), this,
                        onStartRecordingClicked);
    }
+4 −4
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ import androidx.annotation.LayoutRes
import com.android.systemui.mediaprojection.MediaProjectionCaptureTarget
import com.android.systemui.mediaprojection.MediaProjectionMetricsLogger
import com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorActivity
import com.android.systemui.mediaprojection.permission.BaseMediaProjectionPermissionViewBinder
import com.android.systemui.mediaprojection.permission.BaseMediaProjectionPermissionContentManager
import com.android.systemui.mediaprojection.permission.ENTIRE_SCREEN
import com.android.systemui.mediaprojection.permission.SINGLE_APP
import com.android.systemui.mediaprojection.permission.ScreenShareMode
@@ -53,7 +53,7 @@ import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject

class ScreenRecordPermissionViewBinder(
class ScreenRecordPermissionContentManager(
    private val hostUserHandle: UserHandle,
    private val hostUid: Int,
    mediaProjectionMetricsLogger: MediaProjectionMetricsLogger,
@@ -64,7 +64,7 @@ class ScreenRecordPermissionViewBinder(
    private val userContextProvider: UserContextProvider,
    private val onStartRecordingClicked: Runnable?,
) :
    BaseMediaProjectionPermissionViewBinder(
    BaseMediaProjectionPermissionContentManager(
        createOptionList(displayManager),
        appName = null,
        hostUid = hostUid,
@@ -100,7 +100,7 @@ class ScreenRecordPermissionViewBinder(
            hostUid: Int,
            recordingController: RecordingController,
            onStartRecordingClicked: Runnable?,
        ): ScreenRecordPermissionViewBinder
        ): ScreenRecordPermissionContentManager
    }

    private lateinit var tapsSwitch: Switch
Loading