| OLD | NEW |
| 1 # coding=utf-8 | 1 # coding=utf-8 |
| 2 # Copyright 2015 Google Inc. All rights reserved. | 2 # Copyright 2015 Google Inc. All rights reserved. |
| 3 # | 3 # |
| 4 # Licensed under the Apache License, Version 2.0 (the "License"); | 4 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 # you may not use this file except in compliance with the License. | 5 # you may not use this file except in compliance with the License. |
| 6 # You may obtain a copy of the License at | 6 # You may obtain a copy of the License at |
| 7 # | 7 # |
| 8 # http://www.apache.org/licenses/LICENSE-2.0 | 8 # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 # | 9 # |
| 10 # Unless required by applicable law or agreed to in writing, software | 10 # Unless required by applicable law or agreed to in writing, software |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 continue | 137 continue |
| 138 key, value = line.split(u'=', 1) | 138 key, value = line.split(u'=', 1) |
| 139 properties[key] = value | 139 properties[key] = value |
| 140 | 140 |
| 141 mode, _, _ = device.Stat('/system/xbin/su') | 141 mode, _, _ = device.Stat('/system/xbin/su') |
| 142 has_su = bool(mode) | 142 has_su = bool(mode) |
| 143 # Stat'ing /system/xbin/su directly from adbd outside of a shell can fail | 143 # Stat'ing /system/xbin/su directly from adbd outside of a shell can fail |
| 144 # due to SELinux permission errors. Try again by executing su via shell. | 144 # due to SELinux permission errors. Try again by executing su via shell. |
| 145 if not has_su: | 145 if not has_su: |
| 146 out, exit_code = device.Shell('/system/xbin/su root whoami') | 146 out, exit_code = device.Shell('/system/xbin/su root whoami') |
| 147 if not exit_code and out.strip() == 'root': | 147 if not exit_code and out and out.strip() == 'root': |
| 148 has_su = True | 148 has_su = True |
| 149 | 149 |
| 150 available_governors = KNOWN_CPU_SCALING_GOVERNOR_VALUES | 150 available_governors = KNOWN_CPU_SCALING_GOVERNOR_VALUES |
| 151 out = device.PullContent( | 151 out = device.PullContent( |
| 152 '/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors') | 152 '/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors') |
| 153 if out: | 153 if out: |
| 154 available_governors = sorted(i for i in out.split()) | 154 available_governors = sorted(i for i in out.split()) |
| 155 assert set(available_governors).intersection( | 155 assert set(available_governors).intersection( |
| 156 KNOWN_CPU_SCALING_GOVERNOR_VALUES), available_governors | 156 KNOWN_CPU_SCALING_GOVERNOR_VALUES), available_governors |
| 157 | 157 |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 return out | 1002 return out |
| 1003 | 1003 |
| 1004 @classmethod | 1004 @classmethod |
| 1005 def _Connect(cls, constructor, **kwargs): | 1005 def _Connect(cls, constructor, **kwargs): |
| 1006 """Called by either ConnectDevice or Connect.""" | 1006 """Called by either ConnectDevice or Connect.""" |
| 1007 if not kwargs.get('rsa_keys'): | 1007 if not kwargs.get('rsa_keys'): |
| 1008 with _ADB_KEYS_LOCK: | 1008 with _ADB_KEYS_LOCK: |
| 1009 kwargs['rsa_keys'] = _ADB_KEYS[:] | 1009 kwargs['rsa_keys'] = _ADB_KEYS[:] |
| 1010 device = constructor(**kwargs) | 1010 device = constructor(**kwargs) |
| 1011 return HighDevice(device, _InitCache(device)) | 1011 return HighDevice(device, _InitCache(device)) |
| OLD | NEW |