1set -e
2
3if [ $# -ne 1 ]; then
4  echo "Usage: $0 PACKAGE"
5  echo "  PACKAGE - Package name of the app"
6  exit 1
7fi
8
9PACKAGE=$1
10
11LONG_ABI=`adb shell getprop ro.product.cpu.abi`
12if [[ $LONG_ABI == "arm64"* ]]; then
13  ABI="arm64"
14else
15  ABI="arm"
16fi
17
18echo "Checking for unverified classes in package = $PACKAGE, ABI $ABI"
19
20echo -e "\nCurrent compilation: (if not \"verify\" this will be slow)"
21CURRENT_COMPILATION=`adb shell dumpsys package $PACKAGE | grep "$ABI:"`
22echo "    $CURRENT_COMPILATION"
23
24APPDIR=`adb shell pm path $PACKAGE | sed 's/^package:\(.*\)\/base\.apk$/\1/'`
25
26DUMP_CMD="adb shell oatdump --oat-file=$APPDIR/oat/$ABI/base.odex --output=/data/local/tmp/oatdump.txt"
27echo -e "\nDumping oat file with\n$DUMP_CMD"
28
29`time $DUMP_CMD`
30
31OUTFILE=$PACKAGE-oat.txt
32
33echo -e "\nPulling oat file to $OUTFILE"
34adb pull /data/local/tmp/oatdump.txt $OUTFILE
35
36echo -e "\nPrinting unverified classes:"
37# print unverified classes, skipping test libraries that aren't expected to ship in release builds
38cat $OUTFILE | grep "will be verified" \
39  | grep -v Ljunit \
40  | grep -v Lorg\/hamcrest \
41  | grep -v Lcom\/google\/common\/truth \
42