Move vehicle service to main to allow for minimal Automotive build (#3570)

* Move vehicle service to minimal to allow for minimal Automotive build

 - Move the vehicle package from full to main so it is included in the minimal build as well, to allow for a minimal Automotive build
 - Adjust dependencies from full to any version (checked: the androidx.car dependency does not have a dependency on any GMS libraries)
 - Move Automotive CarAppActivity + service + metadata to main manifest; not moved in app module because it is only used for Android Auto there
 - Adjust GitHub Actions to include minimal Automotive APK

* Cleanup duplicate Play Services coroutines dependency

* Cleanup duplicate <uses-feature> for camera

* Missed one GMS dependency
This commit is contained in:
Joris Pelgröm 2023-06-19 20:09:10 +02:00 committed by GitHub
parent b285c9525d
commit e8fae5dc50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 65 additions and 46 deletions

View file

@ -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:

View file

@ -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

View file

@ -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'**.

View file

@ -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")
@ -210,7 +209,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.

View file

@ -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")
}
}
@ -169,20 +189,18 @@ 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")
@ -190,7 +208,7 @@ dependencies {
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")
}

View file

@ -49,34 +49,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>

View file

@ -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"
@ -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>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"