Skip to content

Bad notification posted from package com.khush.sample on Android 4.4-6 #79

@consp1racy

Description

@consp1racy

Note on vector drawables

Sample app uses part of its own default app icon as the notification icon. It's a vector drawable asset in res/drawable-v24.

Hotfix for Android 6 is to move the icon to res/drawable and let AGP generate PNG for Android 6 and older. That's not the real issue.

The actual problem

I tracked down the issue to invalid small icons supplied to NotificationCompat.Builder.addAction. Current value of -1 or 0xFFFFFFFF is technically a valid resource ID pointing to a missing resource. 0 is a designated "no icon" resource ID but action icons are required so that's not an acceptable solution.

See also

Solution

Supply actual icons for PAUSE, RESUME, RETRY, and CANCEL notification actions.

Stack trace

FATAL EXCEPTION: main
Process: com.khush.sample, PID: 4694
android.app.RemoteServiceException: Bad notification posted from package com.khush.sample: Couldn't expand RemoteViews for: StatusBarNotification(pkg=com.khush.sample user=UserHandle{0} id=1283721172 tag=null score=0 key=0|com.khush.sample|1283721172|null|10053: Notification(pri=0 contentView=com.khush.sample/0x1090078 vibrate=null sound=null defaults=0x0 flags=0x6a color=0x00000000 actions=1 vis=PRIVATE))
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1441)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:135)
	at android.app.ActivityThread.main(ActivityThread.java:5221)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
...
No known package when getting value for resource number 0xffffffff
couldn't inflate view for notification com.khush.sample/0x4c8407d4
android.content.res.Resources$NotFoundException: Resource ID #0xffffffff
	at android.content.res.Resources.getValue(Resources.java:1233)
	at android.content.res.Resources.getDrawable(Resources.java:756)
	at android.content.Context.getDrawable(Context.java:402)
	at android.widget.TextView.setCompoundDrawablesRelativeWithIntrinsicBounds(TextView.java:2328)
	at android.widget.RemoteViews$TextViewDrawableAction.apply(RemoteViews.java:1415)
	at android.widget.RemoteViews.performApply(RemoteViews.java:2587)
	at android.widget.RemoteViews.apply(RemoteViews.java:2547)
	at android.widget.RemoteViews$ViewGroupAction.apply(RemoteViews.java:1343)
	at android.widget.RemoteViews.performApply(RemoteViews.java:2587)
	at android.widget.RemoteViews.apply(RemoteViews.java:2547)
	at com.android.systemui.statusbar.BaseStatusBar.inflateViews(BaseStatusBar.java:1316)
	at com.android.systemui.statusbar.BaseStatusBar.inflateViews(BaseStatusBar.java:1227)
	at com.android.systemui.statusbar.BaseStatusBar.createNotificationViews(BaseStatusBar.java:1629)
	at com.android.systemui.statusbar.phone.PhoneStatusBar.addNotification(PhoneStatusBar.java:1298)
	at com.android.systemui.statusbar.BaseStatusBar$5$2.run(BaseStatusBar.java:402)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:135)
	at android.app.ActivityThread.main(ActivityThread.java:5221)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions