Enable the terminal app activity without hard-coding its name

Bug: 377170371
Test: watch TH
Change-Id: I526b77cca264d07958ec140dbe0afd022b1a7254
diff --git a/tests/Terminal/TerminalAppTests-preparer.sh b/tests/Terminal/TerminalAppTests-preparer.sh
index de25af3..6022d7d 100644
--- a/tests/Terminal/TerminalAppTests-preparer.sh
+++ b/tests/Terminal/TerminalAppTests-preparer.sh
@@ -17,6 +17,11 @@
 set -e
 
 serial=${ANDROID_SERIAL}
+user=$(adb -s ${serial} shell am get-current-user)
+
+# Enable the terminal app
+package_name=$(adb -s ${serial} shell pm list package virtualization.terminal | cut -d ':' -f 2)
+adb -s ${serial} shell pm enable --user ${user} ${package_name}
 
 # Identify file to download
 arch=$(adb -s ${serial} shell getprop ro.bionic.arch)
@@ -31,7 +36,6 @@
 wget ${src} -O ${downloaded}
 
 # Push the file to the device
-user=$(adb -s ${serial} shell am get-current-user)
 dst=/data/media/${user}/linux
 adb -s ${serial} shell mkdir -p ${dst}
 adb -s ${serial} push ${downloaded} ${dst}/images.tar.gz