NotificationCompat() { loadSystemLayoutRes(); mNotificationFixer = new NotificationFixer(this); }
drawableToBitMap(appContext.getResources().getDrawable((int) value)))); mActions.remove(action); } else if (methodName.equals("setText") && type == ReflectionActionCompat.INT) { if (value instanceof Icon) { Icon icon = (Icon) value; fixIcon(icon, appContext, installed);
getNotificationFixer().fixNotificationRemoteViews(appContext, notification); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { getNotificationFixer().fixIcon(notification.getSmallIcon(), appContext, packageInfo != null); getNotificationFixer().fixIcon(notification.getLargeIcon(), appContext, packageInfo != null); } else { getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, false, notification);
getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, false, notification); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getNotificationFixer().fixIconImage(appContext.getResources(), notification.bigContentView, false, notification); getNotificationFixer().fixRemoteViewActions(appContext, false, notification.tickerView); } else { notification.tickerView = getRemoteViewsFixer().makeRemoteViews(id + ":tickerView", appContext, boolean hasIconBitmap = getNotificationFixer().fixRemoteViewActions(appContext, false, notification.contentView); getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, hasIconBitmap, notification); } else { notification.contentView = getRemoteViewsFixer().makeRemoteViews(id + ":contentView", appContext, if (notification.bigContentView != null) { if (isSystemLayout(notification.bigContentView)) { getNotificationFixer().fixRemoteViewActions(appContext, false, notification.bigContentView); } else { notification.bigContentView = getRemoteViewsFixer().makeRemoteViews(id + ":bigContentView", appContext, if (notification.headsUpContentView != null) { if (isSystemLayout(notification.headsUpContentView)) { boolean hasIconBitmap = getNotificationFixer().fixRemoteViewActions(appContext, false, notification.headsUpContentView); getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, hasIconBitmap, notification); } else { notification.headsUpContentView = getRemoteViewsFixer().makeRemoteViews(id + ":headsUpContentView", appContext,
@TargetApi(Build.VERSION_CODES.M) void fixIcon(Icon icon, Context appContext, boolean installed) { if (icon == null) { return; } int type = mirror.android.graphics.drawable.Icon.mType.get(icon); if (type == mirror.android.graphics.drawable.Icon.TYPE_RESOURCE) { if (installed) { mirror.android.graphics.drawable.Icon.mObj1.set(icon, appContext.getResources()); mirror.android.graphics.drawable.Icon.mString1.set(icon, appContext.getPackageName()); } else { Drawable drawable = icon.loadDrawable(appContext); Bitmap bitmap = drawableToBitMap(drawable); mirror.android.graphics.drawable.Icon.mObj1.set(icon, bitmap); mirror.android.graphics.drawable.Icon.mString1.set(icon, null); mirror.android.graphics.drawable.Icon.mType.set(icon, mirror.android.graphics.drawable.Icon.TYPE_BITMAP); } } }
getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, false, notification); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getNotificationFixer().fixIconImage(appContext.getResources(), notification.bigContentView, false, notification); getNotificationFixer().fixRemoteViewActions(appContext, false, notification.tickerView); } else { notification.tickerView = getRemoteViewsFixer().makeRemoteViews(id + ":tickerView", appContext, boolean hasIconBitmap = getNotificationFixer().fixRemoteViewActions(appContext, false, notification.contentView); getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, hasIconBitmap, notification); } else { notification.contentView = getRemoteViewsFixer().makeRemoteViews(id + ":contentView", appContext, if (notification.bigContentView != null) { if (isSystemLayout(notification.bigContentView)) { getNotificationFixer().fixRemoteViewActions(appContext, false, notification.bigContentView); } else { notification.bigContentView = getRemoteViewsFixer().makeRemoteViews(id + ":bigContentView", appContext, if (notification.headsUpContentView != null) { if (isSystemLayout(notification.headsUpContentView)) { boolean hasIconBitmap = getNotificationFixer().fixRemoteViewActions(appContext, false, notification.headsUpContentView); getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, hasIconBitmap, notification); } else { notification.headsUpContentView = getRemoteViewsFixer().makeRemoteViews(id + ":headsUpContentView", appContext,
private static void fixNotificationIcon(Context context, Notification notification, Notification.Builder builder) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { //noinspection deprecation builder.setSmallIcon(notification.icon); //noinspection deprecation builder.setLargeIcon(notification.largeIcon); } else { Icon icon = notification.getSmallIcon(); if (icon != null) { Bitmap bitmap = drawableToBitMap(icon.loadDrawable(context)); if (bitmap != null) { Icon newIcon = Icon.createWithBitmap(bitmap); builder.setSmallIcon(newIcon); } } Icon largeIcon = notification.getLargeIcon(); if (largeIcon != null) { Bitmap bitmap = drawableToBitMap(largeIcon.loadDrawable(context)); if (bitmap != null) { Icon newIcon = Icon.createWithBitmap(bitmap); builder.setLargeIcon(newIcon); } } } }
getNotificationFixer().fixNotificationRemoteViews(appContext, notification); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { getNotificationFixer().fixIcon(notification.getSmallIcon(), appContext, packageInfo != null); getNotificationFixer().fixIcon(notification.getLargeIcon(), appContext, packageInfo != null); } else { getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, false, notification);
getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, false, notification); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getNotificationFixer().fixIconImage(appContext.getResources(), notification.bigContentView, false, notification); getNotificationFixer().fixRemoteViewActions(appContext, false, notification.tickerView); } else { notification.tickerView = getRemoteViewsFixer().makeRemoteViews(id + ":tickerView", appContext, boolean hasIconBitmap = getNotificationFixer().fixRemoteViewActions(appContext, false, notification.contentView); getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, hasIconBitmap, notification); } else { notification.contentView = getRemoteViewsFixer().makeRemoteViews(id + ":contentView", appContext, if (notification.bigContentView != null) { if (isSystemLayout(notification.bigContentView)) { getNotificationFixer().fixRemoteViewActions(appContext, false, notification.bigContentView); } else { notification.bigContentView = getRemoteViewsFixer().makeRemoteViews(id + ":bigContentView", appContext, if (notification.headsUpContentView != null) { if (isSystemLayout(notification.headsUpContentView)) { boolean hasIconBitmap = getNotificationFixer().fixRemoteViewActions(appContext, false, notification.headsUpContentView); getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, hasIconBitmap, notification); } else { notification.headsUpContentView = getRemoteViewsFixer().makeRemoteViews(id + ":headsUpContentView", appContext,
drawableToBitMap(appContext.getResources().getDrawable((int) value)))); mActions.remove(action); } else if (methodName.equals("setText") && type == ReflectionActionCompat.INT) { if (value instanceof Icon) { Icon icon = (Icon) value; fixIcon(icon, appContext, installed);
void fixIconImage(Resources resources, RemoteViews remoteViews, boolean hasIconBitmap, Notification notification) { if (remoteViews == null || notification.icon == 0) return; if (!mNotificationCompat.isSystemLayout(remoteViews)) { return; } try { //noinspection deprecation int id = R_Hide.id.icon.get(); //only fake small icon if (!hasIconBitmap && notification.largeIcon == null) { Drawable drawable = resources.getDrawable(notification.icon); drawable.setLevel(notification.iconLevel); Bitmap bitmap = drawableToBitMap(drawable); remoteViews.setImageViewBitmap(id, bitmap); //emui if(OSUtils.getInstance().isEmui()) { if (notification.largeIcon == null) { notification.largeIcon = bitmap; } } } } catch (Exception e) { e.printStackTrace(); } }
NotificationCompat() { loadSystemLayoutRes(); mNotificationFixer = new NotificationFixer(this); }
getNotificationFixer().fixNotificationRemoteViews(appContext, notification); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { getNotificationFixer().fixIcon(notification.getSmallIcon(), appContext, packageInfo != null); getNotificationFixer().fixIcon(notification.getLargeIcon(), appContext, packageInfo != null); } else { getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, false, notification);
drawableToBitMap(appContext.getResources().getDrawable((int) value)))); mActions.remove(action); } else if (methodName.equals("setText") && type == ReflectionActionCompat.INT) { if (value instanceof Icon) { Icon icon = (Icon) value; fixIcon(icon, appContext, installed);
private static void fixNotificationIcon(Context context, Notification notification, Notification.Builder builder) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { //noinspection deprecation builder.setSmallIcon(notification.icon); //noinspection deprecation builder.setLargeIcon(notification.largeIcon); } else { Icon icon = notification.getSmallIcon(); if (icon != null) { Bitmap bitmap = drawableToBitMap(icon.loadDrawable(context)); if (bitmap != null) { Icon newIcon = Icon.createWithBitmap(bitmap); builder.setSmallIcon(newIcon); } } Icon largeIcon = notification.getLargeIcon(); if (largeIcon != null) { Bitmap bitmap = drawableToBitMap(largeIcon.loadDrawable(context)); if (bitmap != null) { Icon newIcon = Icon.createWithBitmap(bitmap); builder.setLargeIcon(newIcon); } } } }
NotificationCompat() { loadSystemLayoutRes(); mNotificationFixer = new NotificationFixer(this); }
@TargetApi(Build.VERSION_CODES.M) void fixIcon(Icon icon, Context appContext, boolean installed) { if (icon == null) { return; } int type = mirror.android.graphics.drawable.Icon.mType.get(icon); if (type == mirror.android.graphics.drawable.Icon.TYPE_RESOURCE) { if (installed) { mirror.android.graphics.drawable.Icon.mObj1.set(icon, appContext.getResources()); mirror.android.graphics.drawable.Icon.mString1.set(icon, appContext.getPackageName()); } else { Drawable drawable = icon.loadDrawable(appContext); Bitmap bitmap = drawableToBitMap(drawable); mirror.android.graphics.drawable.Icon.mObj1.set(icon, bitmap); mirror.android.graphics.drawable.Icon.mString1.set(icon, null); mirror.android.graphics.drawable.Icon.mType.set(icon, mirror.android.graphics.drawable.Icon.TYPE_BITMAP); } } }
@TargetApi(Build.VERSION_CODES.M) void fixIcon(Icon icon, Context appContext, boolean installed) { if (icon == null) { return; } int type = mirror.android.graphics.drawable.Icon.mType.get(icon); if (type == mirror.android.graphics.drawable.Icon.TYPE_RESOURCE) { if (installed) { mirror.android.graphics.drawable.Icon.mObj1.set(icon, appContext.getResources()); mirror.android.graphics.drawable.Icon.mString1.set(icon, appContext.getPackageName()); } else { Drawable drawable = icon.loadDrawable(appContext); Bitmap bitmap = drawableToBitMap(drawable); mirror.android.graphics.drawable.Icon.mObj1.set(icon, bitmap); mirror.android.graphics.drawable.Icon.mString1.set(icon, null); mirror.android.graphics.drawable.Icon.mType.set(icon, mirror.android.graphics.drawable.Icon.TYPE_BITMAP); } } }
private static void fixNotificationIcon(Context context, Notification notification, Notification.Builder builder) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { //noinspection deprecation builder.setSmallIcon(notification.icon); //noinspection deprecation builder.setLargeIcon(notification.largeIcon); } else { Icon icon = notification.getSmallIcon(); if (icon != null) { Bitmap bitmap = drawableToBitMap(icon.loadDrawable(context)); if (bitmap != null) { Icon newIcon = Icon.createWithBitmap(bitmap); builder.setSmallIcon(newIcon); } } Icon largeIcon = notification.getLargeIcon(); if (largeIcon != null) { Bitmap bitmap = drawableToBitMap(largeIcon.loadDrawable(context)); if (bitmap != null) { Icon newIcon = Icon.createWithBitmap(bitmap); builder.setLargeIcon(newIcon); } } } }
void fixIconImage(Resources resources, RemoteViews remoteViews, boolean hasIconBitmap, Notification notification) { if (remoteViews == null || notification.icon == 0) return; if (!mNotificationCompat.isSystemLayout(remoteViews)) { return; } try { //noinspection deprecation int id = R_Hide.id.icon.get(); //only fake small icon if (!hasIconBitmap && notification.largeIcon == null) { Drawable drawable = resources.getDrawable(notification.icon); drawable.setLevel(notification.iconLevel); Bitmap bitmap = drawableToBitMap(drawable); remoteViews.setImageViewBitmap(id, bitmap); //emui if(OSUtils.getInstance().isEmui()) { if (notification.largeIcon == null) { notification.largeIcon = bitmap; } } } } catch (Exception e) { e.printStackTrace(); } }