Loading packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordPermissionContentManager.kt +34 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.widget.ArrayAdapter import android.widget.Spinner import android.widget.Switch import androidx.annotation.LayoutRes import com.android.systemui.Prefs import com.android.systemui.mediaprojection.MediaProjectionCaptureTarget import com.android.systemui.mediaprojection.MediaProjectionMetricsLogger import com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorActivity Loading Loading @@ -207,6 +208,8 @@ class ScreenRecordPermissionContentManager( } } options.isLongClickable = false loadPrefs(); } override fun onItemSelected(adapterView: AdapterView<*>?, view: View, pos: Int, id: Long) { Loading Loading @@ -262,6 +265,7 @@ class ScreenRecordPermissionContentManager( RecordingService.getStopIntent(userContext), PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE, ) savePrefs(); controller.startCountdown(if (skipTimeSwitch.isChecked) NO_DELAY else DELAY_MS, INTERVAL_MS, startIntent, stopIntent) } Loading @@ -284,6 +288,28 @@ class ScreenRecordPermissionContentManager( return false } private fun savePrefs() { val userContext = userContextProvider.userContext Prefs.putInt(userContext, PREF_TAPS, if (tapsSwitch.isChecked) 1 else 0) Prefs.putInt(userContext, PREF_LOW, if (lowQualitySwitch.isChecked) 1 else 0) Prefs.putInt(userContext, PREF_LONGER, if (longerDurationSwitch.isChecked) 1 else 0) Prefs.putInt(userContext, PREF_AUDIO, if (audioSwitch.isChecked) 1 else 0) Prefs.putInt(userContext, PREF_AUDIO_SOURCE, options.selectedItemPosition) Prefs.putInt(userContext, PREF_SKIP, if (skipTimeSwitch.isChecked) 1 else 0) Prefs.putInt(userContext, PREF_HEVC, if (hevcSwitch.isChecked) 1 else 0) } private fun loadPrefs() { val userContext = userContextProvider.userContext tapsSwitch.isChecked = Prefs.getInt(userContext, PREF_TAPS, 0) == 1 lowQualitySwitch.isChecked = Prefs.getInt(userContext, PREF_LOW, 0) == 1 longerDurationSwitch.isChecked = Prefs.getInt(userContext, PREF_LONGER, 0) == 1 audioSwitch.isChecked = Prefs.getInt(userContext, PREF_AUDIO, 0) == 1 options.setSelection(Prefs.getInt(userContext, PREF_AUDIO_SOURCE, 0)) skipTimeSwitch.isChecked = Prefs.getInt(userContext, PREF_SKIP, 0) == 1 hevcSwitch.isChecked = Prefs.getInt(userContext, PREF_HEVC, 1) == 1 } private inner class CaptureTargetResultReceiver : ResultReceiver(Handler(Looper.getMainLooper())) { override fun onReceiveResult(resultCode: Int, resultData: Bundle) { Loading Loading @@ -312,6 +338,14 @@ class ScreenRecordPermissionContentManager( private const val NO_DELAY: Long = 100 private const val INTERVAL_MS: Long = 1000 private const val PREF_TAPS = "screenrecord_show_taps" private const val PREF_LOW = "screenrecord_use_low_quality" private const val PREF_LONGER = "screenrecord_use_longer_timeout" private const val PREF_AUDIO = "screenrecord_use_audio" private const val PREF_AUDIO_SOURCE = "screenrecord_audio_source" private const val PREF_SKIP = "screenrecord_skip_timer" private const val PREF_HEVC = "screenrecord_use_hevc" fun createOptionList(displayManager: DisplayManager): List<ScreenShareOption> { val connectedDisplays = getConnectedDisplays(displayManager) Loading Loading
packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordPermissionContentManager.kt +34 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.widget.ArrayAdapter import android.widget.Spinner import android.widget.Switch import androidx.annotation.LayoutRes import com.android.systemui.Prefs import com.android.systemui.mediaprojection.MediaProjectionCaptureTarget import com.android.systemui.mediaprojection.MediaProjectionMetricsLogger import com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorActivity Loading Loading @@ -207,6 +208,8 @@ class ScreenRecordPermissionContentManager( } } options.isLongClickable = false loadPrefs(); } override fun onItemSelected(adapterView: AdapterView<*>?, view: View, pos: Int, id: Long) { Loading Loading @@ -262,6 +265,7 @@ class ScreenRecordPermissionContentManager( RecordingService.getStopIntent(userContext), PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE, ) savePrefs(); controller.startCountdown(if (skipTimeSwitch.isChecked) NO_DELAY else DELAY_MS, INTERVAL_MS, startIntent, stopIntent) } Loading @@ -284,6 +288,28 @@ class ScreenRecordPermissionContentManager( return false } private fun savePrefs() { val userContext = userContextProvider.userContext Prefs.putInt(userContext, PREF_TAPS, if (tapsSwitch.isChecked) 1 else 0) Prefs.putInt(userContext, PREF_LOW, if (lowQualitySwitch.isChecked) 1 else 0) Prefs.putInt(userContext, PREF_LONGER, if (longerDurationSwitch.isChecked) 1 else 0) Prefs.putInt(userContext, PREF_AUDIO, if (audioSwitch.isChecked) 1 else 0) Prefs.putInt(userContext, PREF_AUDIO_SOURCE, options.selectedItemPosition) Prefs.putInt(userContext, PREF_SKIP, if (skipTimeSwitch.isChecked) 1 else 0) Prefs.putInt(userContext, PREF_HEVC, if (hevcSwitch.isChecked) 1 else 0) } private fun loadPrefs() { val userContext = userContextProvider.userContext tapsSwitch.isChecked = Prefs.getInt(userContext, PREF_TAPS, 0) == 1 lowQualitySwitch.isChecked = Prefs.getInt(userContext, PREF_LOW, 0) == 1 longerDurationSwitch.isChecked = Prefs.getInt(userContext, PREF_LONGER, 0) == 1 audioSwitch.isChecked = Prefs.getInt(userContext, PREF_AUDIO, 0) == 1 options.setSelection(Prefs.getInt(userContext, PREF_AUDIO_SOURCE, 0)) skipTimeSwitch.isChecked = Prefs.getInt(userContext, PREF_SKIP, 0) == 1 hevcSwitch.isChecked = Prefs.getInt(userContext, PREF_HEVC, 1) == 1 } private inner class CaptureTargetResultReceiver : ResultReceiver(Handler(Looper.getMainLooper())) { override fun onReceiveResult(resultCode: Int, resultData: Bundle) { Loading Loading @@ -312,6 +338,14 @@ class ScreenRecordPermissionContentManager( private const val NO_DELAY: Long = 100 private const val INTERVAL_MS: Long = 1000 private const val PREF_TAPS = "screenrecord_show_taps" private const val PREF_LOW = "screenrecord_use_low_quality" private const val PREF_LONGER = "screenrecord_use_longer_timeout" private const val PREF_AUDIO = "screenrecord_use_audio" private const val PREF_AUDIO_SOURCE = "screenrecord_audio_source" private const val PREF_SKIP = "screenrecord_skip_timer" private const val PREF_HEVC = "screenrecord_use_hevc" fun createOptionList(displayManager: DisplayManager): List<ScreenShareOption> { val connectedDisplays = getConnectedDisplays(displayManager) Loading