The following error message occurred on the 8.0 machine

The 2019-10-26 18:00:51. 099, 4825-4825 /? D/AndroidRuntime: Shutting down VM 9-26 18:00:51.100 E/AndroidRuntime: FATAL EXCEPTION: main Process: com.android.systemui, PID: 4825 java.lang.IllegalArgumentException: width and height must be > 0 at android.graphics.Bitmap.createBitmap(Bitmap.java:1001) at android.graphics.Bitmap.createBitmap(Bitmap.java:968) at android.graphics.Bitmap.createBitmap(Bitmap.java:918) at android.graphics.Bitmap.createBitmap(Bitmap.java:879) at android.graphics.drawable.AdaptiveIconDrawable.updateMaskBoundsInternal(AdaptiveIconDrawable.java:333) at android.graphics.drawable.AdaptiveIconDrawable.updateLayerBounds(AdaptiveIconDrawable.java:295) at android.graphics.drawable.AdaptiveIconDrawable.onStateChange(AdaptiveIconDrawable.java:782) at android.graphics.drawable.Drawable.setState(Drawable.java:775) at android.widget.ImageView.drawableStateChanged(ImageView.java:1305) at android.view.View.refreshDrawableState(View.java:20012) at android.view.View.dispatchAttachedToWindow(View.java:17409) at android.view.ViewGroup.addViewInner(ViewGroup.java:4964) at android.view.ViewGroup.addView(ViewGroup.java:4755) at com.android.systemui.statusbar.phone.NotificationIconAreaController.updateIconsForLayout(NotificationIconAreaController. java:247) at com.android.systemui.statusbar.phone.NotificationIconAreaController.updateNotificationIcons(NotificationIconAreaControll er.java:155) at com.android.systemui.statusbar.phone.StatusBar.updateNotificationShade(StatusBar.java:1962) at com.android.systemui.statusbar.phone.StatusBar.updateNotifications(StatusBar.java:2142) at com.android.systemui.statusbar.phone.StatusBar.addNotificationViews(StatusBar.java:6804) at com.android.systemui.statusbar.phone.StatusBar.addEntry(StatusBar.java:1633) at com.android.systemui.statusbar.phone.StatusBar.onAsyncInflationFinished(StatusBar.java:1650) at com.android.systemui.statusbar.notification.NotificationInflater$AsyncInflationTask.onAsyncInflationFinished(NotificationInflater.java:641)
        at com.android.systemui.statusbar.notification.NotificationInflater.finishIfDone(NotificationInflater.java:460)
        at com.android.systemui.statusbar.notification.NotificationInflater.-wrap0(Unknown Source:0)
        at com.android.systemui.statusbar.notification.NotificationInflater$6.onViewApplied(NotificationInflater.java:343)
        at android.widget.RemoteViews$AsyncApplyTask.onPostExecute(RemoteViews.java:3421)
        at android.widget.RemoteViews$AsyncApplyTask.onPostExecute(RemoteViews.java:3401)
        at android.os.AsyncTask.finish(AsyncTask.java:695)
        at android.os.AsyncTask.-wrap1(Unknown Source:0)
        at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        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. The run (Zygote. Java: 240) at the android. Internal. OS. ZygoteInit. Main (ZygoteInit. Java: 775) the 2019-10-26 18:00:51. 107 2389-4630/system_process W/RescueParty: Noticed 3 eventsfor UID 10015 inLast 4 SEC 2019-10-26 18:00:51.108 2389-4630/system_process W/ActivityManager: Process com.android.systemui has crashed too manytimes: killing! The 2019-10-26 18:00:51. 108, 4825-4825 /? I/Process: Sending Signal. PID: 4825 SIG: 9 2019-10-26 18:00:51.177 2389-2577/system_process W/InputDispatcher: channel'ce0fd40 com.android.systemui (server)'~ Consumer closed input channel or an error occurred. Events =0x9 2019-10-26 18:00:51.177 2389-2577/system_process E/InputDispatcher: channel'ce0fd40 com.android.systemui (server)'~ Channel is unrecoverably broken and will be disposed! /system_process W/InputDispatcher: channel'14e8472 com.android.systemui (server)'~ Consumer closed input channel or an error occurred. Events =0x9 2019-10-26 18:00:51.177 2389-2577/system_process E/InputDispatcher: channel'14e8472 com.android.systemui (server)'~ Channel is unrecoverably broken and will be disposed! /system_process W/InputDispatcher: channel'2ee37d4 com.android.systemui (server)'~ Consumer closed input channel or an error occurred. Events =0x9 2019-10-26 18:00:51.177 2389-2577/system_process E/InputDispatcher: channel'2ee37d4 com.android.systemui (server)'~ Channel is unrecoverably broken and will be disposed! /system_process W/InputDispatcher: channel'7becac5 com.android.systemui.ImageWallpaper (server)'~ Consumer closed input channel or an error occurred. Events =0x9 2019-10-26 18:00:51.177 2389-2577/system_process E/InputDispatcher: channel'7becac5 com.android.systemui.ImageWallpaper (server)'~ Channel is unrecoverably broken and will be disposed! /system_process W/InputDispatcher: channel'666dc68 StatusBar (server)'~ Consumer closed input channel or an error occurred. Events =0x9 2019-10-26 18:00:51.177 2389-2577/system_process E/InputDispatcher: channel'666dc68 StatusBar (server)' ~ Channel is unrecoverably broken and will be disposed!
2019-10-26 18:00:51.190 2389-2577/system_process W/InputDispatcher: channel '70763c0 AssistPreviewPanel (server)'~ Consumer closed input channel or an error occurred. Events =0x9 2019-10-26 18:00:51.190 2389-2577/system_process E/InputDispatcher: channel'70763c0 AssistPreviewPanel (server)' ~ Channel is unrecoverably broken and will be disposed!
2019-10-26 18:00:51.190 2389-2577/system_process W/InputDispatcher: channel '8767c24 DockedStackDivider (server)'~ Consumer closed input channel or an error occurred. Events =0x9 2019-10-26 18:00:51.190 2389-2577/system_process E/InputDispatcher: channel'8767c24 DockedStackDivider (server)'~ Channel is unrecoverably broken and will be disposed! The 2019-10-26 18:00:51. 191, 2389-2409 / system_process D/ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [ LISTEN id=14, [] ], android.os.BinderProxy@61e49b1) 2019-10-26 18:00:51.191 2389-2409/system_process W/AudioService: Current remote volume controller died, Unregistering 10-26 18:00:51.192 2389-2409/system_process W/VolumeController: Error calling dismiss android.os.DeadObjectException at android.os.BinderProxy.transactNative(Native Method) at android.os.BinderProxy.transact(Binder.java:748) at android.media.IVolumeController$Stub$Proxy.dismiss(IVolumeController.java:170)
        at com.android.server.audio.AudioService$VolumeController.postDismiss(AudioService.java:6493)
        at com.android.server.audio.AudioService.setVolumeController(AudioService.java:6341)
        at com.android.server.audio.AudioService$4.binderDied(AudioService.java:6350)
        at android.os.BinderProxy.sendDeathNotice(Binder.java:828)
Copy the code

At first, I realized that the crash was caused by Notification, but I didn’t think it was caused by setIcon. Because I developed a large screen, I just suspected that small factories did not package the system well, so I kept checking my own code

The way of sending notification is written according to the SDK, so there is no problem with syntax and logic

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    NotificationChannel channel = new NotificationChannel(NotificationChannelId, NotificationChannelName, NotificationManager.IMPORTANCE_DEFAULT);
    NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    notificationManager.createNotificationChannel(channel);
}
Notification.Builder builder = new Notification.Builder(this)
        .setSmallIcon(R.mipmap.ic_launcher)
        .setTicker(this.getString(R.string.service_foreground_notification_ticker))
        .setContentTitle(this.getString(R.string.service_foreground_notification_title))
        .setContentText(this.getString(R.string.service_foreground_notification_text))
        .setOngoing(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    builder.setChannelId(NotificationChannelId);
}
Notification notification = builder.build();
this.startForeground(1, notification);
Copy the code

When the Notification is set to read the Notification picture, there is a problem in reading the drawn bitmap, resulting in width and height < 0, note out

.setSmallIcon(R.mipmap.ic_launcher)
Copy the code

Indeed as expected success

When I think about setting this line, I call

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background" />
    <foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
Copy the code

Solution:

This problem can be solved by deleting the mipmap-anydpi-v26 folder or deleting the resource files in the replacement folder. The problem caused by Notification should also occur in the push

Therefore, I suspected that there was something wrong with the call at the bottom level, which led to the failure of bitmap reading, so I found some information to look at the call process at the bottom level

https://blog.csdn.net/u013989732/article/details/85090535 reference call process