Fixed
Status Update
Comments
mm...@commonsware.com <mm...@commonsware.com> #2
am...@google.com <am...@google.com>
am...@google.com <am...@google.com> #3
Hi,
Not observing the reported crash on the below environment
Nexus 5X emulator with 7.0 and 7.1.1
Nexus 5X device with 7.0 and 7.1.1
Also Nexus 6P with above said builds, with emulator also
The app is launching fine without any crash
So please do provide any other inputs which exactly says how to reproduce the issue, either with video or screenrecord.
Also let me know, if it is working fine on 7.1.1 and is the issue only on 7.0?
Also provide the bugreport
Android bug report:
After reproducing the issue, navigate to developer settings, ensure ‘USB debugging’ is enabled, then enable ‘Bug report shortcut’. To take bug report, hold the power button and select the ‘Take bug report’ option.
Note: Please upload the bug report to google drive and share the folder to android-bugreport@google.com, then share the link here.
Not observing the reported crash on the below environment
Nexus 5X emulator with 7.0 and 7.1.1
Nexus 5X device with 7.0 and 7.1.1
Also Nexus 6P with above said builds, with emulator also
The app is launching fine without any crash
So please do provide any other inputs which exactly says how to reproduce the issue, either with video or screenrecord.
Also let me know, if it is working fine on 7.1.1 and is the issue only on 7.0?
Also provide the bugreport
Android bug report:
After reproducing the issue, navigate to developer settings, ensure ‘USB debugging’ is enabled, then enable ‘Bug report shortcut’. To take bug report, hold the power button and select the ‘Take bug report’ option.
Note: Please upload the bug report to google drive and share the folder to android-bugreport@google.com, then share the link here.
mm...@commonsware.com <mm...@commonsware.com> #4
Wonderful! That means that you reproduced the problem seven times. The problem is that THE APP IS SUPPOSED TO CRASH. The behavior regression is that the app does not crash on 7.0+, when it should.
> The app is launching fine without any crash
Fantastic! You are able to reliably reproduce the problem!
> So please do provide any other inputs which exactly says how to reproduce the issue, either with video or screenrecord.
Just keep doing what you are doing, as you have reproduced the problem seven times.
> Also let me know, if it is working fine on 7.1.1 and is the issue only on 7.0?
The behavior regression can be seen on both 7.0 and 7.1.1. You know this, because you reproduced the problem on both 7.0 and 7.1.1.
am...@google.com <am...@google.com> #5
Hi,
We have passed this defect on to the development team and will update this issue with more information as it becomes available.
Thanks
We have passed this defect on to the development team and will update this issue with more information as it becomes available.
Thanks
mm...@commonsware.com <mm...@commonsware.com> #6
This issue still exists on the O Developer Preview 1. I have cross-filed it as:
https://issuetracker.google.com/issues/36520749
am...@google.com <am...@google.com> #7
Our engineering team has fixed this issue. It will be available in a future Android release.
Description
example, NPF10C). See Settings > About phone > Build number
NDE63L (Google Pixel) and NPF10C (Nexus 5X)
* What device are you using? (for example, Nexus 6P)
Google Pixel and Nexus 5X
* What are the steps to reproduce the problem? (Please provide the
minimal reproducible test case.)
Import the attached project into Android Studio and run it. Contrast the results with running the same app on an Android 6.0 device.
* What was the expected result?
The following stack trace, or the equivalent:
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:672)
at android.app.ContextImpl.startActivity(ContextImpl.java:659)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:331)
at com.commonsware.myapplication.MyIntentService.onHandleIntent(MyIntentService.java:14)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
That is because we are starting an activity from a service. This has crashed with this error for years.
* What was the actual result?
No crash. You see an activity.
* Relevant logcat output.
See above.
This change was introduced in Android 7.0. In Android 6.0.1, we have:
Android will throw the "requires FLAG_ACTIVITY_NEW_TASK" exception if that flag is not set.
In Android 7.0, that code is changed to:
Now, that exception will only be thrown if:
- the flag is missing, AND
- the options Bundle is supplied, AND
- getLaunchTaskId() is -1 on the ActivityOptions inflated from that Bundle
If this is intended, and we can now start activities from random Contexts without FLAG_ACTIVITY_NEW_TASK, that should be documented somewhere. Otherwise, my guess is that:
if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0
&& options != null && ActivityOptions.fromBundle(options).getLaunchTaskId() == -1)
might really need to be:
if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0
&& (options == null || ActivityOptions.fromBundle(options).getLaunchTaskId() != -1))