Closed Bug 1646242 Opened 4 years ago Closed 1 year ago

Focus Crash in [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(Fragment.java)]

Categories

(Focus :: General, defect, P3)

ARM64
Android

Tracking

(firefox100 wontfix, firefox105 wontfix, firefox106 wontfix, firefox107 wontfix, firefox108 wontfix, firefox109 wontfix, firefox110 wontfix, firefox111 wontfix, firefox112 wontfix, firefox113 verified)

RESOLVED FIXED
113 Branch
Tracking Status
firefox100 --- wontfix
firefox105 --- wontfix
firefox106 --- wontfix
firefox107 --- wontfix
firefox108 --- wontfix
firefox109 --- wontfix
firefox110 --- wontfix
firefox111 --- wontfix
firefox112 --- wontfix
firefox113 --- verified

People

(Reporter: RyanVM, Assigned: mcarare)

References

Details

(Keywords: crash)

Crash Data

Attachments

(1 file)

This bug is for crash report bp-d8f2cd58-eba7-43b8-a174-f65dc0200617.

Currently the #5 overall topcrash for Focus 8.4.0.

Java stack trace:

java.lang.IllegalStateException
	at androidx.fragment.app.Fragment.requireContext(Fragment.java:2)
	at androidx.transition.CanvasUtils.getRequireComponents(CanvasUtils.java:1)
	at org.mozilla.focus.session.ui.SessionViewHolder$selectSession$1.onAnimationEnd(SessionViewHolder.kt:3)
	at android.view.RenderNodeAnimator.onFinished(RenderNodeAnimator.java:380)
	at android.animation.RevealAnimator.onFinished(RevealAnimator.java:43)
	at android.view.RenderNodeAnimator.callOnFinished(RenderNodeAnimator.java:487)
	at android.os.MessageQueue.nativePollOnce(Native Method)
	at android.os.MessageQueue.next(MessageQueue.java:325)
	at android.os.Looper.loop(Looper.java:142)
	at android.app.ActivityThread.main(ActivityThread.java:6673)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:769)
Summary: Crash in [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(Fragment.java)] → Focus Crash in [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(Fragment.java)]
See Also: → 1646250

I have encountered this crash today, on the Focus beta 100.0.0-beta.1 with Lenovo tablet M10 (Android 10):

8a2fe82e-8795-4796-82d4-43314e574e24
java.lang.IllegalStateException: Fragment SecretSettingsFragment{6573abd} (73b43dd2-e7c8-4c96-b515-f395f523813a) not attached to a context.


java.lang.IllegalStateException: Fragment SecretSettingsFragment{6573abd} (73b43dd2-e7c8-4c96-b515-f395f523813a) not attached to a context.
at androidx.fragment.app.Fragment.requireContext(Fragment.java:2)
at androidx.fragment.app.Fragment.getResources(Fragment.java:1)
at org.mozilla.focus.ext.FragmentKt.getPreferenceKey(Fragment.kt:1)
at org.mozilla.focus.settings.advanced.SecretSettingsFragment.onSharedPreferenceChanged(SecretSettingsFragment.kt:1)
at android.app.SharedPreferencesImpl$EditorImpl.notifyListeners(SharedPreferencesImpl.java:612)
at android.app.SharedPreferencesImpl$EditorImpl.apply(SharedPreferencesImpl.java:494)
at androidx.preference.Preference.persistBoolean(Preference.java:8)
at androidx.preference.TwoStatePreference.setChecked(TwoStatePreference.java:5)
at androidx.preference.TwoStatePreference.onClick(TwoStatePreference.java:3)
at androidx.preference.Preference.performClick(Preference.java:3)
at androidx.preference.SwitchPreference.performClick(SwitchPreference.java:1)
at androidx.preference.Preference$1.onClick(Preference.java:1)
at android.view.View.performClick(View.java:7147)
at android.view.View.performClickInternal(View.java:7120)
at android.view.View.access$3500(View.java:804)
at android.view.View$PerformClick.run(View.java:27538)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7399)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:502)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)

The app crashed when I tapped the "Show home screen tips" from Settings - Mozilla.
I was not able to reproduce it again, just one time.
I was not able to reproduce it on other devices.

Hardware: Unspecified → ARM64
Severity: -- → S2
Priority: -- → P3
Component: Stability → General

I've encountered this crash on the latest Focus Nightly build 109.0a1 from 11/21 with Google Pixel 6 (Android 13).
I was browsing this page (in order to test something) http://www.millersmiles.co.uk/identitytheft/URL-spoofing-test.php, then I've accessed Settings - Privacy & Security - Cookies and Site Data, and selected the "Yes, please" option.
I was not able to reproduce the crash a second time.

Crash stats: https://crash-stats.mozilla.org/report/index/c56b066d-d591-4982-ae96-1251f0221121

java.lang.IllegalStateException: Fragment PrivacySecuritySettingsFragment{a9302a3} (3ccea527-3086-42d8-96e3-865a6d588cb1) not attached to a context.
	at androidx.fragment.app.Fragment.requireContext(Fragment.java:18)
	at androidx.fragment.app.Fragment.getResources(Fragment.java:1)
	at androidx.fragment.app.Fragment.getString(Fragment.java:1)
	at org.mozilla.focus.settings.privacy.PrivacySecuritySettingsFragment.onSharedPreferenceChanged(PrivacySecuritySettingsFragment.kt:23)
	at android.app.SharedPreferencesImpl$EditorImpl.notifyListeners(SharedPreferencesImpl.java:637)
	at android.app.SharedPreferencesImpl$EditorImpl.lambda$notifyListeners$0$android-app-SharedPreferencesImpl$EditorImpl(SharedPreferencesImpl.java:643)
	at android.app.SharedPreferencesImpl$EditorImpl$$ExternalSyntheticLambda0.run(Unknown Source:4)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7898)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Crash Signature: [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(Fragment.java)] → [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(Fragment.java)] [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(Unknown Source)] [@ java.lang.IllegalStateException: at androidx.fr…
Assignee: nobody → mcarare
Status: NEW → ASSIGNED
Crash Signature: androidx.fragment.app.Fragment.requireContext(Unknown Source:17)] → androidx.fragment.app.Fragment.requireContext(Unknown Source:17)] [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(:900)]
Crash Signature: [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(Fragment.java)] [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(Unknown Source)] [@ java.lang.IllegalStateException: at androidx.fr… → [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext] [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext] [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireCont…
Summary: Focus Crash in [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(Fragment.java)] → Focus Crash in [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext]
Crash Signature: [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext] [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext] [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireCont… → [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(Fragment.java)] [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(Unknown Source)] [@ java.lang.IllegalStateException: at androidx.fr…
Summary: Focus Crash in [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext] → Focus Crash in [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext(Fragment.java)]
Authored by https://github.com/mcarare
https://github.com/mozilla-mobile/firefox-android/commit/31882f1927f784df6611978c3b69466d6f723b19
[main] Bug 1646242 - Show ETP panel only if browser fragment is still attached.

Authored by https://github.com/mcarare
https://github.com/mozilla-mobile/firefox-android/commit/d5d731593ba1b9c863031127d698012177265ad2
[main] Bug 1646242 - Use button view context for retrieving app context.

Authored by https://github.com/mcarare
https://github.com/mozilla-mobile/firefox-android/commit/1523b46ec96c1d06210b95a689ce3d6b75889e85
[main] Bug 1646242 - Dispatch FinishEdit action only if UrlInputFragment is still attached.
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Flags: qe-verify+
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch

For QA: Test that showing the ETP panel, opening a downloaded file, and entering an URL does not produce crashes and runs as expected.

Verified on the latest Focus Nightly build 113.0a1 from 3/21 with the following devices:

  • Oppo Reno 6 (Android 13),
  • Sony Xperia Z5 Premium (Android 7.1.1),
  • Google Pixel 6 (Android 13), and
  • Samsung Galaxy Note 8 (Android 9).
Flags: qe-verify+

Mihai, do you think these crash fixes are safe to uplift to Focus Beta 112?

Flags: needinfo?(mcarare)

IMO these are safe to uplift. Not sure if the crash volume warrants an uplift. Will handle it if considered important.

Flags: needinfo?(mcarare)

(In reply to Mihai Adrian Carare [:mcarare] from comment #9)

Not sure if the crash volume warrants an uplift. Will handle it if considered important.

In that case, no need to uplift. I'll set the Beta status to wontfix.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: