From 2b32853a25760858064728a90a07bc4c11b1d0a5 Mon Sep 17 00:00:00 2001 From: Adam Svoboda Date: Fri, 11 Sep 2020 13:56:53 +0200 Subject: [PATCH 1/3] fix package presence check --- android/alaunch | 4 ++-- common_tools | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/android/alaunch b/android/alaunch index 40aac9f0..34caa94a 100755 --- a/android/alaunch +++ b/android/alaunch @@ -5,8 +5,8 @@ android_choose_device if [[ "$1" == "-s" ]]; then PACKAGES=($(adb -s "$SELECTED_DEVICE" shell pm list packages -f | sed -e 's/.*=//' | sort)) elif [[ -n "$1" ]]; then - PACKAGE=$1 - adb -s "$SELECTED_DEVICE" shell pm list packages -f | sed -e 's/.*=//' | grep -wx "$PACKAGE" &> /dev/null || { echo "🤷‍ Package \"$PACKAGE\" not installed"; exit; } + PACKAGE="$1" + android_is_package_installed "$PACKAGE" else PACKAGES=($(adb -s "$SELECTED_DEVICE" shell pm list packages -f -3 | sed -e 's/.*=//' | sort)) fi diff --git a/common_tools b/common_tools index 545a0f42..e77c953e 100644 --- a/common_tools +++ b/common_tools @@ -161,7 +161,7 @@ android_is_package_installed() { EXIT_CODE=$? if [ $EXIT_CODE -ne 0 ]; then echo "🤷‍ Package \"$1\" is not installed." - exit + exit 1 fi } From 267b54b1fe484a9972776829fc789dc91dbc3594 Mon Sep 17 00:00:00 2001 From: Adam Svoboda Date: Fri, 11 Sep 2020 14:57:28 +0200 Subject: [PATCH 2/3] fix awipe on Android 11 --- android/arecord | 6 +++--- android/ascreenshot | 6 +++--- android/awipe | 5 ++++- common_tools | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/android/arecord b/android/arecord index 01453a28..05386a56 100755 --- a/android/arecord +++ b/android/arecord @@ -14,8 +14,8 @@ ctrlc(){ FILENAME=$1 fi echo "📁 Copying the video from the device..." - adb -s "$SELECTED_DEVICE" pull "$DEVICE_FILE_PATH" ~/Desktop/"$FILENAME".mp4 &> /dev/null - adb -s "$SELECTED_DEVICE" shell rm "$DEVICE_FILE_PATH" &> /dev/null + adb -s "$SELECTED_DEVICE" pull "$DEVICE_FILE_PATH"/output.mp4 ~/Desktop/"$FILENAME".mp4 &> /dev/null + adb -s "$SELECTED_DEVICE" shell rm "$DEVICE_FILE_PATH"/output.mp4 &> /dev/null echo "✅ Saved into ~/Desktop/$FILENAME.mp4" fi exit @@ -30,4 +30,4 @@ android_get_storage_location_per_SDK "$SDK" RECORDING=true echo "📹 Recording screen on $SELECTED_DEVICE, stop it with ctrl^c" adb -s "$SELECTED_DEVICE" shell settings put system show_touches 1 -adb -s "$SELECTED_DEVICE" shell screenrecord "$DEVICE_FILE_PATH" +adb -s "$SELECTED_DEVICE" shell screenrecord "$DEVICE_FILE_PATH"/output.mp4 diff --git a/android/ascreenshot b/android/ascreenshot index 1e68946c..673f1080 100755 --- a/android/ascreenshot +++ b/android/ascreenshot @@ -10,9 +10,9 @@ screenshot(){ android_get_storage_location_per_SDK "$SDK" echo "📸 Saving screenshot into $FILENAME..." - adb -s "$1" shell screencap -p "$DEVICE_FILE_PATH" - adb -s "$1" pull "$DEVICE_FILE_PATH" ~/Desktop/"$FILENAME" &>/dev/null - adb -s "$1" shell rm "$DEVICE_FILE_PATH" + adb -s "$1" shell screencap -p "$DEVICE_FILE_PATH"/output.png + adb -s "$1" pull "$DEVICE_FILE_PATH"/output.png ~/Desktop/"$FILENAME" &>/dev/null + adb -s "$1" shell rm "$DEVICE_FILE_PATH"/output.png } screenshot_all(){ diff --git a/android/awipe b/android/awipe index 577209df..177f4a18 100755 --- a/android/awipe +++ b/android/awipe @@ -14,8 +14,11 @@ prompt(){ } wipe_data(){ + android_device_info "$SELECTED_DEVICE" + android_get_storage_location_per_SDK "$SDK" + echo "🔥 Deleting everything in mnt/sdcard..." - adb -s "$SELECTED_DEVICE" shell rm -rf mnt/sdcard/* + adb -s "$SELECTED_DEVICE" shell rm -rf "$DEVICE_FILE_PATH/*" &>/dev/null } wipe_apps(){ diff --git a/common_tools b/common_tools index e77c953e..d05571c1 100644 --- a/common_tools +++ b/common_tools @@ -150,9 +150,9 @@ android_get_foreground_package_sdk_low(){ android_get_storage_location_per_SDK(){ if (( "$1" < 30 )); then - DEVICE_FILE_PATH="/mnt/sdcard/output.png" + DEVICE_FILE_PATH="/mnt/sdcard" else - DEVICE_FILE_PATH="/storage/self/primary/output.png" + DEVICE_FILE_PATH="/storage/self/primary" fi } From b77c857d64cdf865bc794094595bc9403c8fd24e Mon Sep 17 00:00:00 2001 From: Adam Svoboda Date: Fri, 11 Sep 2020 15:30:45 +0200 Subject: [PATCH 3/3] update changelog --- changelog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index ab31ab94..14f437a3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1 +1,2 @@ - 🩹 fix Android 11 - arecord, ascreenshot, akill, aerase + 🩹 fix alaunch installed package detection + 🩹 fix awipe on Android 11 \ No newline at end of file