Skip to content

Instantly share code, notes, and snippets.

@blundell
Last active April 22, 2022 17:23
Show Gist options
  • Save blundell/7c0c3bb17898b28fe8122b0dc230af50 to your computer and use it in GitHub Desktop.
Save blundell/7c0c3bb17898b28fe8122b0dc230af50 to your computer and use it in GitHub Desktop.

Revisions

  1. blundell revised this gist Apr 18, 2018. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions clear-android-things-apps.sh
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,9 @@ endspin() {
    printf "\r"
    }

    echo "Uninstalling IOT_LAUNCHER category apps"
    echo "Uninstalling Android Things category apps"
    # This script is for > DP8
    # for < DP8 you need to replace android.intent.category.HOME with android.intent.category.IOT_LAUNCHER on line 25

    spin

    @@ -20,7 +22,7 @@ for userPackage in "${userInstalledPackages[@]}"
    do
    :
    spin
    categoryLauncherText=$( adb shell pm dump $userPackage | grep "android.intent.category.IOT_LAUNCHER")
    categoryLauncherText=$( adb shell pm dump $userPackage | grep "android.intent.category.HOME")
    if [ -n "${categoryLauncherText}" ]; then
    iotPackages+=(${userPackage})
    fi
  2. blundell created this gist Jan 4, 2017.
    37 changes: 37 additions & 0 deletions clear-android-things-apps.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    #!/bin/bash
    sp="/-\|"
    sc=0
    spin() {
    printf "\b${sp:sc++:1}"
    ((sc==${#sp})) && sc=0
    }
    endspin() {
    printf "\r"
    }

    echo "Uninstalling IOT_LAUNCHER category apps"

    spin

    userInstalledPackages=( $(adb shell pm list packages -3 | sed -e "s/^"package:"//" ) )

    iotPackages=()
    for userPackage in "${userInstalledPackages[@]}"
    do
    :
    spin
    categoryLauncherText=$( adb shell pm dump $userPackage | grep "android.intent.category.IOT_LAUNCHER")
    if [ -n "${categoryLauncherText}" ]; then
    iotPackages+=(${userPackage})
    fi
    done
    endspin

    for iotPackage in "${iotPackages[@]}"
    do
    :
    echo "Uninstalling $iotPackage"
    adb uninstall $iotPackage
    done

    echo "Complete"