Closed Bug 1192346 Opened 9 years ago Closed 9 years ago

NullPointerException: RestrictedProfiles.isGuestProfile(RestrictedProfiles.java:54)

Categories

(Firefox for Android Graveyard :: Profile Handling, defect)

42 Branch
All
Android
defect
Not set
normal

Tracking

(firefox42 fixed, firefox43 fixed)

RESOLVED FIXED
Firefox 43
Tracking Status
firefox42 --- fixed
firefox43 --- fixed

People

(Reporter: sebastian, Assigned: sebastian)

References

Details

Attachments

(1 file)

This crash happens pretty reliable after browsing the settings and sync status activity for some time. I assume this is outfall from removing the static initWithProfile() method.

> 08-07 16:37:46.219    5138-5138/org.mozilla.fennec_sebastian E/AndroidRuntime﹕ FATAL EXCEPTION: main
>     Process: org.mozilla.fennec_sebastian, PID: 5138
>    java.lang.NullPointerException: Attempt to invoke interface method 'org.mozilla.gecko.GeckoProfile org.mozilla.gecko.GeckoAppShell$GeckoInterface.getProfile()' on a null object reference
>             at org.mozilla.gecko.RestrictedProfiles.isGuestProfile(RestrictedProfiles.java:54)
>             at org.mozilla.gecko.RestrictedProfiles.createConfiguration(RestrictedProfiles.java:44)
>             at org.mozilla.gecko.RestrictedProfiles.getConfiguration(RestrictedProfiles.java:32)
>             at org.mozilla.gecko.RestrictedProfiles.isAllowed(RestrictedProfiles.java:101)
>             at org.mozilla.gecko.preferences.GeckoPreferences.setupPreferences(GeckoPreferences.java:814)
>             at org.mozilla.gecko.preferences.GeckoPreferences.setupPreferences(GeckoPreferences.java:655)
>             at org.mozilla.gecko.preferences.GeckoPreferenceFragment.onCreate(GeckoPreferenceFragment.java:81)
>             at android.app.Fragment.performCreate(Fragment.java:2185)
>             at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:942)
>             at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1148)
>             at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1130)
>             at android.app.FragmentManagerImpl.dispatchCreate(FragmentManager.java:1948)
>             at android.app.FragmentController.dispatchCreate(FragmentController.java:141)
>             at android.app.Activity.onCreate(Activity.java:917)
>             at android.preference.PreferenceActivity.onCreate(PreferenceActivity.java:536)
>             at org.mozilla.gecko.preferences.GeckoPreferences.onCreate(GeckoPreferences.java:354)
>             at android.app.Activity.performCreate(Activity.java:6162)
>             at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
>             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2370)
>             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2477)
>             at android.app.ActivityThread.-wrap11(ActivityThread.java)
>             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1345)
>             at android.os.Handler.dispatchMessage(Handler.java:102)
>             at android.os.Looper.loop(Looper.java:148)
>             at android.app.ActivityThread.main(ActivityThread.java:5415)
>             at java.lang.reflect.Method.invoke(Native Method)
>             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:725)
>             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:615)
This is reproducible by enabling the developer option "Don't keep activities". After that pause and resume the settings activity.

It seems like GeckoInterface is not set on GeckoAppShell when GeckoPreferences resumes and queries RestrictedProfiles.
Status: NEW → ASSIGNED
This patch is partially restoring the previous behavior:
https://hg.mozilla.org/integration/fx-team/diff/8fd046b77ea3/mobile/android/base/preferences/GeckoPreferences.java

Background: We are in the settings activity. If we now switch to a different app then Android can decide to kill our process. Later when we go back to the application Android creates a new process and restores the state. Now we are in the settings activity again but Gecko never ran in this process. GeckoApp has not been started and therefore no GeckoInterface instance has been set on GeckoAppShell.

This patch now checks whether a GeckoInterface instance is available and if not then falls back to call GeckoProfile.get(context) like previously.
Attachment #8646372 - Flags: review?(mhaigh)
Comment on attachment 8646372 [details] [diff] [review]
1192346-gecko-profile.patch

LGTM
Attachment #8646372 - Flags: review?(mhaigh) → review+
url:        https://hg.mozilla.org/integration/fx-team/rev/10cab33e893c8627c02ecfe3dfdae94f5fea84f1
changeset:  10cab33e893c8627c02ecfe3dfdae94f5fea84f1
user:       Sebastian Kaspari <s.kaspari@gmail.com>
date:       Tue Aug 11 16:12:31 2015 +0200
description:
Bug 1192346 - RestrictedProfiles: If no GeckoInterface instance is available, try to get GeckoProfile from context. r=mhaigh
Comment on attachment 8646372 [details] [diff] [review]
1192346-gecko-profile.patch

Approval Request Comment
[Feature/regressing bug #]: Regression introduced in bug 1187260
[User impact if declined]: App crashing in settings if app is resumed and Android has cleaned the previous process.
[Describe test coverage new/current, TreeHerder]: Not covered by a UI test. Tested locally. Needs to reproduce system behavior (process re-creation)
[Risks and why]: Low Risk - Partial restoring previous behavior.
[String/UUID change made/needed]: -
Attachment #8646372 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/10cab33e893c
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 43
Comment on attachment 8646372 [details] [diff] [review]
1192346-gecko-profile.patch

Fix a crash, taking it.
Attachment #8646372 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: