Loading packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingState.kt +17 −6 Original line number Diff line number Diff line Loading @@ -52,9 +52,20 @@ constructor( get() = prefs.getBoolean(HAS_APPROVED_SCREEN_RECORDING, false) private set(value) = prefs.edit().putBoolean(HAS_APPROVED_SCREEN_RECORDING, value).apply() // Store the index of the issue type because res ids are generated at compile time and change // in value from one build to another. The index will not change between package versions. private var issueTypeIndex: Int get() = prefs.getInt(KEY_ISSUE_TYPE_INDEX, ISSUE_TYPE_NOT_SET) set(value) = prefs.edit().putInt(KEY_ISSUE_TYPE_INDEX, value).apply() var issueTypeRes get() = prefs.getInt(KEY_ISSUE_TYPE_RES, ISSUE_TYPE_NOT_SET) set(value) = prefs.edit().putInt(KEY_ISSUE_TYPE_RES, value).apply() get() = // If the user has never used the record issue tile, we don't show a default issue type if (issueTypeIndex == ISSUE_TYPE_NOT_SET) ISSUE_TYPE_NOT_SET else ALL_ISSUE_TYPES.keys.toIntArray()[issueTypeIndex] set(value) { issueTypeIndex = ALL_ISSUE_TYPES.keys.toIntArray().indexOf(value) } val traceConfig: TraceConfig get() = ALL_ISSUE_TYPES[issueTypeRes] ?: customTraceState.traceConfig Loading Loading @@ -89,17 +100,17 @@ constructor( private const val HAS_APPROVED_SCREEN_RECORDING = "HasApprovedScreenRecord" private const val KEY_RECORD_SCREEN = "key_recordScreen" private const val KEY_TAG_TITLES = "key_tagTitles" const val KEY_ISSUE_TYPE_RES = "key_issueTypeRes" const val KEY_ISSUE_TYPE_INDEX = "key_issueTypeIndex" const val ISSUE_TYPE_NOT_SET = -1 const val TAG_TITLE_DELIMITER = ": " val ALL_ISSUE_TYPES: Map<Int, TraceConfig?> = hashMapOf( val ALL_ISSUE_TYPES: LinkedHashMap<Int, TraceConfig?> = linkedMapOf( Pair(R.string.performance, PresetTraceConfigs.getPerformanceConfig()), Pair(R.string.user_interface, PresetTraceConfigs.getUiConfig()), Pair(R.string.battery, PresetTraceConfigs.getBatteryConfig()), Pair(R.string.thermal, PresetTraceConfigs.getThermalConfig()), Pair(R.string.custom, null), Pair(R.string.custom, null), // Null means we are using a custom trace config ) } } packages/SystemUI/src/com/android/systemui/recordissue/RecordIssueDialogDelegate.kt +4 −3 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ import com.android.systemui.mediaprojection.devicepolicy.ScreenCaptureDevicePoli import com.android.systemui.mediaprojection.devicepolicy.ScreenCaptureDisabledDialogDelegate import com.android.systemui.recordissue.IssueRecordingState.Companion.ALL_ISSUE_TYPES import com.android.systemui.recordissue.IssueRecordingState.Companion.ISSUE_TYPE_NOT_SET import com.android.systemui.recordissue.IssueRecordingState.Companion.KEY_ISSUE_TYPE_RES import com.android.systemui.res.R import com.android.systemui.settings.UserTracker import com.android.systemui.statusbar.phone.SystemUIDialog Loading @@ -51,6 +50,8 @@ import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import java.util.concurrent.Executor private const val EXTRA_ISSUE_TYPE_RES = "extra_issueTypeRes" class RecordIssueDialogDelegate @AssistedInject constructor( Loading Loading @@ -170,7 +171,7 @@ constructor( PopupMenu.OnMenuItemClickListener { issueTypeButton.text = it.title state.issueTypeRes = it.intent?.getIntExtra(KEY_ISSUE_TYPE_RES, ISSUE_TYPE_NOT_SET) it.intent?.getIntExtra(EXTRA_ISSUE_TYPE_RES, ISSUE_TYPE_NOT_SET) ?: ISSUE_TYPE_NOT_SET onIssueTypeSelected.run() true Loading @@ -181,7 +182,7 @@ constructor( if (it != state.issueTypeRes) { iconTintList = ColorStateList.valueOf(Color.TRANSPARENT) } intent = Intent().putExtra(KEY_ISSUE_TYPE_RES, it) intent = Intent().putExtra(EXTRA_ISSUE_TYPE_RES, it) if (it == R.string.custom) { setOnMenuItemClickListener { Loading Loading
packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingState.kt +17 −6 Original line number Diff line number Diff line Loading @@ -52,9 +52,20 @@ constructor( get() = prefs.getBoolean(HAS_APPROVED_SCREEN_RECORDING, false) private set(value) = prefs.edit().putBoolean(HAS_APPROVED_SCREEN_RECORDING, value).apply() // Store the index of the issue type because res ids are generated at compile time and change // in value from one build to another. The index will not change between package versions. private var issueTypeIndex: Int get() = prefs.getInt(KEY_ISSUE_TYPE_INDEX, ISSUE_TYPE_NOT_SET) set(value) = prefs.edit().putInt(KEY_ISSUE_TYPE_INDEX, value).apply() var issueTypeRes get() = prefs.getInt(KEY_ISSUE_TYPE_RES, ISSUE_TYPE_NOT_SET) set(value) = prefs.edit().putInt(KEY_ISSUE_TYPE_RES, value).apply() get() = // If the user has never used the record issue tile, we don't show a default issue type if (issueTypeIndex == ISSUE_TYPE_NOT_SET) ISSUE_TYPE_NOT_SET else ALL_ISSUE_TYPES.keys.toIntArray()[issueTypeIndex] set(value) { issueTypeIndex = ALL_ISSUE_TYPES.keys.toIntArray().indexOf(value) } val traceConfig: TraceConfig get() = ALL_ISSUE_TYPES[issueTypeRes] ?: customTraceState.traceConfig Loading Loading @@ -89,17 +100,17 @@ constructor( private const val HAS_APPROVED_SCREEN_RECORDING = "HasApprovedScreenRecord" private const val KEY_RECORD_SCREEN = "key_recordScreen" private const val KEY_TAG_TITLES = "key_tagTitles" const val KEY_ISSUE_TYPE_RES = "key_issueTypeRes" const val KEY_ISSUE_TYPE_INDEX = "key_issueTypeIndex" const val ISSUE_TYPE_NOT_SET = -1 const val TAG_TITLE_DELIMITER = ": " val ALL_ISSUE_TYPES: Map<Int, TraceConfig?> = hashMapOf( val ALL_ISSUE_TYPES: LinkedHashMap<Int, TraceConfig?> = linkedMapOf( Pair(R.string.performance, PresetTraceConfigs.getPerformanceConfig()), Pair(R.string.user_interface, PresetTraceConfigs.getUiConfig()), Pair(R.string.battery, PresetTraceConfigs.getBatteryConfig()), Pair(R.string.thermal, PresetTraceConfigs.getThermalConfig()), Pair(R.string.custom, null), Pair(R.string.custom, null), // Null means we are using a custom trace config ) } }
packages/SystemUI/src/com/android/systemui/recordissue/RecordIssueDialogDelegate.kt +4 −3 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ import com.android.systemui.mediaprojection.devicepolicy.ScreenCaptureDevicePoli import com.android.systemui.mediaprojection.devicepolicy.ScreenCaptureDisabledDialogDelegate import com.android.systemui.recordissue.IssueRecordingState.Companion.ALL_ISSUE_TYPES import com.android.systemui.recordissue.IssueRecordingState.Companion.ISSUE_TYPE_NOT_SET import com.android.systemui.recordissue.IssueRecordingState.Companion.KEY_ISSUE_TYPE_RES import com.android.systemui.res.R import com.android.systemui.settings.UserTracker import com.android.systemui.statusbar.phone.SystemUIDialog Loading @@ -51,6 +50,8 @@ import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import java.util.concurrent.Executor private const val EXTRA_ISSUE_TYPE_RES = "extra_issueTypeRes" class RecordIssueDialogDelegate @AssistedInject constructor( Loading Loading @@ -170,7 +171,7 @@ constructor( PopupMenu.OnMenuItemClickListener { issueTypeButton.text = it.title state.issueTypeRes = it.intent?.getIntExtra(KEY_ISSUE_TYPE_RES, ISSUE_TYPE_NOT_SET) it.intent?.getIntExtra(EXTRA_ISSUE_TYPE_RES, ISSUE_TYPE_NOT_SET) ?: ISSUE_TYPE_NOT_SET onIssueTypeSelected.run() true Loading @@ -181,7 +182,7 @@ constructor( if (it != state.issueTypeRes) { iconTintList = ColorStateList.valueOf(Color.TRANSPARENT) } intent = Intent().putExtra(KEY_ISSUE_TYPE_RES, it) intent = Intent().putExtra(EXTRA_ISSUE_TYPE_RES, it) if (it == R.string.custom) { setOnMenuItemClickListener { Loading