2023-09-10 04:25:36 +02:00
|
|
|
#!/usr/bin/env bash
|
2023-03-02 18:33:29 +01:00
|
|
|
#
|
|
|
|
# SPDX-FileCopyrightText: 2023 The Calyx Institute
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
#
|
2023-09-10 04:25:36 +02:00
|
|
|
|
|
|
|
# assert ANDROID_HOME is set
|
2023-09-22 06:12:53 +02:00
|
|
|
if [ -z "$ANDROID_HOME" ]; then
|
|
|
|
echo "ANDROID_HOME is not set"
|
2023-09-10 04:25:36 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
|
|
|
ROOT_PROJECT_DIR=$SCRIPT_DIR/../../..
|
|
|
|
|
2024-05-31 21:53:26 +02:00
|
|
|
EMULATOR_DEVICE_NAME=$("$ANDROID_HOME"/platform-tools/adb devices | grep emulator | cut -f1)
|
2023-09-10 04:25:36 +02:00
|
|
|
|
|
|
|
if [ -z "$EMULATOR_DEVICE_NAME" ]; then
|
|
|
|
echo "Emulator device name not found"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-09-22 06:12:53 +02:00
|
|
|
ADB="$ANDROID_HOME/platform-tools/adb -s $EMULATOR_DEVICE_NAME"
|
2023-09-10 04:25:36 +02:00
|
|
|
|
|
|
|
$ADB root
|
|
|
|
sleep 3 # wait for adb to restart
|
|
|
|
$ADB remount # remount /system as writable
|
|
|
|
|
|
|
|
echo "Installing Seedvault app..."
|
|
|
|
$ADB shell mkdir -p /system/priv-app/Seedvault
|
2024-05-31 21:53:26 +02:00
|
|
|
$ADB push "$ROOT_PROJECT_DIR"/app/build/outputs/apk/release/app-release.apk /system/priv-app/Seedvault/Seedvault.apk
|
2023-09-10 04:25:36 +02:00
|
|
|
|
|
|
|
echo "Installing Seedvault permissions..."
|
2024-05-31 21:53:26 +02:00
|
|
|
$ADB push "$ROOT_PROJECT_DIR"/permissions_com.stevesoltys.seedvault.xml /system/etc/permissions/privapp-permissions-seedvault.xml
|
|
|
|
$ADB push "$ROOT_PROJECT_DIR"/allowlist_com.stevesoltys.seedvault.xml /system/etc/sysconfig/allowlist-seedvault.xml
|
2024-01-27 22:27:59 +01:00
|
|
|
$ADB shell am broadcast -a android.intent.action.BOOT_COMPLETED
|