def __exit__(self, exception_type, exception_value, traceback):
    Hardware.__exit__(self, exception_type, exception_value, traceback)

    if self._adb.is_root():
      self._adb.shell('\n'.join([
        # restore ASLR.
        '''
        echo %s > /proc/sys/kernel/randomize_va_space''' % self._initial_ASLR,

        # revive the gui.
        '''
        setprop ctl.start drm
        setprop ctl.start surfaceflinger
        setprop ctl.start zygote
        setprop ctl.start media''']))
Пример #2
0
  def __exit__(self, exception_type, exception_value, traceback):
    Hardware.__exit__(self, exception_type, exception_value, traceback)

    if self._is_root:
      # restore ASLR.
      self._adb.shell('echo %s > /proc/sys/kernel/randomize_va_space' %
                      self._initial_ASLR)

      # revive the gui.
      self._adb.shell('''\
        setprop ctl.start drm &&
        setprop ctl.start surfaceflinger &&
        setprop ctl.start zygote &&
        setprop ctl.start media''')
    else:
      # restore GPS (doesn't seem to work if we killed the gui).
      self._adb.shell('''\
        for PROVIDER in %s; do
          settings put secure location_providers_allowed +$PROVIDER
        done''' % self._initial_location_providers)

      # restore airplane mode (doesn't seem to work if we killed the gui).
      self._adb.shell('settings put global airplane_mode_on %s' %
                      self._initial_airplane_mode)
 def __exit__(self, exception_type, exception_value, traceback):
     Hardware.__exit__(self, exception_type, exception_value, traceback)
     self._adb.reboot(
     )  # some devices struggle waking up; just hard reboot.
 def __exit__(self, exception_type, exception_value, traceback):
   Hardware.__exit__(self, exception_type, exception_value, traceback)
   self._adb.reboot() # some devices struggle waking up; just hard reboot.