#!/system/bin/sh

# 定义目标应用包名和启动活动
PACKAGE_NAME="com.tencent.iglite"
ACTIVITY_NAME="com.epicgames.ue4.SplashActivity"

# 确定注入的共享库路径
INJECT_SO_PATH="$(pwd)/inject.so"
LIBHUALUO_PATH="$(pwd)/libhualuo.so"
INJECT_ARM_PATH="$(pwd)/Inject_arm"

# 检查 inject.so 和 libhualuo.so 是否是 32 位版本

# 将 32 位文件复制到目标路径
path=`pm path $PACKAGE_NAME | sed -E 's/(.*):(.*)/\2/'| sed -E 's/(.*)base.apk/\1/'`
cp -f "$INJECT_ARM_PATH" $path"Inject_arm"
chmod 777 $path"Inject_arm"

cp -f "$LIBHUALUO_PATH" $path"libhualuo.so"
chmod 777 $path"libhualuo.so"

# 启动目标应用
am start -n $PACKAGE_NAME/$ACTIVITY_NAME
sleep 4.5

# 注入共享库
$path"Inject_arm" --pname $PACKAGE_NAME --libpath $path"libhualuo.so"

echo "$PACKAGE_NAME 应用正在运行！"