Fixed
Status Update
Comments
lb...@gmail.com <lb...@gmail.com> #2
This issue does not reproduce with dev preview 4.
am...@google.com <am...@google.com>
dn...@google.com <dn...@google.com>
am...@google.com <am...@google.com> #3
Closing this issue as per comment #2 from reporter.
lb...@gmail.com <lb...@gmail.com> #4
The sample does create a shortcut. You are supposed to click the FAB.
Weird thing is that it doesn't crash anymore.
However, I have succeeded causing the launcher to crash.
If you remove the part of setting an icon, it crashes:
ShortcutInfoCompat pinShortcutInfo = new ShortcutInfoCompat.Builder(context, "aaa")
//.setIcon(IconCompat.createWithResource(context, R.mipmap.ic_launcher))
.setShortLabel("My " + System.currentTimeMillis())
.setIntent(new Intent(context, MainActivity.class).setAction(Intent.ACTION_MAIN))
.build();
ShortcutManagerCompat.requestPinShortcut(context, pinShortcutInfo, null);
The reason there should be a way not to set an icon, is that the icon should be generated each time the target app gets updated.
For example, suppose you create a shortcut to another app, and the app got updated, while also updating its app icon. The app icon should get updated on the launcher. Same goes for when you create the shortcut to a specific Activity within the app.
In order to get the most recent app icon of the app, each time it gets updated, you should use something like that:
private static String tryGetResourceName(Resources resources, int iconRes) {
if (iconRes == 0)
return null;
try {
String iconResourceName = resources.getResourceName(iconRes);
return iconResourceName;
} catch (Exception e) {
return null;
}
}
int iconRes = 0;
final ApplicationInfo applicationInfo = AppInfoUtil.getApplicationInfo(context, packageName);
if (applicationInfo == null)
// app doesn't exist, so need to actually remove the icon
return null;
final PackageManager pm = context.getPackageManager();
try {
Resources resources = pm.getResourcesForApplication(packageName);
final Intent launchIntentForPackage = pm.getLaunchIntentForPackage(packageName);
String iconResourceName = null;
if (launchIntentForPackage != null && TextUtils.equals(launchIntentForPackage.getComponent().getClassName(), fullPathToActivity))
iconRes = applicationInfo.icon;
else
iconRes = pm.getActivityInfo(new ComponentName(packageName, fullPathToActivity), 0).icon;
if (iconRes == 0 || (iconResourceName = tryGetResourceName(resources, iconRes)) == null)
iconRes = applicationInfo.icon;
if (iconRes == 0 || (iconResourceName = tryGetResourceName(resources, iconRes)) == null)
iconRes = android.R.drawable.sym_def_app_icon;
if (iconResourceName == null)
iconResourceName = context.getResources().getResourceName(iconRes);
// use iconResourceName for the shortcut
Anyway, back to what you wrote:
1. Steps to reproduce
Remove the part of setting the icon. Run the sample. Click the FAB.
2. Attached bug report.
Weird thing is that it doesn't crash anymore.
However, I have succeeded causing the launcher to crash.
If you remove the part of setting an icon, it crashes:
ShortcutInfoCompat pinShortcutInfo = new ShortcutInfoCompat.Builder(context, "aaa")
//.setIcon(IconCompat.createWithResource(context, R.mipmap.ic_launcher))
.setShortLabel("My " + System.currentTimeMillis())
.setIntent(new Intent(context, MainActivity.class).setAction(Intent.ACTION_MAIN))
.build();
ShortcutManagerCompat.requestPinShortcut(context, pinShortcutInfo, null);
The reason there should be a way not to set an icon, is that the icon should be generated each time the target app gets updated.
For example, suppose you create a shortcut to another app, and the app got updated, while also updating its app icon. The app icon should get updated on the launcher. Same goes for when you create the shortcut to a specific Activity within the app.
In order to get the most recent app icon of the app, each time it gets updated, you should use something like that:
private static String tryGetResourceName(Resources resources, int iconRes) {
if (iconRes == 0)
return null;
try {
String iconResourceName = resources.getResourceName(iconRes);
return iconResourceName;
} catch (Exception e) {
return null;
}
}
int iconRes = 0;
final ApplicationInfo applicationInfo = AppInfoUtil.getApplicationInfo(context, packageName);
if (applicationInfo == null)
// app doesn't exist, so need to actually remove the icon
return null;
final PackageManager pm = context.getPackageManager();
try {
Resources resources = pm.getResourcesForApplication(packageName);
final Intent launchIntentForPackage = pm.getLaunchIntentForPackage(packageName);
String iconResourceName = null;
if (launchIntentForPackage != null && TextUtils.equals(launchIntentForPackage.getComponent().getClassName(), fullPathToActivity))
iconRes = applicationInfo.icon;
else
iconRes = pm.getActivityInfo(new ComponentName(packageName, fullPathToActivity), 0).icon;
if (iconRes == 0 || (iconResourceName = tryGetResourceName(resources, iconRes)) == null)
iconRes = applicationInfo.icon;
if (iconRes == 0 || (iconResourceName = tryGetResourceName(resources, iconRes)) == null)
iconRes = android.R.drawable.sym_def_app_icon;
if (iconResourceName == null)
iconResourceName = context.getResources().getResourceName(iconRes);
// use iconResourceName for the shortcut
Anyway, back to what you wrote:
1. Steps to reproduce
Remove the part of setting the icon. Run the sample. Click the FAB.
2. Attached bug report.
lb...@gmail.com <lb...@gmail.com> #5
The video shows how to reproduce the issue.
Again, weird thing is that I saw the crash occurs while the icon is being set.
I also still can't find information about what the "id" is supposed to be.
Please tell what it is used for, and update the docs.
Again, weird thing is that I saw the crash occurs while the icon is being set.
I also still can't find information about what the "id" is supposed to be.
Please tell what it is used for, and update the docs.
am...@google.com <am...@google.com> #6
We have not been able to observe the crash on Oreo release, OPR6.160623.013 by commenting the below lines.
ShortcutInfoCompat pinShortcutInfo = new ShortcutInfoCompat.Builder(context, "aaa")
.setIcon(IconCompat.createWithResource(context, R.mipmap.ic_launcher))
.setShortLabel("My " + System.currentTimeMillis())
.setIntent(new Intent(context, MainActivity.class).setAction(Intent.ACTION_MAIN))
.build();
ShortcutManagerCompat.requestPinShortcut(context, pinShortcutInfo, null);
Attached 2 videos for reference, one is creating the shortcut and the other one having the aforementioned lines commented, is not crashing.
So please provide your feedback on this.
ShortcutInfoCompat pinShortcutInfo = new ShortcutInfoCompat.Builder(context, "aaa")
.setIcon(IconCompat.createWithResource(context, R.mipmap.ic_launcher))
.setShortLabel("My " + System.currentTimeMillis())
.setIntent(new Intent(context, MainActivity.class).setAction(Intent.ACTION_MAIN))
.build();
ShortcutManagerCompat.requestPinShortcut(context, pinShortcutInfo, null);
Attached 2 videos for reference, one is creating the shortcut and the other one having the aforementioned lines commented, is not crashing.
So please provide your feedback on this.
lb...@gmail.com <lb...@gmail.com> #7
@6 Tested again, on both my Nexus 5x and on emulator.
Still crashes.
On Nexus 5x, I have OPR6.170623.013, and on emulator, it's on OSR1.170720.005
Having this code:
ShortcutInfoCompat pinShortcutInfo = new ShortcutInfoCompat.Builder(context, "aaa")
//.setIcon(IconCompat.createWithResource(context, R.mipmap.ic_launcher))
.setShortLabel("My " + System.currentTimeMillis())
.setIntent(new Intent(context, MainActivity.class).setAction(Intent.ACTION_MAIN))
.build();
ShortcutManagerCompat.requestPinShortcut(context, pinShortcutInfo, null);
It crashes on the "google now launcher" , with this log:
08-29 23:34:25.956 23339-23616/? E/AndroidRuntime: FATAL EXCEPTION: pool-2-thread-2
Process: com.google.android.googlequicksearchbox, PID: 23339
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:353)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable.mutate()' on a null object reference
at com.android.launcher3.WidgetPreviewLoader.mutateOnMainThread(SourceFile:136)
at com.android.launcher3.WidgetPreviewLoader$PreviewLoadTask.doInBackground$51DKOQJ1EPGIUR31DPJIULJFD5I3MAACC5N68SJFD5I2UPRIC5O6GQB3ECNK4QBKDLGN0EO_0(SourceFile:44)
at com.android.launcher3.WidgetPreviewLoader$PreviewLoadTask.doInBackground(SourceFile:79)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable.mutate()' on a null object reference
at java.util.concurrent.FutureTask.report(FutureTask.java:123)
at java.util.concurrent.FutureTask.get(FutureTask.java:193)
at com.android.launcher3.WidgetPreviewLoader.mutateOnMainThread(SourceFile:130)
at com.android.launcher3.WidgetPreviewLoader$PreviewLoadTask.doInBackground$51DKOQJ1EPGIUR31DPJIULJFD5I3MAACC5N68SJFD5I2UPRIC5O6GQB3ECNK4QBKDLGN0EO_0(SourceFile:44)
at com.android.launcher3.WidgetPreviewLoader$PreviewLoadTask.doInBackground(SourceFile:79)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable.mutate()' on a null object reference
at com.android.launcher3.WidgetPreviewLoader$1.call(SourceFile:3)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Attached new video of device itself and a new one with emulator. Since the launcher crashes, it goes to my other launcher (Nova), which sadly doesn't support shortcuts on Android O at all, because there is no backward compatibility of shortcuts (which I consider a huge issue, as I can't get any shortcuts of anything automatically anymore:https://issuetracker.google.com/issues/65119381 ) .
Not only that, but the shortcuts that I can create manually are very ugly because of "adaptive icons" idea, which puts a shaped background for every icon without any reason, and I have no choice about it either.
Since you probably fail to create the correct APK to reproduce it, I've also attached it.
Still crashes.
On Nexus 5x, I have OPR6.170623.013, and on emulator, it's on OSR1.170720.005
Having this code:
ShortcutInfoCompat pinShortcutInfo = new ShortcutInfoCompat.Builder(context, "aaa")
//.setIcon(IconCompat.createWithResource(context, R.mipmap.ic_launcher))
.setShortLabel("My " + System.currentTimeMillis())
.setIntent(new Intent(context, MainActivity.class).setAction(Intent.ACTION_MAIN))
.build();
ShortcutManagerCompat.requestPinShortcut(context, pinShortcutInfo, null);
It crashes on the "google now launcher" , with this log:
08-29 23:34:25.956 23339-23616/? E/AndroidRuntime: FATAL EXCEPTION: pool-2-thread-2
Process: com.google.android.googlequicksearchbox, PID: 23339
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:353)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable.mutate()' on a null object reference
at com.android.launcher3.WidgetPreviewLoader.mutateOnMainThread(SourceFile:136)
at com.android.launcher3.WidgetPreviewLoader$PreviewLoadTask.doInBackground$51DKOQJ1EPGIUR31DPJIULJFD5I3MAACC5N68SJFD5I2UPRIC5O6GQB3ECNK4QBKDLGN0EO_0(SourceFile:44)
at com.android.launcher3.WidgetPreviewLoader$PreviewLoadTask.doInBackground(SourceFile:79)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable.mutate()' on a null object reference
at java.util.concurrent.FutureTask.report(FutureTask.java:123)
at java.util.concurrent.FutureTask.get(FutureTask.java:193)
at com.android.launcher3.WidgetPreviewLoader.mutateOnMainThread(SourceFile:130)
at com.android.launcher3.WidgetPreviewLoader$PreviewLoadTask.doInBackground$51DKOQJ1EPGIUR31DPJIULJFD5I3MAACC5N68SJFD5I2UPRIC5O6GQB3ECNK4QBKDLGN0EO_0(SourceFile:44)
at com.android.launcher3.WidgetPreviewLoader$PreviewLoadTask.doInBackground(SourceFile:79)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable.mutate()' on a null object reference
at com.android.launcher3.WidgetPreviewLoader$1.call(SourceFile:3)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Attached new video of device itself and a new one with emulator. Since the launcher crashes, it goes to my other launcher (Nova), which sadly doesn't support shortcuts on Android O at all, because there is no backward compatibility of shortcuts (which I consider a huge issue, as I can't get any shortcuts of anything automatically anymore:
Not only that, but the shortcuts that I can create manually are very ugly because of "adaptive icons" idea, which puts a shaped background for every icon without any reason, and I have no choice about it either.
Since you probably fail to create the correct APK to reproduce it, I've also attached it.
am...@google.com <am...@google.com> #8
Thanks for the clarity on the details. We have shared this with our product and engineering team and will update this issue with more information as it becomes available.
lb...@gmail.com <lb...@gmail.com> #9
@8 Still don't get how I got a crash even in the case that I do provide an icon, and I still don't get why I need to provide and ID. What is its purpose, and why isn't it documented.
Can you please explain?
Can you please explain?
am...@google.com <am...@google.com> #10
Our engineering team has fixed the crash on Launcher side. However, we were able to reproduce the crash only when the icon was not set https://b.corp.google.com/issues/64831848#comment4 .
With regards to one of your comments on "The reason there should be a way not to set an icon, is that the icon should be generated each time the target app gets updated." — the way to update the shortcut's icon is viahttps://developer.android.com/reference/android/content/pm/ShortcutManager.html#updateShortcuts(java.util.List <android.content.pm.ShortcutInfo>). And JFYI, the docs for the id field is here: https://developer.android.com/reference/android/support/v4/content/pm/ShortcutInfoCompat.html#getId()
With regards to one of your comments on "The reason there should be a way not to set an icon, is that the icon should be generated each time the target app gets updated." — the way to update the shortcut's icon is via
lb...@gmail.com <lb...@gmail.com> #11
@10 I don't understand.
Suppose my app wishes to create a shortcut to another app, called "X" .
What should be done? My app should call "updateShortcuts" each time "X" gets updated? This doesn't make sense. Not only that, but getting the intent of updates to apps is not available anymore using the manifest alone (because of this annoying limitation:https://developer.android.com/about/versions/oreo/background.html#broadcasts ) . The app must be registered to this intent at runtime, meaning it must have a foreground service.
All this, to have an always-up-to-date icon for apps icons...
The launcher is supposed to be responsible about its app icons. Not the app that requested them... The API to request to update should be optional.
And what should be the ID ? It says :
"Shortcut IDs are unique within each publisher app and must be stable across devices so that shortcuts will still be valid when restored on a different device"
Should it be the packageName of the app "X" , with its activity path?
Why aren't the docs about the ID, inside the CTOR docs, where they are first introduced and used:
https://developer.android.com/reference/android/support/v4/content/pm/ShortcutInfoCompat.Builder.html#ShortcutInfoCompat.Builder(android.content.Context , java.lang.String)
?
While this API seems interesting, it doesn't seem to me it meets with the minimal, basic things a launcher should be able to do, which it could do before. To me it sounds limiting.
Suppose my app wishes to create a shortcut to another app, called "X" .
What should be done? My app should call "updateShortcuts" each time "X" gets updated? This doesn't make sense. Not only that, but getting the intent of updates to apps is not available anymore using the manifest alone (because of this annoying limitation:
All this, to have an always-up-to-date icon for apps icons...
The launcher is supposed to be responsible about its app icons. Not the app that requested them... The API to request to update should be optional.
And what should be the ID ? It says :
"Shortcut IDs are unique within each publisher app and must be stable across devices so that shortcuts will still be valid when restored on a different device"
Should it be the packageName of the app "X" , with its activity path?
Why aren't the docs about the ID, inside the CTOR docs, where they are first introduced and used:
?
While this API seems interesting, it doesn't seem to me it meets with the minimal, basic things a launcher should be able to do, which it could do before. To me it sounds limiting.
lb...@gmail.com <lb...@gmail.com> #12
Also, what do you mean " However, we were able to reproduce the crash only when the icon was not set https://b.corp.google.com/issues/64831848#comment4 "
You mean "were not able" ?
You mean "were not able" ?
Description
OSR1.170720.005
* What device are you using? (for example, Nexus 6P)
Emulator
* What are the steps to reproduce the problem? (Please provide the minimal reproducible test case.)
run an app that tries to create a shortcut with a bad "id" parameter:
ShortcutInfoCompat pinShortcutInfo = new ShortcutInfoCompat.Builder(context, "aaa")
.setIcon(IconCompat.createWithResource(context, R.mipmap.ic_launcher))
.setShortLabel("My " + System.currentTimeMillis())
.setIntent(new Intent(context, MainActivity.class).setAction(Intent.ACTION_MAIN))
.build();
ShortcutManagerCompat.requestPinShortcut(context, pinShortcutInfo, null);
The "aaa" is supposed to be the package name of the current app, apparently, even though all the docs say it is, is that it's "id" :
I don't get why it even needs this parameter. And even if it does, if it's supposed to be the package name, it can just use the context instead... And why call it "id" without any explanation of it?
* Issue Category e.g. Framework (platform), NDK (platform), Hardware (CPU, GPU, Sensor, Camera), ART (platform), Runtime Permissions etc
Framework?
* What was the expected result?
Not to crash.
* What was the actual result?
It crashes.
* Relevant logcat output.
Here:
08-18 14:16:44.216 4304-4348/? E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-3
Process: com.google.android.apps.nexuslauncher, PID: 4304
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:353)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable.mutate()' on a null object reference
at com.android.launcher3.WidgetPreviewLoader.mutateOnMainThread(SourceFile:507)
at com.android.launcher3.WidgetPreviewLoader.generateShortcutPreview(SourceFile:485)
at com.android.launcher3.WidgetPreviewLoader.generatePreview(SourceFile:298)
at com.android.launcher3.WidgetPreviewLoader.-wrap0(Unknown Source:0)
at com.android.launcher3.WidgetPreviewLoader$PreviewLoadTask.doInBackground(SourceFile:601)
at com.android.launcher3.WidgetPreviewLoader$PreviewLoadTask.doInBackground(SourceFile:560)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable.mutate()' on a null object reference
at java.util.concurrent.FutureTask.report(FutureTask.java:123)
at java.util.concurrent.FutureTask.get(FutureTask.java:193)
at com.android.launcher3.WidgetPreviewLoader.mutateOnMainThread(SourceFile:497)
at com.android.launcher3.WidgetPreviewLoader.generateShortcutPreview(SourceFile:485)
at com.android.launcher3.WidgetPreviewLoader.generatePreview(SourceFile:298)
at com.android.launcher3.WidgetPreviewLoader.-wrap0(Unknown Source:0)
at com.android.launcher3.WidgetPreviewLoader$PreviewLoadTask.doInBackground(SourceFile:601)
at com.android.launcher3.WidgetPreviewLoader$PreviewLoadTask.doInBackground(SourceFile:560)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable.mutate()' on a null object reference
at com.android.launcher3.WidgetPreviewLoader$1.call(SourceFile:500)
at com.android.launcher3.WidgetPreviewLoader$1.call(SourceFile:498)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Also attached sample code.
This is just one issue of multiple issues I've found and reported about on Android O, that's related to shortcuts. Please fix all the rest too.