diff options
author | Brendan Jackman <brendan.jackman@arm.com> | 2017-10-11 13:09:15 +0100 |
---|---|---|
committer | Brendan Jackman <brendan.jackman@arm.com> | 2017-10-11 13:22:37 +0100 |
commit | 0bfb6e4e544e1221220a77c19f83cca7de9dfca2 (patch) | |
tree | b833dd2478d79a6ce6217eb19ef653ebf0a5813b | |
parent | dc453ad8916cfb914c9dafaad8b0b440d3a4b443 (diff) | |
download | devlib-0bfb6e4e544e1221220a77c19f83cca7de9dfca2.tar.gz |
AndroidTarget: Add boolean 'state' to airplane mode intent broadcast
Recently I've been seeing some errors with enabling airplane mode on
hikey960 - firstly I get a 'broken pipe' error followed by a 'cmd:
Can't find service: settings'. This missing boolean was the first
thing I found that had changed wrt. the code I used to use, and
adding it back appears to fix the issue.
-rw-r--r-- | devlib/target.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/devlib/target.py b/devlib/target.py index b2cfd2f..6132f2b 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -1252,9 +1252,11 @@ class AndroidTarget(Target): root_required = self.get_sdk_version() > 23 if root_required and not self.is_rooted: raise TargetError('Root is required to toggle airplane mode on Android 7+') + mode = int(boolean(mode)) cmd = 'settings put global airplane_mode_on {}' - self.execute(cmd.format(int(boolean(mode)))) - self.execute('am broadcast -a android.intent.action.AIRPLANE_MODE', as_root=root_required) + self.execute(cmd.format(mode)) + self.execute('am broadcast -a android.intent.action.AIRPLANE_MODE ' + '--ez state {}'.format(mode), as_root=root_required) def get_auto_rotation(self): cmd = 'settings get system accelerometer_rotation' |