Closed Bug 1698214 Opened 5 years ago Closed 1 year ago

Getting media permissions fails with Isolated Process

Categories

(GeckoView :: General, task, P2)

Unspecified
All
task

Tracking

(firefox139 fixed)

RESOLVED FIXED
139 Branch
Tracking Status
firefox139 --- fixed

People

(Reporter: owlish, Assigned: olivia)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [sandboxing] [geckoview:2022q3] [fxdroid][geckoview])

Attachments

(1 file)

requestRecordingPermission method fails during the tests.

 val isActive = mainSession.waitForJS(
                """$code
                   this.stream.then(stream => {
                     if (!stream.active || stream.id == '') {
                       return false;
                     }

                     return true;
                   })
                """.trimMargin()) as Boolean

times out.

Affected tests:

  • org.mozilla.geckoview.test.MediaDelegateTest#testDeviceRecordingEventVideo
  • org.mozilla.geckoview.test.PermissionDelegateTest#media
  • org.mozilla.geckoview.test.MediaDelegateXOriginTest#testDeviceRecordingEventAudioAndVideoInXOriginIframe

Needs investigation

Summary: MediaSessionDelegate tests are not compatible with Isolated Process → Getting media permissions in tests fails with Isolated Process
Summary: Getting media permissions in tests fails with Isolated Process → Getting media permissions fails with Isolated Process
Whiteboard: [geckoview:m89]
Whiteboard: [geckoview:m89] → [geckoview:m89][sandboxing]
Severity: -- → S3
Priority: -- → P1
Assignee: nobody → bugzeeeeee
Depends on: 1700243
Whiteboard: [geckoview:m89][sandboxing] → [sandboxing]
Priority: P1 → P2
Assignee: bugzeeeeee → nobody
Whiteboard: [sandboxing] → [sandboxing] [geckoview:2022q3?]
Whiteboard: [sandboxing] [geckoview:2022q3?] → [sandboxing] [geckoview:2022q3]

Moving isolated process bugs to the new GeckoView::Sandboxing component.

Component: General → Sandboxing

Tasks should have severity N/A.

Severity: S3 → N/A
Blocks: 1835146
Component: Sandboxing → General

Testing latest state in this try.

I'll revisit to interpret results.

Flags: needinfo?(ohall)

Tests enabled:

MediaDelegateTest.kt:

  • testDeviceRecordingEventVideo

MediaDelegateXOriginTest.kt:

  • testDeviceRecordingEventAudioAndVideoInXOriginIframe

PermissionDelegateTest.kt:

  • media

Failures still occurring:

  • TEST-UNEXPECTED-FAIL | org.mozilla.geckoview.test.MediaDelegateTest#testDeviceRecordingEventVideo | org.mozilla.geckoview.test.util.UiThreadUtils$TimeoutException: Timed out after 30000ms

  • TEST-UNEXPECTED-FAIL | org.mozilla.geckoview.test.MediaDelegateXOriginTest#testDeviceRecordingEventAudioAndVideoInXOriginIframeNoAllow | org.mozilla.geckoview.test.util.UiThreadUtils$TimeoutException: Timed out after 30000ms

  • Something about enabling theses tests also seems to also be causing chaos failures in NavigationDelegateTest? (I don't think it is in tree because I have a run on the same-day that is green.) Needs to be confirmed.

Happening in all variants.

No failures:

  • media

I'll update media in bug 1698216 or bug 1698230, since those runs look clear and I'll be updating conditions in the area.

Flags: needinfo?(ohall)

When working on bug 1698216, I tried to open the media test. Surprisingly, it caused failures. I did not update media in that bug and will leave the investigation here.

See Also: → 1698216
Whiteboard: [sandboxing] [geckoview:2022q3] → [sandboxing] [geckoview:2022q3] [fxdroid][geckoview]
Assignee: nobody → ohall

I had thought it might just be something on the GeckoView side due to media permissions, but it seems deeper. I have the impression that the permission is granted based on logging, but something is timing out when the next part begins

Testing on Android 9 emulator.

These tests have these logs, which seem to be the root issue:

02-27 12:22:48.294 21686 21709 W ServiceManager: Service media.audio_flinger didn't start. Returning NULL
02-27 12:22:48.294 21686 21709 W AudioSystem: AudioFlinger not published, waiting...

./mach geckoview-junit org.mozilla.geckoview.test.MediaDelegateXOriginTest#testDeviceRecordingEventAudioAndVideoInXOriginIframe seems to get a little further:

02-27 12:26:02.984 22671 22718 I Gecko   : [Child 22671, MediaSupervisor #1] WARNING: Did not initialize sbrandName, and not on the main thread?: 'sBrandName', file /Users/olivia/Repos/gecko/dom/media/CubebUtils.cpp:570
02-27 12:26:02.985 22671 22718 I Gecko   : [Child 22671, MediaSupervisor #1] WARNING: Could not register the audio output device collection changed callback.: file /Users/olivia/Repos/gecko/dom/media/webrtc/CubebDeviceEnumerator.cpp:69
02-27 12:26:02.985 22671 22718 I Gecko   : [Child 22671, MediaSupervisor #1] WARNING: Could not register the audio input device collection changed callback.: file /Users/olivia/Repos/gecko/dom/media/webrtc/CubebDeviceEnumerator.cpp:78

Unassigned myself since it seems to be deeper in the media stack than I originally hoped.

Assignee: ohall → nobody

Leaving here for reference - last line I see executed on these tests from GV side logging is in getAudioOutputSampleRate at final String prop = am.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE); here. (Seems to be where it get stuck.) May need to research this call more in terms of isolated processes specifically.

I think this might be similar to bug 1706656, not the original description but in comment 8 I was seeing "ServiceManager: Waiting for service SurfaceFlinger...", which is like what you're seeing with audioflinger. Presumably isolated processes don't have permissions to launch the audioflinger service, which is required by the AudioManager.getProperty() call you highlighted.

Just a drive by comment as I don't know the ins and outs of this code - but perhaps we could query and cache these values in the parent process and send them to the content process as required.

We spent quite some time there with :phersons and :padenot and the conclusion was

Presumably isolated processes don't have permissions to launch the audioflinger service, which is required by the AudioManager.getProperty() call you highlighted.*

Blocks: 1771452

:owlish, :calu, and myself pair programmed on this today.

Locally, it appears this build define of defined(MOZ_ANDROID_CONTENT_SERVICE_ISOLATED_PROCESS) in CubebUtils.cpp is not properly triggering.

:owlish had a patch locally that fixed MOZ_ANDROID_CONTENT_SERVICE_ISOLATED_PROCESS and appeared to fix these tests. I'll run a baseline try and a try with the fix to confirm it works on CI as well.

(Note: This change only impacts the junit to not gate the test. It does not fix the underlying Cubeb remoting that has a ToDo still yet listed.)

I'll also try to determine if this build define not working as expected is a regression by looking at the history.

Patch fixes:

  • Fixes missing define of MOZ_ANDROID_CONTENT_SERVICE_ISOLATED_PROCESS

Patch opens for general availability in isolated process runs:

  • MediaDelegateTest#testDeviceRecordingEventVideo
  • MediaDelegateXOriginTest#testDeviceRecordingEventAudioAndVideoInXOriginIframe
Assignee: nobody → ohall
Attachment #9477854 - Attachment description: WIP: Bug 1698214 - Getting media permissions fails with Isolated Process → Bug 1698214 - Getting media permissions fails with Isolated Process
Pushed by ohall@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/97090b7feb48 Getting media permissions fails with Isolated Process r=geckoview-reviewers,calu

(In reply to Olivia Hall [:olivia] from comment #12)

Created attachment 9477854 [details]
Bug 1698214 - Getting media permissions fails with Isolated Process

Patch fixes:

  • Fixes missing define of MOZ_ANDROID_CONTENT_SERVICE_ISOLATED_PROCESS

Patch opens for general availability in isolated process runs:

  • MediaDelegateTest#testDeviceRecordingEventVideo
  • MediaDelegateXOriginTest#testDeviceRecordingEventAudioAndVideoInXOriginIframe

I'm giving a new try to bug 1771452 with that fix arriving

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: