Skip to content

Commit

Permalink
Install contactsbackup before restart, so default permissions get app…
Browse files Browse the repository at this point in the history
…lied

Also add testkey for signed builds
  • Loading branch information
grote committed Oct 17, 2024
1 parent 910c68a commit 9e5f22a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
6 changes: 5 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ instrumentation_tests_task:
adb remount;
sleep 5;
assemble_script:
./gradlew :app:assembleRelease :app:assembleAndroidTest
./gradlew :app:assembleRelease :contacts:assembleRelease assembleAndroidTest
install_app_script:
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;';
Expand All @@ -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 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 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 shell bmgr enable true;
adb reboot;
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;';
Expand Down
32 changes: 13 additions & 19 deletions contactsbackup/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
* SPDX-FileCopyrightText: 2020 The Calyx Institute
* SPDX-License-Identifier: Apache-2.0
*/
import java.io.FileInputStream
import java.util.Properties

plugins {
alias(libs.plugins.android.application)
Expand Down Expand Up @@ -42,23 +40,18 @@ android {
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 {
create("release") {
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = file(keystoreProperties["storeFile"] as String)
storePassword = keystoreProperties["storePassword"] as String
}
signingConfigs {
create("aosp") {
keyAlias = "android"
keyPassword = "android"
storePassword = "android"
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")
}
}

Expand All @@ -74,6 +67,7 @@ dependencies {
androidTestImplementation(libs.kotlin.stdlib.jdk8)
androidTestImplementation("androidx.test.ext:junit:1.1.5")
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()}")
}
Binary file added contactsbackup/testkey.jks
Binary file not shown.

0 comments on commit 9e5f22a

Please sign in to comment.