1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-20 11:58:55 +00:00

AndroidDevice: Add as_root flag to broadcast_media_mounted

Allows the `MEDIA_MOUNTED` broadcast to be performed as root as
this now requires elevated permission in android N.
This commit is contained in:
Marc Bonnici 2017-05-05 11:00:40 +01:00
parent f5b40e3d64
commit e866cfed12

View File

@ -716,12 +716,13 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223
except KeyError:
return None
def broadcast_media_mounted(self, dirpath):
def broadcast_media_mounted(self, dirpath, as_root=False):
"""
Force a re-index of the mediaserver cache for the specified directory.
"""
command = 'am broadcast -a android.intent.action.MEDIA_MOUNTED -d file://'
self.execute(command + dirpath)
command = 'am broadcast -a android.intent.action.MEDIA_MOUNTED -d file://'
self.execute(command + dirpath, as_root=as_root)
# Internal methods: do not use outside of the class.