Restarts adbd as root. .. doctest:: :skipif: skip_android >>> adb.root()
()
| 148 | |
| 149 | @with_device |
| 150 | def root(): |
| 151 | """Restarts adbd as root. |
| 152 | |
| 153 | .. doctest:: |
| 154 | :skipif: skip_android |
| 155 | |
| 156 | >>> adb.root() |
| 157 | """ |
| 158 | log.info("Enabling root on %s" % context.device) |
| 159 | |
| 160 | with context.quiet: |
| 161 | with AdbClient() as c: |
| 162 | reply = c.root() |
| 163 | |
| 164 | if 'already running as root' in reply: |
| 165 | return |
| 166 | |
| 167 | elif not reply or 'restarting adbd as root' in reply: |
| 168 | with context.quiet: |
| 169 | wait_for_device() |
| 170 | |
| 171 | else: |
| 172 | log.error("Could not run as root:\n%s" % reply) |
| 173 | |
| 174 | def no_emulator(f): |
| 175 | @functools.wraps(f) |
no test coverage detected