导航菜单

页面标题

页面副标题

Pulsar v1.0.0 - f.java 源代码

正在查看: Pulsar v1.0.0 应用的 f.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package g2;

import android.app.AppOpsManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Patterns;
import android.webkit.URLUtil;
import android.widget.RemoteViews;
import androidx.constraintlayout.core.motion.utils.w;
import com.engagelab.privates.common.component.MTCommonActivity;
import com.facebook.common.util.h;
import com.facebook.react.uimanager.events.PointerEventHelper;
import d2.g;
import e2.a;
import g1.m;
import g1.q0;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.zip.Adler32;
import org.json.JSONObject;
import p1.a;

public class f {

    private static final String f19988a = "NotificationUtil";

    private static final String f19989b = "checkOpNoThrow";

    private static final String f19990c = "OP_POST_NOTIFICATION";

    public static final String f19991d = "ic_launcher";

    private static final String f19992e = "MTInAppExtra";

    public static class a {

        public static final Map<String, String> f19993a = new HashMap();

        static {
            a();
        }

        public static int a(int i5) {
            if (i5 == 0 || i5 == 1) {
                return -2;
            }
            if (i5 != 2) {
                return (i5 == 4 || i5 == 5) ? 1 : 0;
            }
            return -1;
        }

        public static int b(JSONObject jSONObject) {
            JSONObject optJSONObject = jSONObject.optJSONObject("n_importance");
            if (optJSONObject != null) {
                String str = Build.MANUFACTURER;
                if (str == null) {
                    return a(jSONObject, -1);
                }
                String str2 = f19993a.get(str.toLowerCase());
                if (str2 != null) {
                    int optInt = optJSONObject.optInt(str2, -1);
                    t1.a.d(f.f19988a, "im_v:" + optInt);
                    return optInt;
                }
            }
            return a(jSONObject, -1);
        }

        public static int c(JSONObject jSONObject) {
            int a5;
            int optInt = jSONObject.optInt("n_priority", 0);
            int b5 = b(jSONObject);
            return (-1 != b5 && optInt > (a5 = a(b5))) ? a5 : optInt;
        }

        public static int a(JSONObject jSONObject, int i5) {
            return i5;
        }

        public static void a() {
            Map<String, String> map = f19993a;
            map.put("google".toLowerCase(), "fc");
            map.put(a.d.f19271c.toLowerCase(), "hw");
            map.put(a.d.f19272d.toLowerCase(), "hn");
            map.put(a.d.f19273e.toLowerCase(), "mz");
            map.put(a.d.f19277i.toLowerCase(), "vi");
            map.put(a.d.f19274f.toLowerCase(), "op");
            map.put(a.d.f19275g.toLowerCase(), "op");
            map.put(a.d.f19276h.toLowerCase(), "op");
            map.put(a.d.f19269a.toLowerCase(), "xm");
            map.put(a.d.f19270b.toLowerCase(), "xm");
        }
    }

    private static String a(Context context) {
        try {
            Intent launchIntentForPackage = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
            if (launchIntentForPackage != null && launchIntentForPackage.getComponent() != null) {
                return launchIntentForPackage.getComponent().getClassName();
            }
            PackageManager packageManager = context.getPackageManager();
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.setPackage(context.getPackageName());
            intent.addCategory("android.intent.category.LAUNCHER");
            ResolveInfo resolveActivity = packageManager.resolveActivity(intent, 65536);
            if (resolveActivity == null) {
                resolveActivity = packageManager.resolveActivity(launchIntentForPackage, 0);
            }
            return resolveActivity != null ? resolveActivity.activityInfo.name : PointerEventHelper.POINTER_TYPE_UNKNOWN;
        } catch (Throwable th) {
            t1.a.w(f19988a, "getLaunchActivityClassName failed " + th.getMessage());
            return PointerEventHelper.POINTER_TYPE_UNKNOWN;
        }
    }

    private static Intent b(Context context, String str, g gVar) {
        Intent intent = new Intent();
        intent.setClass(context, MTCommonActivity.class);
        intent.setAction(str);
        intent.addFlags(276824064);
        Bundle bundle = new Bundle();
        bundle.putParcelable(a.e.f19278a, gVar);
        intent.putExtras(bundle);
        return intent;
    }

    private static boolean c(Context context, String str, String str2) {
        try {
            Intent parseUri = parseUri(str);
            parseUri.setFlags(268435456);
            if (context.getPackageManager().resolveActivity(parseUri, 0) == null) {
                return false;
            }
            parseUri.putExtra(f19992e, str2);
            context.startActivity(parseUri);
            return true;
        } catch (Throwable unused) {
            return false;
        }
    }

    public static String[] convertJsonToArray(String str) {
        try {
            if (TextUtils.isEmpty(str)) {
                return null;
            }
            JSONObject jSONObject = new JSONObject(str);
            Iterator<String> keys = jSONObject.keys();
            String[] strArr = new String[jSONObject.length()];
            int i5 = 0;
            while (keys.hasNext()) {
                strArr[i5] = jSONObject.optString(keys.next());
                i5++;
            }
            return strArr;
        } catch (Throwable th) {
            t1.a.w(f19988a, "convertJsonToArray failed " + th.getMessage());
            return null;
        }
    }

    public static Bundle convertJsonToBundle(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        try {
            if (TextUtils.isEmpty(jSONObject.toString())) {
                return null;
            }
            Bundle bundle = new Bundle();
            Iterator<String> keys = jSONObject.keys();
            while (keys.hasNext()) {
                String next = keys.next();
                bundle.putString(next, jSONObject.optString(next));
            }
            return bundle;
        } catch (Throwable th) {
            t1.a.w(f19988a, "convertJsonToBundle failed " + th.getMessage());
            return null;
        }
    }

    public static Bundle convertMapToBundle(Map<String, String> map) {
        Bundle bundle = new Bundle();
        for (Map.Entry<String, String> entry : map.entrySet()) {
            bundle.putString(entry.getKey(), entry.getValue());
        }
        return bundle;
    }

    private static boolean d(Context context, String str, String str2) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        try {
            try {
                e(context, parseUri(str), str2);
                return true;
            } catch (ActivityNotFoundException unused) {
                e(context, parseUri(str), str2);
                return true;
            }
        } catch (Throwable unused2) {
            return false;
        }
    }

    private static void e(Context context, Intent intent, String str) throws Throwable {
        intent.setFlags(268435456);
        intent.putExtra(f19992e, str);
        context.startActivity(intent);
    }

    public static Notification.BigPictureStyle getBigPictureStyle(Context context, String str) {
        try {
            if (TextUtils.isEmpty(str)) {
                return null;
            }
            Notification.BigPictureStyle bigPictureStyle = new Notification.BigPictureStyle();
            Bitmap pictureBitmap = getPictureBitmap(context, str);
            if (pictureBitmap == null) {
                return null;
            }
            return bigPictureStyle.bigPicture(pictureBitmap);
        } catch (Throwable th) {
            t1.a.w(f19988a, "get bigPictureStyle failed " + th.getMessage());
            return null;
        }
    }

    public static Notification.BigTextStyle getBigTextStyle(Context context, String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        return new Notification.BigTextStyle().bigText(str);
    }

    public static String getContent(Context context, g gVar) {
        return TextUtils.isEmpty(gVar.getContent()) ? context.getApplicationInfo().loadLabel(context.getPackageManager()).toString() : gVar.getContent();
    }

    public static int getDefaults(Context context, boolean z4, g gVar) {
        int defaults = gVar.getDefaults();
        if (z4) {
            return (defaults & 1) == 0 ? gVar.getDefaults() : gVar.getDefaults() - 1;
        }
        switch (defaults) {
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
                return gVar.getDefaults();
            default:
                return -1;
        }
    }

    public static Notification.InboxStyle getInboxStyle(Context context, String[] strArr) {
        if (strArr != null) {
            try {
                if (strArr.length != 0) {
                    Notification.InboxStyle inboxStyle = new Notification.InboxStyle();
                    for (String str : strArr) {
                        inboxStyle.addLine(str);
                    }
                    inboxStyle.setSummaryText(" + " + strArr.length + " new messages");
                    return inboxStyle;
                }
            } catch (Throwable th) {
                t1.a.w(f19988a, "getInboxStyle failed " + th.getMessage());
            }
        }
        return null;
    }

    public static Bitmap getLargeIcon(Context context, String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        return getPictureBitmap(context, str);
    }

    public static String getMessageId(JSONObject jSONObject) {
        String optString = jSONObject.optString("ad_id");
        if (TextUtils.isEmpty(optString)) {
            optString = jSONObject.optString("msg_id");
        }
        return TextUtils.isEmpty(optString) ? jSONObject.optString("_jmsgid_") : optString;
    }

    public static int getNotificationId(String str) {
        try {
            return Integer.parseInt(str);
        } catch (Throwable unused) {
            t1.a.d(f19988a, "the messageId [" + str + "] will convert to adler32");
            try {
                Adler32 adler32 = new Adler32();
                adler32.update(str.getBytes());
                int value = (int) adler32.getValue();
                return value < 0 ? Math.abs(value) : value;
            } catch (Throwable th) {
                t1.a.w(f19988a, "getNotificationId failed " + th.getMessage());
                return 0;
            }
        }
    }

    public static int getNotificationImportance(JSONObject jSONObject) throws Throwable {
        return a.b(jSONObject);
    }

    public static RemoteViews getNotificationLayout(Context context, g gVar) {
        try {
            d2.f a5 = m.a().a(context, gVar.getBuilderId());
            if (a5 == null) {
                t1.a.d(f19988a, "getNotificationLayout builderId:" + gVar.getBuilderId() + ", notificationLayout is null");
                return null;
            }
            t1.a.d(f19988a, "getNotificationLayout builderId:" + gVar.getBuilderId() + ", notificationLayout:" + a5.toString());
            RemoteViews remoteViews = new RemoteViews(context.getPackageName(), a5.getLayoutId());
            if (a5.getIconViewId() > 0) {
                remoteViews.setImageViewResource(a5.getIconViewId(), getSmallIcon(context));
                Icon smallIcon = getSmallIcon(context, gVar);
                if (smallIcon != null) {
                    remoteViews.setImageViewIcon(a5.getIconViewId(), smallIcon);
                }
            }
            if (a5.getTitleViewId() > 0) {
                remoteViews.setTextViewText(a5.getTitleViewId(), getTitle(context, gVar));
            }
            if (a5.getContentViewId() > 0) {
                remoteViews.setTextViewText(a5.getContentViewId(), getContent(context, gVar));
            }
            if (a5.getTimeViewId() > 0) {
                remoteViews.setLong(a5.getTimeViewId(), "setTime", System.currentTimeMillis());
            }
            return remoteViews;
        } catch (Throwable th) {
            t1.a.w(f19988a, "getNotificationLayout failed " + th.getMessage());
            return null;
        }
    }

    public static g getNotificationMessage(String str) {
        try {
            if (TextUtils.isEmpty(str)) {
                return null;
            }
            JSONObject jSONObject = new JSONObject(str);
            String messageId = getMessageId(jSONObject);
            if (TextUtils.isEmpty(messageId)) {
                t1.a.d(f19988a, "notificationMessage's messageId is null, can't show this notification");
                return null;
            }
            String optString = jSONObject.optString("override_msg_id");
            int notificationId = TextUtils.isEmpty(optString) ? getNotificationId(messageId) : getNotificationId(optString);
            int optInt = jSONObject.optInt("n_builder_id");
            JSONObject optJSONObject = jSONObject.optJSONObject("m_content");
            if (optJSONObject == null) {
                t1.a.d(f19988a, "onMessage failed, can't parse content");
                return null;
            }
            JSONObject optJSONObject2 = jSONObject.optJSONObject("inapp");
            long optLong = optJSONObject2 != null ? optJSONObject2.optLong("inapp_end_time", 0L) : 0L;
            String optString2 = optJSONObject.optString("n_title");
            String optString3 = optJSONObject.optString("n_content");
            Bundle convertJsonToBundle = convertJsonToBundle(optJSONObject.optJSONObject("n_extras"));
            String optString4 = optJSONObject.optString("n_small_icon");
            String optString5 = optJSONObject.optString("n_color");
            String optString6 = optJSONObject.optString("n_large_icon");
            int optInt2 = optJSONObject.optInt("n_alert_type", -1);
            int priority = getPriority(optJSONObject);
            try {
                int notificationImportance = getNotificationImportance(optJSONObject);
                long j5 = optLong;
                String optString7 = optJSONObject.optString("n_category");
                int optInt3 = optJSONObject.optInt("n_style");
                String optString8 = optJSONObject.optString("n_big_text");
                String optString9 = optJSONObject.optString("n_big_pic_path");
                String[] convertJsonToArray = convertJsonToArray(optJSONObject.optString("n_inbox"));
                return new g().setMessageId(messageId).setOverrideMessageId(optString).setDisplayForeground(optJSONObject.optString("n_display_foreground")).setPlatform((byte) 0).setNotificationId(notificationId).setSmallIcon(optString4).setLargeIcon(optString6).setTitle(optString2).setContent(optString3).setColor(optString5).setBuilderId(optInt).setExtras(convertJsonToBundle).setStyle(optInt3).setBigText(optString8).setInbox(convertJsonToArray).setBigPicture(optString9).setDefaults(optInt2).setPriority(priority).setImportance(notificationImportance).setCategory(optString7).setSound(optJSONObject.optString("n_sound")).setChannelId(optJSONObject.optString("n_channel_id")).setIntentUri(optJSONObject.optString("intent_uri")).setBadge(optJSONObject.optInt("n_badge_add_num")).setInAppEndTime(j5);
            } catch (Throwable unused) {
                return null;
            }
        } catch (Throwable unused2) {
            return null;
        }
    }

    public static boolean getNotificationState(Context context) {
        boolean areNotificationsEnabled;
        if (Build.VERSION.SDK_INT >= 24) {
            try {
                NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
                if (notificationManager == null) {
                    return false;
                }
                areNotificationsEnabled = notificationManager.areNotificationsEnabled();
                return areNotificationsEnabled;
            } catch (Throwable th) {
                t1.a.w(f19988a, "getNotificationState failed " + th.getMessage());
            }
        }
        try {
            AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService("appops");
            ApplicationInfo applicationInfo = context.getApplicationInfo();
            String packageName = context.getApplicationContext().getPackageName();
            int i5 = applicationInfo.uid;
            Class<?> cls = Class.forName(AppOpsManager.class.getName());
            Class<?> cls2 = Integer.TYPE;
            return ((Integer) cls.getMethod(f19989b, cls2, cls2, String.class).invoke(appOpsManager, Integer.valueOf(((Integer) cls.getDeclaredField(f19990c).get(Integer.class)).intValue()), Integer.valueOf(i5), packageName)).intValue() == 0;
        } catch (Throwable th2) {
            t1.a.w(f19988a, "getNotificationState failed " + th2.getMessage());
            return false;
        }
    }

    public static PendingIntent getPendingIntent(Context context, String str, g gVar) {
        return PendingIntent.getActivity(context, gVar.getNotificationId(), b(context, str, gVar), 67108864);
    }

    public static Bitmap getPictureBitmap(Context context, String str) {
        byte[] bArr;
        Bitmap decodeByteArray;
        try {
            if (!Patterns.WEB_URL.matcher(str).matches() && !URLUtil.isValidUrl(str)) {
                decodeByteArray = BitmapFactory.decodeResource(context.getResources(), context.getResources().getIdentifier(str, "drawable", context.getPackageName()));
                return decodeByteArray;
            }
            bArr = g2.a.get(context, str, false);
        } finally {
            try {
                return null;
            } finally {
            }
        }
        if (bArr == null) {
            t1.a.d(f19988a, "getPicture bytes is null");
            return null;
        }
        decodeByteArray = BitmapFactory.decodeByteArray(bArr, 0, bArr.length);
        return decodeByteArray;
    }

    public static int getPriority(Context context, boolean z4, g gVar) {
        if (z4) {
            return -1;
        }
        int priority = gVar.getPriority();
        if (priority == -2 || priority == -1 || priority == 0 || priority == 1 || priority == 2) {
            return gVar.getPriority();
        }
        return 0;
    }

    public static int getSmallIcon(Context context) {
        int identifier = context.getResources().getIdentifier(f19991d, "drawable", context.getPackageName());
        if (identifier > 0) {
            return identifier;
        }
        try {
            return context.getPackageManager().getApplicationInfo(context.getPackageName(), 0).icon;
        } catch (Throwable th) {
            t1.a.w(f19988a, "get getSmallIcon failed " + th.getMessage());
            t1.a.e(f19988a, "please put icon [ic_launcher] in res/drawable");
            return 0;
        }
    }

    public static Uri getSoundUri(Context context, boolean z4, g gVar) {
        if (z4) {
            return null;
        }
        try {
            if (TextUtils.isEmpty(gVar.getSound())) {
                return null;
            }
            if (context.getResources().getIdentifier(gVar.getSound(), "raw", context.getPackageName()) == 0) {
                t1.a.d(f19988a, "there are no sound resource");
                return null;
            }
            return Uri.parse("android.resource://" + context.getPackageName() + "/raw/" + gVar.getSound());
        } catch (Throwable th) {
            t1.a.w(f19988a, "getSoundUri failed " + th.getMessage());
            return null;
        }
    }

    public static Notification.Style getStyle(Context context, g gVar) {
        int style = gVar.getStyle();
        if (style == 1) {
            return getBigTextStyle(context, gVar.getBigText());
        }
        if (style == 2) {
            return getInboxStyle(context, gVar.getInbox());
        }
        if (style != 3) {
            return null;
        }
        return getBigPictureStyle(context, gVar.getBigPicture());
    }

    public static String getTitle(Context context, g gVar) {
        return TextUtils.isEmpty(gVar.getTitle()) ? context.getApplicationInfo().loadLabel(context.getPackageManager()).toString() : gVar.getTitle();
    }

    public static int getVisibility(Context context, boolean z4, g gVar) {
        int priority;
        if (z4 || (priority = gVar.getPriority()) == -2 || priority == -1) {
            return -1;
        }
        return (priority == 1 || priority == 2) ? 1 : 0;
    }

    public static boolean goToAppNotificationSettings(Context context) {
        try {
            if (Build.VERSION.SDK_INT >= 26) {
                Intent intent = new Intent();
                intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
                intent.putExtra("android.provider.extra.APP_PACKAGE", context.getPackageName());
                intent.putExtra("android.provider.extra.CHANNEL_ID", context.getApplicationInfo().uid);
                intent.setFlags(268435456);
                context.startActivity(intent);
                return true;
            }
            Intent intent2 = new Intent();
            intent2.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
            intent2.putExtra("app_package", context.getPackageName());
            intent2.putExtra("app_uid", context.getApplicationInfo().uid);
            intent2.setFlags(268435456);
            context.startActivity(intent2);
            return true;
        } catch (Throwable th) {
            t1.a.w(f19988a, "goToAppNotificationSettings failed " + th.getMessage());
            return false;
        }
    }

    public static boolean isAppInstalled(Context context, String str) {
        PackageInfo packageInfo;
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        try {
            packageInfo = context.getPackageManager().getPackageInfo(str, 0);
        } catch (PackageManager.NameNotFoundException unused) {
            packageInfo = null;
        }
        return packageInfo != null;
    }

    public static boolean jumpDeepLink(Context context, String str, String str2) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        try {
            return str.startsWith("http") ? d(context, str, str2) : c(context, str, str2);
        } catch (Throwable unused) {
            return false;
        }
    }

    public static Bundle notificationMessageToInApp(g gVar, Bundle bundle) {
        try {
            String string = bundle.getString(a.e.f19278a);
            if (TextUtils.isEmpty(string)) {
                t1.a.w(f19988a, "notificationMessageToInApp message is null");
                return null;
            }
            if (gVar == null) {
                t1.a.w(f19988a, "notificationMessageToInApp notificationMessage is null");
                return null;
            }
            long inAppEndTime = gVar.getInAppEndTime();
            if (inAppEndTime <= 0) {
                t1.a.w(f19988a, "notificationMessageToInApp expired is " + inAppEndTime);
                return null;
            }
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("is_notification", true);
            jSONObject.put("expired", inAppEndTime);
            jSONObject.put("delay", androidx.vectordrawable.graphics.drawable.g.f11210d);
            jSONObject.put(a.b.f19240c, androidx.vectordrawable.graphics.drawable.g.f11210d);
            jSONObject.put(w.h.f3562b, 10000);
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("type", 2);
            jSONObject2.put("action", gVar.getIntentUri());
            jSONObject.put("click", jSONObject2);
            jSONObject.put("type", 10);
            jSONObject.put("extras", new JSONObject(string));
            JSONObject jSONObject3 = new JSONObject();
            jSONObject3.put("small_image", gVar.getLargeIcon());
            JSONObject jSONObject4 = new JSONObject();
            jSONObject4.put("text", gVar.getTitle());
            jSONObject3.put(a.c.f21729c, jSONObject4);
            JSONObject jSONObject5 = new JSONObject();
            jSONObject5.put("text", gVar.getContent());
            jSONObject3.put(h.f15152d, jSONObject5);
            jSONObject.put("banner", jSONObject3);
            jSONObject.put("location", 0);
            String jSONObject6 = jSONObject.toString();
            t1.a.w(f19988a, "valueInApp:" + jSONObject6);
            bundle.putString(a.e.f19278a, jSONObject6);
            return bundle;
        } catch (Throwable th) {
            t1.a.e(f19988a, "notificationMessageToInApp failed:" + th);
            return null;
        }
    }

    public static void onClickInAppNotification(Context context, String str) {
        try {
            String valueOf = String.valueOf(3003);
            g notificationMessage = getNotificationMessage(str);
            if (notificationMessage == null) {
                t1.a.d(f19988a, "notificationMessage  is null, can't onClick notification");
            } else {
                context.startActivity(b(context, valueOf, notificationMessage));
            }
        } catch (Throwable th) {
            t1.a.e(f19988a, "onClickInAppNotification failed " + th);
        }
    }

    public static Intent parseUri(String str) throws URISyntaxException {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        Intent parseUri = Intent.parseUri(str, 4);
        Intent intent = new Intent(parseUri);
        parseUri.addCategory("android.intent.category.BROWSABLE");
        parseUri.setComponent(null);
        parseUri.setSelector(null);
        return intent;
    }

    public static boolean setHonorBadge(Context context, int i5) {
        try {
            ContentResolver contentResolver = context.getContentResolver();
            Uri parse = Uri.parse("content://com.hihonor.android.launcher.settings/badge/");
            if (TextUtils.isEmpty(contentResolver.getType(parse))) {
                parse = Uri.parse("content://com.huawei.android.launcher.settings/badge/");
                if (TextUtils.isEmpty(contentResolver.getType(parse))) {
                    t1.a.e(f19988a, " setHonorBadge fail, uri is null");
                    return false;
                }
            }
            Bundle bundle = new Bundle();
            bundle.putString("package", context.getPackageName());
            bundle.putString("class", a(context));
            bundle.putInt("badgenumber", i5);
            contentResolver.call(parse, "change_badge", (String) null, bundle);
            return true;
        } catch (Throwable th) {
            t1.a.e(f19988a, " setHonorBadge wrong error:" + th);
            return false;
        }
    }

    public static void setHuaweiBadgeNumber(Context context, int i5) {
        try {
            Bundle bundle = new Bundle();
            bundle.putString("package", context.getPackageName());
            String a5 = a(context);
            if (TextUtils.isEmpty(a5)) {
                return;
            }
            t1.a.d(f19988a, "setHuaweiBadgeNumber " + i5);
            bundle.putString("class", a5);
            bundle.putInt("badgenumber", i5);
            context.getContentResolver().call(Uri.parse("content://com.huawei.android.launcher.settings/badge/"), "change_badge", (String) null, bundle);
        } catch (Throwable th) {
            t1.a.w(f19988a, "setHuaweiBadgeNumber failed " + th.getMessage());
        }
    }

    public static void setNotificationBadge(Context context, Notification notification, int i5) {
        int i6;
        if (i5 == 0) {
        }
        int a5 = m.a().a(context);
        i6 = a5 + i5;
        q0.b(context, i6);
        t1.a.d(f19988a, "setNotificationBadge cacheNotificationBadge[" + a5 + "]+currentNotificationBadge[" + i5 + "]");
        String lowerCase = Build.MANUFACTURER.toLowerCase();
        lowerCase.hashCode();
        switch (lowerCase) {
            case "huawei":
                setHuaweiBadgeNumber(context, i6);
                break;
            case "xiaomi":
                setXiaomiBadgeNumber(context, notification, i5);
                break;
            case "honor":
                setHonorBadge(context, i6);
                break;
        }
    }

    public static void setXiaomiBadgeNumber(Context context, Notification notification, int i5) {
        if (notification == null) {
            return;
        }
        if (i5 <= 0) {
            i5 = 0;
        }
        try {
            Object obj = notification.getClass().getDeclaredField("extraNotification").get(notification);
            obj.getClass().getDeclaredMethod("setMessageCount", Integer.TYPE).invoke(obj, Integer.valueOf(i5));
        } catch (Throwable th) {
            t1.a.w(f19988a, "setXiaomiBadgeNumber failed " + th.getMessage());
        }
    }

    public static int getPriority(JSONObject jSONObject) throws Throwable {
        return a.c(jSONObject);
    }

    public static Icon getSmallIcon(Context context, g gVar) {
        Bitmap pictureBitmap;
        try {
            if (TextUtils.isEmpty(gVar.getSmallIcon()) || (pictureBitmap = getPictureBitmap(context, gVar.getSmallIcon())) == null) {
                return null;
            }
            return Icon.createWithBitmap(pictureBitmap);
        } catch (Throwable th) {
            t1.a.w(f19988a, "getSmallIcon failed " + th.getMessage());
            return null;
        }
    }
}