OLD | NEW |
1 # Copyright 2016 Google Inc. | 1 # Copyright 2016 Google Inc. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 from __future__ import print_function | 6 from __future__ import print_function |
7 from _hardware import Hardware | 7 from _hardware import Hardware |
8 import sys | 8 import sys |
9 import time | 9 import time |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 # restore ASLR. | 68 # restore ASLR. |
69 self._adb.shell('echo %s > /proc/sys/kernel/randomize_va_space' % | 69 self._adb.shell('echo %s > /proc/sys/kernel/randomize_va_space' % |
70 self._initial_ASLR) | 70 self._initial_ASLR) |
71 | 71 |
72 # revive the gui. | 72 # revive the gui. |
73 self._adb.shell('''\ | 73 self._adb.shell('''\ |
74 setprop ctl.start drm && | 74 setprop ctl.start drm && |
75 setprop ctl.start surfaceflinger && | 75 setprop ctl.start surfaceflinger && |
76 setprop ctl.start zygote && | 76 setprop ctl.start zygote && |
77 setprop ctl.start media''') | 77 setprop ctl.start media''') |
| 78 else: |
| 79 # restore GPS (doesn't seem to work if we killed the gui). |
| 80 self._adb.shell('''\ |
| 81 for PROVIDER in %s; do |
| 82 settings put secure location_providers_allowed +$PROVIDER |
| 83 done''' % self._initial_location_providers) |
78 | 84 |
79 # restore GPS (doesn't seem to work if we killed the gui). | 85 # restore airplane mode (doesn't seem to work if we killed the gui). |
80 self._adb.shell('''\ | 86 self._adb.shell('settings put global airplane_mode_on %s' % |
81 for PROVIDER in %s; do | 87 self._initial_airplane_mode) |
82 settings put secure location_providers_allowed +$PROVIDER | |
83 done''' % self._initial_location_providers) | |
84 | |
85 # restore airplane mode (doesn't seem to work if we killed the gui). | |
86 self._adb.shell('settings put global airplane_mode_on %s' % | |
87 self._initial_airplane_mode) | |
88 | 88 |
89 def sanity_check(self): | 89 def sanity_check(self): |
90 Hardware.sanity_check(self) | 90 Hardware.sanity_check(self) |
91 | 91 |
92 def print_debug_diagnostics(self): | 92 def print_debug_diagnostics(self): |
93 # search for and print thermal trip points that may have been exceeded. | 93 # search for and print thermal trip points that may have been exceeded. |
94 self._adb.shell('''\ | 94 self._adb.shell('''\ |
95 THERMALDIR=/sys/class/thermal | 95 THERMALDIR=/sys/class/thermal |
96 if [ -e $THERMALDIR ]; then | 96 if [ ! -d $THERMALDIR ]; then |
97 for ZONE in $(cd $THERMALDIR; echo thermal_zone*); do | 97 exit |
98 cd $THERMALDIR/$ZONE | 98 fi |
99 if [ -e mode ] && grep -Fxq enabled mode; then | 99 for ZONE in $(cd $THERMALDIR; echo thermal_zone*); do |
100 TEMP=$(cat temp) | 100 cd $THERMALDIR/$ZONE |
101 TRIPPOINT= | 101 if [ ! -e mode ] || grep -Fxqv enabled mode || [ ! -e trip_point_0_temp
]; then |
102 let i=0 | 102 continue |
103 while [ -e trip_point_${i}_temp ] && | 103 fi |
104 [ $TEMP -gt $(cat trip_point_${i}_temp) ]; do | 104 TEMP=$(cat temp) |
105 TRIPPOINT=trip_point_${i}_temp | 105 TRIPPOINT=trip_point_0_temp |
106 let i=i+1 | 106 if [ $TEMP -le $(cat $TRIPPOINT) ]; then |
107 done | 107 echo "$ZONE ($(cat type)): temp=$TEMP <= $TRIPPOINT=$(cat $TRIPPOINT)"
1>&2 |
108 if [ $TRIPPOINT ]; then | 108 else |
109 echo "$ZONE ($(cat type)): temp=$TEMP > $TRIPPOINT=$(cat $TRIPPOIN
T)" | 109 let i=1 |
110 fi | 110 while [ -e trip_point_${i}_temp ] && |
111 fi | 111 [ $TEMP -gt $(cat trip_point_${i}_temp) ]; do |
112 done | 112 TRIPPOINT=trip_point_${i}_temp |
113 fi''') | 113 let i=i+1 |
| 114 done |
| 115 echo "$ZONE ($(cat type)): temp=$TEMP > $TRIPPOINT=$(cat $TRIPPOINT)"
1>&2 |
| 116 fi |
| 117 done''') |
114 | 118 |
115 Hardware.print_debug_diagnostics(self) | 119 Hardware.print_debug_diagnostics(self) |
116 | 120 |
117 def sleep(self, sleeptime): | 121 def sleep(self, sleeptime): |
118 Hardware.sleep(self, sleeptime) | 122 Hardware.sleep(self, sleeptime) |
OLD | NEW |