Closed Bug 1643448 Opened 4 years ago Closed 3 years ago

Add ACCESS_WIFI_STATE permission to TestRunnerActivity

Categories

(GeckoView :: General, defect, P3)

Tracking

(firefox-esr78 unaffected, firefox83 wontfix, firefox84 wontfix, firefox85 fixed, firefox86 fixed)

RESOLVED FIXED
85 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox83 --- wontfix
firefox84 --- wontfix
firefox85 --- fixed
firefox86 --- fixed

People

(Reporter: marco, Assigned: gbrown)

References

(Depends on 1 open bug)

Details

(Keywords: crash, good-first-bug)

Attachments

(3 files)

For ASj1831zRye71eH4q_pzQA, AD says dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html failed, but it actually passed.
There seems to be no failure in the mochitest-plain_raw.log or mochitest-plain_errorsummary.log or in the backing log.

ActiveData is considering the test as failing because it thinks the test is missing test-end: https://activedata.allizom.org/tools/query.html#query_id=R7xEaqNP.

https://treeherder.mozilla.org/logviewer.html#?job_id=303438375&repo=autoland
https://firefoxci.taskcluster-artifacts.net/ASj1831zRye71eH4q_pzQA/0/public/logs/live_backing.log

[task 2020-05-23T00:05:31.227Z] 00:05:31     INFO -  835 INFO SimpleTest START
[task 2020-05-23T00:05:31.227Z] 00:05:31     INFO -  836 INFO TEST-START | dom/presentation/tests/mochitest/test_presentation_availability.html
[task 2020-05-23T00:05:41.672Z] 00:05:41     INFO -  837 INFO TEST-OK | dom/presentation/tests/mochitest/test_presentation_availability.html | took 7284ms
[task 2020-05-23T00:05:41.672Z] 00:05:41     INFO -  838 INFO TEST-START | dom/presentation/tests/mochitest/test_presentation_dc_sender.html
[task 2020-05-23T00:05:41.673Z] 00:05:41     INFO -  839 INFO TEST-OK | dom/presentation/tests/mochitest/test_presentation_dc_sender.html | took 276ms
[task 2020-05-23T00:05:41.673Z] 00:05:41     INFO -  840 INFO TEST-START | dom/presentation/tests/mochitest/test_presentation_mixed_security_contexts.html
[task 2020-05-23T00:05:41.674Z] 00:05:41     INFO -  841 INFO TEST-OK | dom/presentation/tests/mochitest/test_presentation_mixed_security_contexts.html | took 3167ms
[task 2020-05-23T00:05:41.674Z] 00:05:41     INFO -  842 INFO TEST-START | dom/presentation/tests/mochitest/test_presentation_reconnect.html
[task 2020-05-23T00:05:41.678Z] 00:05:41     INFO -  843 INFO TEST-OK | dom/presentation/tests/mochitest/test_presentation_reconnect.html | took 269ms
[task 2020-05-23T00:05:41.678Z] 00:05:41     INFO -  844 INFO TEST-START | dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html
[task 2020-05-23T00:06:02.673Z] 00:06:02     INFO -  wait for org.mozilla.geckoview.test complete; top activity=com.android.launcher3
[task 2020-05-23T00:06:02.781Z] 00:06:02     INFO -  remoteautomation.py | Application ran for: 0:00:37.736846
[task 2020-05-23T00:06:03.327Z] 00:06:03     INFO -  Stopping web server
[task 2020-05-23T00:06:03.332Z] 00:06:03     INFO -  Stopping web socket server
[task 2020-05-23T00:06:03.353Z] 00:06:03     INFO -  Stopping ssltunnel
[task 2020-05-23T00:06:03.374Z] 00:06:03     INFO -  leakcheck | refcount logging is off, so leaks can't be detected!
[task 2020-05-23T00:06:03.374Z] 00:06:03     INFO -  runtests.py | Running tests: end.
[task 2020-05-23T00:06:04.672Z] 00:06:04     INFO -  Buffered messages logged at 00:05:40
[task 2020-05-23T00:06:04.672Z] 00:06:04     INFO -  845 INFO TEST-PASS | dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html | PresentationRequest should be available.
[task 2020-05-23T00:06:04.672Z] 00:06:04     INFO -  846 INFO TEST-PASS | dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html | Sender: should have no available device after setup
[task 2020-05-23T00:06:04.673Z] 00:06:04     INFO -  847 INFO TEST-PASS | dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html | Device should be available.
[task 2020-05-23T00:06:04.673Z] 00:06:04     INFO -  848 INFO Device prompt is triggered.
[task 2020-05-23T00:06:04.673Z] 00:06:04     INFO -  849 INFO A control channel is established.
[task 2020-05-23T00:06:04.673Z] 00:06:04     INFO -  850 INFO TEST-PASS | dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html | Connection should be available.
[task 2020-05-23T00:06:04.673Z] 00:06:04     INFO -  851 INFO TEST-PASS | dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html | Connection ID should be set.
[task 2020-05-23T00:06:04.674Z] 00:06:04     INFO -  852 INFO TEST-PASS | dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html | The initial state should be connecting.
[task 2020-05-23T00:06:04.674Z] 00:06:04     INFO -  853 INFO TEST-PASS | dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html | |connectionavailable| event is fired with a connection.
[task 2020-05-23T00:06:04.674Z] 00:06:04     INFO -  854 INFO TEST-PASS | dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html | The connection from promise and the one from |connectionavailable| event should be the same.
[task 2020-05-23T00:06:04.674Z] 00:06:04     INFO -  855 INFO The control channel is opened.
[task 2020-05-23T00:06:04.674Z] 00:06:04     INFO -  Buffered messages finished

Logcat shows:

05-23 01:05:40.571  5609  5629 I GeckoDump: ⰲ겿{"action":"test_start","time":1590192340571,"thread":null,"pid":null,"source":"mochitest","test":"/tests/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html","js_source":"TestRunner.js"}ⰲ겿
05-23 01:05:40.572  5609  5629 D GeckoViewWebBrowserChrome[C]: shouldLoadURI http://mochi.test:8888/tests/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html
05-23 01:05:40.584  5609  5629 D GeckoViewAutofill[C]: handleEvent: pageshow
05-23 01:05:40.592  5609  5629 D GeckoViewSelectionAction[C]: handleEvent: visibilitychange
05-23 01:05:40.593  5609  5629 D GeckoViewAutofill[C]: handleEvent: pagehide
05-23 01:05:40.610  5609  5629 D GeckoViewContent[C]: handleEvent: DOMTitleChanged
05-23 01:05:40.628  5609  5629 D GeckoViewContent[C]: handleEvent: DOMContentLoaded
05-23 01:05:40.632  5609  5629 D GeckoViewAutofill[C]: handleEvent: pageshow
05-23 01:05:40.666  5609  5629 I GeckoDump: ⰲ겿{"action":"test_status","time":1590192340666,"thread":null,"pid":null,"source":"mochitest","test":"/tests/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html","subtest":"PresentationRequest should be available.","status":"PASS","js_source":"TestRunner.js"}ⰲ겿
05-23 01:05:40.669  5609  5629 I GeckoDump: ⰲ겿{"action":"test_status","time":1590192340669,"thread":null,"pid":null,"source":"mochitest","test":"/tests/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html","subtest":"Sender: should have no available device after setup","status":"PASS","js_source":"TestRunner.js"}ⰲ겿
05-23 01:05:40.674  5609  5629 I GeckoDump: ⰲ겿{"action":"test_status","time":1590192340673,"thread":null,"pid":null,"source":"mochitest","test":"/tests/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html","subtest":"Device should be available.","status":"PASS","js_source":"TestRunner.js"}ⰲ겿
05-23 01:05:40.683  5609  5629 I GeckoDump: ⰲ겿{"action":"log","time":1590192340681,"thread":null,"pid":null,"source":"mochitest","level":"INFO","message":"Device prompt is triggered.","js_source":"TestRunner.js"}ⰲ겿
05-23 01:05:40.686  5609  5629 I GeckoDump: ⰲ겿{"action":"log","time":1590192340686,"thread":null,"pid":null,"source":"mochitest","level":"INFO","message":"A control channel is established.","js_source":"TestRunner.js"}ⰲ겿
05-23 01:05:40.687  5609  5629 I GeckoDump: ⰲ겿{"action":"test_status","time":1590192340687,"thread":null,"pid":null,"source":"mochitest","test":"/tests/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html","subtest":"Connection should be available.","status":"PASS","js_source":"TestRunner.js"}ⰲ겿
05-23 01:05:40.688  5609  5629 I GeckoDump: ⰲ겿{"action":"test_status","time":1590192340687,"thread":null,"pid":null,"source":"mochitest","test":"/tests/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html","subtest":"Connection ID should be set.","status":"PASS","js_source":"TestRunner.js"}ⰲ겿
05-23 01:05:40.688  5609  5629 I GeckoDump: ⰲ겿{"action":"test_status","time":1590192340688,"thread":null,"pid":null,"source":"mochitest","test":"/tests/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html","subtest":"The initial state should be connecting.","status":"PASS","js_source":"TestRunner.js"}ⰲ겿
05-23 01:05:40.689  5609  5629 I GeckoDump: ⰲ겿{"action":"test_status","time":1590192340689,"thread":null,"pid":null,"source":"mochitest","test":"/tests/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html","subtest":"|connectionavailable| event is fired with a connection.","status":"PASS","js_source":"TestRunner.js"}ⰲ겿
05-23 01:05:40.689  5609  5629 I GeckoDump: ⰲ겿{"action":"test_status","time":1590192340689,"thread":null,"pid":null,"source":"mochitest","test":"/tests/dom/presentation/tests/mochitest/test_presentation_sender_on_terminate_request.html","subtest":"The connection from promise and the one from |connectionavailable| event should be the same.","status":"PASS","js_source":"TestRunner.js"}ⰲ겿
05-23 01:05:40.690  5583  5583 D AndroidRuntime: Shutting down VM
--------- beginning of crash
05-23 01:05:40.690  5583  5583 E AndroidRuntime: FATAL EXCEPTION: main
05-23 01:05:40.690  5583  5583 E AndroidRuntime: Process: org.mozilla.geckoview.test, PID: 5583
05-23 01:05:40.690  5583  5583 E AndroidRuntime: java.lang.SecurityException: WifiService: Neither user 10062 nor current process has android.permission.ACCESS_WIFI_STATE.
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at android.os.Parcel.readException(Parcel.java:1683)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at android.os.Parcel.readException(Parcel.java:1636)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at android.net.wifi.IWifiManager$Stub$Proxy.getConnectionInfo(IWifiManager.java:1158)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at android.net.wifi.WifiManager.getConnectionInfo(WifiManager.java:1286)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at org.mozilla.gecko.GeckoNetworkManager.getWifiIPAddress(GeckoNetworkManager.java:456)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at org.mozilla.gecko.GeckoNetworkManager.handleMessage(GeckoNetworkManager.java:442)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at org.mozilla.gecko.EventDispatcher$3.run(EventDispatcher.java:356)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:751)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:154)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6077)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
05-23 01:05:40.690  5583  5583 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
05-23 01:05:40.691  5609  5629 I GeckoDump: ⰲ겿{"action":"log","time":1590192340691,"thread":null,"pid":null,"source":"mochitest","level":"INFO","message":"The control channel is opened.","js_source":"TestRunner.js"}ⰲ겿
05-23 01:05:40.692  1610  1621 W ActivityManager:   Force finishing activity org.mozilla.geckoview.test/.TestRunnerActivity

From the harness perspective, test_presentation_sender_on_terminate_request.html started, then Firefox was no longer running.

Usually a crash will result in the generation of a minidump, which will trigger a crash report, log a crash, and fail the run. In this case we didn't get a minidump, presumably because the OS forced Firefox down due to the security exception.

Previously, the harness would fail a run if the summary was not printed; I don't know why that didn't happen.

This seems to be a perma-fail -- it fails in a similar way in every android mochitest log I checked.

Depends on: 1643478

Indeed, it looks like we should request that in TestRunnerActivity. We also need to fail gracefully if we don't have it, since our embedded app might not request it. Moving this over to GeckoView and we'll address in the next triage.

Flags: needinfo?(snorp)
Product: Testing → GeckoView

:snorp When you have a chance, please change the name of this bug to better describe the problem as you see it.

Flags: needinfo?(snorp)
Flags: needinfo?(snorp)
Summary: ActiveData reports test as failing, even though it didn't → Add ACCESS_WIFI_STATE permission to TestRunnerActivity
Severity: -- → S3
Priority: -- → P3
Assignee: nobody → amoya
Status: NEW → ASSIGNED
Pushed by jwillcox@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/39ee74362843
Add ACCESS_WIFI_STATE permission to TestRunnerActivity. r=geckoview-reviewers,snorp
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
See Also: → 1680322
Blocks: 1680833

Add the permission to the geckoview manifest, as previously attempted. Also disable failing tests
to enable a green test run. Add permission to adb.py grants list for good measure.

Thanks for getting this started, :amoya!

Assignee: amoya → whole.grains
Flags: needinfo?(amoya)
Pushed by whole.grains@protonmail.com:
https://hg.mozilla.org/integration/autoland/rev/580e0207d5e8
Add ACCESS_WIFI_STATE permission and disable failing tests in dom/presentation; r=geckoview-reviewers,bc,agi
Status: REOPENED → RESOLVED
Closed: 4 years ago3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch

I've been running tests locally using emulators and I see the following errors frequently.

adb Unable to grant runtime permission android.permission.ACCESS_WIFI_STATE to org.mozilla.geckoview_example
adb Unable to grant runtime permission android.permission.ACCESS_WIFI_STATE to org.mozilla.geckoview.test

geckoview.test has the permission set but still has the error. Out of the following

mobile/android/geckoview/src/main/AndroidManifest.xml
mobile/android/geckoview/src/androidTest/AndroidManifest.xml
mobile/android/geckoview_example/src/main/AndroidManifest.xml
mobile/android/examples/port_messaging_example/app/src/main/AndroidManifest.xml
mobile/android/examples/messaging_example/app/src/main/AndroidManifest.xml

only geckoview.test has this permission. Should this be added to the other manifests? If not, can we remove the permission from adb.py's grant_runtime_permissions ?

Flags: needinfo?(whole.grains)

I hadn't noticed this before, but now I see all of our android-em and android-hw tests fail this grant:

[task 2020-12-25T10:51:41.091Z] 10:51:41     INFO -  adb Granting important runtime permissions to org.mozilla.geckoview.test
[task 2020-12-25T10:51:42.776Z] 10:51:42     INFO -  adb Unable to grant runtime permission android.permission.ACCESS_WIFI_STATE to org.mozilla.geckoview.test due to args: adb wait-for-device shell pm grant org.mozilla.geckoview.test android.permission.ACCESS_WIFI_STATE; echo adb_returncode=$?, exitcode: 1, stdout: Operation not allowed: java.lang.SecurityException: Permission android.permission.ACCESS_WIFI_STATE is not a changeable permission type

I don't understand why ACCESS_WIFI_STATE fails, when, for instance, FOREGROUND_SERVICE is OK. At any rate, since the grant of ACCESS_WIFI_STATE fails, I think it should be removed from the adb.py list.

I think

  mobile/android/geckoview/src/androidTest/AndroidManifest.xml
  mobile/android/geckoview_example/src/main/AndroidManifest.xml

should be kept in sync -- ACCESS_WIFI_STATE should be added to the geckoview_example manifest.

I don't know much about the other manifests.

:agi -- Should ACCESS_WIFI_STATE be added to any other manifest files? Do you have any insight into why 'pm grant' would fail on android.permission.ACCESS_WIFI_STATE?

I can make the changes, but will wait until we hear back from :agi.

Flags: needinfo?(agi)

(In reply to Geoff Brown [:gbrown] from comment #18)

I don't understand why ACCESS_WIFI_STATE fails, when, for instance, FOREGROUND_SERVICE is OK.

Actually, FOREGROUND_SERVICE is not in the adb.py list of grants. FOREGROUND_SERVICE and ACCESS_WIFI_STATE have protection level "normal", while the other permissions, which we successfully grant, are protection level "dangerous". Does that difference explain the ACCESS_WIFI_STATE grant failure?

(In reply to Geoff Brown [:gbrown] from comment #19)

(In reply to Geoff Brown [:gbrown] from comment #18)

I don't understand why ACCESS_WIFI_STATE fails, when, for instance, FOREGROUND_SERVICE is OK.

Actually, FOREGROUND_SERVICE is not in the adb.py list of grants. FOREGROUND_SERVICE and ACCESS_WIFI_STATE have protection level "normal", while the other permissions, which we successfully grant, are protection level "dangerous". Does that difference explain the ACCESS_WIFI_STATE grant failure?

I think you can only pm grant permissions that are dangerous or present in the manifest:

pm grant, revoke: these commands either grant or revoke permissions
    to apps. The permissions must be declared as used in the app's
    manifest, be runtime permissions (protection level dangerous),
    and the app targeting SDK greater than Lollipop MR1.

I think adding ACCESS_WIFI_STATE to the GVE manifest is the right thing to do here.

Flags: needinfo?(agi)

Thanks! Changes coming up...

Status: RESOLVED → REOPENED
Flags: needinfo?(whole.grains)
Resolution: FIXED → ---

Add ACCESS_WIFI_STATE to the gve manifest, same as androidTest.
Remove ACCESS_WIFI_STATE from the list of pm grants, since it is not of
type dangerous.

Pushed by whole.grains@protonmail.com:
https://hg.mozilla.org/integration/autoland/rev/124069464191
Update test handling of ACCESS_WIFI_STATE; r=geckoview-reviewers,bc,agi
Status: REOPENED → RESOLVED
Closed: 3 years ago3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: