Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into native-assist
Browse files Browse the repository at this point in the history
# Conflicts:
#	automotive/src/main/AndroidManifest.xml
  • Loading branch information
jpelgrom committed Jun 19, 2023
2 parents 4ab7864 + b586bf9 commit b94ba00
Show file tree
Hide file tree
Showing 24 changed files with 152 additions and 122 deletions.
1 change: 1 addition & 0 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
./app/build/outputs/apk/minimal/release/app-minimal-release.apk
./wear/build/outputs/apk/release/wear-release.apk
./automotive/build/outputs/apk/full/release/automotive-full-release.apk
./automotive/build/outputs/apk/minimal/release/automotive-minimal-release.apk
- name: Deploy to Firebase
env:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
./app/build/outputs/apk/minimal/release/app-minimal-release.apk
./wear/build/outputs/apk/release/wear-release.apk
./automotive/build/outputs/apk/full/release/automotive-full-release.apk
./automotive/build/outputs/apk/minimal/release/automotive-minimal-release.apk
./app/build/outputs/version_code.txt
- name: Deploy to Firebase
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ If you are looking for documentation around the companion applications check out
- `io.homeassistant.companion.android.minimal`
- `io.homeassistant.companion.android.minimal.debug`

5. Now download the `google-services.json` file and put it in the _home-assistant-Android/app_ and _home-assistant-Android/wear_ folder. This file contains the configuration of the whole project (all four applications). ([You can also use the mock services file instead of generating your own](/.github/mock-google-services.json). The file should contain client IDs for all packages listed above for debugging to work properly. **If you do not generate your own file FCM push notification will never work, only websocket notifications will**)
5. Now download the `google-services.json` file and put it in the project's _/app_, _/automotive_ and _/wear_ folders. This file contains the configuration of the whole project (all four applications). ([You can also use the mock services file instead of generating your own](/.github/mock-google-services.json). The file should contain client IDs for all packages listed above for debugging to work properly. **If you do not generate your own file FCM push notification will never work, only websocket notifications will**)
6. Start Android Studio, open your source code folder and check if the Gradle build will be successful using Build/Make Module "App". You might have to install the right Android SDK via Tools/SDK Manager first.
7. Run `gradlew assembleDebug` to build all debug versions, this might take a while.
8. If the build is successful, you can run the app by doing the following: click **Run** -> **Run 'app'**.
Expand Down
3 changes: 1 addition & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ dependencies {
"fullImplementation"(platform("com.google.firebase:firebase-bom:32.1.0"))
"fullImplementation"("com.google.firebase:firebase-messaging")
"fullImplementation"("io.sentry:sentry-android:6.21.0")
"fullImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.7.1")
"fullImplementation"("com.google.android.gms:play-services-wearable:18.0.0")
"fullImplementation"("androidx.wear:wear-remote-interactions:1.0.0")

Expand Down Expand Up @@ -211,7 +210,7 @@ dependencies {
"fullImplementation"("org.burnoutcrew.composereorderable:reorderable:0.9.6")
implementation("com.github.AppDevNext:ChangeLog:3.4")

"fullImplementation"("androidx.car.app:app:1.3.0-rc01")
implementation("androidx.car.app:app:1.3.0-rc01")
}

// Disable to fix memory leak and be compatible with the configuration cache.
Expand Down
7 changes: 7 additions & 0 deletions app/src/full/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

<uses-sdk tools:overrideLibrary="com.google.android.gms.threadnetwork" />

<queries>
<!-- For GMS Core/Play service -->
<package android:name="com.google.android.gms" />
<package android:name="com.android.vending" />
<!-- End of GMS Core/Play service-->
</queries>

<application
android:name="io.homeassistant.companion.android.HomeAssistantApplication" >
<meta-data android:name="io.sentry.auto-init" android:value="false" />
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/xml/changelog_master.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingDefaultResource">
<release version="2023.5 - Phone" versioncode="3">
<release version="2023.6 - Phone" versioncode="3">
<change>Add 2 new Android version sensors</change>
<change>Add new intent extra types for notification commands</change>
<change>Matter improvements and fixes</change>
<change>Bug fixes, design improvements and dependency updates</change>
</release>
<release version="2023.5 - Wear" versioncode="2">
<release version="2023.6 - Wear" versioncode="2">
<change>Entity State Complication: Support long text type, add new option to show or hide friendly name</change>
<change>Add 2 new Android version sensors</change>
<change>Bug fixes, design improvements and dependency updates</change>
</release>
<release version="2023.5 - Automotive" versioncode="1">
<release version="2023.6 - Automotive" versioncode="1">
<change>Initial Release</change>
</release>
</changelog>
46 changes: 32 additions & 14 deletions automotive/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,32 @@ android {
sourceSets {
getByName("main") {
java {
srcDirs("../app/src/main/java", "../app/src/full/java")
srcDirs("../app/src/main/java")
}
res {
srcDirs("../app/src/main/res", "../app/src/full/res")
srcDirs("../app/src/main/res")
}
}
create("full") {
java {
srcDirs("../app/src/full/java")
}
res {
srcDirs("../app/src/full/res")
}
}
create("minimal") {
java {
srcDirs("../app/src/minimal/java")
}
res {
srcDirs("../app/src/minimal/res")
}
}
getByName("debug") {
res {
srcDirs("../app/src/debug/res")
}
manifest.srcFile("src/main/AndroidManifest.xml")
}
}

Expand Down Expand Up @@ -169,28 +189,26 @@ dependencies {
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.fragment:fragment-ktx:1.5.7")

implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.5")
implementation("com.squareup.okhttp3:okhttp:4.11.0")
implementation("com.squareup.picasso:picasso:2.8")

implementation("com.google.android.gms:play-services-location:21.0.1")
implementation("com.google.android.gms:play-services-home:16.0.0")
implementation("com.google.android.gms:play-services-threadnetwork:16.0.0")
implementation(platform("com.google.firebase:firebase-bom:32.1.0"))
implementation("com.google.firebase:firebase-messaging")
implementation("io.sentry:sentry-android:6.21.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.7.1")
implementation("com.google.android.gms:play-services-wearable:18.0.0")
implementation("androidx.wear:wear-remote-interactions:1.0.0")
"fullImplementation"("com.google.android.gms:play-services-location:21.0.1")
"fullImplementation"("com.google.android.gms:play-services-home:16.0.0")
"fullImplementation"("com.google.android.gms:play-services-threadnetwork:16.0.0")
"fullImplementation"(platform("com.google.firebase:firebase-bom:32.1.0"))
"fullImplementation"("com.google.firebase:firebase-messaging")
"fullImplementation"("io.sentry:sentry-android:6.21.0")
"fullImplementation"("com.google.android.gms:play-services-wearable:18.0.0")
"fullImplementation"("androidx.wear:wear-remote-interactions:1.0.0")

implementation("androidx.biometric:biometric:1.1.0")
implementation("androidx.webkit:webkit:1.7.0")

implementation("com.google.android.exoplayer:exoplayer-core:2.18.7")
implementation("com.google.android.exoplayer:exoplayer-hls:2.18.7")
implementation("com.google.android.exoplayer:exoplayer-ui:2.18.7")
implementation("com.google.android.exoplayer:extension-cronet:2.18.7")
"fullImplementation"("com.google.android.exoplayer:extension-cronet:2.18.7")
"minimalImplementation"("com.google.android.exoplayer:extension-cronet:2.18.7") {
exclude(group = "com.google.android.gms", module = "play-services-cronet")
}
Expand Down
35 changes: 7 additions & 28 deletions automotive/src/full/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

<uses-sdk tools:overrideLibrary="com.google.android.gms.threadnetwork" />

<queries>
<!-- For GMS Core/Play service -->
<package android:name="com.google.android.gms" />
<package android:name="com.android.vending" />
<!-- End of GMS Core/Play service-->
</queries>

<application
android:name="io.homeassistant.companion.android.HomeAssistantApplication" >
<meta-data android:name="io.sentry.auto-init" android:value="false" />
Expand Down Expand Up @@ -49,34 +56,6 @@
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/colorPrimary" />

<meta-data
android:name="androidx.car.app.minCarApiLevel"
android:value="1"/>
<meta-data
android:name="com.android.automotive"
android:resource="@xml/automotive_app_desc"/>
<service
android:name=".vehicle.HaCarAppService"
android:exported="true">
<intent-filter>
<action android:name="androidx.car.app.CarAppService" />
<category android:name="androidx.car.app.category.IOT"/>
</intent-filter>
</service>
<activity
android:name="androidx.car.app.activity.CarAppActivity"
android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
android:exported="true"
android:launchMode="singleTask"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="distractionOptimized" android:value="true"/>
</activity>

</application>

</manifest>
30 changes: 29 additions & 1 deletion automotive/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
<uses-feature android:name="android.hardware.wifi" android:required="false" />
<uses-feature android:name="android.hardware.screen.portrait" android:required="false" />
<uses-feature android:name="android.hardware.screen.landscape" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<application
android:name="io.homeassistant.companion.android.HomeAssistantApplication"
android:allowBackup="true"
Expand Down Expand Up @@ -379,6 +378,35 @@
</intent-filter>
</activity>

<meta-data
android:name="androidx.car.app.minCarApiLevel"
android:value="1"/>
<meta-data
android:name="com.android.automotive"
android:resource="@xml/automotive_app_desc"/>
<service
android:name=".vehicle.HaCarAppService"
android:exported="true">
<intent-filter>
<action android:name="androidx.car.app.CarAppService" />
<category android:name="androidx.car.app.category.IOT"/>
</intent-filter>
</service>
<activity
android:name="androidx.car.app.activity.CarAppActivity"
android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
android:exported="true"
android:launchMode="singleTask"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="distractionOptimized" android:value="true"/>
</activity>

<activity android:name=".assist.AssistActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,38 @@ interface WebSocketRepository {
suspend fun getTemplateUpdates(template: String): Flow<TemplateUpdatedEvent>?
suspend fun getNotifications(): Flow<Map<String, Any>>?
suspend fun ackNotification(confirmId: String): Boolean

/**
* Request the server to add a Matter device to the network and commission it.
* @return [MatterCommissionResponse] detailing the server's response, or `null` if the server
* did not return a response.
*/
suspend fun commissionMatterDevice(code: String): MatterCommissionResponse?

/**
* Request the server to commission a Matter device that is already on the network.
* @return [MatterCommissionResponse] detailing the server's response, or `null` if the server
* did not return a response.
*/
suspend fun commissionMatterDeviceOnNetwork(pin: Long): MatterCommissionResponse?

/**
* Return a list of all Thread datasets known to the server.
* @return List with [ThreadDatasetResponse]s, or `null` if not an admin or no response.
*/
suspend fun getThreadDatasets(): List<ThreadDatasetResponse>?

/**
* Return the TLV value for a dataset.
* @return [ThreadDatasetTlvResponse] for the Thread dataset, or `null` if not found, not an
* admin or no response.
*/
suspend fun getThreadDatasetTlv(datasetId: String): ThreadDatasetTlvResponse?

/**
* Add a new set of Thread network credentials to the server.
* @return `true` if the server indicated success
*/
suspend fun addThreadDataset(tlv: ByteArray): Boolean

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,6 @@ class WebSocketRepositoryImpl @AssistedInject constructor(
return response?.success == true
}

/**
* Request the server to add a Matter device to the network and commission it
* @return [MatterCommissionResponse] detailing the server's response, or `null` if the server
* did not return a response
*/
override suspend fun commissionMatterDevice(code: String): MatterCommissionResponse? {
val response = sendMessage(
WebSocketRequest(
Expand All @@ -471,11 +466,6 @@ class WebSocketRepositoryImpl @AssistedInject constructor(
}
}

/**
* Request the server to commission a Matter device that is already on the network
* @return [MatterCommissionResponse] detailing the server's response, or `null` if the server
* did not return a response
*/
override suspend fun commissionMatterDeviceOnNetwork(pin: Long): MatterCommissionResponse? {
val response = sendMessage(
WebSocketRequest(
Expand All @@ -501,10 +491,6 @@ class WebSocketRepositoryImpl @AssistedInject constructor(
}
}

/**
* Return a list of all Thread datasets known to the server.
* @return List with [ThreadDatasetResponse]s, or `null` if not an admin or no response.
*/
override suspend fun getThreadDatasets(): List<ThreadDatasetResponse>? {
val response = sendMessage(
mapOf(
Expand All @@ -518,11 +504,6 @@ class WebSocketRepositoryImpl @AssistedInject constructor(
}
}

/**
* Return the TLV value for a dataset.
* @return [ThreadDatasetTlvResponse] for the Thread dataset, or `null` if not found, not an
* admin or no response.
*/
override suspend fun getThreadDatasetTlv(datasetId: String): ThreadDatasetTlvResponse? {
val response = sendMessage(
mapOf(
Expand All @@ -534,10 +515,6 @@ class WebSocketRepositoryImpl @AssistedInject constructor(
return mapResponse(response)
}

/**
* Add a new set of Thread network credentials to the server.
* @return `true` if the server indicated success
*/
override suspend fun addThreadDataset(tlv: ByteArray): Boolean {
val response = sendMessage(
mapOf(
Expand Down
Loading

0 comments on commit b94ba00

Please sign in to comment.