mirror of
https://github.com/ARM-software/devlib.git
synced 2025-04-17 07:10:03 +01:00
Merge pull request #189 from bjackman/master
AndroidTarget: Add boolean 'state' to airplane mode intent broadcast
This commit is contained in:
commit
0f2ac2589f
@ -1252,9 +1252,11 @@ class AndroidTarget(Target):
|
|||||||
root_required = self.get_sdk_version() > 23
|
root_required = self.get_sdk_version() > 23
|
||||||
if root_required and not self.is_rooted:
|
if root_required and not self.is_rooted:
|
||||||
raise TargetError('Root is required to toggle airplane mode on Android 7+')
|
raise TargetError('Root is required to toggle airplane mode on Android 7+')
|
||||||
|
mode = int(boolean(mode))
|
||||||
cmd = 'settings put global airplane_mode_on {}'
|
cmd = 'settings put global airplane_mode_on {}'
|
||||||
self.execute(cmd.format(int(boolean(mode))))
|
self.execute(cmd.format(mode))
|
||||||
self.execute('am broadcast -a android.intent.action.AIRPLANE_MODE', as_root=root_required)
|
self.execute('am broadcast -a android.intent.action.AIRPLANE_MODE '
|
||||||
|
'--ez state {}'.format(mode), as_root=root_required)
|
||||||
|
|
||||||
def get_auto_rotation(self):
|
def get_auto_rotation(self):
|
||||||
cmd = 'settings get system accelerometer_rotation'
|
cmd = 'settings get system accelerometer_rotation'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user