1#!/usr/bin/bash
2
3# Builds, installs, then runs a small test binary on an Android device that is
4# attached to your workstation. This tool checks to see if the KeyMint
5# instances on this device have been registered with the RKP backend.
6#
7# Run the script by passing the desired lunch target on the command-line:
8# ./packages/modules/RemoteKeyProvisioning/util/RkpRegistrationCheck.sh <aosp_arm64-userdebug>
9
10if [ -z "$1" ]; then
11  echo "Lunch target must be specified"
12  exit 1
13fi
14
15. build/envsetup.sh
16lunch $1
17m RkpRegistrationCheck
18
19adb push $ANDROID_PRODUCT_OUT/system/framework/RkpRegistrationCheck.jar \
20  /data/local/tmp
21
22adb shell "CLASSPATH=/data/local/tmp/RkpRegistrationCheck.jar \
23  exec app_process /system/bin com.android.rkpdapp.RkpRegistrationCheck"
24
25adb shell "rm /data/local/tmp/RkpRegistrationCheck.jar"
26