Commit 145bd31
committed
Migrate Android Auto implementation to androidx.car.app:app:1.7.0
Updates the Android Auto code path to the androidx.car.app:app:1.7.0
contract. The bulk of this PR is the 1.7.0 contract alignment from
#2008; the MediaPlayerService / TelegramMediaSession
integration is a follow-up added by risin42 in
risin42/NagramX@ec956e3 ("fix: Android Auto support", co-authored by
rainman74).
The AndroidX media-compat artifact androidx.media:media:1.7.0 keeps its
classes under the legacy android.support.v4.media.* package for binary
compatibility reasons - the import migration to androidx.media.* is
NOT applied here (it would reference non-existent classes). Only the
new transitive dependency is added; existing android.support.v4.media.*
imports are left as-is.
Build
- bump androidx.car.app:app:1.4.0 -> 1.7.0
- drop androidx.car.app:app-projected:1.4.0 (upstream pre-1.7.0 used
the projected variant; the 1.7.0 line no longer needs it as a
separate dependency)
- add androidx.media:media:1.7.0 (AndroidX media session)
- add androidx.lifecycle:lifecycle-runtime:2.7.0 (DefaultLifecycleObserver)
Manifest / config
- uncomment the CarAppService <meta-data> + <service> block in
AndroidManifest.xml; bump minCarApiLevel 5 -> 7 (required by
ConversationItem @RequiresCarApi(7))
- automotive_app_desc.xml: add <uses name="media"/> for the new
CarAppService media category; keep notification and template
Code
- HomeScreen: ensure Person always carries a key, which the 1.7.x
ConversationItem.validateSender() requires. Applied locally to the
senderBuilder.setName("") branch in buildCarMessage, matching the
upstream intent without touching the surrounding code.
- MusicPlayerService: after every mediaSession.setPlaybackState() and
mediaSession.setMetadata(), also publish the same state / metadata
to TelegramMediaSession so the MediaBrowserService is in sync with
the phone player. On onDestroy, publish STATE_STOPPED if nothing is
playing. Without this, the Android Auto media surface had no view of
what the phone player was doing.
- TelegramMediaSession.publishPlaybackState: merge getAvailableActions()
(skip next/prev, set shuffle, etc.) into the state before publishing,
so Android Auto renders the full action set.
Upstream-specific context
- This PR adds the risin42/NagramX@ec956e3 MediaPlayerService /
TelegramMediaSession integration on top of the original #2008
contract alignment, so all three repos (upstream / NagramXF / NagramX)
are in sync. The ec956e3 version of MusicPlayerService.java is NOT
copied verbatim because DrKLO's upstream code has additional
MIUI-specific lock-screen logic and an accountLogin handler that
NagramX does not carry; the four targeted hunks (publishPlaybackState
after each setPlaybackState, publishMetadata after setMetadata, and
STATE_STOPPED cleanup in onDestroy) are applied on top of DrKLO's
current file instead.
- Final diff against master: 6 files, 23 insertions(+), 10 deletions(-).
Refs: risin42/NagramX@ec956e31 parent 45ab8f4 commit 145bd31
6 files changed
Lines changed: 23 additions & 10 deletions
File tree
- TMessagesProj
- src/main
- java/org/telegram/messenger
- car
- res/xml
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
30 | 32 | | |
31 | | - | |
32 | | - | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
672 | 672 | | |
673 | 673 | | |
674 | 674 | | |
675 | | - | |
676 | 675 | | |
677 | 676 | | |
678 | 677 | | |
| |||
688 | 687 | | |
689 | 688 | | |
690 | 689 | | |
691 | | - | |
692 | | - | |
| 690 | + | |
693 | 691 | | |
694 | 692 | | |
695 | 693 | | |
| |||
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | | - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
530 | 532 | | |
531 | 533 | | |
532 | 534 | | |
| |||
540 | 542 | | |
541 | 543 | | |
542 | 544 | | |
| 545 | + | |
543 | 546 | | |
544 | 547 | | |
545 | 548 | | |
| |||
749 | 752 | | |
750 | 753 | | |
751 | 754 | | |
752 | | - | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
753 | 758 | | |
754 | 759 | | |
755 | 760 | | |
| |||
822 | 827 | | |
823 | 828 | | |
824 | 829 | | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
825 | 836 | | |
826 | 837 | | |
827 | 838 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
439 | | - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
440 | 442 | | |
441 | 443 | | |
442 | 444 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
| 271 | + | |
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
0 commit comments