Android7.0显示USB连接图标

修改方式在frameworks/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java文件中



                    Notification notification = new Notification.Builder(mContext)
                            .setSmallIcon(com.android.internal.R.drawable.stat_sys_data_usb)
                            .setWhen(0)
                            .setOngoing(true)
                            .setTicker(title)
                            .setDefaults(0)  // please be quiet
                            .setPriority(Notification.PRIORITY_MIN)
                            .setColor(mContext.getColor(
                                    com.android.internal.R.color.system_notification_accent_color))
                            .setContentTitle(title)
                            .setContentText(message)
                            .setContentIntent(pi)
                            .setVisibility(Notification.VISIBILITY_PUBLIC)
                            .build();

.setPriority(Notification.PRIORITY_MIN)此方法是设置notification提醒的优先级

将优先级设置为

 .setPriority(Notification.PRIORITY_LOW)后,就可以显示USB的图标了

猜你喜欢

转载自blog.csdn.net/u014630142/article/details/80609984