Closed Bug 1504154 Opened 6 years ago Closed 6 years ago

Port mozrunner.grant_runtime_permissions to mozdevice.ADBAndroid

Categories

(Testing :: Mozbase, enhancement)

enhancement
Not set
normal

Tracking

(firefox65 fixed)

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: bc, Assigned: bc)

References

Details

Attachments

(1 file)

mozrunner.grant_runtime_permissions <https://searchfox.org/mozilla-central/source/testing/mozbase/mozrunner/mozrunner/devices/android_device.py#376> is used to allow the granting of permissions to apps without the need for installation via adb install -g. The usage of adb install -g appears to be the root cause of the fennec crashes such as Bug 1496627 comment 8.

ADBAndroid.install_app should handle this.
<https://treeherder.mozilla.org/#/jobs?repo=try&tier=1%2C2%2C3&group_state=expanded&revision=f8a6345d87fceff2e818964da12c388fa263e2e9>

This is redundant with the mozrunner.grant_runtime_permissions() but it eliminates the use of adb install -g and would allow us to eliminate any uses of mozrunner.grant_runtime_permissions() as long as we using ADBAndroid.launch_application().
Attachment #9022100 - Flags: review?(gbrown)
<https://treeherder.mozilla.org/#/jobs?repo=try&tier=1%2C2%2C3&group_state=expanded&revision=f8a6345d87fceff2e818964da12c388fa263e2e9>

wlach: This might help with the reported rooting related crashes in mozregression.

We should make sure to include this with the changes in bug 1504117.
Blocks: 1504117
Comment on attachment 9022100 [details] [diff] [review]
ADBAndroid-grant-permissions.patch

Review of attachment 9022100 [details] [diff] [review]:
-----------------------------------------------------------------

::: testing/mozbase/mozdevice/mozdevice/adb_android.py
@@ +449,5 @@
>          if fail_if_running and self.process_exist(app_name, timeout=timeout):
>              raise ADBError("Only one instance of an application may be running "
>                             "at once")
>  
> +        if grant_runtime_permissions and self.version >= version_codes.M:

grant_runtime_permissions() already checks for version >= version_codes.M, so perhaps eliminate this check?
Attachment #9022100 - Flags: review?(gbrown) → review+
Right. Thanks.
Pushed by bclary@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/41cabeaa42e7
[mozdevice] Add ADBAndroid.grant_runtime_permissions() and use when launching applications, r=gbrown.
https://hg.mozilla.org/mozilla-central/rev/41cabeaa42e7
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
This broke Android 7.0 x86 geckoview-junit (tier 3): It was already perma-fail for a couple of tests, but it began crashing on startup with this change. Adding back "-g" to install_app avoids the crash:

https://treeherder.mozilla.org/#/jobs?repo=try&tier=1%2C2%2C3&revision=df125efc7c5822de8840982bd68182d317a3163a

Maybe we need to grant additional permissions?
Depends on: 1504447
Blocks: 1483695
See Also: → 1570051
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: