-
-
Notifications
You must be signed in to change notification settings - Fork 97
Feat: Add media output switcher support for original equipment manufacturers (OEMs) #635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: beta
Are you sure you want to change the base?
Conversation
| if (!tag) { | ||
| Toast.makeText(context, R.string.media_control_text_error, Toast.LENGTH_SHORT).show() | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this duplicated?
|
If you have any more questions, let's talk about them tomorrow. I'm going to bed now. |
|
Can you please:
thank you! |
OK, I have confirmed that Xiaomi will not remove the api, because this is one of their important interfaces for interconnection. |
0a17957 to
deb62e0
Compare
|
So, the current problem is that it will show button for old device which never had output switcher. Like Android 5, 6, 7, 8, etc. |
Then add detection, and hide it if it is not supported |
|
Sure, I'll do it soon. |
OK |
…cturers (OEMs) Code sources: https://github.com/Moriafly/media-kit and https://github.com/Yos-X/FlamingoSank The functionality works as follows across different Android versions and OEM ROMs: - For Android 14 and higher, it uses MediaRouter2#showSystemOutputSwitcher. - For Android 12 and higher, it uses the “com.android.systemui.action.LAUNCH_MEDIA_OUTPUT_DIALOG” action. - For Android 11, it uses the “com.android.settings.panel.action.MEDIA_OUTPUT” action. - For MIUI (Xiaomi), it uses “miui.systemui.miplay.MiPlayDetailActivity”. - For One UI (Samsung), it uses “com.samsung.android.mdx.quickboard.view.MediaActivity”.
The SystemMediaControlResolver has been refactored to better handle various Android versions and OEM customizations. It also introduces dedicated checks for One UI versions and displays a Toast message when media output settings cannot be opened. Specific changes include: * The logic for launching the system media control dialog has been refactored into a new private function `startSystemMediaControl()`. * Added a new function `getOneUIVersionReadable()` to retrieve the One UI version. * Fall back to `startSystemMediaControl()` when launching OEM-specific media control dialogs fails. * Display a Toast message when media output settings cannot be opened. * Added new strings in `strings.xml`.
Moved the `getSystemProperties` logic into a separate private function for better readability and potential reuse. This change also ensures that an `IllegalArgumentException` is properly thrown if encountered during reflection.
The SystemMediaControlResolver has been refactored to better handle various Android versions and OEM customizations. It also introduces dedicated checks for One UI versions and displays a Toast message when media output settings cannot be opened. Specific changes include: * The logic for launching the system media control dialog has been refactored into a new private function `startSystemMediaControl()`. * Added a new function `getOneUIVersionReadable()` to retrieve the One UI version. * Fall back to `startSystemMediaControl()` when launching OEM-specific media control dialogs fails. * Display a Toast message when media output settings cannot be opened. * Added new strings in `strings.xml`.
…ml layout. The media control buttons have been removed from the linear layout at the bottom of the screen and moved to the top of the screen. This button is now fixed at the top of the parent layout and has some margin for adjustment.
Temporarily disable One UI MediaActivity calls and wait until it is certain that they will not be deleted before adding them back. Signed-off-by: ghhccghk <[email protected]>
Adjusted media output panel availability check logic based on Android version. - For Android 14 and above, assume the panel is always available. - For Android 12 and 13, check if the system UI can handle the media output dialog intent. - For Android 11 and below, check if the Settings app can handle the media output panel intent. If the panel is unavailable, hide the media control buttons. Signed-off-by: ghhccghk <[email protected]>
|
Hi, just to clarify what's the status: I think I will merge this after next release when I have more time. Reason is that 1. this is good opportunity to move more buttons around and migrate to proper TopAppBar in that screen, 2. as fallback I want to implement in-app output switcher (for A10 and earlier), 3. I want to check if it's possible to make MediaRouter allow to change between headphones and speaker before A15 in this output switcher, 4. for the previous point it would be good if Google fixed https://issuetracker.google.com/issues/340805981 Basically I want to check how much potential MediaRouter has before merging this feature, but I promise I will get back to you. Thank you for your patience! |
no problem |
Code sources: https://github.com/Moriafly/media-kit and https://github.com/Yos-X/FlamingoSank
The functionality works as follows across different Android versions and OEM ROMs: