Closed Bug 1839239 Opened 1 year ago Closed 1 year ago

Crash in [@ android.util.AndroidRuntimeException: at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java)] "requestFeature() must be called before adding content"

Categories

(Fenix :: General, defect, P2)

Unspecified
Android
defect

Tracking

(firefox115+ verified, firefox116+ verified, firefox117+ verified)

VERIFIED FIXED
117 Branch
Tracking Status
firefox115 + verified
firefox116 + verified
firefox117 + verified

People

(Reporter: cpeterson, Assigned: amejia)

References

(Regression)

Details

(Keywords: crash, regression, topcrash)

Crash Data

Attachments

(7 files, 1 obsolete file)

Crash report: https://crash-stats.mozilla.org/report/index/527e74fb-04ec-4175-9eeb-cd0b90230617

Java stack trace:

android.util.AndroidRuntimeException: requestFeature() must be called before adding content
	at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:359)
	at com.android.internal.app.AlertController.installContent(AlertController.java:233)
	at android.app.AlertDialog.onCreate(AlertDialog.java:356)
	at android.app.Dialog.dispatchOnCreate(Dialog.java:463)
	at android.app.Dialog.show(Dialog.java:288)
	at androidx.fragment.app.DialogFragment.onStart(DialogFragment.java:11)
	at androidx.fragment.app.FragmentStateManager.start(FragmentStateManager.java:30)
	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:57)
	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1139)
	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:92)
	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:74)
	at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:4)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:145)
	at android.app.ActivityThread.main(ActivityThread.java:5951)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Summary: Crash in [@ android.util.AndroidRuntimeException: at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java)] → Crash in [@ android.util.AndroidRuntimeException: at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java)] "requestFeature() must be called before adding content"

The bug is linked to a topcrash signature, which matches the following criterion:

  • Top 10 AArch64 and ARM crashes on beta

:jonalmeida, could you consider increasing the severity of this top-crash bug?

For more information, please visit BugBot documentation.

Flags: needinfo?(jonalmeida942)
Keywords: topcrash

Bryan, can you please help find an assignee for this Fenix topcrash? Thanks!

Flags: needinfo?(brclark)

This crash looks like a regression in 115: we have crash reports from 115-117 (Nightly, Beta, and Release), but none before 115.

100% of the crash reports are from devices running API 21-23 (Android 5.0, 5.1, and 6.0). 70% are from ARMv7 devices.

Keywords: regression

While nearly all the crash reports are from Fenix, there are a few from Focus 115.0, so we know this crash is in code common to Fenix and Focus.

The first crash reports were from Nightly 115.0a1 build ID 20230510213701. If this crash was caused by a code change, it might have landed before this build, but here is the mozilla-central change log for build ID 20230510213701:

https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=ab25e7dfc0dc5bb8217fb436aac0957faf03a793&tochange=ffee8e3a7870875ab78af162638548f72cdabddf

The only suspicious Android change in that change log is compositor bug 1824083. Seems more likely that a change in Fenix/Focus or A-C code would cause this crash related to fragments and alerts.

Priority: P5 → P2

Hi Jamie, is this something that could possibly be related to bug 1824083?

Flags: needinfo?(jnicol)

Do we know what the stack trace is trying to do calling AlertDialog.onCreate() and PhoneWindow.requestFeature()? Is this code trying to ask the user for a new app permission?

android.util.AndroidRuntimeException: requestFeature() must be called before adding content
	at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:359)
	at com.android.internal.app.AlertController.installContent(AlertController.java:233)
	at android.app.AlertDialog.onCreate(AlertDialog.java:356)
	at android.app.Dialog.dispatchOnCreate(Dialog.java:463)
	at android.app.Dialog.show(Dialog.java:288)
	at androidx.fragment.app.DialogFragment.onStart(DialogFragment.java:11)
	at androidx.fragment.app.FragmentStateManager.start(FragmentStateManager.java:30)
	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:57)
	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1139)
	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:92)
	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:74)
	at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:4)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:145)
	at android.app.ActivityThread.main(ActivityThread.java:5951)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Severity: S3 → S2
See Also: → 1824083

(In reply to Roger Yang [:royang] from comment #6)

Hi Jamie, is this something that could possibly be related to bug 1824083?

It seems pretty unlikely given the stack trace, but to encounter that bug in the first place there had to be something strange going on, so I won't rule it out completely.

The nightly crash numbers are pretty low, with large gaps between build IDs that have >= 1 crash. So I don't think we can safely look at the changelog for a single nightly version. Also given the stack trace has nothing gecko-related in it, perhaps we ought to look at the android-components changelog too.

Flags: needinfo?(jnicol)

I think it's really unlikely this is gecko/GeckoView related, I think this is something that could be on the Android layer.

Attached image Android_versions.png

Checking the Sentry Android versions, it looks like is happening on older Android versions, where newest one is Android 6.0.1.

Assignee: nobody → amejiamarmol

This patch seen a bit suspicious, I'm not completely sure if it could be the source.

As the stack-trace is very generic, it's difficult to know for sure the source, I think adding some extra information to the crash could help, I'll add some Sentry breadcrumbs on each part where we create a dialog, that will give us some hints about which is the dialog the produce crash.

In the meantime, should we temporarily back out Jonathan's tabs tray fix from bug 1822448 to see if that fixes the issue?

Flags: needinfo?(brclark) → needinfo?(amejiamarmol)

We could but I'm not 100% sure that it is the root cause. We could back it out and see if the crashes reduce and it doesn't we can put it back, what do you think?

Flags: needinfo?(amejiamarmol)
Status: NEW → RESOLVED
Closed: 1 year ago
Flags: qe-verify+
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Flags: qe-verify+

Comment on attachment 9343489 [details] [review]
[mozilla-mobile/firefox-android] Bug 1839239 - Add crash bread crumbs for dialogs. (backport #2804) (#2811)

Beta/Release Uplift Approval Request

  • User impact if declined: The rate on this bug will continue increasing without a solution.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): We are only collecting more information about the crash, nothing visible to the user.
  • String changes made/needed:
  • Is Android affected?: Yes
Attachment #9343489 - Flags: approval-mozilla-release?

:amejia could you add a beta uplift request also on a backport for 116?
We should get this into beta first and then we can pick it for next week's 115 dot release.

Flags: needinfo?(amejiamarmol)

Sure!

Flags: needinfo?(amejiamarmol)

The crash rate in beta is similar is similar to nightly, both are really low, it looks like we don't have enough of those devices there, it's very likely that we will need to wait until the next week's 115 dot release to start getting data.

Comment on attachment 9343508 [details] [review]
[mozilla-mobile/firefox-android] Bug 1839239 - Add crash bread crumbs for dialogs. (backport #2804) (#2813)

Beta/Release Uplift Approval Request

  • User impact if declined: The rate on this bug could continue increasing without a solution.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): We are only collecting more information about the crash, nothing visible to the user.
  • String changes made/needed:
  • Is Android affected?: Yes
Attachment #9343508 - Flags: approval-mozilla-beta?
Status: REOPENED → ASSIGNED
Keywords: leave-open
Target Milestone: 117 Branch → ---
Comment on attachment 9343508 [details] [review]
[mozilla-mobile/firefox-android] Bug 1839239 - Add crash bread crumbs for dialogs. (backport #2804) (#2813)

Approved for 116.0b5.
Attachment #9343508 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Comment on attachment 9343508 [details] [review]
[mozilla-mobile/firefox-android] Bug 1839239 - Add crash bread crumbs for dialogs. (backport #2804) (#2813)

Sorry, reverting this back as it looks like the backport PR needs more work before it's ready to land.
Flags: needinfo?(amejiamarmol)
Attachment #9343508 - Flags: approval-mozilla-beta+ → approval-mozilla-beta?

Thanks Ryan!
The patch is now updated!

Flags: needinfo?(amejiamarmol) → needinfo?(ryanvm)
Comment on attachment 9343508 [details] [review]
[mozilla-mobile/firefox-android] Bug 1839239 - Add crash bread crumbs for dialogs. (backport #2804) (#2813)

Thanks, approved again for 116.0b5!
Flags: needinfo?(ryanvm)
Attachment #9343508 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

(In reply to Arturo Mejia [:amejia] from comment #16)

We could but I'm not 100% sure that it is the root cause. We could back it out and see if the crashes reduce and it doesn't we can put it back, what do you think?

Since this bug's crash rate continues to climb in 115, I think backing out Jonathan's change is worth testing. His fix was pretty small and should be easy to back out. Plus, the bug we would be temporarily reintroducing (an animation issue on older Android versions) isn't as bad as this crash.

Since the crash rate is pretty low in Nightly and Beta, we will probably need to uplift to next week's 115 dot release to see if there is any change.

The uplift deadline for next week's 115 dot release is this Friday (July 14).

Flags: needinfo?(amejiamarmol)

Luckily we started to get some data in nightly:

We got 4 reports

As this stack is pretty generic is very likely that is no one issue, but multiple issues aggregated in a generic stack.
I started taking a look the new data to see if something that we can address.

Flags: needinfo?(amejiamarmol)

The last changes to TimePickerDialogFragment was this commit Bug 1815637 - Add rtl support which applies withCenterAlignedButtons to practically every dialog.

I was able to reproduce the crash locally, with an emulator Pixel 6 API 23 (Android 6 Google APIs | arm64) .

STR:

  1. Go to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time
  2. Tap on the time input with the label "Choose a time for your meeting"

After removing the calls to withCenterAlignedButtons I don't get the crash anymore.

As the crash doesn't happen on newer version of Android, we could disable withCenterAlignedButtons on API levels lower or equal to 23, so we don't lose the improvements for newer Android versions.

Unfortunately, checking closer at the reports we also have small number of Android versions like 13, and 12. I'll back out Bug 1815637 - Add rtl support.

Adding Mike for future research about bug #1815637

Flags: needinfo?(mavduevskiy)
See Also: 18224481815637
Regressed by: 1815637

This is the patch for back out Bug 1815637 - Add rtl support.

Attached file GitHub Pull Request (obsolete) —
Attachment #9343760 - Attachment is obsolete: true
Flags: needinfo?(jonalmeida942)
See Also: 1815637

Mike, since Arturo is backing out your fix for RTL bug 1815637, should we reopen that bug, file a new bug, or accept that the RTL issue won't be fixed?

Sorry, I just noticed the message, and I already opened the bug.

Flags: qe-verify+

Hi QA team,
Could you help us to verify that the crash doesn't happen on nightly steps can be found on comment #33.

Thanks in advance!

(In reply to Chris Peterson [:cpeterson] from comment #38)

Mike, since Arturo is backing out your fix for RTL bug 1815637, should we reopen that bug, file a new bug, or accept that the RTL issue won't be fixed?

PSA: Mike's out on PTO this week - with bug 1815637 reopened, he can make a call on next steps for it when he's back online next week.

(In reply to Arturo Mejia [:amejia] from comment #40)

Hi QA team,
Could you help us to verify that the crash doesn't happen on nightly steps can be found on [comment #33]

Hi, we followed the STR using the latest Nightly 117.0a1 from 07/14 and the application remained stable.
Devices used for testing:

  • Huawei MediaPad M2 (Android 5.1.1)
  • Sony Xperia (Android 6.0.1)
  • OPPO A15s (Android 10)
  • Xiaomi 12 Pro (Android 13)
Flags: qe-verify+

Thanks Delia and Joe!

Comment on attachment 9343891 [details] [review]
Reverts "Bug 1815637 - Add rtl support." (backport #2835) in Beta

Beta/Release Uplift Approval Request

  • User impact if declined: The rate on this bug could continue increasing.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): We are just reverting a patch.
  • String changes made/needed:
  • Is Android affected?: Yes
Attachment #9343891 - Flags: approval-mozilla-beta?

Comment on attachment 9343908 [details] [review]
Reverts "Bug 1815637 - Add rtl support." (backport #2835) in Release

Beta/Release Uplift Approval Request

  • User impact if declined: The rate on this bug could continue increasing.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): We are just reverting a patch, and verify the crash was fixed with the revert
  • String changes made/needed:
  • Is Android affected?: Yes
Attachment #9343908 - Flags: approval-mozilla-release?
Comment on attachment 9343891 [details] [review]
Reverts "Bug 1815637 - Add rtl support." (backport #2835) in Beta

Approved for 116.0b6
Attachment #9343891 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

There is no crash on the latest Beta 116.0b6 build with steps from https://bugzilla.mozilla.org/show_bug.cgi?id=1839239#c33.

Devices used:

  • Lenovo Tab P11 Plus (Android 12)
  • Oppo Find X5 (Android 13)
  • Google Pixel 7 Pro (Android 14)
  • Samsung S22 Ultra (Android 13)

Also checked on the latest Nightly 117.0a1 from 2023-07-17 with the same result.

Marking the ticket as verified for 116 and 117.

Status: ASSIGNED → RESOLVED
Closed: 1 year ago1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
Status: RESOLVED → VERIFIED
Comment on attachment 9343908 [details] [review]
Reverts "Bug 1815637 - Add rtl support." (backport #2835) in Release

Approved for Mobile 115.2.1
Attachment #9343908 - Flags: approval-mozilla-release? → approval-mozilla-release+
Attachment #9343489 - Flags: approval-mozilla-release? → approval-mozilla-release+
Status: VERIFIED → RESOLVED
Closed: 1 year ago1 year ago
Flags: qe-verify+

Verified as fixed on Fenix RC 115.2.1, using the STR from Comment 33.

Devices used for testing:

  • Samsung Galaxy Tab S3 (Android 9)
  • Oppo Find X5 (Android 12)
  • Google Pixel 7 (Android 14)
  • Samsung Galaxy Tab A6 (Android 5.1.1)
  • Google Pixel 7 Pro (Android 14)
  • Lenovo Tab P11 Plus (Android 12)
  • LG Nexus 5 (Android 6.0.1)
Status: RESOLVED → VERIFIED
Flags: qe-verify+
Flags: needinfo?(mavduevskiy)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: