Install contactsbackup before restart, so default permissions get applied

Also add testkey for signed builds
This commit is contained in:
Torsten Grote 2024-09-27 13:42:38 -03:00
parent 910c68aa52
commit 9e5f22a8a0
No known key found for this signature in database
GPG key ID: 3E5F77D92CF891FF
3 changed files with 18 additions and 20 deletions

View file

@ -31,7 +31,7 @@ instrumentation_tests_task:
adb remount; adb remount;
sleep 5; sleep 5;
assemble_script: assemble_script:
./gradlew :app:assembleRelease :app:assembleAndroidTest ./gradlew :app:assembleRelease :contacts:assembleRelease assembleAndroidTest
install_app_script: install_app_script:
timeout 180s bash -c 'while [[ -z $(adb shell mount | grep "/system " | grep "(rw,") ]]; do sleep 1; done;'; timeout 180s bash -c 'while [[ -z $(adb shell mount | grep "/system " | grep "(rw,") ]]; do sleep 1; done;';
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;'; adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;';
@ -44,7 +44,11 @@ instrumentation_tests_task:
adb push app/build/outputs/apk/release/app-release.apk /system/priv-app/Seedvault/Seedvault.apk; adb push app/build/outputs/apk/release/app-release.apk /system/priv-app/Seedvault/Seedvault.apk;
adb push permissions_com.stevesoltys.seedvault.xml /system/etc/permissions/privapp-permissions-seedvault.xml; adb push permissions_com.stevesoltys.seedvault.xml /system/etc/permissions/privapp-permissions-seedvault.xml;
adb push allowlist_com.stevesoltys.seedvault.xml /system/etc/sysconfig/allowlist-seedvault.xml; adb push allowlist_com.stevesoltys.seedvault.xml /system/etc/sysconfig/allowlist-seedvault.xml;
adb shell mkdir -p /system/priv-app/ContactsBackup;
adb push contactsbackup/build/outputs/apk/release/contactsbackup-release.apk /system/priv-app/ContactsBackup/contactsbackup.apk;
adb push contactsbackup/default-permissions_org.calyxos.backup.contacts.xml /system/etc/default-permissions/default-permissions_org.calyxos.backup.contacts.xml; adb push contactsbackup/default-permissions_org.calyxos.backup.contacts.xml /system/etc/default-permissions/default-permissions_org.calyxos.backup.contacts.xml;
adb shell bmgr enable true; adb shell bmgr enable true;
adb reboot; adb reboot;
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;'; adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;';

View file

@ -2,8 +2,6 @@
* SPDX-FileCopyrightText: 2020 The Calyx Institute * SPDX-FileCopyrightText: 2020 The Calyx Institute
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import java.io.FileInputStream
import java.util.Properties
plugins { plugins {
alias(libs.plugins.android.application) alias(libs.plugins.android.application)
@ -42,23 +40,18 @@ android {
isReturnDefaultValues = true isReturnDefaultValues = true
} }
// optional signingConfigs
// On userdebug builds, you can use the testkey here to update the system app
val keystorePropertiesFile = project.file("keystore.properties")
if (keystorePropertiesFile.exists()) {
val keystoreProperties = Properties()
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
signingConfigs { signingConfigs {
create("release") { create("aosp") {
keyAlias = keystoreProperties["keyAlias"] as String keyAlias = "android"
keyPassword = keystoreProperties["keyPassword"] as String keyPassword = "android"
storeFile = file(keystoreProperties["storeFile"] as String) storePassword = "android"
storePassword = keystoreProperties["storePassword"] as String storeFile = file("testkey.jks")
} }
} }
buildTypes.getByName("release").signingConfig = signingConfigs.getByName("release")
buildTypes.getByName("debug").signingConfig = signingConfigs.getByName("release") buildTypes {
getByName("release").signingConfig = signingConfigs.getByName("aosp")
getByName("debug").signingConfig = signingConfigs.getByName("aosp")
} }
} }
@ -74,6 +67,7 @@ dependencies {
androidTestImplementation(libs.kotlin.stdlib.jdk8) androidTestImplementation(libs.kotlin.stdlib.jdk8)
androidTestImplementation("androidx.test.ext:junit:1.1.5") androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation( androidTestImplementation(
"androidx.test.espresso:espresso-core:${libs.versions.espresso.get()}") "androidx.test.espresso:espresso-core:${libs.versions.espresso.get()}"
)
androidTestImplementation("io.mockk:mockk-android:${libs.versions.mockk.get()}") androidTestImplementation("io.mockk:mockk-android:${libs.versions.mockk.get()}")
} }

BIN
contactsbackup/testkey.jks Normal file

Binary file not shown.