Skip to content

Commit 785d6a5

Browse files
committed
Add native Android media controls for HA media_player entities
1 parent bdd2ac6 commit 785d6a5

File tree

25 files changed

+2081
-16
lines changed

25 files changed

+2081
-16
lines changed

app/lint-baseline.xml

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@
404404
errorLine2=" ~~~~~~~~~~~">
405405
<location
406406
file="src/main/AndroidManifest.xml"
407-
line="89"
407+
line="90"
408408
column="6"/>
409409
</issue>
410410

@@ -646,7 +646,7 @@
646646
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
647647
<location
648648
file="src/main/kotlin/io/homeassistant/companion/android/settings/SettingsFragment.kt"
649-
line="539"
649+
line="554"
650650
column="17"/>
651651
</issue>
652652

@@ -657,7 +657,7 @@
657657
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
658658
<location
659659
file="src/main/kotlin/io/homeassistant/companion/android/settings/SettingsFragment.kt"
660-
line="539"
660+
line="554"
661661
column="17"/>
662662
</issue>
663663

@@ -1609,6 +1609,61 @@
16091609
column="14"/>
16101610
</issue>
16111611

1612+
<issue
1613+
id="ComposeUnstableCollections"
1614+
message="The Compose Compiler cannot infer the stability of a parameter if a List&lt;Server> is used in it, even if the item type is stable.&#xA;You should use Kotlinx Immutable Collections instead: `servers: ImmutableList&lt;Server>` or create an `@Immutable` wrapper for this class: `@Immutable data class ServersList(val items: List&lt;Server>)`&#xA;See https://slackhq.github.io/compose-lints/rules/#avoid-using-unstable-collections for more information."
1615+
errorLine1=" servers: List&lt;Server>,"
1616+
errorLine2=" ~~~~~~~~~~~~">
1617+
<location
1618+
file="src/main/kotlin/io/homeassistant/companion/android/settings/mediacontrol/views/MediaControlSettingsView.kt"
1619+
line="62"
1620+
column="14"/>
1621+
</issue>
1622+
1623+
<issue
1624+
id="ComposeUnstableCollections"
1625+
message="The Compose Compiler cannot infer the stability of a parameter if a List&lt;Entity> is used in it, even if the item type is stable.&#xA;You should use Kotlinx Immutable Collections instead: `sortedEntities: ImmutableList&lt;Entity>` or create an `@Immutable` wrapper for this class: `@Immutable data class SortedEntitiesList(val items: List&lt;Entity>)`&#xA;See https://slackhq.github.io/compose-lints/rules/#avoid-using-unstable-collections for more information."
1626+
errorLine1=" sortedEntities: List&lt;Entity>,"
1627+
errorLine2=" ~~~~~~~~~~~~">
1628+
<location
1629+
file="src/main/kotlin/io/homeassistant/companion/android/settings/mediacontrol/views/MediaControlSettingsView.kt"
1630+
line="63"
1631+
column="21"/>
1632+
</issue>
1633+
1634+
<issue
1635+
id="ComposeUnstableCollections"
1636+
message="The Compose Compiler cannot infer the stability of a parameter if a List&lt;EntityRegistryResponse> is used in it, even if the item type is stable.&#xA;You should use Kotlinx Immutable Collections instead: `entityRegistry: ImmutableList&lt;EntityRegistryResponse>` or create an `@Immutable` wrapper for this class: `@Immutable data class EntityRegistryList(val items: List&lt;EntityRegistryResponse>)`&#xA;See https://slackhq.github.io/compose-lints/rules/#avoid-using-unstable-collections for more information."
1637+
errorLine1=" entityRegistry: List&lt;EntityRegistryResponse>,"
1638+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
1639+
<location
1640+
file="src/main/kotlin/io/homeassistant/companion/android/settings/mediacontrol/views/MediaControlSettingsView.kt"
1641+
line="64"
1642+
column="21"/>
1643+
</issue>
1644+
1645+
<issue
1646+
id="ComposeUnstableCollections"
1647+
message="The Compose Compiler cannot infer the stability of a parameter if a List&lt;DeviceRegistryResponse> is used in it, even if the item type is stable.&#xA;You should use Kotlinx Immutable Collections instead: `deviceRegistry: ImmutableList&lt;DeviceRegistryResponse>` or create an `@Immutable` wrapper for this class: `@Immutable data class DeviceRegistryList(val items: List&lt;DeviceRegistryResponse>)`&#xA;See https://slackhq.github.io/compose-lints/rules/#avoid-using-unstable-collections for more information."
1648+
errorLine1=" deviceRegistry: List&lt;DeviceRegistryResponse>,"
1649+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
1650+
<location
1651+
file="src/main/kotlin/io/homeassistant/companion/android/settings/mediacontrol/views/MediaControlSettingsView.kt"
1652+
line="65"
1653+
column="21"/>
1654+
</issue>
1655+
1656+
<issue
1657+
id="ComposeUnstableCollections"
1658+
message="The Compose Compiler cannot infer the stability of a parameter if a List&lt;AreaRegistryResponse> is used in it, even if the item type is stable.&#xA;You should use Kotlinx Immutable Collections instead: `areaRegistry: ImmutableList&lt;AreaRegistryResponse>` or create an `@Immutable` wrapper for this class: `@Immutable data class AreaRegistryList(val items: List&lt;AreaRegistryResponse>)`&#xA;See https://slackhq.github.io/compose-lints/rules/#avoid-using-unstable-collections for more information."
1659+
errorLine1=" areaRegistry: List&lt;AreaRegistryResponse>,"
1660+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
1661+
<location
1662+
file="src/main/kotlin/io/homeassistant/companion/android/settings/mediacontrol/views/MediaControlSettingsView.kt"
1663+
line="66"
1664+
column="19"/>
1665+
</issue>
1666+
16121667
<issue
16131668
id="ComposeUnstableCollections"
16141669
message="The Compose Compiler cannot infer the stability of a parameter if a List&lt;SensorWithAttributes> is used in it, even if the item type is stable.&#xA;You should use Kotlinx Immutable Collections instead: `dbSensor: ImmutableList&lt;SensorWithAttributes>` or create an `@Immutable` wrapper for this class: `@Immutable data class DbSensorList(val items: List&lt;SensorWithAttributes>)`&#xA;See https://slackhq.github.io/compose-lints/rules/#avoid-using-unstable-collections for more information."

app/src/main/AndroidManifest.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
3737
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/>
3838
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
39+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
3940
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING"/>
4041
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
4142
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
@@ -322,6 +323,18 @@
322323
</intent-filter>
323324
</service>
324325

326+
<service
327+
android:name=".mediacontrol.HaMediaSessionService"
328+
android:exported="true"
329+
android:foregroundServiceType="mediaPlayback"
330+
tools:ignore="ExportedService">
331+
<!-- Exported so system media controllers can bind to the session.
332+
Connections are filtered in MediaSession.Callback#onConnect. -->
333+
<intent-filter>
334+
<action android:name="androidx.media3.session.MediaSessionService"/>
335+
</intent-filter>
336+
</service>
337+
325338
<activity android:name=".controls.HaControlsPanelActivity"
326339
android:permission="android.permission.BIND_CONTROLS"
327340
android:exported="true"

0 commit comments

Comments
 (0)