1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 10:51:13 +01:00

AndroidDevice: Fixed screen lock disable

Due to the previous commits, this command no longer works properly.

It turns out there is an issue with using multiple levels of escaping.
It seems that bash handles the backslashes and single quotes separately
incorrectly processing our escaping. To get around this we are writing the
sqlite command to a shell script file and running that.

This seems to be the only case in WA at the moment that requires this,
if more show up/when WA moves to devlib it should use the devlib shutil
mechanism.
This commit is contained in:
Sebastian Goscik 2016-05-06 13:18:32 +01:00
parent e96450d226
commit ef61f16896
2 changed files with 9 additions and 11 deletions

View File

@ -637,7 +637,15 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223
"""
lockdb = '/data/system/locksettings.db'
sqlcommand = "update locksettings set value='0' where name='screenlock.disabled';"
self.execute('{} {} "{}"'.format(self.sqlite, lockdb, sqlcommand), as_root=True)
f = tempfile.NamedTemporaryFile()
try:
f.write('{} {} "{}"'.format(self.sqlite, lockdb, sqlcommand))
f.flush()
on_device_executable = self.install_executable(f.name,
with_name="disable_screen_lock")
finally:
f.close()
self.execute(on_device_executable, as_root=True)
def disable_selinux(self):
# This may be invoked from intialize() so we can't use execute() or the

View File

@ -199,16 +199,6 @@ class Gem5AndroidDevice(BaseGem5Device, AndroidDevice):
props = self._get_android_properties(context)
return props
def disable_screen_lock(self):
"""
Attempts to disable he screen lock on the device.
Overridden here as otherwise we have issues with too many backslashes.
"""
lockdb = '/data/system/locksettings.db'
sqlcommand = "update locksettings set value=\'0\' where name=\'screenlock.disabled\';"
self.execute('{} {} "{}"'.format(self.sqlite, lockdb, sqlcommand), as_root=True)
def capture_screen(self, filepath):
if BaseGem5Device.capture_screen(self, filepath):
return