mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-22 02:29:10 +00: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:
parent
e96450d226
commit
ef61f16896
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user