#! /bin/bash
adbDevices=`adb devices | awk '{print $1}'`
echo "$adbDevices"
echo "--------------start------------"
str1="List"
loss="0% packet loss"
settings="settings"
for line in $(echo -e $adbDevices);do
if [ "$str1" == "$line" ]; then
continue
else
echo $line
pingResult=`adb -s $line shell ping -c 2 www.baidu.com`
if [[ $pingResult == *"$loss"* ]]; then
echo "ping success!"
else
echo "ping failed!"
fi
adb -s $line shell am force-stop com.android.settings
sleep 2
adb -s $line shell am start -a android.settings.SETTINGS
sleep 2
adb -s $line shell screencap -p /storage/emulated/0/"$line"_setting.png
adb -s $line shell am force-stop com.android.settings
adb -s $line pull /storage/emulated/0/"$line"_setting.png /tmp
chown deveco:deveco /tmp/"$line"_setting.png
adb -s $line shell rm /storage/emulated/0/"$line"_setting.png
stopResult=`adb -s $line shell ps -ef | grep settings`
if [[ $stopResult == *"$settings"* ]]; then
echo "stop setting failed!"
else
echo "stop setting success!"
fi
fi
done
echo "---------------end--------------"