Closed Bug 1829619 Opened 2 years ago Closed 2 years ago

Crash opening external activity in [@ android.content.ActivityNotFoundException: at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java)]

Categories

(Firefox for Android :: General, defect, P1)

Unspecified
Android
defect

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox112 --- wontfix
firefox113 --- fixed
firefox114 --- fixed

People

(Reporter: rsainani, Assigned: rsainani)

References

Details

(Keywords: crash, Whiteboard: [fxdroid])

Crash Data

Attachments

(2 files)

Crash report: https://crash-stats.mozilla.org/report/index/59f035e7-257c-4363-9ae9-d4bdf0230419
From Sentry, issue 1 and issue 2

Notes:
This seems to be happening in navigateToDefaultBrowserAppsSettings. A fix could be to make sure the activity described by the intent is present before navigating/starting the activity.

Java stack trace:

android.content.ActivityNotFoundException
	at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1809)
	at android.app.Instrumentation.execStartActivity(Instrumentation.java:1523)
	at android.app.Activity.startActivityForResult(Activity.java:4247)
	at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:2)
	at android.app.Activity.startActivityForResult(Activity.java:4205)
	at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:1)
	at android.app.Activity.startActivity(Activity.java:4544)
	at android.app.Activity.startActivity(Activity.java:4512)
	at org.mozilla.fenix.ext.ActivityKt.navigateToDefaultBrowserAppsSettings(Activity.kt:41)
	at org.mozilla.fenix.ext.ActivityKt.openSetDefaultBrowserOption$default(Activity.kt:82)
	at org.mozilla.fenix.onboarding.JunoOnboardingFragment$ScreenContent$1.invoke(JunoOnboardingFragment.kt:12)
	at org.mozilla.fenix.onboarding.view.JunoOnboardingScreenKt$JunoOnboardingScreen$4$1.invoke(JunoOnboardingScreen.kt:8)
	at androidx.compose.foundation.ClickableKt$genericClickableWithoutGesture$detectPressAndClickFromKey$1.invoke(Clickable.kt:183)
	at androidx.compose.ui.input.key.KeyInputModifier.propagateKeyEvent-ZmokQxo(KeyInputModifier.kt:15)
	at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:126)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1630)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1630)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1630)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1630)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1630)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1630)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1630)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1630)
	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1630)
	at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:421)
	at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1806)
	at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:103)
	at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:19)
	at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:23)
	at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:3)
	at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:9)
	at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:335)
	at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4362)
	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4327)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3878)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3931)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3897)
	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4024)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3905)
	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4081)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3878)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3931)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3897)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3905)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3878)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3931)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3897)
	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4057)
	at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4218)
	at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2400)
	at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1964)
	at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1955)
	at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2377)
	at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
	at android.os.MessageQueue.nativePollOnce(Native Method)
	at android.os.MessageQueue.next(MessageQueue.java:323)
	at android.os.Looper.loop(Looper.java:136)
	at android.app.ActivityThread.main(ActivityThread.java:6200)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:801)
Assignee: nobody → rsainani
Status: NEW → ASSIGNED
Whiteboard: [fxdroid]
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Flags: qe-verify+
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch

Arturo and I verified the crash fix. It's hard to reproduce as it's device specific and based on the device OS implementation, so removing the qe-verify flag.

Flags: qe-verify+

Joe, as this util is used in onboarding "make firefox default" action, requesting uplift to 113 for this.

Flags: needinfo?(jmahon)

(In reply to Rahul Sainani [:rsainani] from comment #4)

Joe, as this util is used in onboarding "make firefox default" action, requesting uplift to 113 for this.

I am curious are we not filling out the uplift request questionnaire when we are doing uplift requests? You can get to this by going to your PR "Details" in the "Attachments" section above https://bugzilla.mozilla.org/show_bug.cgi?id=1829619#:~:text=github%2Dpull%2Drequest-,Details,-%7C%20Review

From there, you want to find the flag for "approval-mozilla-beta" and set the flag to "?". This will present a form that with similar questions that you would've been answering in the uplift spreadsheet, but this will simply attach the uplift request directly into a Bugzilla comment. If the request is approved, then the "?" should be changed to a "+".

We'll want to learn how to adopt this practise in the future for when we move from GitHub into m-c since the sheriffs will be the ones involved with uplifting the patch for you.

(In reply to Gabriel [:gl] (ΦωΦ) from comment #5)

(In reply to Rahul Sainani [:rsainani] from comment #4)

Joe, as this util is used in onboarding "make firefox default" action, requesting uplift to 113 for this.

I am curious are we not filling out the uplift request questionnaire when we are doing uplift requests? You can get to this by going to your PR "Details" in the "Attachments" section above https://bugzilla.mozilla.org/show_bug.cgi?id=1829619#:~:text=github%2Dpull%2Drequest-,Details,-%7C%20Review

From there, you want to find the flag for "approval-mozilla-beta" and set the flag to "?". This will present a form that with similar questions that you would've been answering in the uplift spreadsheet, but this will simply attach the uplift request directly into a Bugzilla comment. If the request is approved, then the "?" should be changed to a "+".

We'll want to learn how to adopt this practise in the future for when we move from GitHub into m-c since the sheriffs will be the ones involved with uplifting the patch for you.

Hey gl, thanks for the comment! I was just requesting Joe for his opinion, if we were in sync, would've done that :)

Hey! Summarizing some of our Slack convo about this for the public:

I'm a bit nervous about uplifting this immediately because:

  • It's not been QAed and there doesn't seem to be a way to QA it consistently
  • The diff is appx 'medium' complexity (not enormous, but also not just a small several-line change)
  • The diff is in a very low-level component (Activity itself), so if it causes a regression, it would be possible for that regression to affect a lot more people than the current crash affects.

I think it'd be best to schedule this for an uplift only after soaking in Nightly for at least a week. (I'm not sure if there's a 'systematic' way to track something like that, or if we should just track it manually and request the uplift later)

Flags: needinfo?(jmahon)

(In reply to Joe M [:jmahon] from comment #7)

I'm not sure if there's a 'systematic' way to track something like that, or if we should just track it manually and request the uplift later

Leaving the status set to fix-optional or affected will keep it on our radar if we want to consider taking this later down the road via the burndown queries we look at.

Sounds fair to me. Thanks Joe and Ryan!

Is this ready for a v113 uplift PR and release approval request?

Flags: needinfo?(rsainani)

Oh, thanks for the reminder Ryan! Looks OK to me to uplift at this point.

Comment on attachment 9333350 [details] [review]
[mozilla-mobile/firefox-android] Bug 1829619 - Fix external ActivityNotFoundException for default browser settings (backport #1754) (#2013)

Beta/Release Uplift Approval Request

Note that the keyword "MANAGE_DEFAULT_APPS_SETTINGS" is important for the search. Not all "ActivityNotFoundException"s are related to this bug.

  • 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): The patch checks whether the default apps screen is available on android before navigating to it. If it's not present, the SUMO page for making firefox the default browser is opened, similar to other android versions where default apps screen cannot be navigated to from an app.
  • String changes made/needed: no
  • Is Android affected?: Yes
Flags: needinfo?(rsainani)
Attachment #9333350 - Flags: approval-mozilla-release?
Comment on attachment 9333350 [details] [review] [mozilla-mobile/firefox-android] Bug 1829619 - Fix external ActivityNotFoundException for default browser settings (backport #1754) (#2013) Approved for Fenix 113.1.0.
Attachment #9333350 - Flags: approval-mozilla-release? → approval-mozilla-release+

Authored by https://github.com/rahulsainani
https://github.com/mozilla-mobile/firefox-android/commit/b18a68219ab5778721d3bd45baa3eaffb8ccfc44
[releases_v113] Bug 1829619 - Fix external ActivityNotFoundException for default browser settings

Flags: qe-verify+
Flags: qe-verify+
See Also: → 1869770
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: