Closed Bug 1034017 Opened 10 years ago Closed 9 years ago

crash in android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? at android.app.ContextImpl.startActivity(ContextImpl.java)

Categories

(Firefox for Android Graveyard :: General, defect)

33 Branch
ARM
Android
defect
Not set
critical

Tracking

(firefox31+ verified, firefox32 verified, firefox33 verified, fennec31+)

VERIFIED FIXED
Firefox 33
Tracking Status
firefox31 + verified
firefox32 --- verified
firefox33 --- verified
fennec 31+ ---

People

(Reporter: TeoVermesan, Assigned: blassey)

References

Details

(Keywords: crash, regression, reproducible)

Crash Data

This bug was filed from the Socorro interface and is 
report bp-443e4961-dd48-46f2-8639-3c6202140703.
=============================================================

Environment: 
Device: LG Nexus 4 (Android 4.4.2);
Build: Nightly 33.0a1 (2014-07-03);

Steps to reproduce:
1. Long Tap on a page from Top Sites/ History/ Bookmarks/ Reading List
2. Choose "Share"


Expected result:
- The user shares the page.

Actual result:
- Firefox crashes

Stacktrace:
android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
	at android.app.ContextImpl.startActivity(ContextImpl.java:1042)
	at android.app.ContextImpl.startActivity(ContextImpl.java:1029)
	at android.content.ContextWrapper.startActivity(ContextWrapper.java:311)
	at org.mozilla.gecko.GeckoAppShell.openUriExternal(GeckoAppShell.java:1134)
	at org.mozilla.gecko.home.HomeFragment.onContextItemSelected(HomeFragment.java:161)
	at org.mozilla.gecko.home.RecentTabsPanel.onContextItemSelected(RecentTabsPanel.java:50)
	at android.support.v4.app.Fragment.performContextItemSelected(Fragment.java:1623)
	at android.support.v4.app.FragmentManagerImpl.dispatchContextItemSelected(FragmentManager.java:2015)
	at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:381)
	at com.android.internal.policy.impl.PhoneWindow$DialogMenuCallback.onMenuItemSelected(PhoneWindow.java:3864)
	at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:741)
	at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
	at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:884)
	at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
	at com.android.internal.view.menu.MenuDialogHelper.onClick(MenuDialogHelper.java:167)
	at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:941)
	at android.widget.AdapterView.performItemClick(AdapterView.java:299)
	at android.widget.AbsListView.performItemClick(AbsListView.java:1113)
	at android.widget.AbsListView$PerformClick.run(AbsListView.java:2911)
	at android.widget.AbsListView$3.run(AbsListView.java:3645)
	at android.os.Handler.handleCallback(Handler.java:733)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:136)
	at android.app.ActivityThread.main(ActivityThread.java:5001)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
	at dalvik.system.NativeStart.main(Native Method)
Product: Firefox → Firefox for Android
Version: 33 Branch → Firefox 33
Reproducible also when trying to: share through action bar, reader mode, when trying to open a file from download manager, tapping the download notification after saving a video.
tracking-fennec: --- → ?
Regression:
mozilla-central
Good Build: 02-07-2014
Bad Build: 03-07-2014

Pushlog:http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=7075808c3306&tochange=38ecfc3922b8
https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=4ffff7bdb4c8&tochange=60133a85f8ae

97203a8ac74b	Brad Lassey — bug 1025931 - Crash java.lang.NullPointerException in in org.mozilla.gecko.GeckoAppShell.getContext r=snorp
Blocks: 1025931
Flags: needinfo?(blassey.bugs)
Flipping the 31 flag since bug 1025931 made it's way to mozilla-beta too.
Not all contexts are equal, and our code has been very bad about making that distinction.

To save me typing:

http://stackoverflow.com/a/7298955/22003

Brad's patch in Bug 1025931 means that resuming an activity after GeckoView/GeckoApp has launched will replace the previous GeckoAppShell activity context (from GeckoView.init) with an application context. Application contexts can't do UI work.

GeckoAppShell needs an activity context for when it's working with UI code. There are a number of possible solutions for this, ranging from conditionally setting through to maintaining two contexts in GAS, ideally with a weak reference to the activity context.

In the short term, backing out is the most straightforward option.

(Brad also snuck a tab into that patch. Sigh.)
backed out bug 1025931
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(blassey.bugs)
Resolution: --- → FIXED
tracking-fennec: ? → 31+
Device: LG Nexus 4 (Android 4.4.2);
Build: Nightly 33.0a1 (2014-07-04);
Share through action bar, reader mode, from about:home and  trying to open a file from download manager, tapping the download notification after saving a video, now can be performed with no issues. 
So, I'll mark the bug as verified fixed.
Status: RESOLVED → VERIFIED
Assignee: nobody → blassey.bugs
Target Milestone: --- → Firefox 33
Verified as fixed in builds:
Nightly 33.0a1 (2014-07-04) based on Teodora's comment 7;
Aurora 32.0a2 (2014-07-08);
Beta 31.0b8;

Device: Motorola Razr (Android 4.0.4)
Just to update on this bug issue seems to be still happening well its returned 

Can confirm it's back https://crash-stats.mozilla.com/report/index/ddac95cc-4efc-45c3-b4cd-99f1f2151122
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Sorry just seen the other bug and it got fixed
Status: REOPENED → RESOLVED
Closed: 10 years ago9 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.