Nicolas Geoffray | d2d62d1 | 2015-03-18 11:23:56 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2015 The Android Open Source Project |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | green='\033[0;32m' |
| 18 | nc='\033[0m' |
| 19 | |
| 20 | echo -e "${green}Date on device${nc}" |
| 21 | adb shell date |
| 22 | |
| 23 | echo -e "${green}Turn off selinux${nc}" |
| 24 | adb shell setenforce 0 |
| 25 | adb shell getenforce |
| 26 | |
Nicolas Geoffray | 0a38a0e | 2015-03-25 17:22:34 +0000 | [diff] [blame] | 27 | echo -e "${green}Setting local loopback${nc}" |
| 28 | adb shell ifconfig lo up |
| 29 | adb shell ifconfig |
| 30 | |
Nicolas Geoffray | d2d62d1 | 2015-03-18 11:23:56 +0000 | [diff] [blame] | 31 | echo -e "${green}List properties${nc}" |
| 32 | adb shell getprop |
Nicolas Geoffray | b8703d6 | 2015-10-30 11:18:52 +0000 | [diff] [blame] | 33 | |
| 34 | echo -e "${green}Uptime${nc}" |
| 35 | adb shell uptime |
| 36 | |
Nicolas Geoffray | 7ea5747 | 2016-02-24 09:53:09 +0000 | [diff] [blame] | 37 | echo -e "${green}Battery info${nc}" |
| 38 | adb shell dumpsys battery |
| 39 | |
Nicolas Geoffray | 80d9c85 | 2016-03-04 15:28:35 +0000 | [diff] [blame] | 40 | echo -e "${green}Setting adb buffer size to 32MB${nc}" |
| 41 | adb logcat -G 32M |
| 42 | adb logcat -g |
| 43 | |
| 44 | echo -e "${green}Removing adb spam filter${nc}" |
| 45 | adb logcat -P "" |
| 46 | adb logcat -p |
| 47 | |
Nicolas Geoffray | b8703d6 | 2015-10-30 11:18:52 +0000 | [diff] [blame] | 48 | echo -e "${green}Kill stalled dalvikvm processes${nc}" |
Nicolas Geoffray | fe6f0b6 | 2016-03-07 13:33:37 +0000 | [diff] [blame] | 49 | # 'ps' on M can sometimes hang. |
| 50 | timeout 2s adb shell "ps" |
| 51 | if [ $? = 124 ]; then |
| 52 | echo -e "${green}Rebooting device to fix 'ps'${nc}" |
| 53 | adb reboot |
| 54 | adb wait-for-device root |
| 55 | else |
| 56 | processes=$(adb shell "ps" | grep dalvikvm | awk '{print $2}') |
| 57 | for i in $processes; do adb shell kill -9 $i; done |
| 58 | fi |