Crash in android.util.AndroidRuntimeException: at android.app.ContextImpl.startActivity(ContextImpl.java)

VERIFIED FIXED in Firefox 68

Status

()

defect
P1
critical
VERIFIED FIXED
5 months ago
Last month

People

(Reporter: jseward, Assigned: brad.arant)

Tracking

({crash, reproducible})

unspecified
Firefox 69
ARM64
Android
Points:
---

Firefox Tracking Flags

(firefox65 wontfix, firefox66 wontfix, firefox67 wontfix, firefox68+ verified, firefox69 verified)

Details

(crash signature)

Attachments

(2 attachments)

This bug is for crash report bp-d8b204dc-01f0-4d00-aa9f-b1d460190201.

This happened for 3 different installations in the Android nightly
20190131093752.

Java stack trace:

android.util.AndroidRuntimeException
	at android.app.ContextImpl.startActivity(ContextImpl.java:915)
	at android.app.ContextImpl.startActivity(ContextImpl.java:891)
	at android.content.ContextWrapper.startActivity(ContextWrapper.java:379)
	at org.mozilla.gecko.BrowserApp.onPictureInPictureModeChanged(BrowserApp.java:1079)
	at android.app.Activity.dispatchPictureInPictureModeChanged(Activity.java:7446)
	at android.app.ActivityThread.handlePictureInPictureModeChanged(ActivityThread.java:3408)
	at android.app.servertransaction.PipModeChangeItem.execute(PipModeChangeItem.java:40)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1906)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:6863)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Flags: needinfo?(droeh)

I see crash reports with this signature from ARM64 builds of Fennec 67 Nightly, but not from ARMv7 builds.

Hardware: Unspecified → ARM64

Interesting. The only thing that immediately comes to mind for an AndroidRuntimeException on a startActivity() call is calling it from a non-activity context, but I can't imagine why it would be ARM64-specific in that case.

Flags: needinfo?(droeh)

This crash is pretty low volume across all branches. Marking as a P3 for now.

Priority: -- → P3

Here is a pretty long comment that someone left:

In Firefox Nightly ran in the background of the TV Phoenix livestream. Another app asked if a link should be opened and with which browser. I chose Nightly to see if it's possible to open a second Nightly window next to the livestream running in the background. Then came the crash. As long as that is not fixed, I will then use the Chrome browser for it, although I like Firefox better.

During triage we also talked about the fact there is stuff related to Picture in Picture mode in the stack - org.mozilla.gecko.BrowserApp.onPictureInPictureModeChanged(BrowserApp.java:1079). All the URLs are youtube related.

This is #7 overall on Fennec Nightly 67.

@Sorina can we do some testing around picture in picture mode?

Flags: needinfo?(sorina.florean)

(In reply to Marcia Knous [:marcia - needinfo? me] from comment #6)

@Sorina can we do some testing around picture in picture mode?

Sure. I'll needinfo Andrei and Mira to investigate this tomorrow.

Affected devices: https://crash-stats.mozilla.com/signature/?product=FennecAndroid&signature=android.util.AndroidRuntimeException%3A%20at%20android.app.ContextImpl.startActivity%28ContextImpl.java%29#summary.

Flags: needinfo?(sorina.florean)
Flags: needinfo?(mirabela.lobontiu)
Flags: needinfo?(andrei.bodea)
Posted file logcat

Hi all,

I have managed to reproduce the issue, using these STR:

  1. Go to Settings -> General and enable Custom Tabs.
  2. Go to YouTube and enter fullscreen.
  3. While watching a video in full-screen mode, press the home button.
  4. Go to Gmail app and long-tap a link and choose to open with Nightly - Nightly crashes.

Device: OnePlus 5T (Android 9)
I`ve attached a logcat.

Thanks,

Note: I cannot reproduce this crash on Beta 66.0b9, RC 65.0.1.

Flags: needinfo?(mirabela.lobontiu)
Flags: needinfo?(andrei.bodea)

Adding 68 as affected. This is the #4 overall crash on nightly.

[Tracking Requested - why for this release]: Very high crash volume on nightly.

Priority: P3 → P1
Assignee: nobody → brad.arant

I am unable to recreate the issue on a Samsung Note 8 running Android 9.

Exception message is "Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?"

Placed a testing APK into the testing Skype group. Awaiting responses.

Indicated that changing context to Activity context has indeed resolved the problem in initial APK testing. Submitting for final approval.

Keywords: checkin-needed

Pushed by ccoroiu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8194de6da1c7
StartActivity must be called from Activity context and not Application context.;r=VladBaicu

Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 69

Brad, can you please request uplift of your crash fix to Fennec 68 Beta? We'll be supporting Fennec 68 in ESR until mid-2020 so it would be nice to have your fix.

Flags: needinfo?(brad.arant)

Comment on attachment 9067360 [details]
Bug 1524868 - StartActivity must be called from Activity context and not Application context.;r?VladBaicu

Beta/Release Uplift Approval Request

  • User impact if declined: Bug continues relating to negative user experience.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: Go to Settings -> General and enable Custom Tabs.
    Go to YouTube and enter fullscreen.
    While watching a video in full-screen mode, press the home button.
    Go to Gmail app and long-tap a link and choose to open with Nightly - Nightly crashes.
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Single line change to resolve well known android pitfall.
  • String changes made/needed: -
Flags: needinfo?(brad.arant)
Attachment #9067360 - Flags: approval-mozilla-beta?
Flags: qe-verify+
QA Whiteboard: [qa-triaged]

Comment on attachment 9067360 [details]
Bug 1524868 - StartActivity must be called from Activity context and not Application context.;r?VladBaicu

fennec crash fix, approved for 68.0b9

Attachment #9067360 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Verified as fixed on Nightly 68.0a1 (2019-06-05) using Samsung Galaxy S8 (Android 9) and Motorola Moto G6 (Android 8). I'll let the qe-verify + till the verification on Beta, thanks.

Verified as fixed on Nightly 69.0a1 (2019-06-10) and Beta 68.0b9 with Nexus 6P (Android 8.1.0), Samsung Galaxy S8 (Android 9).
Due to my findings, I'll mark this issue as verified on Firefox 68 and 69. Thanks.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
QA Whiteboard: [qa-triaged]
You need to log in before you can comment on or make changes to this bug.