Skip to content

Commit 951938d

Browse files
committed
fix:Merge code for calling media controls on Android 11 and lower versions
1 parent a74b551 commit 951938d

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

app/src/main/java/org/akanework/gramophone/logic/utils/exoplayer/oem/SystemMediaControlResolver.kt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,9 @@ class SystemMediaControlResolver(val context: Context) {
6666
if (!tag) {
6767
Toast.makeText(context, R.string.media_control_text_error, Toast.LENGTH_SHORT).show()
6868
}
69-
} else if (Build.VERSION.SDK_INT == 30) {
70-
// Android 11
71-
val tag = startNativeMediaDialogForAndroid11(context)
72-
if (!tag) {
73-
Toast.makeText(context, R.string.media_control_text_error, Toast.LENGTH_SHORT).show()
74-
}
7569
} else {
76-
val intent = Intent().apply {
77-
flags = Intent.FLAG_ACTIVITY_NEW_TASK
78-
action = "com.android.settings.panel.action.MEDIA_OUTPUT"
79-
putExtra("com.android.settings.panel.extra.PACKAGE_NAME", context.packageName)
80-
}
81-
val tag = startNativeMediaDialog(intent)
70+
// zh: Android 11 及以下
71+
val tag = startNativeMediaDialogForAndroid11(context)
8272
if (!tag) {
8373
Toast.makeText(context, R.string.media_control_text_error, Toast.LENGTH_SHORT).show()
8474
}

0 commit comments

Comments
 (0)