Closed Bug 1280405 Opened 3 years ago Closed 3 years ago

Crash in java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(Unknown Source)

Categories

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

ARM
Android
defect
Not set
critical

Tracking

()

RESOLVED FIXED
Firefox 50
Tracking Status
firefox47 --- unaffected
firefox48 + fixed
firefox49 + fixed
fennec 48+ ---
firefox50 + fixed

People

(Reporter: kbrosnan, Assigned: mcomella)

References

Details

(Keywords: crash)

Crash Data

Attachments

(1 file)

This bug was filed from the Socorro interface and is 
report bp-5290a1c6-bfff-4812-b2a6-0679e2160609.
=============================================================

java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
	at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(Unknown Source)
	at android.support.v7.app.AppCompatDelegateImplV7.setContentView(Unknown Source)
	at android.support.v7.app.AppCompatActivity.setContentView(Unknown Source)
	at org.mozilla.gecko.GeckoApp.onCreate(GeckoApp.java:1267)
	at org.mozilla.gecko.BrowserApp.onCreate(BrowserApp.java:634)
	at android.app.Activity.performCreate(Activity.java:6550)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3102)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3248)
	at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5146)
	at android.app.ActivityThread.access$1100(ActivityThread.java:197)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1687)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:145)
	at android.app.ActivityThread.main(ActivityThread.java:6872)
	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:1404)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

This is a new crash in 48.

Mfgr      Model     Andr API    CPU ABI    #  
samsung  SM-N910F   22 (REL)  armeabi-v7a  4  6.6%
samsung  SM-A7000   21 (REL)  armeabi-v7a  2  3.3%
samsung  SM-G530BT  19 (REL)  armeabi-v7a  2  3.3%
samsung  SM-G531F   22 (REL)  armeabi-v7a  2  3.3%
samsung  SM-N9005   21 (REL)  armeabi-v7a  2  3.3%
sony     E6883      23 (REL)  armeabi-v7a  2  3.3%
htc      HTL23      21 (REL)  armeabi-v7a  2  3.3%
Link to crashes: http://bit.ly/28PZCSQ. Right now #31 on the 48 top crash list.
Mike, can you take a look at this?
Assignee: nobody → michael.l.comella
tracking-fennec: ? → 48+
Flags: needinfo?(michael.l.comella)
It looks like the error is thrown here [1]:

        if (!a.hasValue(R.styleable.Theme_windowActionBar)) {
            a.recycle();
            throw new IllegalStateException(
                    "You need to use a Theme.AppCompat theme (or descendant) with this activity.");
        }

which is actually one call further into the stack trace – ensureSubDecor calls createSubDecor which is ^.

It's odd because not having the windowActionBar attr doesn't seem like it would affect whether or not you inherit from Theme.AppCompat. But that's the crash so we have to live with it.

Thoughts:
  1) We specify "windowActionBar" in all configurations [2]. However, we do not specify "android:windowActionBar". It's possible these crashing devices in particular are looking for the that specific attr.
  2) An activity that isn't BrowserApp (e.g. shareoverlay or dialog) are being launched and don't extend AppCompat correctly. I doubt this is the case because the stack trace indicates otherwise, but ¯\_(ツ)_/¯

[1]: https://github.com/android/platform_frameworks_support/blob/625c9c3db9bb6f6b92ca35b74f26a61a04ec8cd7/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV7.java#L308
[2]: https://dxr.mozilla.org/mozilla-beta/search?q=windowactionbar&redirect=false
Flags: needinfo?(michael.l.comella)
Wikimedia had a similar issue: https://phabricator.wikimedia.org/T75236

It eventually just disappeared for them though. :|
Clearly I should put on my spectacles – in the base configuration, windowActionBar is only specified for Gecko.Preferences [1] but not GeckoBase, which the activity inherits from. Still, it's odd this affects v11+ devices given that we have other configurations for those – maybe it's because these particular devices are doing special things.

Since I can't reproduce, we'll just have to post a patch and see how it goes.

If this does not bear fruit, some other thoughts:
 * List of changes on the themes.xml in beta: https://hg.mozilla.org/releases/mozilla-beta/filelog/229741b7de0485ca56b91e0e657fe5d37dbbc98f/mobile/android/base/resources/values/themes.xml
 * Perhaps we changed our support library dependencies in this version

[1]: https://dxr.mozilla.org/mozilla-beta/rev/229741b7de0485ca56b91e0e657fe5d37dbbc98f/mobile/android/base/resources/values/themes.xml#25
Comment on attachment 8765637 [details]
Bug 1280405 - Add windowActionBar to theme in base configuration.

Note: this is missing on 48 (maybe before?) -> 50.

Approval Request Comment
[Feature/regressing bug #]: Unknown.
[User impact if declined]: Users on particular devices crash.
[Describe test coverage new/current, TreeHerder]: Tested locally
[Risks and why]: Low – we add an attribute which (I expect) to be disabled by default. We don't support devices before v11 so I don't think this will even have a visible effect, except perhaps on the crashing devices.
[String/UUID change made/needed]: None.
Attachment #8765637 - Flags: approval-mozilla-beta?
Attachment #8765637 - Flags: approval-mozilla-aurora?
Comment on attachment 8765637 [details]
Bug 1280405 - Add windowActionBar to theme in base configuration.

https://reviewboard.mozilla.org/r/60918/#review57814
Attachment #8765637 - Flags: review?(ahunt) → review+
https://hg.mozilla.org/mozilla-central/rev/a6c376df05ce
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 50
Comment on attachment 8765637 [details]
Bug 1280405 - Add windowActionBar to theme in base configuration.

Fix a crash, taking it.
should be in 48 beta 6
Attachment #8765637 - Flags: approval-mozilla-beta?
Attachment #8765637 - Flags: approval-mozilla-beta+
Attachment #8765637 - Flags: approval-mozilla-aurora?
Attachment #8765637 - Flags: approval-mozilla-aurora+
Track this as this crash happened in 48~50.
See Also: → 1389082
You need to log in before you can comment on or make changes to this bug.