Loading packages/SystemUI/src/com/android/systemui/recordissue/RecordIssueDialogDelegate.kt +50 −44 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ import android.view.WindowManager import android.widget.Button import android.widget.PopupMenu import android.widget.Switch import androidx.annotation.AnyThread import androidx.annotation.MainThread import androidx.annotation.WorkerThread import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.flags.FeatureFlagsClassic Loading Loading @@ -74,6 +74,7 @@ constructor( @SuppressLint("UseSwitchCompatOrMaterialCode") private lateinit var screenRecordSwitch: Switch private lateinit var issueTypeButton: Button private var hasSelectedIssueType: Boolean = false @MainThread override fun beforeCreate(dialog: SystemUIDialog, savedInstanceState: Bundle?) { Loading @@ -82,7 +83,10 @@ constructor( setTitle(context.getString(R.string.qs_record_issue_label)) setIcon(R.drawable.qs_record_issue_icon_off) setNegativeButton(R.string.cancel) { _, _ -> dismiss() } setPositiveButton(R.string.qs_record_issue_start) { _, _ -> setPositiveButton( R.string.qs_record_issue_start, { _, _ -> if (hasSelectedIssueType) { onStarted.accept( IssueRecordingConfig( screenRecordSwitch.isChecked, Loading @@ -91,6 +95,9 @@ constructor( ) dismiss() } }, false ) } } Loading @@ -104,18 +111,17 @@ constructor( screenRecordSwitch = requireViewById(R.id.screenrecord_switch) screenRecordSwitch.setOnCheckedChangeListener { _, isEnabled -> onScreenRecordSwitchClicked(context, isEnabled) if (isEnabled) { bgExecutor.execute { onScreenRecordSwitchClicked() } } } issueTypeButton = requireViewById(R.id.issue_type_button) issueTypeButton.setOnClickListener { onIssueTypeClicked(context) } } } @AnyThread private fun onScreenRecordSwitchClicked(context: Context, isEnabled: Boolean) { if (!isEnabled) return bgExecutor.execute { @WorkerThread private fun onScreenRecordSwitchClicked() { if ( flags.isEnabled(WM_ENABLE_PARTIAL_SCREEN_SHARING_ENTERPRISE_POLICIES) && devicePolicyResolver Loading @@ -126,7 +132,7 @@ constructor( screenCaptureDisabledDialogDelegate.createDialog().show() screenRecordSwitch.isChecked = false } return@execute return } mediaProjectionMetricsLogger.notifyProjectionInitiated( Loading @@ -151,7 +157,6 @@ constructor( } } } } @MainThread private fun onIssueTypeClicked(context: Context) { Loading @@ -174,5 +179,6 @@ constructor( setForceShowIcon(true) show() } hasSelectedIssueType = true } } Loading
packages/SystemUI/src/com/android/systemui/recordissue/RecordIssueDialogDelegate.kt +50 −44 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ import android.view.WindowManager import android.widget.Button import android.widget.PopupMenu import android.widget.Switch import androidx.annotation.AnyThread import androidx.annotation.MainThread import androidx.annotation.WorkerThread import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.flags.FeatureFlagsClassic Loading Loading @@ -74,6 +74,7 @@ constructor( @SuppressLint("UseSwitchCompatOrMaterialCode") private lateinit var screenRecordSwitch: Switch private lateinit var issueTypeButton: Button private var hasSelectedIssueType: Boolean = false @MainThread override fun beforeCreate(dialog: SystemUIDialog, savedInstanceState: Bundle?) { Loading @@ -82,7 +83,10 @@ constructor( setTitle(context.getString(R.string.qs_record_issue_label)) setIcon(R.drawable.qs_record_issue_icon_off) setNegativeButton(R.string.cancel) { _, _ -> dismiss() } setPositiveButton(R.string.qs_record_issue_start) { _, _ -> setPositiveButton( R.string.qs_record_issue_start, { _, _ -> if (hasSelectedIssueType) { onStarted.accept( IssueRecordingConfig( screenRecordSwitch.isChecked, Loading @@ -91,6 +95,9 @@ constructor( ) dismiss() } }, false ) } } Loading @@ -104,18 +111,17 @@ constructor( screenRecordSwitch = requireViewById(R.id.screenrecord_switch) screenRecordSwitch.setOnCheckedChangeListener { _, isEnabled -> onScreenRecordSwitchClicked(context, isEnabled) if (isEnabled) { bgExecutor.execute { onScreenRecordSwitchClicked() } } } issueTypeButton = requireViewById(R.id.issue_type_button) issueTypeButton.setOnClickListener { onIssueTypeClicked(context) } } } @AnyThread private fun onScreenRecordSwitchClicked(context: Context, isEnabled: Boolean) { if (!isEnabled) return bgExecutor.execute { @WorkerThread private fun onScreenRecordSwitchClicked() { if ( flags.isEnabled(WM_ENABLE_PARTIAL_SCREEN_SHARING_ENTERPRISE_POLICIES) && devicePolicyResolver Loading @@ -126,7 +132,7 @@ constructor( screenCaptureDisabledDialogDelegate.createDialog().show() screenRecordSwitch.isChecked = false } return@execute return } mediaProjectionMetricsLogger.notifyProjectionInitiated( Loading @@ -151,7 +157,6 @@ constructor( } } } } @MainThread private fun onIssueTypeClicked(context: Context) { Loading @@ -174,5 +179,6 @@ constructor( setForceShowIcon(true) show() } hasSelectedIssueType = true } }