-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathstart_agent.sh
More file actions
executable file
·40 lines (34 loc) · 1.15 KB
/
start_agent.sh
File metadata and controls
executable file
·40 lines (34 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e
# This script launches the Agent app using Instrumentation
# to acquire privileged permissions via Shell identity.
# Package and instrumentation details
PACKAGE_NAME="dev.filipfan.appfunctionspilot.agent"
INSTRUMENTATION_NAME="${PACKAGE_NAME}/.ShellIdentityInstrumentation"
usage() {
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " -h, --help Show this help message"
echo ""
echo "Description:"
echo " Launches the Agent app with EXECUTE_APP_FUNCTIONS permission"
echo " using ShellIdentityInstrumentation."
}
while [[ "$#" -gt 0 ]]; do
case $1 in
-h|--help) usage; exit 0 ;;
*) echo "Unknown parameter: $1"; usage; exit 1 ;;
esac
shift
done
echo "🔍 Verifying Agent app installation..."
if ! adb shell pm list packages | grep -q "$PACKAGE_NAME"; then
echo "❌ Package $PACKAGE_NAME is not installed."
echo "Please install the Agent app first."
exit 1
fi
echo "🛑 Stopping any existing Agent instances..."
adb shell am force-stop "$PACKAGE_NAME"
echo "🚀 Starting Agent via ShellIdentityInstrumentation..."
adb shell am instrument -w "$INSTRUMENTATION_NAME"