Closed Bug 773562 Opened 12 years ago Closed 12 years ago

android.content.ActivityNotFoundException: at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java) on Motorola devices

Categories

(Firefox for Android Graveyard :: Android Sync, defect, P1)

ARM
Android
defect

Tracking

(firefox14+ fixed, firefox15+ verified)

VERIFIED FIXED
mozilla16
Tracking Status
firefox14 + fixed
firefox15 + verified

People

(Reporter: scoobidiver, Assigned: nalexander)

References

Details

(Keywords: crash, regression, Whiteboard: [native-crash][sync])

Crash Data

Attachments

(1 file, 1 obsolete file)

It's currently #14 top crasher in 14.0b12 where it first appeared and has been hit by 3 users.
The regression range is:
http://hg.mozilla.org/releases/mozilla-beta/pushloghtml?fromchange=60598398e29c&tochange=f0f236ff96dd
It's a regression from bug 721760.

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.motorola.blur.setup/com.motorola.blur.settings.AccountsAndServicesPreferenceActivity}; have you declared this activity in your AndroidManifest.xml?
	at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
	at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
	at android.app.Activity.startActivityForResult(Activity.java:3248)
	at android.app.Activity.startActivity(Activity.java:3359)
	at org.mozilla.gecko.sync.setup.SyncAccounts.openSyncSettings(SyncAccounts.java:378)
	at org.mozilla.gecko.sync.setup.activities.SetupSuccessActivity.settingsClickHandler(SetupSuccessActivity.java:81)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at android.view.View$1.onClick(View.java:3041)
	at android.view.View.performClick(View.java:3526)
	at android.view.View$PerformClick.run(View.java:14133)
	at android.os.Handler.handleCallback(Handler.java:605)
	at android.os.Handler.dispatchMessage(Handler.java:92)
	at android.os.Looper.loop(Looper.java:137)
	at android.app.ActivityThread.main(ActivityThread.java:4697)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
	at dalvik.system.NativeStart.main(Native Method)

More reports at:
https://crash-stats.mozilla.com/report/list?signature=android.content.ActivityNotFoundException%3A+at+android.app.Instrumentation.checkStartActivityResult%28Instrumentation.java%29
Component: General → Android Sync
Product: Firefox for Android → Mozilla Services
Version: Firefox 14 → unspecified
Relevant code is:

    try {
      // Allow Motorola Blur package to be loaded.
      final int contextFlags = Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY;
      Context foreignContext = context.createPackageContext(MOTO_BLUR_PACKAGE, contextFlags);
      Class<?> motorolaAccounts = foreignContext.getClassLoader().loadClass(MOTO_BLUR_SETTINGS_ACTIVITY);
      Logger.info(LOG_TAG, "Blur package found. Launching Moto activity.");
      intent = new Intent(foreignContext, motorolaAccounts);
    } catch (NameNotFoundException e) {
      Logger.debug(LOG_TAG, "No Blur package. Using default Sync Settings intent.");
      intent = new Intent(Settings.ACTION_SYNC_SETTINGS);
    } catch (ClassNotFoundException e) {
      Logger.warn(LOG_TAG, "Blur package found but no class. Launching Sync Settings normally.", e);
      intent = new Intent(Settings.ACTION_SYNC_SETTINGS);
    }
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);

Somehow we're finding the class and building the Intent, and then Android is failing.  FFS.  Can we can bandaid?  Wrap startActivity in try catch, fall back to using the Sync intent if we catch an exception?
(In reply to Nick Alexander :nalexander from comment #1)

> Somehow we're finding the class and building the Intent, and then Android is
> failing.  FFS.  Can we can bandaid?  Wrap startActivity in try catch, fall
> back to using the Sync intent if we catch an exception?

Oh, Android.

Yes, BandAid®. This is hacky workaround code anyway.
Priority: -- → P1
Test APK at

http://people.mozilla.com/~nalexander/fennec-blur.apk

Test instructions:

First, verify you see the problem:

0. install Nightly.
1. pair Sync with existing Sync account.
2. from Fennec, select Settings > Sync.
3. verify crash of some sort (see above); logs will say for sure.

Second, verify that this works around the problem:

1. install APK (can be on top; should preserve account, etc).
2. Verify that Force Sync works.
3. from Fennec, select Settings > Sync.
4. verify no crash; you should see something like 

D FxSync(16569)               SyncAccounts :: Blur package and class found, but activity not found. Launching Sync Settings normally.

Third, tell us whether you got to the Sync settings, or if you got to Battery & data.  Logs even better!
Verified by bnicholson on a RAZR:

14:14 bnicholson: nalexander: your build works for me - it takes me to Accounts & sync
14:15 nalexander: bnicholson: v.g.  Did it crash before?
14:15 bnicholson: yep
https://hg.mozilla.org/integration/mozilla-inbound/rev/be16c1ae0133
Assignee: nobody → nalexander
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla16
Could we get QA on devices that exhibited Bug 721760, please?
Keywords: qawanted
(In reply to Nick Alexander :nalexander from comment #6)
> Could we get QA on devices that exhibited Bug 721760, please?

Motorla Droid Pro, tested the above APK and the fix from bug 721760 still holds.
Keywords: qawanted
We'll be backing out https://bugzilla.mozilla.org/show_bug.cgi?id=721760#c54 on both mozilla-beta and mozilla-release due to this bug.
https://hg.mozilla.org/mozilla-central/rev/be16c1ae0133
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
This doesn't appear to be affecting 15, please correct me if I'm wrong, so I'm untracking and marking unaffected for 15.
(In reply to Lukas Blakk [:lsblakk] from comment #10)
> This doesn't appear to be affecting 15, please correct me if I'm wrong, so
> I'm untracking and marking unaffected for 15.
15.0a2 is affected.
Attached patch patch against m-b (obsolete) — Splinter Review
[Approval Request Comment]
Bug caused by (feature/regressing bug #):

Regression from Bug 721760.

User impact if declined:

Continued crashing on some Motorola devices.

Testing completed (on m-c, etc.):

QA has tested this with custom m-b builds.

Risk to taking this patch (and alternatives if risky):

Very low risk -- just catches the relevant exception.

String or UUID changes made by this patch:

None.
Attachment #645052 - Flags: approval-mozilla-beta?
PS.  This does not need to be landed on m-a.
Blocks: 774233
Comment on attachment 645052 [details] [diff] [review]
patch against m-b

Review of attachment 645052 [details] [diff] [review]:
-----------------------------------------------------------------

Rubberstamp. But please correct my username in the commit message :)
Attachment #645052 - Flags: review+
Attachment #645052 - Attachment is obsolete: true
Attachment #645052 - Flags: approval-mozilla-beta?
Comment on attachment 645057 [details] [diff] [review]
patch against m-b

[Approval Request Comment]
Bug caused by (feature/regressing bug #): 
User impact if declined: 
Testing completed (on m-c, etc.): 
Risk to taking this patch (and alternatives if risky): 
String or UUID changes made by this patch:

As above.
Attachment #645057 - Flags: approval-mozilla-beta?
Attachment #645057 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Status: RESOLVED → VERIFIED
Product: Mozilla Services → Android Background Services
tracking-fennec: ? → ---
Product: Android Background Services → Firefox for Android
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: