导航菜单

页面标题

页面副标题

CallApp v2.226 - NotificationManager.java 源代码

正在查看: CallApp v2.226 应用的 NotificationManager.java JAVA 源代码文件

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


package com.callapp.contacts.manager;

import a1.d0;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
import android.app.PendingIntent;
import android.app.RemoteInput;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.media.AudioAttributes;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Parcelable;
import android.service.notification.StatusBarNotification;
import android.telecom.TelecomManager;
import android.text.Html;
import android.text.Spanned;
import android.util.Pair;
import android.widget.RemoteViews;
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
import androidx.core.app.a0;
import androidx.core.app.x;
import androidx.core.graphics.drawable.IconCompat;
import androidx.fragment.app.n;
import apk.tool.patcher.Premium;
import com.callapp.contacts.CallAppApplication;
import com.callapp.contacts.R;
import com.callapp.contacts.activity.SpamAppPermissionsActivity;
import com.callapp.contacts.activity.contact.details.BaseContactDetailsActivity;
import com.callapp.contacts.activity.contact.details.ContactDetailsActivity;
import com.callapp.contacts.activity.contact.details.PostCallActivity;
import com.callapp.contacts.activity.contact.details.incall.AnsweringMethodViewControllerFactory;
import com.callapp.contacts.activity.contact.list.ContactsListActivity;
import com.callapp.contacts.activity.crop.CallAppCropActivity;
import com.callapp.contacts.activity.idplus.IDPlusActivity;
import com.callapp.contacts.activity.marketplace.MarketPlaceActivity;
import com.callapp.contacts.activity.missedcall.MissedCallManager;
import com.callapp.contacts.activity.settings.SettingsActivity;
import com.callapp.contacts.activity.setup.navigation.OnBoardingNavigationActivity;
import com.callapp.contacts.activity.sms.SmsHelper;
import com.callapp.contacts.activity.sms.chat.SmsChatActivity;
import com.callapp.contacts.activity.sms.conversations.SmsConversationsActivity;
import com.callapp.contacts.activity.virtualNumber.VirtualNumberActivity;
import com.callapp.contacts.activity.virtualNumber.VirtualNumberNotificationType;
import com.callapp.contacts.activity.whoViewedMyProfile.WhoViewedMyProfileActivity;
import com.callapp.contacts.activity.whoViewedMyProfile.WhoViewedMyProfileDataManager;
import com.callapp.contacts.api.helper.backup.BackupUtils;
import com.callapp.contacts.manager.BlockManager;
import com.callapp.contacts.manager.NotificationExtractors.IMDataExtractionUtils;
import com.callapp.contacts.manager.analytics.AnalyticsManager;
import com.callapp.contacts.manager.contacts.ContactUtils;
import com.callapp.contacts.manager.phone.PhoneManager;
import com.callapp.contacts.manager.phone.PhoneStateManager;
import com.callapp.contacts.manager.preferences.Prefs;
import com.callapp.contacts.manager.preferences.prefs.BooleanPref;
import com.callapp.contacts.manager.preferences.prefs.IntegerPref;
import com.callapp.contacts.manager.sim.SimManager;
import com.callapp.contacts.manager.task.Task;
import com.callapp.contacts.model.ButtonSet;
import com.callapp.contacts.model.Constants;
import com.callapp.contacts.model.call.CallData;
import com.callapp.contacts.model.contact.ContactData;
import com.callapp.contacts.model.objectbox.BirthdayData;
import com.callapp.contacts.model.objectbox.ENTRYPOINT;
import com.callapp.contacts.model.objectbox.ExtractedInfo;
import com.callapp.contacts.model.objectbox.SingleSmsData;
import com.callapp.contacts.model.sms.conversations.SmsConversationType;
import com.callapp.contacts.receiver.SmsReplyReceiver;
import com.callapp.contacts.service.CallAppService;
import com.callapp.contacts.service.NotificationPendingIntentHandlerService;
import com.callapp.contacts.util.Activities;
import com.callapp.contacts.util.AndroidUtils;
import com.callapp.contacts.util.CLog;
import com.callapp.contacts.util.CallLogUtils;
import com.callapp.contacts.util.ImageUtils;
import com.callapp.contacts.util.LocaleUtils;
import com.callapp.contacts.util.MissedCallUtils;
import com.callapp.contacts.util.ThemeUtils;
import com.callapp.contacts.util.ViewUtils;
import com.callapp.contacts.util.callappRomHelper.romHelper.base.RomHelper;
import com.callapp.contacts.util.date.DateUtils;
import com.callapp.contacts.util.glide.GlideUtils;
import com.callapp.contacts.wearable.WearableClientHandler;
import com.callapp.contacts.widget.referandearn.ReferAndEarnActivity;
import com.callapp.contacts.workers.RemoveMissedCallNotAnsweredNotificationWorker;
import com.callapp.framework.phone.Phone;
import com.callapp.framework.util.CollectionUtils;
import com.callapp.framework.util.StringUtils;
import com.google.android.play.core.splitcompat.SplitCompatApplication;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import m7.d;
import s4.y;

public class NotificationManager {
    public static NotificationManager p;
    public static final HashMap q = new HashMap();
    public static int r = 0;
    public static final Object s = new Object();
    public static final Object t = new Object();
    public final android.app.NotificationManager f;
    public CountDownLatch h;
    public final InCallNotification l;
    public final HashMap n;
    public final Intent o;
    public final SimpleDateFormat a = new SimpleDateFormat(" - HH:mm");
    public final SimpleDateFormat b = new SimpleDateFormat(" - HH:mm dd/MM");
    public final long c = DateUtils.getTodayStartTime();
    public final Random d = new Random();
    public final Object e = new Object();
    public final Object g = new Object();
    public final AtomicInteger i = new AtomicInteger(0);
    public long j = n.d();
    public final CurrentCallDynamicObject k = new CurrentCallDynamicObject();
    public final t0.c[] m = {new t0.c(50, 50), new t0.c(15, 15), new t0.c(1, 1), new t0.c(9, 9), new t0.c(8, 8), new t0.c(4, 4), new t0.c(12, 12), new t0.c(17, 17), new t0.c(40, 40), new t0.c(10000, Integer.valueOf(CallAppCropActivity.REQUEST_CODE_IMAGE_CROP)), new t0.c(100, 1000), new t0.c(16, 16), new t0.c(20, 20), new t0.c(19, 19), new t0.c(70, 70), new t0.c(90, 90), new t0.c(91, 91), new t0.c(92, 92), new t0.c(93, 93), new t0.c(94, 94)};

    public static class AnonymousClass3 {
        public static final int[] a;

        static {
            int[] iArr = new int[MissedCallUtils.MissedCallNotificationType.values().length];
            a = iArr;
            try {
                iArr[MissedCallUtils.MissedCallNotificationType.SINGLE_CALL_PRIVATE_NUMBER.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[MissedCallUtils.MissedCallNotificationType.SINGLE_CALL_NON_PRIVATE_NUMBER.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[MissedCallUtils.MissedCallNotificationType.MULTIPLE_CALLS_ALL_PRIVATE_NUMBERS.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[MissedCallUtils.MissedCallNotificationType.MULTIPLE_CALLS_ALL_SAME_CALLER.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                a[MissedCallUtils.MissedCallNotificationType.MULTIPLE_CALLS_MIXED_CALLERS.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
        }
    }

    public static abstract class ContactDataForNotification<T> {
        public final Object a;
        public ContactData b;

        public ContactDataForNotification(T t) {
            this.a = t;
        }

        public static String a(ContactDataForNotification contactDataForNotification) {
            String str;
            String nameForNotificationLine = contactDataForNotification.getNameForNotificationLine();
            if (StringUtils.x(nameForNotificationLine)) {
                str = "<b>" + StringUtils.b(nameForNotificationLine) + "</b>";
            } else {
                str = null;
            }
            if (StringUtils.x(str)) {
                str = ViewUtils.isLocaleLTR() ? com.mobilefuse.sdk.assetsmanager.a.m("\u200e\u202a", str, "\u202c") : com.mobilefuse.sdk.assetsmanager.a.m("\u200f\u202b", str, "\u202c");
            }
            Phone sourcePhone = contactDataForNotification.getSourcePhone();
            if (sourcePhone != null && !CallLogUtils.s(sourcePhone.getRawNumber())) {
                String c = LocaleUtils.c(sourcePhone.g());
                str = StringUtils.x(str) ? com.mobilefuse.sdk.assetsmanager.a.n(str, " (", c, ")") : com.mobilefuse.sdk.assetsmanager.a.m("(", c, ")");
            }
            if (!StringUtils.t(str)) {
                return str;
            }
            if (ViewUtils.isLocaleLTR()) {
                return "\u200e\u202a" + Activities.getString(R.string.calllog_unknown_name) + "\u202c";
            }
            return "\u200f\u202b" + Activities.getString(R.string.calllog_unknown_name) + "\u202c";
        }

        public static void b(ArrayList arrayList) {
            Iterator it = arrayList.iterator();
            while (it.hasNext()) {
                ContactDataForNotification contactDataForNotification = (ContactDataForNotification) it.next();
                if (contactDataForNotification.getSourcePhone() != null) {
                    String rawNumber = contactDataForNotification.getSourcePhone().getRawNumber();
                    if (StringUtils.x(rawNumber)) {
                        contactDataForNotification.setContactData(ContactUtils.h(rawNumber));
                    }
                }
            }
        }

        public final boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null || getClass() != obj.getClass()) {
                return false;
            }
            return Objects.equals(this.a, ((ContactDataForNotification) obj).a);
        }

        public Intent getAddContactIntent() {
            ContactData contactData = this.b;
            if (contactData == null) {
                return null;
            }
            return ContactUtils.o(contactData, true);
        }

        public String getCallappName() {
            ContactData contactData = this.b;
            if (contactData == null) {
                return null;
            }
            return contactData.getFullName();
        }

        public ContactData getContactData() {
            return this.b;
        }

        public String getNameForNotificationLine() {
            if (StringUtils.x(getCallappName())) {
                return StringUtils.b(getCallappName());
            }
            if (StringUtils.x(getSourceName())) {
                return StringUtils.b(getSourceName());
            }
            return null;
        }

        public String getPhotoUrl() {
            ContactData contactData = this.b;
            if (contactData == null) {
                return null;
            }
            return contactData.getThumbnailUrl();
        }

        public abstract Date getSourceDate();

        public abstract String getSourceName();

        public abstract Phone getSourcePhone();

        public final int hashCode() {
            return Objects.hash(this.a, this.b);
        }

        public boolean isContactInDevice() {
            ContactData contactData = this.b;
            return contactData != null && contactData.isContactInDevice();
        }

        public void setContactData(ContactData contactData) {
            this.b = contactData;
        }
    }

    public class InCallNotification {
        public final Handler a;

        public InCallNotification() {
            HandlerThread handlerThread = new HandlerThread(InCallNotification.class.toString());
            handlerThread.start();
            AndroidUtils.b(handlerThread.getLooper());
            this.a = new Handler(handlerThread.getLooper());
        }

        public static void a(ContactData contactData, Intent intent, boolean z) {
            Pair e = BlockManager.e(contactData.getPhone());
            intent.setAction("com.callapp.contacts.ACTION_START_CALL_SCREEN").setComponent(new ComponentName((Context) CallAppApplication.get(), (Class<?>) CallAppService.class));
            NotificationManager.setDummyData(intent);
            intent.putExtra(Constants.EXTRA_IS_INCOMING, z);
            intent.putExtra(ContactDetailsActivity.EXTRA_IS_BLOCKED, (Serializable) e.first);
            if (IncognitoCallManager.get().isIncognito(contactData.getPhone())) {
                intent.putExtra(BaseContactDetailsActivity.EXTRA_INCOGNITO_CALL, true);
            }
            if (contactData.getGenomeData() != null) {
                intent.putExtra(PostCallActivity.EXTRA_IS_SPAMMER, contactData.isSpammer());
            }
            intent.putExtra(PostCallActivity.EXTRA_IS_GOLD, Premium.Premium());
            String rawNumber = contactData.getPhone().getRawNumber();
            if (StringUtils.x(rawNumber)) {
                ContactDetailsActivity.fillIntentWithCallData(intent, contactData.getDeviceId(), rawNumber, null, ExtractedInfo.Builder.getBuilderAccordingToOrigin(contactData.getPhone(), IMDataExtractionUtils.RecognizedPersonOrigin.CALL).build(), false, null, null);
                intent.putExtra(ContactDetailsActivity.EXTRA_FULL_NAME, (contactData.isIncognito() || IncognitoCallManager.get().isIncognito(contactData)) ? contactData.getFullName() : "");
            }
        }

        public static int d(ContactData contactData) {
            return ((PhoneManager.get().isDefaultPhoneApp() && PhoneStateManager.get().shouldConferenceScreenAppear()) || !contactData.isSpammer() || Premium.Premium()) ? ThemeUtils.getColor(ThemeUtils.isCurrentOSThemeModeLight(CallAppApplication.get().getResources().getConfiguration().uiMode) ? R.color.notification_background_light : R.color.notification_background_dark) : ThemeUtils.getColor(R.color.spam_color_dark);
        }

        public static String e(ContactData contactData, boolean z, boolean z2) {
            return z ? Activities.getString(R.string.conference_call) : z2 ? Activities.getString(R.string.voice_mail_text) : (contactData.isUnknownNumber() || contactData.getPhone().getRawNumber().equals("0")) ? Activities.getString(R.string.calllog_unknown_name) : StringUtils.b(contactData.getNameOrNumber());
        }

        public static void f(ContactData contactData, String str, Bitmap bitmap, String str2) {
            if (!((Boolean) BlockManager.e(contactData.getPhone()).first).booleanValue() || Prefs.b2.get() == BlockManager.BlockMethod.SILENT) {
                WearableClientHandler wearableClientHandler = Singletons.get().getWearableClientHandler();
                if (wearableClientHandler.isWearConnected()) {
                    if (bitmap != null) {
                        ByteArrayOutputStream byteArrayOutputStream = null;
                        try {
                            ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream();
                            try {
                                bitmap.compress(Bitmap.CompressFormat.PNG, 20, byteArrayOutputStream2);
                                byte[] byteArray = byteArrayOutputStream2.toByteArray();
                                try {
                                    byteArrayOutputStream2.close();
                                } catch (IOException unused) {
                                    StringUtils.I(WearableClientHandler.class);
                                    CLog.a();
                                }
                                if (byteArray != null) {
                                    byte[] bArr = wearableClientHandler.h;
                                    if (bArr == null) {
                                        wearableClientHandler.h = byteArray;
                                        wearableClientHandler.d("/callapp/image_path", byteArray);
                                    } else if (!Arrays.equals(byteArray, bArr)) {
                                        wearableClientHandler.h = byteArray;
                                        wearableClientHandler.d("/callapp/image_path", byteArray);
                                    }
                                }
                            } catch (Throwable th) {
                                th = th;
                                byteArrayOutputStream = byteArrayOutputStream2;
                                if (byteArrayOutputStream != null) {
                                    try {
                                        byteArrayOutputStream.close();
                                    } catch (IOException unused2) {
                                        StringUtils.I(WearableClientHandler.class);
                                        CLog.a();
                                    }
                                }
                                throw th;
                            }
                        } catch (Throwable th2) {
                            th = th2;
                        }
                    }
                    if (StringUtils.x(str)) {
                        String str3 = wearableClientHandler.i;
                        if (str3 == null) {
                            wearableClientHandler.i = str;
                            wearableClientHandler.d("/callapp/name_path", str.getBytes());
                        } else if (!StringUtils.k(str3, str)) {
                            wearableClientHandler.i = str;
                            wearableClientHandler.d("/callapp/name_path", str.getBytes());
                        }
                    }
                    wearableClientHandler.k = str2;
                }
            }
        }

        public final androidx.core.app.NotificationCompat.h b(com.callapp.contacts.model.contact.ContactData r21) {
            throw new UnsupportedOperationException("Method not decompiled: com.callapp.contacts.manager.NotificationManager.InCallNotification.b(com.callapp.contacts.model.contact.ContactData):androidx.core.app.NotificationCompat$h");
        }

        public final NotificationCompat.h c(ContactData contactData) {
            NotificationChannelEnum notificationChannelEnum = NotificationChannelEnum.INCALL_NOTIFICATION_CHANNEL;
            NotificationManager notificationManager = NotificationManager.p;
            NotificationManager notificationManager2 = NotificationManager.this;
            NotificationCompat.h p = notificationManager2.p(notificationChannelEnum);
            p.D = d(contactData);
            p.z = true;
            p.A = true;
            Intent intent = new Intent();
            a(contactData, intent, true);
            Bundle bundle = new Bundle();
            long time = new Date().getTime();
            bundle.putLong("time_stamp", time);
            p.C = bundle;
            p.Q.icon = R.drawable.ic_status_ongoing_call;
            p.m = false;
            boolean z = PhoneManager.get().isDefaultPhoneApp() && PhoneStateManager.get().shouldConferenceScreenAppear();
            boolean z2 = !IncognitoCallManager.get().isIncognito(contactData.getPhone()) && PhoneManager.get().k(contactData.getPhone());
            String e = e(contactData, z, z2);
            if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
                notificationManager2.k.f(z, z2, time, contactData.isSpammer() && !Premium.Premium());
            }
            CurrentCallDynamicObject currentCallDynamicObject = notificationManager2.k;
            f(contactData, e, currentCallDynamicObject.getPhotoBitmap(), contactData.getPhone().getRawNumber());
            p.i(2, true);
            p.E = 1;
            p.l = 2;
            p.B = "call";
            p.k((Uri) null);
            boolean isCurrentOSThemeModeLight = ThemeUtils.isCurrentOSThemeModeLight(CallAppApplication.get().getResources().getConfiguration().uiMode);
            PendingIntent service = PendingIntent.getService(CallAppApplication.get(), 30, intent, NotificationManager.c(134217728));
            PendingIntent service2 = PendingIntent.getService(CallAppApplication.get(), 20, new Intent((Context) CallAppApplication.get(), (Class<?>) NotificationPendingIntentHandlerService.class).setAction("com.callapp.contacts.ACTION_END_CALL_TELECOM"), NotificationManager.c(134217728));
            Intent action = new Intent((Context) CallAppApplication.get(), (Class<?>) NotificationPendingIntentHandlerService.class).setAction("com.callapp.contacts.ACTION_INCOMING_CALL_SMS_TELECOM");
            action.putExtra(Constants.EXTRA_PHONE_NUMBER, contactData.getPhone().getRawNumber());
            action.putExtra("contactId", contactData.getDeviceId());
            PendingIntent service3 = PendingIntent.getService(CallAppApplication.get(), 40, action, NotificationManager.c(134217728));
            PendingIntent service4 = PendingIntent.getService(CallAppApplication.get(), 60, new Intent((Context) CallAppApplication.get(), (Class<?>) NotificationPendingIntentHandlerService.class).setAction("com.callapp.contacts.ACTION_ANSWER_CALL_TELECOM"), NotificationManager.c(134217728));
            RemoteViews remoteViews = new RemoteViews(CallAppApplication.get().getPackageName(), R.layout.notification_incoming_custom_big);
            RemoteViews remoteViews2 = new RemoteViews(CallAppApplication.get().getPackageName(), R.layout.notification_call_custom_small);
            int color = ThemeUtils.getColor(isCurrentOSThemeModeLight ? R.color.title_light : R.color.title_dark);
            int color2 = ThemeUtils.getColor(isCurrentOSThemeModeLight ? R.color.subtitle_light : R.color.subtitle_dark);
            if (contactData.isSpammer() && !Premium.Premium()) {
                color2 = color;
            }
            Bitmap photoBitmap = currentCallDynamicObject.getPhotoBitmap();
            remoteViews.setImageViewBitmap(R.id.notificationCallPic, photoBitmap);
            remoteViews2.setImageViewBitmap(R.id.notificationCallPic, photoBitmap);
            if (CallLogUtils.s(contactData.getPhone().getRawNumber())) {
                StringUtils.I(NotificationManager.class);
                CLog.a();
                remoteViews.setViewVisibility(R.id.notificationIncomingBigSms, 4);
            } else {
                remoteViews.setViewVisibility(R.id.notificationIncomingBigSms, 0);
                remoteViews.setOnClickPendingIntent(R.id.notificationIncomingBigSms, service3);
            }
            ButtonSet buttonSet = (ButtonSet) Prefs.v3.get();
            AnsweringMethodViewControllerFactory.a(buttonSet);
            ButtonSet.Config config = buttonSet.getConfig();
            ButtonSet.Config config2 = ButtonSet.Config.DUAL_LEFT;
            if (config == config2 || buttonSet.getConfig() == ButtonSet.Config.HORIZONTAL_LEFT) {
                remoteViews.setOnClickPendingIntent(R.id.notificationIncomingBigRightButton, service2);
                remoteViews.setImageViewResource(R.id.notificationIncomingBigRightButton, R.drawable.ic_notification_decline);
                remoteViews.setOnClickPendingIntent(R.id.notificationIncomingBigLeftButton, service4);
                remoteViews.setImageViewResource(R.id.notificationIncomingBigLeftButton, R.drawable.ic_notification_answer);
            } else {
                remoteViews.setOnClickPendingIntent(R.id.notificationIncomingBigRightButton, service4);
                remoteViews.setImageViewResource(R.id.notificationIncomingBigRightButton, R.drawable.ic_notification_answer);
                remoteViews.setOnClickPendingIntent(R.id.notificationIncomingBigLeftButton, service2);
                remoteViews.setImageViewResource(R.id.notificationIncomingBigLeftButton, R.drawable.ic_notification_decline);
            }
            remoteViews.setOnClickPendingIntent(R.id.notificationIncomingBigWrapper, service);
            remoteViews.setTextViewText(R.id.notificationIncomingBigTitle, e);
            remoteViews.setTextViewText(R.id.notificationIncomingBigSubtitle, (!contactData.isSpammer() || Premium.Premium()) ? Activities.getString(R.string.incoming_call) : Activities.getString(R.string.action_spam_caption));
            remoteViews.setTextColor(R.id.notificationIncomingBigSubtitle, color2);
            remoteViews.setTextColor(R.id.notificationIncomingBigTitle, color);
            remoteViews.setInt(R.id.notificationIncomingBigSeparator, "setBackgroundColor", ThemeUtils.getColor(isCurrentOSThemeModeLight ? R.color.notification_separator_line_light : R.color.notification_separator_line_dark));
            if (buttonSet.getConfig() == config2 || buttonSet.getConfig() == ButtonSet.Config.HORIZONTAL_LEFT) {
                remoteViews2.setOnClickPendingIntent(R.id.notificationCallRightBtn, service2);
                remoteViews2.setImageViewResource(R.id.notificationCallRightBtn, R.drawable.ic_notification_decline);
                remoteViews2.setOnClickPendingIntent(R.id.notificationCallLeftBtn, service4);
                remoteViews2.setImageViewResource(R.id.notificationCallLeftBtn, R.drawable.ic_notification_answer);
            } else {
                remoteViews2.setOnClickPendingIntent(R.id.notificationCallRightBtn, service4);
                remoteViews2.setImageViewResource(R.id.notificationCallRightBtn, R.drawable.ic_notification_answer);
                remoteViews2.setOnClickPendingIntent(R.id.notificationCallLeftBtn, service2);
                remoteViews2.setImageViewResource(R.id.notificationCallLeftBtn, R.drawable.ic_notification_decline);
            }
            remoteViews2.setOnClickPendingIntent(R.id.notificationCallWrapper, service);
            remoteViews2.setTextViewText(R.id.notificationCallTitle, e);
            remoteViews2.setTextViewText(R.id.notificationCallSubtitle, Activities.getString(R.string.incoming_call));
            remoteViews2.setTextColor(R.id.notificationCallSubtitle, color2);
            remoteViews2.setTextColor(R.id.notificationCallTitle, color);
            int color3 = ThemeUtils.getColor(isCurrentOSThemeModeLight ? R.color.notification_background_light : R.color.notification_background_dark);
            if (contactData.isSpammer() && !Premium.Premium()) {
                color3 = ThemeUtils.getColor(R.color.spam_color_dark);
            }
            p.D = color3;
            p.z = true;
            p.A = true;
            p.g(e);
            p.f(Activities.getString(R.string.incoming_call));
            if (Build.VERSION.SDK_INT >= 31) {
                remoteViews2.setViewVisibility(R.id.notificationHeaderWrapper, 8);
                remoteViews.setViewVisibility(R.id.notificationHeaderWrapper, 8);
                remoteViews2.setViewVisibility(R.id.notificationCallEndExtender, 8);
                remoteViews.setViewVisibility(R.id.notificationCallEndExtender, 8);
                remoteViews2.setViewVisibility(R.id.notificationCallStartExtender, 8);
                remoteViews.setViewVisibility(R.id.notificationCallStartExtender, 8);
                remoteViews2.setViewVisibility(R.id.notificationCallBottomExtender, 8);
                remoteViews.setViewVisibility(R.id.notificationCallBottomExtender, 8);
                p.l(new NotificationCompat.j());
            } else {
                remoteViews2.setInt(R.id.notificationCallBackground, "setBackgroundColor", color3);
                remoteViews.setInt(R.id.notificationCallBackground, "setBackgroundColor", color3);
                remoteViews.setTextColor(R.id.notificationCallAppName, color);
                remoteViews2.setTextColor(R.id.notificationCallAppName, color);
            }
            p.H = remoteViews;
            p.G = remoteViews2;
            return p;
        }
    }

    public static final class NotificationChannelEnum {
        private static final NotificationChannelEnum[] $VALUES;
        public static final NotificationChannelEnum BACKUP_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum BIRTHDAY_REMINDER_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum CALLER_ID_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum CALL_BLOCKED_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum CALL_REMINDER_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum DEFAULT_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum IM_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum INCALL_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum MISSED_CALL_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum NOT_ANSWERED_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum OTP_SMS_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum PROFILE_VIEWED_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum REFER_AND_EARN_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum REGISTRATION_REMINDER_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum REMINDER_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum SECOND_NUMBER_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum SECOND_NUMBER_PERMISSION_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum SETUP_INPROGRESS_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum SHOW_VOICEMAIL_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum SMS_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum SYNC_PROGRESS_NOTIFICATION_CHANNEL;
        public static final NotificationChannelEnum VALIDATE_CLIENT_TASK_NOTIFICATION_CHANNEL;
        private final String groupId;
        private final int id;
        private final int importance;
        private final CharSequence name;
        private final boolean showBadge;

        private static NotificationChannelEnum[] $values() {
            return new NotificationChannelEnum[]{REMINDER_NOTIFICATION_CHANNEL, CALL_REMINDER_NOTIFICATION_CHANNEL, BIRTHDAY_REMINDER_NOTIFICATION_CHANNEL, REGISTRATION_REMINDER_NOTIFICATION_CHANNEL, BACKUP_NOTIFICATION_CHANNEL, SETUP_INPROGRESS_NOTIFICATION_CHANNEL, SYNC_PROGRESS_NOTIFICATION_CHANNEL, VALIDATE_CLIENT_TASK_NOTIFICATION_CHANNEL, CALL_BLOCKED_NOTIFICATION_CHANNEL, IM_NOTIFICATION_CHANNEL, INCALL_NOTIFICATION_CHANNEL, MISSED_CALL_NOTIFICATION_CHANNEL, NOT_ANSWERED_NOTIFICATION_CHANNEL, REFER_AND_EARN_NOTIFICATION_CHANNEL, PROFILE_VIEWED_NOTIFICATION_CHANNEL, CALLER_ID_NOTIFICATION_CHANNEL, OTP_SMS_NOTIFICATION_CHANNEL, SMS_NOTIFICATION_CHANNEL, SHOW_VOICEMAIL_NOTIFICATION_CHANNEL, SECOND_NUMBER_NOTIFICATION_CHANNEL, SECOND_NUMBER_PERMISSION_NOTIFICATION_CHANNEL, DEFAULT_NOTIFICATION_CHANNEL};
        }

        static {
            String string = Activities.getString(R.string.reminders_notification_channel);
            NotificationChannelGroupEnum notificationChannelGroupEnum = NotificationChannelGroupEnum.REMINDERS;
            REMINDER_NOTIFICATION_CHANNEL = new NotificationChannelEnum("REMINDER_NOTIFICATION_CHANNEL", 0, 4, string, 3, notificationChannelGroupEnum, false);
            CALL_REMINDER_NOTIFICATION_CHANNEL = new NotificationChannelEnum("CALL_REMINDER_NOTIFICATION_CHANNEL", 1, 10000, Activities.getString(R.string.call_reminder_notification_channel), 4, notificationChannelGroupEnum, false);
            BIRTHDAY_REMINDER_NOTIFICATION_CHANNEL = new NotificationChannelEnum("BIRTHDAY_REMINDER_NOTIFICATION_CHANNEL", 2, 100, Activities.getString(R.string.birthday_reminder_notification_channel), 3, notificationChannelGroupEnum, false);
            String string2 = Activities.getString(R.string.registration_reminder_notification_channel);
            NotificationChannelGroupEnum notificationChannelGroupEnum2 = NotificationChannelGroupEnum.REGISTRATION_AND_SYNC;
            REGISTRATION_REMINDER_NOTIFICATION_CHANNEL = new NotificationChannelEnum("REGISTRATION_REMINDER_NOTIFICATION_CHANNEL", 3, 5, string2, 4, notificationChannelGroupEnum2, false);
            BACKUP_NOTIFICATION_CHANNEL = new NotificationChannelEnum("BACKUP_NOTIFICATION_CHANNEL", 4, 60, Activities.getString(R.string.backup_notification_channel), 2, NotificationChannelGroupEnum.BACKUP, false);
            SETUP_INPROGRESS_NOTIFICATION_CHANNEL = new NotificationChannelEnum("SETUP_INPROGRESS_NOTIFICATION_CHANNEL", 5, 9, Activities.getString(R.string.setup_inprogress_notification_channel), 4, notificationChannelGroupEnum2, false);
            SYNC_PROGRESS_NOTIFICATION_CHANNEL = new NotificationChannelEnum("SYNC_PROGRESS_NOTIFICATION_CHANNEL", 6, 8, Activities.getString(R.string.sync_progress_notification_channel), 2, notificationChannelGroupEnum2, false);
            VALIDATE_CLIENT_TASK_NOTIFICATION_CHANNEL = new NotificationChannelEnum("VALIDATE_CLIENT_TASK_NOTIFICATION_CHANNEL", 7, 7, Activities.getString(R.string.validate_client_task_notification_channel), 4, notificationChannelGroupEnum2, false);
            String string3 = Activities.getString(R.string.call_blocked_notification_channel);
            NotificationChannelGroupEnum notificationChannelGroupEnum3 = NotificationChannelGroupEnum.CALL_IDENTIFICATION;
            CALL_BLOCKED_NOTIFICATION_CHANNEL = new NotificationChannelEnum("CALL_BLOCKED_NOTIFICATION_CHANNEL", 8, 1, string3, 3, notificationChannelGroupEnum3, false);
            IM_NOTIFICATION_CHANNEL = new NotificationChannelEnum("IM_NOTIFICATION_CHANNEL", 9, 50, Activities.getString(R.string.call_identification_group_title), 3, notificationChannelGroupEnum3, false);
            String string4 = Activities.getString(R.string.incall_notification_channel);
            NotificationChannelGroupEnum notificationChannelGroupEnum4 = NotificationChannelGroupEnum.CALL_NOTIFICATION;
            INCALL_NOTIFICATION_CHANNEL = new NotificationChannelEnum("INCALL_NOTIFICATION_CHANNEL", 10, 12, string4, 3, notificationChannelGroupEnum4, false);
            MISSED_CALL_NOTIFICATION_CHANNEL = new NotificationChannelEnum("MISSED_CALL_NOTIFICATION_CHANNEL", 11, 17, Activities.getString(R.string.missed_call_notification_channel), 3, NotificationChannelGroupEnum.MISSED_CALL_NOTIFICATION, true);
            NOT_ANSWERED_NOTIFICATION_CHANNEL = new NotificationChannelEnum("NOT_ANSWERED_NOTIFICATION_CHANNEL", 12, 40, Activities.getString(R.string.not_answered_notification_channel), 3, NotificationChannelGroupEnum.NOT_ANSWERED_NOTIFICATION, true);
            REFER_AND_EARN_NOTIFICATION_CHANNEL = new NotificationChannelEnum("REFER_AND_EARN_NOTIFICATION_CHANNEL", 13, 14, Activities.getString(R.string.refer_and_earn_notification_channel), 4, NotificationChannelGroupEnum.REFER_AND_EARN_NOTIFICATION, false);
            PROFILE_VIEWED_NOTIFICATION_CHANNEL = new NotificationChannelEnum("PROFILE_VIEWED_NOTIFICATION_CHANNEL", 14, 15, Activities.getString(R.string.profile_viewed_notification_channel), 4, NotificationChannelGroupEnum.PROFILE_VIEWED, false);
            CALLER_ID_NOTIFICATION_CHANNEL = new NotificationChannelEnum("CALLER_ID_NOTIFICATION_CHANNEL", 15, 16, Activities.getString(R.string.caller_id_notification_channel), 4, notificationChannelGroupEnum4, false);
            String string5 = Activities.getString(R.string.otp_notification_channel);
            NotificationChannelGroupEnum notificationChannelGroupEnum5 = NotificationChannelGroupEnum.SMS;
            OTP_SMS_NOTIFICATION_CHANNEL = new NotificationChannelEnum("OTP_SMS_NOTIFICATION_CHANNEL", 16, 20, string5, 4, notificationChannelGroupEnum5, false);
            SMS_NOTIFICATION_CHANNEL = new NotificationChannelEnum("SMS_NOTIFICATION_CHANNEL", 17, 90, Activities.getString(R.string.sms_notification_channel), 4, notificationChannelGroupEnum5, true);
            SHOW_VOICEMAIL_NOTIFICATION_CHANNEL = new NotificationChannelEnum("SHOW_VOICEMAIL_NOTIFICATION_CHANNEL", 18, 70, Activities.getString(R.string.show_voicemail_notification_channel), 4, notificationChannelGroupEnum4, false);
            String string6 = Activities.getString(R.string.second_number_notification_channel);
            NotificationChannelGroupEnum notificationChannelGroupEnum6 = NotificationChannelGroupEnum.SECOND_NUMBER;
            SECOND_NUMBER_NOTIFICATION_CHANNEL = new NotificationChannelEnum("SECOND_NUMBER_NOTIFICATION_CHANNEL", 19, 93, string6, 4, notificationChannelGroupEnum6, false);
            SECOND_NUMBER_PERMISSION_NOTIFICATION_CHANNEL = new NotificationChannelEnum("SECOND_NUMBER_PERMISSION_NOTIFICATION_CHANNEL", 20, 94, Activities.getString(R.string.second_number_notification_channel), 4, notificationChannelGroupEnum6, false);
            DEFAULT_NOTIFICATION_CHANNEL = new NotificationChannelEnum("DEFAULT_NOTIFICATION_CHANNEL", 21, -1, Activities.getString(R.string.default_notification_channel), 3, null, false);
            $VALUES = $values();
        }

        private NotificationChannelEnum(String str, int i, int i2, CharSequence charSequence, int i3, NotificationChannelGroupEnum notificationChannelGroupEnum, boolean z) {
            this.id = i2;
            this.name = charSequence;
            this.importance = i3;
            if (notificationChannelGroupEnum != null) {
                this.groupId = notificationChannelGroupEnum.getId();
            } else {
                this.groupId = null;
            }
            this.showBadge = z;
        }

        public static NotificationChannelEnum valueOf(String str) {
            return (NotificationChannelEnum) Enum.valueOf(NotificationChannelEnum.class, str);
        }

        public static NotificationChannelEnum[] values() {
            return (NotificationChannelEnum[]) $VALUES.clone();
        }

        public String getGroupId() {
            return this.groupId;
        }

        public int getId() {
            return this.id;
        }

        public int getImportance() {
            return this.importance;
        }

        public CharSequence getName() {
            return this.name;
        }

        public boolean isShowBadge() {
            return this.showBadge;
        }

        @Override
        @NonNull
        public String toString() {
            StringBuilder sb2 = new StringBuilder("NotificationChannelEnum{id=");
            sb2.append(this.id);
            sb2.append(", name=");
            sb2.append((Object) this.name);
            sb2.append(", importance=");
            sb2.append(this.importance);
            sb2.append(", groupId='");
            sb2.append(this.groupId);
            sb2.append("', showBadge=");
            return n.s(sb2, this.showBadge, '}');
        }
    }

    public enum NotificationChannelGroupEnum {
        REMINDERS("0", Activities.getString(R.string.reminders_group_title)),
        CALL_IDENTIFICATION("2", Activities.getString(R.string.call_identification_group_title)),
        REGISTRATION_AND_SYNC("3", Activities.getString(R.string.registration_and_sync_group_title)),
        CALL_NOTIFICATION("4", Activities.getString(R.string.call_notification_group_title)),
        MISSED_CALL_NOTIFICATION("5", Activities.getString(R.string.missed_call_notification_group_title)),
        NOT_ANSWERED_NOTIFICATION("6", Activities.getString(R.string.not_answer_notification_group_title)),
        REFER_AND_EARN_NOTIFICATION("7", Activities.getString(R.string.refer_and_earn_notification_group_title)),
        PROFILE_VIEWED("8", Activities.getString(R.string.profile_viewed_notification_group_title)),
        BACKUP("9", Activities.getString(R.string.backup_notification_group_title)),
        SMS("10", Activities.getString(R.string.sms_notification_group_title)),
        SECOND_NUMBER("11", Activities.getString(R.string.second_number_notification_group_title));

        private final String id;
        private final CharSequence name;

        NotificationChannelGroupEnum(String str, CharSequence charSequence) {
            this.id = str;
            this.name = charSequence;
        }

        public String getId() {
            return this.id;
        }

        public CharSequence getName() {
            return this.name;
        }
    }

    public static class NotificationTimeUtils {
        public static boolean isCurrentTimeDisturbing() {
            int i = Calendar.getInstance().get(11);
            return i < 10 || i >= 20;
        }
    }

    private NotificationManager() {
        VirtualNumberActivity.Companion companion = VirtualNumberActivity.INSTANCE;
        SplitCompatApplication splitCompatApplication = CallAppApplication.get();
        companion.getClass();
        this.o = VirtualNumberActivity.Companion.a(splitCompatApplication);
        this.f = (android.app.NotificationManager) CallAppApplication.get().getSystemService(Constants.NOTIFICATION);
        this.n = new HashMap();
        for (NotificationChannelEnum notificationChannelEnum : NotificationChannelEnum.values()) {
            this.n.put(Integer.valueOf(notificationChannelEnum.getId()), notificationChannelEnum);
        }
        this.l = new InCallNotification();
    }

    public static int c(int i) {
        return Build.VERSION.SDK_INT >= 31 ? i | 67108864 : i;
    }

    public static void d() {
        try {
            TelecomManager telecomManager = (TelecomManager) Singletons.b("telecom");
            if (telecomManager != null) {
                try {
                    telecomManager.cancelMissedCallsNotification();
                } catch (IllegalArgumentException | NoSuchMethodError | SecurityException unused) {
                    StringUtils.I(PhoneManager.class);
                    CLog.d();
                }
            }
        } catch (Throwable th) {
            StringUtils.I(NotificationManager.class);
            CLog.c("Failed to clear missed calls notification due to Throwable!", th);
        }
    }

    public static void g(NotificationCompat.h hVar, Bitmap bitmap, ArrayList arrayList) {
        if (Singletons.get().getWearableClientHandler().isWearConnected()) {
            NotificationCompat.n nVar = new NotificationCompat.n();
            nVar.f = R.mipmap.ic_launcher;
            nVar.e = bitmap == null ? null : Bitmap.createScaledBitmap(bitmap, 400, 400, false);
            if (CollectionUtils.h(arrayList)) {
                nVar.a.addAll(arrayList);
            }
            Bundle bundle = new Bundle();
            if (!nVar.a.isEmpty()) {
                ArrayList<? extends Parcelable> arrayList2 = new ArrayList<>(nVar.a.size());
                Iterator it = nVar.a.iterator();
                while (it.hasNext()) {
                    NotificationCompat.a aVar = (NotificationCompat.a) it.next();
                    int i = Build.VERSION.SDK_INT;
                    IconCompat a = aVar.a();
                    Notification.Action.Builder a2 = NotificationCompat.n.b.a(a == null ? null : a.f((Context) null), aVar.i, aVar.j);
                    Bundle bundle2 = aVar.a;
                    Bundle bundle3 = bundle2 != null ? new Bundle(bundle2) : new Bundle();
                    boolean z = aVar.d;
                    bundle3.putBoolean("android.support.allowGeneratedReplies", z);
                    NotificationCompat.n.c.a(a2, z);
                    if (i >= 31) {
                        NotificationCompat.n.d.a(a2, aVar.k);
                    }
                    NotificationCompat.n.a.a(a2, bundle3);
                    x[] xVarArr = aVar.c;
                    if (xVarArr != null) {
                        for (RemoteInput remoteInput : x.a(xVarArr)) {
                            NotificationCompat.n.a.b(a2, remoteInput);
                        }
                    }
                    arrayList2.add(NotificationCompat.n.a.c(a2));
                }
                bundle.putParcelableArrayList("actions", arrayList2);
            }
            int i2 = nVar.b;
            if (i2 != 1) {
                bundle.putInt("flags", i2);
            }
            PendingIntent pendingIntent = nVar.c;
            if (pendingIntent != null) {
                bundle.putParcelable("displayIntent", pendingIntent);
            }
            if (!nVar.d.isEmpty()) {
                ArrayList arrayList3 = nVar.d;
                bundle.putParcelableArray("pages", (Parcelable[]) arrayList3.toArray(new Notification[arrayList3.size()]));
            }
            Bitmap bitmap2 = nVar.e;
            if (bitmap2 != null) {
                bundle.putParcelable("background", bitmap2);
            }
            int i3 = nVar.f;
            if (i3 != 0) {
                bundle.putInt("contentIcon", i3);
            }
            int i4 = nVar.g;
            if (i4 != 8388613) {
                bundle.putInt("contentIconGravity", i4);
            }
            int i5 = nVar.h;
            if (i5 != -1) {
                bundle.putInt("contentActionIndex", i5);
            }
            int i6 = nVar.i;
            if (i6 != 0) {
                bundle.putInt("customSizePreset", i6);
            }
            int i7 = nVar.j;
            if (i7 != 0) {
                bundle.putInt("customContentHeight", i7);
            }
            int i8 = nVar.k;
            if (i8 != 80) {
                bundle.putInt("gravity", i8);
            }
            int i10 = nVar.l;
            if (i10 != 0) {
                bundle.putInt("hintScreenTimeout", i10);
            }
            String str = nVar.m;
            if (str != null) {
                bundle.putString("dismissalId", str);
            }
            String str2 = nVar.n;
            if (str2 != null) {
                bundle.putString("bridgeTag", str2);
            }
            hVar.c().putBundle("android.wearable.EXTENSIONS", bundle);
        }
    }

    public static NotificationManager get() {
        synchronized (NotificationManager.class) {
            try {
                if (p == null) {
                    p = new NotificationManager();
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        return p;
    }

    private NotificationChannelEnum getChannelEnumFromNotificationId(int i) {
        int i2 = 10000;
        if (i < 10000 || i > 20000) {
            i2 = 100;
            if (i < 100 || i > 20000) {
                if (i == 91 || i < -1) {
                    i = 90;
                }
                return (NotificationChannelEnum) this.n.get(Integer.valueOf(i));
            }
        }
        i = i2;
        return (NotificationChannelEnum) this.n.get(Integer.valueOf(i));
    }

    private NotificationCompat.h getImDetailNotificationBuilder() {
        NotificationCompat.h p2 = p(NotificationChannelEnum.IM_NOTIFICATION_CHANNEL);
        p2.i(16, true);
        p2.l = 1;
        p2.D = ThemeUtils.getColor(R.color.sms_blue);
        p2.k((Uri) null);
        p2.Q.icon = R.drawable.ic_status_identification;
        return p2;
    }

    public String getNotificationChannelIdWithPrefix(int i) {
        return Prefs.w0.get() + " " + i;
    }

    private PendingIntent getSmsOpenConversationListPendingIntent(int i) {
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) SmsConversationsActivity.class);
        intent.putExtra(SmsConversationsActivity.SELECT_TAB_EXTRA, SmsConversationType.ALL_CONVERSATIONS.getIntType());
        intent.putExtra("notification_id", 92);
        return PendingIntent.getActivity(CallAppApplication.get(), i, intent, c(268435456));
    }

    private PendingIntent getSmsOpenSpamListPendingIntent(int i) {
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) SmsConversationsActivity.class);
        intent.putExtra(SmsConversationsActivity.SELECT_TAB_EXTRA, SmsConversationType.SPAM_CONVERSATIONS.getIntType());
        return PendingIntent.getActivity(CallAppApplication.get(), i, intent, c(134217728));
    }

    public static NotificationCompat.a h(int i, int i2, PendingIntent pendingIntent) {
        return new NotificationCompat.a(i, Activities.getString(i2), pendingIntent);
    }

    public static Intent i(String str, int i, Phone phone, String str2, Class cls) {
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) cls);
        setDummyData(intent);
        intent.setAction(str);
        intent.putExtra("notification_id", i);
        intent.putExtra(Constants.EXTRA_PHONE_NUMBER, phone.getRawNumber());
        if (StringUtils.x(str2)) {
            intent.putExtra("full_name", str2);
            return intent;
        }
        intent.putExtra("full_name", phone.getRawNumber());
        return intent;
    }

    private boolean isPartOfGroup(int i) {
        return q.containsKey(Integer.valueOf(i));
    }

    public static PendingIntent k(int i, String str, Phone phone, String str2) {
        return PendingIntent.getService(CallAppApplication.get(), i, i(str2, i, phone, str, NotificationPendingIntentHandlerService.class), c(1073741824));
    }

    public static ArrayList l(int i, Phone phone, String str, long j, boolean z) {
        PendingIntent k = k(i, str, phone, "NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_CALL_REMINDER_CALL");
        PendingIntent s2 = s(i, str, phone, "NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_CALL_REMINDER_SEND_MESSAGE");
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) ContactsListActivity.class);
        intent.setAction("NOTIFICATION_PREFIX_com.callapp.NOTIFICATION_ACTION_CALL_REMINDER_SNOOZE");
        intent.putExtra("full_name", str);
        intent.putExtra("notification_id", i);
        intent.putExtra(Constants.EXTRA_PHONE_NUMBER, phone.getRawNumber());
        intent.putExtra("notification_reminder_time", j);
        PendingIntent activity = PendingIntent.getActivity(CallAppApplication.get(), i, intent, c(1073741824));
        ArrayList arrayList = new ArrayList(3);
        int[] iArr = z ? new int[]{R.drawable.ic_call_notification_wear, R.drawable.ic_messaging_notification_wear, R.drawable.ic_time_notification_wear} : new int[]{R.drawable.ic_call_notification, R.drawable.ic_messaging_notification, R.drawable.ic_action_time_notification};
        arrayList.add(h(iArr[0], R.string.call_reminder_call_action, k));
        arrayList.add(h(iArr[1], R.string.call_reminder_sms_action, s2));
        arrayList.add(h(iArr[2], R.string.call_reminder_snooze_action, activity));
        return arrayList;
    }

    public static PendingIntent m(ContactData contactData, int i, boolean z) {
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) NotificationPendingIntentHandlerService.class);
        intent.setAction("com.callapp.contacts.ACTION_DISMISS_SMS_NOTIFICATION");
        intent.putExtra(Constants.EXTRA_PHONE_NUMBER, contactData.getPhone().getRawNumber());
        intent.putExtra("is_spam", contactData.isSpammer());
        intent.putExtra("is_contact", contactData.isContactInDevice());
        if (z) {
            intent.putExtra("mark_as_read", z);
        }
        return PendingIntent.getService(CallAppApplication.get(), i, intent, c(1073741824));
    }

    public static ArrayList o(int i, String str, Phone phone, int i2, int i3, boolean z) {
        ArrayList arrayList = new ArrayList(3);
        int[] iArr = z ? new int[]{R.drawable.ic_call_notification_wear, R.drawable.ic_messaging_notification_wear, R.drawable.ic_time_notification_wear} : new int[]{R.drawable.ic_call_notification, R.drawable.ic_messaging_notification, R.drawable.ic_action_time_notification};
        PendingIntent k = k(i, str, phone, i3 == 3 ? "NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_CALL_FROM_MISSED_CALL" : "NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_CALL_FROM_NOT_ANSWERED");
        PendingIntent s2 = s(i, str, phone, i3 == 3 ? "NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_SEND_MESSAGE_FROM_MISSED_CALL" : "NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_SEND_MESSAGE_FROM_NOT_ANSWERED");
        String str2 = i3 == 3 ? "NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_BTN_REMINDER_FROM_MISSED_CALL" : "NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_BTN_REMINDER_FROM_NOT_ANSWERED";
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) ContactsListActivity.class);
        intent.putExtra("future_target_index_key", i2);
        intent.setAction(str2);
        intent.putExtra("full_name", str);
        intent.putExtra("notification_id", i);
        intent.putExtra(Constants.EXTRA_PHONE_NUMBER, phone.getRawNumber());
        PendingIntent activity = PendingIntent.getActivity(CallAppApplication.get(), i, intent, c(1073741824));
        arrayList.add(h(iArr[0], i3 == 3 ? R.string.call_reminder_call_action : R.string.call_reminder_call_again_action, k));
        arrayList.add(h(iArr[1], R.string.call_reminder_sms_action, s2));
        arrayList.add(h(iArr[2], R.string.reminderText, activity));
        return arrayList;
    }

    public static PendingIntent q(int i, ContactData contactData) {
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) NotificationPendingIntentHandlerService.class);
        intent.setAction("com.callapp.contacts.ACTION_DISMISS_SMS_NOTIFICATION");
        intent.putExtra(Constants.EXTRA_PHONE_NUMBER, contactData.getPhone().c());
        intent.putExtra("is_spam", contactData.isSpammer());
        intent.putExtra("is_contact", contactData.isContactInDevice());
        return PendingIntent.getService(CallAppApplication.get(), i, intent, c(268435456));
    }

    public static PendingIntent r(String str, int i, Integer num) {
        Intent intent = new Intent("android.intent.action.SENDTO", Uri.parse("sms:" + str));
        if (num != null) {
            if (Build.VERSION.SDK_INT >= 30) {
                intent.putExtra("android.telephony.extra.SLOT_INDEX", SimManager.get().getSimSlotIdFromSubscriptionInfo(num.intValue()).simId);
            } else if (PhoneManager.get().isDefaultPhoneApp()) {
                intent.putExtra(SingleSmsData.EXTRA_MESSAGE_SUB_ID, num);
            }
        }
        intent.setFlags(268435456);
        return PendingIntent.getActivity(CallAppApplication.get(), i, intent, c(134217728));
    }

    public static PendingIntent s(int i, String str, Phone phone, String str2) {
        return PendingIntent.getActivity(CallAppApplication.get(), i, i(str2, i, phone, str, ContactsListActivity.class), c(1073741824));
    }

    public static void setDummyData(Intent intent) {
        intent.setData(Uri.parse(Long.toString(System.currentTimeMillis())));
    }

    private void setNotificationAsSilent(Notification notification) {
        notification.defaults = 4;
        notification.sound = null;
    }

    public static PendingIntent t(int i, String str) {
        return PendingIntent.getActivity(CallAppApplication.get(), i, SmsChatActivity.getChatActivityIntent(str, "ClickNotificationReply", true), c(134217728));
    }

    public static void x(NotificationCompat.h hVar, int i, String str, int i2) {
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) NotificationPendingIntentHandlerService.class);
        intent.putExtra("future_target_index_key", i2);
        intent.setAction(str);
        intent.putExtra("notification_id", i);
        hVar.Q.deleteIntent = PendingIntent.getService(CallAppApplication.get(), i, intent, c(1073741824));
    }

    public static void y(Object obj, Intent intent, NotificationCompat.h hVar, int i, int i2, boolean z) {
        a0 d = a0.d(CallAppApplication.get());
        boolean z2 = obj instanceof Class;
        ArrayList arrayList = d.a;
        Context context = d.b;
        if (z2) {
            if (z) {
                ComponentName component = intent.getComponent();
                if (component == null) {
                    component = intent.resolveActivity(context.getPackageManager());
                }
                if (component != null) {
                    d.b(component);
                }
                arrayList.add(intent);
            } else {
                d.b(new ComponentName(context, (Class<?>) obj));
                arrayList.add(intent);
            }
        } else if (obj instanceof Intent) {
            arrayList.add((Intent) obj);
            arrayList.add(intent);
        }
        if (arrayList.isEmpty()) {
            throw new IllegalStateException("No intents added to TaskStackBuilder; cannot getPendingIntent");
        }
        Intent[] intentArr = (Intent[]) arrayList.toArray(new Intent[0]);
        intentArr[0] = new Intent(intentArr[0]).addFlags(268484608);
        hVar.g = PendingIntent.getActivities(context, i, intentArr, i2, null);
    }

    public final void A(String str) {
        String string = Activities.getString(R.string.an_error_occurred);
        String f = Activities.f(R.string.on_backup_disconnection, str);
        NotificationCompat.h p2 = p(NotificationChannelEnum.BACKUP_NOTIFICATION_CHANNEL);
        PendingIntent activity = PendingIntent.getActivity(CallAppApplication.get(), 0, BackupUtils.getBackupSettingsIntent(), c(134217728));
        p2.e = NotificationCompat.h.d(string);
        p2.f = NotificationCompat.h.d(f);
        p2.Q.icon = R.drawable.ic_callapp_icon_notification;
        p2.j(BitmapFactory.decodeResource(CallAppApplication.get().getResources(), R.drawable.ic_app_menu_dot));
        p2.i(16, true);
        p2.g = activity;
        p2.R = true;
        M(60, p2);
    }

    public final void B(boolean z, boolean z2) {
        int i;
        int i2;
        if (z2) {
            i = R.string.the_backup_failed;
            i2 = R.string.please_contact_support_for_assistance;
        } else {
            i = R.string.an_error_occurred;
            i2 = R.string.an_error_occurred_we_will_try_to_backup_again_soon;
        }
        if (z) {
            i = R.string.insufficient_space;
            i2 = R.string.you_need_to_free_up_space_to_continue_the_backup;
        }
        String string = Activities.getString(i);
        String string2 = Activities.getString(i2);
        NotificationCompat.h p2 = p(NotificationChannelEnum.BACKUP_NOTIFICATION_CHANNEL);
        PendingIntent activity = PendingIntent.getActivity(CallAppApplication.get(), 0, BackupUtils.getBackupSettingsIntent(), c(134217728));
        p2.e = NotificationCompat.h.d(string);
        p2.f = NotificationCompat.h.d(string2);
        p2.Q.icon = R.drawable.ic_callapp_icon_notification;
        p2.j(BitmapFactory.decodeResource(CallAppApplication.get().getResources(), R.drawable.ic_app_menu_dot));
        p2.g = activity;
        p2.i(16, true);
        p2.R = true;
        M(60, p2);
    }

    public final void C(List list) {
        int size = list.size();
        final int i = 0;
        while (i < size) {
            final BirthdayData birthdayData = (BirthdayData) list.get(i);
            final boolean z = Prefs.z.get().booleanValue() && i == 0;
            if (Prefs.w.get() != null) {
                new Task() {
                    @Override
                    public final void doTask() {
                        throw new UnsupportedOperationException("Method not decompiled: com.callapp.contacts.manager.NotificationManager.AnonymousClass2.doTask():void");
                    }
                }.execute();
            }
            i++;
        }
        IntegerPref integerPref = Prefs.e0;
        integerPref.set(Integer.valueOf(list.size() + integerPref.get().intValue()));
        if (integerPref.get().intValue() > 1000) {
            integerPref.set(100);
        }
    }

    public final void D(final CallData callData, final ContactData contactData, final boolean z, final boolean z2, final boolean z3) {
        this.l.a.post(new Runnable() {
            @Override
            public final void run() {
                throw new UnsupportedOperationException("Method not decompiled: com.callapp.contacts.manager.a.run():void");
            }
        });
    }

    public final void E(String str) {
        ContactData contact;
        InCallNotification inCallNotification = this.l;
        inCallNotification.getClass();
        synchronized (s) {
            try {
                contact = NotificationManager.this.k.getContact();
                if (contact == null) {
                    contact = new ContactData(PhoneManager.get().e(str), 0L, null);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        this.l.a.post(new ab.a(27, this, PhoneStateManager.get().isIncoming() ? inCallNotification.c(contact) : inCallNotification.b(contact)));
    }

    public final void F(List list) {
        String b;
        String thumbnailUrl;
        int i;
        int i2;
        Intent createIntent;
        String b2;
        Bitmap c;
        if (CollectionUtils.f(list) || !Prefs.q2.get().booleanValue()) {
            return;
        }
        CopyOnWriteArrayList copyOnWriteArrayList = new CopyOnWriteArrayList(list);
        r++;
        SplitCompatApplication splitCompatApplication = CallAppApplication.get();
        NotificationCompat.h p2 = p(NotificationChannelEnum.CALL_BLOCKED_NOTIFICATION_CHANNEL);
        Phone phone = (Phone) copyOnWriteArrayList.get(copyOnWriteArrayList.size() - 1);
        ContactData i3 = ContactUtils.i(phone);
        if (PhoneManager.get().k(phone)) {
            b = Activities.getString(R.string.voice_mail_text);
            thumbnailUrl = ImageUtils.getResourceUri(R.drawable.ic_contact_voice_mail);
        } else {
            b = StringUtils.b(i3.getNameOrNumber());
            thumbnailUrl = i3.getThumbnailUrl();
        }
        String str = b;
        int incrementAndGet = this.i.incrementAndGet();
        if (StringUtils.x(thumbnailUrl) && (c = this.k.c(thumbnailUrl, R.drawable.profile_pic_default, incrementAndGet, i3)) != null) {
            try {
                g(p2, c, null);
            } catch (RuntimeException e) {
                StringUtils.I(getClass());
                CLog.c("Could not generate notification bitmap for in-call", e);
            }
            p2.j(c);
        }
        if (r == 1) {
            p2.g(Activities.getString(R.string.notification_block_single_title));
        } else {
            p2.g(Activities.getString(R.string.multiple_blocked_call_notification_title));
        }
        if (StringUtils.t(str)) {
            createIntent = ContactsListActivity.createBlockedIntent(splitCompatApplication);
            i = 2132019978;
            i2 = incrementAndGet;
        } else {
            i = 2132019978;
            i2 = incrementAndGet;
            createIntent = ContactDetailsActivity.createIntent(splitCompatApplication, 0L, phone.getRawNumber(), ExtractedInfo.Builder.getBuilderAccordingToOrigin(phone, IMDataExtractionUtils.RecognizedPersonOrigin.CALL).build(), true, null, "NotificationBlock", null);
        }
        NotificationCompat.k kVar = new NotificationCompat.k();
        int i4 = r;
        if (i4 == 1) {
            kVar.d(Activities.getString(R.string.notification_block_single_title));
        } else {
            kVar.d(Activities.f(R.string.notification_block_multiple_title, Integer.valueOf(i4)));
        }
        HashMap hashMap = new HashMap();
        HashSet hashSet = new HashSet();
        for (int size = copyOnWriteArrayList.size() - 1; size >= 0; size--) {
            Phone phone2 = (Phone) copyOnWriteArrayList.get(size);
            hashSet.add(phone2);
            ContactData i5 = ContactUtils.i(phone2);
            boolean isIncognito = i5.isIncognito();
            boolean isVoiceMail = i5.isVoiceMail();
            if (isIncognito) {
                b2 = i5.getPhone().d();
            } else if (isVoiceMail) {
                b2 = Activities.getString(i);
            } else {
                b2 = StringUtils.b(i5.getNameOrNumber());
                if (StringUtils.t(str)) {
                    b2 = Activities.getString(R.string.calllog_unknown_name);
                }
            }
            if (hashMap.containsKey(b2)) {
                hashMap.put(b2, Integer.valueOf(((Integer) hashMap.get(b2)).intValue() + 1));
            } else {
                hashMap.put(b2, 1);
            }
        }
        for (String str2 : hashMap.keySet()) {
            if (((Integer) hashMap.get(str2)).intValue() == 1) {
                kVar.c(Activities.f(R.string.notification_calls_blocked, "", str2));
            } else {
                kVar.c(Activities.f(R.string.notification_calls_blocked, String.format("(%s) ", hashMap.get(str2)), str2));
            }
        }
        p2.l(kVar);
        createIntent.putExtra("EXTRA_BLOCKED_CALL_NOTIFICATION_CLICKED", true);
        createIntent.putExtra("EXTRA_ASK_OPEN_RATE_US", true);
        createIntent.putExtra("future_target_index_key", i2);
        p2.Q.icon = R.drawable.ic_status_block;
        p2.g = PendingIntent.getActivity(splitCompatApplication, 0, createIntent, c(134217728));
        x(p2, 1, "com.callapp.contacts.ACTION_DISMISS_FROM_BLOCKED_CALL_NOTIFICATION", i2);
        p2.h(-1);
        p2.e(true);
        M(1, p2);
    }

    public final void G(com.callapp.contacts.activity.callreminder.CallRemindersData r21) {
        throw new UnsupportedOperationException("Method not decompiled: com.callapp.contacts.manager.NotificationManager.G(com.callapp.contacts.activity.callreminder.CallRemindersData):void");
    }

    public final void H() {
        String string = Activities.getString(R.string.complete_tutorial_reminder_notification_title);
        String string2 = Activities.getString(R.string.complete_tutorial_reminder_notification_message);
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) ContactsListActivity.class);
        intent.setAction(ContactsListActivity.SHOW_TUTORIAL);
        PendingIntent activity = PendingIntent.getActivity(CallAppApplication.get(), 0, intent, c(1073741824));
        NotificationCompat.h p2 = p(NotificationChannelEnum.REGISTRATION_REMINDER_NOTIFICATION_CHANNEL);
        p2.e = NotificationCompat.h.d(string);
        p2.f = NotificationCompat.h.d(string2);
        p2.Q.icon = R.drawable.ic_callapp_icon_notification;
        p2.g = activity;
        p2.e(true);
        M(4, p2);
    }

    public final void I() {
        NotificationCompat.h p2 = p(NotificationChannelEnum.SYNC_PROGRESS_NOTIFICATION_CHANNEL);
        String string = Activities.getString(R.string.sync_done_title);
        String string2 = Activities.getString(R.string.first_sync_done_message_without_number);
        p2.e = NotificationCompat.h.d(string);
        p2.f = NotificationCompat.h.d(string2);
        p2.Q.icon = R.drawable.ic_callapp_icon_notification;
        p2.e(true);
        Intent addFlags = new Intent((Context) CallAppApplication.get(), (Class<?>) ContactsListActivity.class).setFlags(268435456).addFlags(536870912);
        addFlags.putExtra(ContactsListActivity.FROM_SYNC_PROGRESS_INTENT_EXTRA, true);
        p2.g = PendingIntent.getActivity(CallAppApplication.get(), 0, addFlags, c(134217728));
        p2.k(RingtoneManager.getDefaultUri(2));
        p2.h(7);
        p2.l = 0;
        M(8, p2);
    }

    public final void J(ArrayList arrayList) {
        char c;
        PendingIntent activity;
        NotificationCompat.h imDetailNotificationBuilder = getImDetailNotificationBuilder();
        if (arrayList.size() == 1) {
            IMDataExtractionUtils.ImDataForCallappNotification imDataForCallappNotification = (IMDataExtractionUtils.ImDataForCallappNotification) arrayList.get(0);
            Spanned fromHtml = Html.fromHtml(ContactDataForNotification.a(imDataForCallappNotification) + " " + n(imDataForCallappNotification.getSourceDate()));
            ExtractedInfo extractedInfo = (ExtractedInfo) imDataForCallappNotification.a;
            IMDataExtractionUtils.RecognizedPersonOrigin recognizedPersonOrigin = extractedInfo.recognizedPersonOrigin;
            imDetailNotificationBuilder.g(recognizedPersonOrigin.comtype == IMDataExtractionUtils.ComType.CALL ? Activities.getString(R.string.ime_phone_title) : Activities.f(R.string.ime_phone_sub, recognizedPersonOrigin.getDisplayName()));
            imDetailNotificationBuilder.f(fromHtml);
            int incrementAndGet = this.i.incrementAndGet();
            Bitmap c2 = this.k.c(imDataForCallappNotification.getPhotoUrl(), R.drawable.profile_pic_default, incrementAndGet, imDataForCallappNotification.getContactData());
            if (c2 != null) {
                imDetailNotificationBuilder.j(c2);
            } else {
                c2 = null;
            }
            imDetailNotificationBuilder.Q.icon = R.drawable.ic_status_identification;
            g(imDetailNotificationBuilder, c2, null);
            Intent addFlags = new Intent((Context) CallAppApplication.get(), (Class<?>) ContactDetailsActivity.class).setFlags(268435456).addFlags(537198592);
            addFlags.setAction("NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_OPEN_CD_FOR_IM_IDENTIFIED_NUMBER");
            String rawNumber = PhoneManager.get().e(extractedInfo.phoneAsRaw).getRawNumber();
            ContactDetailsActivity.fillIntentWithCallData(addFlags, 0L, rawNumber, null, null, true, null, ENTRYPOINT.ID_PLUS);
            addFlags.putExtra(Constants.EXTRA_ENTRY_POINT, "NotificationIM");
            addFlags.putExtra("notification_id", 50);
            addFlags.putExtra("future_target_index_key", incrementAndGet);
            addFlags.putExtra(Constants.EXTRA_PHONE_NUMBER, rawNumber);
            setDummyData(addFlags);
            imDetailNotificationBuilder.g = PendingIntent.getActivity(CallAppApplication.get(), 0, addFlags, c(134217728));
            x(imDetailNotificationBuilder, 50, "com.callapp.contacts.ACTION_DISMISS_FROM_IM_IDENTIFIED_NUMBER_NOTIFICATION", incrementAndGet);
            ArrayList arrayList2 = new ArrayList(3);
            Phone e = PhoneManager.get().e(extractedInfo.phoneAsRaw);
            int[] iArr = {R.drawable.ic_call_notification, R.drawable.ic_messaging_notification, R.drawable.ic_action_add_contact_notification};
            arrayList2.add(h(iArr[0], R.string.call_reminder_call_action, k(50, extractedInfo.displayName, e, "NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_CALL_FROM_IM_IDENTIFIED_NUMBER")));
            if (extractedInfo.recognizedPersonOrigin == IMDataExtractionUtils.RecognizedPersonOrigin.SMS_MESSAGE) {
                activity = s(50, extractedInfo.displayName, e, "NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_SEND_TEXT_MESSAGE");
                c = 1;
            } else {
                Intent i = i("NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_SEND_MESSAGE_FROM_IM_IDENTIFIED_NUMBER", 50, e, extractedInfo.displayName, ContactsListActivity.class);
                c = 1;
                i.putExtra("extra_im_package", extractedInfo.recognizedPersonOrigin.pkgName);
                i.putExtra("extra_im_type", extractedInfo.recognizedPersonOrigin.senderType);
                i.putExtra(Constants.EXTRA_PHONE_NUMBER, e.getRawNumber());
                activity = PendingIntent.getActivity(CallAppApplication.get(), 50, i, c(1073741824));
            }
            arrayList2.add(h(iArr[c], R.string.call_reminder_sms_action, activity));
            if (!imDataForCallappNotification.isContactInDevice()) {
                int i2 = iArr[2];
                Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) ContactsListActivity.class);
                setDummyData(intent);
                imDataForCallappNotification.setContactData(ContactUtils.i(e));
                intent.setAction("NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_CREATE_NEW_CONTACT_FROM_IDENTIFIED_NUMBER");
                intent.putExtra("android.intent.extra.INTENT", imDataForCallappNotification.getAddContactIntent());
                intent.putExtra("notification_id", 50);
                arrayList2.add(h(i2, R.string.add, PendingIntent.getActivity(CallAppApplication.get(), 50, intent, c(134217728))));
            }
            Iterator it = arrayList2.iterator();
            while (it.hasNext()) {
                imDetailNotificationBuilder.a((NotificationCompat.a) it.next());
            }
        } else {
            c = 1;
            HashMap hashMap = new HashMap();
            HashMap hashMap2 = new HashMap();
            int i3 = 0;
            for (int i4 = 0; i4 < arrayList.size(); i4++) {
                Integer num = (Integer) hashMap.get(((ExtractedInfo) ((IMDataExtractionUtils.ImDataForCallappNotification) arrayList.get(i4)).a).recognizedPersonOrigin);
                if (num == null) {
                    hashMap.put(((ExtractedInfo) ((IMDataExtractionUtils.ImDataForCallappNotification) arrayList.get(i4)).a).recognizedPersonOrigin, 1);
                } else {
                    hashMap.put(((ExtractedInfo) ((IMDataExtractionUtils.ImDataForCallappNotification) arrayList.get(i4)).a).recognizedPersonOrigin, Integer.valueOf(num.intValue() + 1));
                }
                i3++;
                List list = (List) hashMap2.get(((ExtractedInfo) ((IMDataExtractionUtils.ImDataForCallappNotification) arrayList.get(i4)).a).recognizedPersonOrigin);
                if (CollectionUtils.f(list)) {
                    list = new ArrayList();
                }
                list.add((IMDataExtractionUtils.ImDataForCallappNotification) arrayList.get(i4));
                hashMap2.put(((ExtractedInfo) ((IMDataExtractionUtils.ImDataForCallappNotification) arrayList.get(i4)).a).recognizedPersonOrigin, list);
            }
            String string = Activities.getString(R.string.identified_numbers_title);
            String str = "";
            for (Map.Entry entry : hashMap.entrySet()) {
                if (StringUtils.t(str)) {
                    str = ((IMDataExtractionUtils.RecognizedPersonOrigin) entry.getKey()).getDisplayName();
                } else {
                    StringBuilder z = d0.z(str, ", ");
                    z.append(((IMDataExtractionUtils.RecognizedPersonOrigin) entry.getKey()).getDisplayName());
                    str = z.toString();
                }
            }
            String f = Activities.f(R.string.identified_numbers_sub_title, Integer.valueOf(i3), str);
            NotificationCompat.k kVar = new NotificationCompat.k();
            kVar.d(Html.fromHtml(string));
            for (Map.Entry entry2 : hashMap.entrySet()) {
                kVar.c(Html.fromHtml("<b>" + Activities.f(R.string.identified_numbers_sub_title, entry2.getValue(), ((IMDataExtractionUtils.RecognizedPersonOrigin) entry2.getKey()).getDisplayName()) + "</b>"));
                List list2 = (List) hashMap2.get(entry2.getKey());
                if (CollectionUtils.h(list2)) {
                    for (int i5 = 0; i5 < list2.size(); i5++) {
                        kVar.c(Html.fromHtml(ContactDataForNotification.a((ContactDataForNotification) list2.get(i5)) + n(((IMDataExtractionUtils.ImDataForCallappNotification) list2.get(i5)).getSourceDate())));
                    }
                }
            }
            imDetailNotificationBuilder.l(kVar);
            imDetailNotificationBuilder.e = NotificationCompat.h.d(string);
            imDetailNotificationBuilder.f(f);
            Intent intent2 = new Intent((Context) CallAppApplication.get(), (Class<?>) IDPlusActivity.class);
            intent2.setAction("NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_OPEN_IM_CALL_LOG_FOR_IM_IDENTIFIED_NUMBER");
            intent2.putExtra("notification_id", 50);
            setDummyData(intent2);
            PendingIntent activity2 = PendingIntent.getActivity(CallAppApplication.get(), 0, intent2, c(134217728));
            x(imDetailNotificationBuilder, 50, "com.callapp.contacts.ACTION_DISMISS_IM_NOTIFICATION", -1);
            imDetailNotificationBuilder.g = activity2;
        }
        M(50, imDetailNotificationBuilder);
        List<IMDataExtractionUtils.ImDataForCallappNotification> lastInfoList = RecognizedContactNotificationManager.get().getLastInfoList();
        char c3 = (lastInfoList == null || arrayList.size() != lastInfoList.size()) ? c : (char) 0;
        if (c3 == 0) {
            int i6 = 0;
            while (true) {
                if (i6 >= arrayList.size()) {
                    break;
                }
                if (!((IMDataExtractionUtils.ImDataForCallappNotification) arrayList.get(i6)).equals(lastInfoList.get(i6))) {
                    c3 = c;
                    break;
                }
                i6++;
            }
        }
        if (c3 != 0) {
            RecognizedContactNotificationManager.get().setLastInfoList(arrayList);
            StringBuilder sb2 = new StringBuilder();
            Iterator it2 = arrayList.iterator();
            char c4 = c;
            while (it2.hasNext()) {
                IMDataExtractionUtils.ImDataForCallappNotification imDataForCallappNotification2 = (IMDataExtractionUtils.ImDataForCallappNotification) it2.next();
                if (c4 == 0) {
                    sb2.append(",");
                }
                sb2.append(((ExtractedInfo) imDataForCallappNotification2.a).recognizedPersonOrigin.name());
                c4 = 0;
            }
            AnalyticsManager.get().p("IDPlus", "NotificationShow", sb2.substring(0, Math.min(90, sb2.length())));
        }
    }

    public final void K(List list, MissedCallUtils.MissedCallsListParams missedCallsListParams, boolean z) {
        if (Prefs.f1.get().booleanValue() && MissedCallManager.isMissedCallsNotificationsEnabled()) {
            if (CollectionUtils.f(list)) {
                e(17);
                return;
            }
            d();
            NotificationCompat.h p2 = p(NotificationChannelEnum.MISSED_CALL_NOTIFICATION_CHANNEL);
            AtomicInteger atomicInteger = this.i;
            int incrementAndGet = atomicInteger.incrementAndGet();
            j(missedCallsListParams, atomicInteger.incrementAndGet(), p2, list, 3, 17);
            p2.k = list.size();
            x(p2, 17, "com.callapp.contacts.ACTION_DISMISS_FROM_MISSED_CALL_NOTIFICATION", incrementAndGet);
            RemoveMissedCallNotAnsweredNotificationWorker.a.a();
            if (z) {
                p2.i(8, true);
            }
            M(17, p2);
        }
    }

    public final void L(List list, MissedCallUtils.MissedCallsListParams missedCallsListParams) {
        if (Prefs.f1.get().booleanValue() && MissedCallManager.isNotAnswerNotificationsEnabled()) {
            if (CollectionUtils.f(list)) {
                e(40);
                return;
            }
            NotificationCompat.h p2 = p(NotificationChannelEnum.NOT_ANSWERED_NOTIFICATION_CHANNEL);
            AtomicInteger atomicInteger = this.i;
            int incrementAndGet = atomicInteger.incrementAndGet();
            j(missedCallsListParams, atomicInteger.incrementAndGet(), p2, list, 40, 40);
            p2.k = list.size();
            x(p2, 40, "com.callapp.contacts.ACTION_DISMISS_FROM_NOT_ANSWERED_NOTIFICATION", incrementAndGet);
            RemoveMissedCallNotAnsweredNotificationWorker.a.a();
            M(40, p2);
        }
    }

    public final void M(int i, NotificationCompat.h hVar) {
        O(hVar, "", i);
    }

    public final boolean N(int i, Notification notification, String str) {
        if (NotificationTimeUtils.isCurrentTimeDisturbing() && i > 0) {
            int abs = i - (StringUtils.t(str) ? 0 : Math.abs(str.hashCode()));
            for (t0.c cVar : this.m) {
                if (abs >= ((Integer) cVar.a).intValue() && abs <= ((Integer) cVar.b).intValue()) {
                    if (i == 8 || i == 50) {
                        setNotificationAsSilent(notification);
                    }
                }
            }
            FeedbackManager.get().a("not showing notification with ID: " + i + " because current time is disturbing");
            return false;
        }
        synchronized (this.g) {
            CountDownLatch countDownLatch = this.h;
            if (countDownLatch != null) {
                try {
                    countDownLatch.await(4L, TimeUnit.SECONDS);
                } catch (InterruptedException e) {
                    FeedbackManager.get().a("Init channel stack!!!");
                    e.getMessage();
                    StringUtils.I(NotificationManager.class);
                    CLog.a();
                }
            }
        }
        this.f.notify(i, notification);
        return true;
    }

    public final boolean O(NotificationCompat.h hVar, String str, int i) {
        if (hVar == null) {
            return false;
        }
        if (i == 12) {
            synchronized (s) {
                try {
                    long j = hVar.c().getLong("time_stamp");
                    if (j <= this.j) {
                        return false;
                    }
                    this.j = j;
                } finally {
                }
            }
        }
        String f = f(i - (StringUtils.t(str) ? 0 : Math.abs(str.hashCode())));
        if (StringUtils.x(f)) {
            hVar.I = f;
        }
        try {
            return N(i, hVar.b(), str);
        } catch (RuntimeException e) {
            CLog.b(NotificationManager.class, e);
            return false;
        }
    }

    public final void P(int i, String str, String str2) {
        ?? r3;
        int i2;
        Bitmap bitmap;
        RemoteViews remoteViews = new RemoteViews(CallAppApplication.get().getPackageName(), R.layout.notification_otp_layout);
        String b = SmsHelper.b(str2);
        String f = Activities.f(R.string.notification_otp_from, StringUtils.b(b));
        boolean isCurrentOSThemeModeLight = ThemeUtils.isCurrentOSThemeModeLight(CallAppApplication.get().getResources().getConfiguration().uiMode);
        int color = ThemeUtils.getColor(isCurrentOSThemeModeLight ? R.color.defaultPrimaryLight : R.color.defaultPrimaryDark);
        int color2 = ThemeUtils.getColor(isCurrentOSThemeModeLight ? R.color.title_light : R.color.title_dark);
        int color3 = ThemeUtils.getColor(isCurrentOSThemeModeLight ? R.color.subtitle_light : R.color.subtitle_dark);
        Drawable drawable = ViewUtils.getDrawable(R.drawable.ic_notification_otp_copy);
        if (drawable instanceof BitmapDrawable) {
            Bitmap bitmap2 = ((BitmapDrawable) drawable).getBitmap();
            if (bitmap2 == null || bitmap2.isRecycled()) {
                bitmap = null;
            } else {
                Paint paint = new Paint();
                paint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));
                bitmap = bitmap2.copy(Bitmap.Config.ARGB_8888, true);
                new Canvas(bitmap).drawBitmap(bitmap, 0.0f, 0.0f, paint);
            }
            if (bitmap != null) {
                remoteViews.setImageViewBitmap(R.id.notificationOtpCopyIcon, bitmap);
            }
        }
        int e = (int) Activities.e(Build.VERSION.SDK_INT < 35 ? 3 : 0);
        if (LocaleUtils.isRTL()) {
            r3 = 0;
            i2 = 0;
            remoteViews.setViewPadding(R.id.notificationOtpCode, 0, 0, -e, 0);
        } else {
            r3 = 0;
            i2 = 0;
            remoteViews.setViewPadding(R.id.notificationOtpCode, -e, 0, 0, 0);
        }
        remoteViews.setTextViewText(R.id.notificationOtpCopyText, Activities.getString(R.string.copy));
        remoteViews.setTextColor(R.id.notificationOtpCopyText, color);
        remoteViews.setTextViewText(R.id.notificationOtpCode, str);
        remoteViews.setTextColor(R.id.notificationOtpCode, color2);
        remoteViews.setTextViewText(R.id.notificationOtpSender, f);
        remoteViews.setTextColor(R.id.notificationOtpSender, color3);
        NotificationCompat.h p2 = p(NotificationChannelEnum.OTP_SMS_NOTIFICATION_CHANNEL);
        PendingIntent t2 = Activities.isDefaultSMSApp() ? t(i, b) : r(b, i, r3);
        p2.i(16, true);
        p2.e = NotificationCompat.h.d(str);
        p2.f = NotificationCompat.h.d(f);
        p2.D = ThemeUtils.getColor(R.color.sms_blue);
        Notification notification = p2.Q;
        notification.icon = R.drawable.ic_callapp_icon_notification;
        p2.l(new NotificationCompat.j());
        notification.contentView = remoteViews;
        p2.k((Uri) r3);
        long[] jArr = new long[1];
        jArr[i2] = 1;
        notification.vibrate = jArr;
        p2.g = t2;
        p2.l = 2;
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) NotificationPendingIntentHandlerService.class);
        intent.setAction("com.callapp.contacts.ACTION_COPY_OTP");
        intent.putExtra("otp_code", str);
        intent.putExtra(Constants.EXTRA_PHONE_NUMBER, b);
        intent.putExtra("notification_id", i);
        setDummyData(intent);
        PendingIntent service = PendingIntent.getService(CallAppApplication.get(), i, intent, c(1073741824));
        p2.a(h(i2, R.string.notification_copy_manage_button, service));
        remoteViews.setOnClickPendingIntent(R.id.notificationOtpCopyWrapper, service);
        Intent intent2 = new Intent((Context) CallAppApplication.get(), (Class<?>) SettingsActivity.class);
        intent2.putExtra(SettingsActivity.EXTRA_NOTIFICATIONS_SETTINGS, true);
        intent2.putExtra(SettingsActivity.MANAGE_CLICKED, true);
        setDummyData(intent2);
        p2.a(h(0, R.string.notification_otp_manage_button, PendingIntent.getActivity(CallAppApplication.get(), 0, intent2, c(1073741824))));
        Intent intent3 = new Intent((Context) CallAppApplication.get(), (Class<?>) NotificationPendingIntentHandlerService.class);
        intent3.setAction("com.callapp.contacts.ACTION_OTP_DISMISS");
        notification.deleteIntent = PendingIntent.getService(CallAppApplication.get(), 0, intent3, c(268435456));
        AnalyticsManager.get().o(Constants.OTP_NOTIFICATION_PROMPT, "OTP_notification_receive");
        M(i, p2);
    }

    public final void Q(String str, String str2) {
        Intent intent;
        Bitmap b;
        FeedbackManager.get().a("send who viewed my profile notification");
        AnalyticsManager.get().o(Constants.WHO_VIEWED_MY_PROFILE_CATEGORY, "ViewProfile_notification_receive");
        WhoViewedMyProfileDataManager.Companion companion = WhoViewedMyProfileDataManager.a;
        companion.setViewerNotificationCount(companion.getViewerNotificationCount() + 1);
        Phone e = PhoneManager.get().e(str);
        int incrementAndGet = this.i.incrementAndGet();
        NotificationCompat.h p2 = p(NotificationChannelEnum.PROFILE_VIEWED_NOTIFICATION_CHANNEL);
        int viewerNotificationCount = WhoViewedMyProfileDataManager.getViewerNotificationCount();
        BooleanPref booleanPref = Prefs.S2;
        String str3 = null;
        ContactData i = booleanPref.get().booleanValue() ? ContactUtils.i(e) : null;
        if (i != null && booleanPref.get().booleanValue()) {
            str3 = i.getThumbnailUrl();
        }
        String str4 = str3;
        ExtractedInfo build = ExtractedInfo.Builder.getBuilderAccordingToOrigin(e, IMDataExtractionUtils.RecognizedPersonOrigin.CALL).build();
        if (booleanPref.get().booleanValue() && viewerNotificationCount == 1) {
            intent = ContactDetailsActivity.createIntent(CallAppApplication.get(), 0L, e.getRawNumber(), build, true, null, "NotificationWhoViewedMyProfile", null);
            intent.putExtra(ContactDetailsActivity.EXTRA_FULL_NAME, str2);
            intent.putExtra(ContactDetailsActivity.EXTRA_WHO_VIEW_PROFILE_NOTIFICATION, true);
        } else {
            intent = new Intent((Context) CallAppApplication.get(), (Class<?>) WhoViewedMyProfileActivity.class);
        }
        Intent intent2 = intent;
        intent2.putExtra(Constants.WHO_VIEWED_MY_NOTIFICATION_CLICKED, true);
        y(ContactsListActivity.class, intent2, p2, 12, c(134217728), true);
        int i2 = booleanPref.get().booleanValue() ? R.drawable.profile_pic_default : R.drawable.notification_pro_blur1;
        CurrentCallDynamicObject currentCallDynamicObject = this.k;
        currentCallDynamicObject.getClass();
        boolean x = StringUtils.x(str4);
        HashMap hashMap = currentCallDynamicObject.d;
        if (x) {
            d b2 = GlideUtils.b(i, str4);
            CurrentCallDynamicObject.a((d) hashMap.put(Integer.valueOf(incrementAndGet), b2));
            b = CurrentCallDynamicObject.b(b2);
        } else {
            d futureTargetForResourceTarget = GlideUtils.getFutureTargetForResourceTarget(i2);
            CurrentCallDynamicObject.a((d) hashMap.put(Integer.valueOf(incrementAndGet), futureTargetForResourceTarget));
            b = CurrentCallDynamicObject.b(futureTargetForResourceTarget);
        }
        if (b != null) {
            p2.j(b);
        }
        p2.Q.icon = R.drawable.ic_notification_who_viewed;
        p2.e(true);
        p2.l = 1;
        p2.B = "call";
        p2.j(b);
        p2.D = ThemeUtils.getColor(R.color.sms_blue);
        String string = Activities.getString(R.string.who_view_my_profile_notification_title);
        String f = booleanPref.get().booleanValue() ? viewerNotificationCount == 1 ? Activities.f(R.string.who_view_my_profile_notification_body_single_premium, str2) : Activities.f(R.string.who_view_my_profile_notification_body_multi_premium, str2, Integer.valueOf(viewerNotificationCount - 1)) : viewerNotificationCount == 1 ? Activities.f(R.string.who_view_my_profile_notification_body_no_premium_single, Integer.valueOf(viewerNotificationCount)) : Activities.f(R.string.who_view_my_profile_notification_body_no_premium, Integer.valueOf(viewerNotificationCount));
        p2.g(string);
        p2.f(f);
        x(p2, 15, "com.callapp.contacts.ACTION_DISMISS_FROM_WHO_VIEWED_MY_PROFILE", incrementAndGet);
        p2.k = WhoViewedMyProfileDataManager.getViewerNotificationCount();
        M(15, p2);
    }

    public final void R(String str) {
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) ReferAndEarnActivity.class);
        intent.putExtra(ReferAndEarnActivity.EXTRA_ENTRY_POINT, "ClickInviteInstallNotification");
        intent.setFlags(268468224);
        PendingIntent activity = PendingIntent.getActivity(CallAppApplication.get(), 0, intent, c(0));
        if (!StringUtils.x(str)) {
            str = Activities.getString(R.string.refer_and_earn_your_friend);
        }
        NotificationChannelEnum notificationChannelEnum = NotificationChannelEnum.REFER_AND_EARN_NOTIFICATION_CHANNEL;
        NotificationCompat.h p2 = p(notificationChannelEnum);
        p2.Q.icon = R.drawable.ic_stat_card_giftcard;
        p2.e = NotificationCompat.h.d(Activities.f(R.string.refer_and_earn_notification_title, str));
        p2.f = NotificationCompat.h.d(Activities.getString(R.string.refer_and_earn_notification_subtitle));
        p2.l = 1;
        p2.v = notificationChannelEnum.name();
        p2.g = activity;
        p2.i(16, true);
        M(this.d.nextInt(), p2);
    }

    public final void S() {
        PendingIntent activity = PendingIntent.getActivity(CallAppApplication.get(), 0, new Intent((Context) CallAppApplication.get(), (Class<?>) OnBoardingNavigationActivity.class), c(134217728));
        NotificationCompat.h p2 = p(NotificationChannelEnum.SETUP_INPROGRESS_NOTIFICATION_CHANNEL);
        p2.Q.icon = R.drawable.ic_callapp_icon_notification;
        p2.e = NotificationCompat.h.d(Activities.getString(R.string.setup_progress_notification_title));
        p2.f = NotificationCompat.h.d(Activities.getString(R.string.setup_progress_notification_message));
        p2.g = activity;
        p2.i(2, true);
        M(9, p2);
    }

    public final void T(ContactData contactData, String str, int i, boolean z, boolean z2, Integer num) {
        Bitmap bitmap;
        NotificationCompat.a aVar;
        boolean z3;
        synchronized (this.e) {
            String rawNumber = contactData.getPhone().getRawNumber();
            try {
                bitmap = (Bitmap) GlideUtils.b(contactData, contactData.getThumbnailUrl()).get();
            } catch (Exception e) {
                Bitmap decodeResource = BitmapFactory.decodeResource(CallAppApplication.get().getResources(), R.drawable.profile_pic_default_with_oval_bg);
                e.getMessage();
                CLog.a();
                bitmap = decodeResource;
            }
            if (!Activities.isDefaultSMSApp()) {
                aVar = new NotificationCompat.a(0, Activities.getString(R.string.sms_notification_reply), r(rawNumber, i, num));
            } else if (contactData.getPhone().isValidForSearch()) {
                x.b bVar = new x.b("key_text_reply");
                String string = Activities.getString(R.string.sms_notification_reply);
                bVar.d = string;
                x xVar = new x(bVar.a, string, bVar.e, bVar.f, bVar.g, bVar.c, bVar.b);
                Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) SmsReplyReceiver.class);
                intent.putExtra(SmsChatActivity.RECIPIENT_PHONE, rawNumber);
                intent.putExtra(SmsChatActivity.RECEIVED_SUB_ID, num);
                NotificationCompat.a.a aVar2 = new NotificationCompat.a.a(0, Activities.getString(R.string.sms_notification_reply), PendingIntent.getBroadcast(CallAppApplication.get(), i, intent, Build.VERSION.SDK_INT >= 31 ? 167772160 : 134217728));
                if (aVar2.f == null) {
                    aVar2.f = new ArrayList();
                }
                aVar2.f.add(xVar);
                aVar = aVar2.a();
            } else {
                aVar = new NotificationCompat.a(0, Activities.getString(R.string.show_spam_sms), t(i, rawNumber));
            }
            NotificationChannelEnum notificationChannelEnum = NotificationChannelEnum.SMS_NOTIFICATION_CHANNEL;
            NotificationCompat.h p2 = p(notificationChannelEnum);
            p2.Q.icon = R.drawable.ic_sms_shortcut;
            p2.D = ThemeUtils.getColor(R.color.sms_blue);
            p2.j(bitmap);
            p2.m = true;
            p2.e = NotificationCompat.h.d(SmsHelper.b(contactData.getNameOrNumber()));
            p2.b.add(new NotificationCompat.a(0, Activities.getString(R.string.sms_notification_mark_as_read), m(contactData, i, true)));
            p2.a(aVar);
            p2.l = notificationChannelEnum.importance;
            p2.v = "com.callapp.contacts.SMS_NOTIFICATION_GROUP_ID";
            p2.B = "msg";
            p2.Q.deleteIntent = q(i, contactData);
            p2.g = t(i, rawNumber);
            HashMap hashMap = q;
            List<String> list = (List) hashMap.get(Integer.valueOf(i));
            if (CollectionUtils.h(list)) {
                p2.f((String) list.get(list.size() - 1));
                CLog.a();
                z3 = true;
            } else {
                p2.f(str);
                CLog.a();
                z3 = false;
            }
            if (CollectionUtils.h(list) && isPartOfGroup(i)) {
                if (z3 && !z2 && hashMap.get(Integer.valueOf(i)) != null) {
                    List list2 = (List) hashMap.get(Integer.valueOf(i));
                    if (list2 != null && list2.size() >= 5) {
                        list2.remove(0);
                    }
                    if (list2 != null) {
                        list2.add(str);
                    }
                    hashMap.put(Integer.valueOf(i), list2);
                }
                String str2 = "";
                for (String str3 : list) {
                    StringBuilder sb2 = new StringBuilder();
                    sb2.append(str2);
                    if (StringUtils.x(str2)) {
                        str3 = "\n" + str3;
                    }
                    sb2.append(str3);
                    str2 = sb2.toString();
                }
                NotificationCompat.f fVar = new NotificationCompat.f();
                fVar.a = NotificationCompat.h.d(str2);
                p2.l(fVar);
            } else if (!z3) {
                hashMap.put(Integer.valueOf(i), new ArrayList(Collections.singletonList(str)));
                NotificationCompat.f fVar2 = new NotificationCompat.f();
                fVar2.a = NotificationCompat.h.d(str);
                p2.l(fVar2);
            }
            if (z3 || z) {
                try {
                    p2.R = true;
                } catch (RuntimeException e2) {
                    CLog.b(NotificationManager.class, e2);
                }
            }
            p2.I = NotificationChannelGroupEnum.SMS.name();
            M(i, p2);
            M(92, u(i, z3 || z));
        }
    }

    public final void U(String str, boolean z) {
        Intent b = RomHelper.a.b(CallAppApplication.get());
        if (!z) {
            b = new Intent((Context) CallAppApplication.get(), (Class<?>) SpamAppPermissionsActivity.class);
            b.setAction("NOTIFICATION_PREFIX_com.callapp.contacts.PERMISSION_ACTION_SPAM");
            b.putExtra(SpamAppPermissionsActivity.PERMISSION_EXTRA_SPAM_PERM_SHOW_SETTINGS, z);
        }
        String string = Activities.getString(R.string.notification_callapp_not_active_title);
        NotificationCompat.h p2 = p(NotificationChannelEnum.CALLER_ID_NOTIFICATION_CHANNEL);
        PendingIntent activity = PendingIntent.getActivity(CallAppApplication.get(), 0, b, c(134217728));
        p2.e = NotificationCompat.h.d(string);
        p2.f = NotificationCompat.h.d(str);
        p2.z = true;
        p2.A = true;
        p2.D = ThemeUtils.getColor(R.color.sms_blue);
        p2.g = activity;
        p2.i(16, true);
        p2.i(2, true);
        Notification notification = p2.Q;
        notification.icon = R.drawable.ic_callapp_icon_notification;
        p2.k((Uri) null);
        notification.vibrate = new long[]{1};
        p2.l = 2;
        M(16, p2);
    }

    public final void V(ContactData contactData, int i, boolean z) {
        Bitmap bitmap;
        try {
            bitmap = (Bitmap) GlideUtils.a(R.drawable.ic_spam_contact, contactData).get();
        } catch (InterruptedException | ExecutionException e) {
            e.getMessage();
            CLog.a();
            bitmap = null;
        }
        String string = Activities.getString(z ? R.string.sms_message_moved_multiple : R.string.sms_message_moved);
        PendingIntent smsOpenSpamListPendingIntent = getSmsOpenSpamListPendingIntent(i);
        NotificationChannelEnum notificationChannelEnum = NotificationChannelEnum.SMS_NOTIFICATION_CHANNEL;
        NotificationCompat.h p2 = p(notificationChannelEnum);
        p2.D = ThemeUtils.getColor(R.color.sms_blue);
        Notification notification = p2.Q;
        notification.icon = R.drawable.ic_sms_shortcut;
        p2.j(bitmap);
        p2.e = NotificationCompat.h.d(Activities.getString(R.string.spam_sms_detected));
        p2.m = true;
        p2.i(16, true);
        p2.f = NotificationCompat.h.d(string);
        p2.b.add(new NotificationCompat.a(0, Activities.getString(R.string.show_spam_sms), smsOpenSpamListPendingIntent));
        p2.b.add(new NotificationCompat.a(0, Activities.getString(R.string.close), m(contactData, 91, false)));
        notification.deleteIntent = m(contactData, 91, false);
        p2.l = notificationChannelEnum.importance;
        p2.v = contactData.getId();
        NotificationCompat.f fVar = new NotificationCompat.f();
        fVar.a = NotificationCompat.h.d(string);
        p2.l(fVar);
        p2.B = "msg";
        p2.g = smsOpenSpamListPendingIntent;
        if (z) {
            p2.R = true;
        }
        M(91, p2);
    }

    public final void W(String str, String str2) {
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) MarketPlaceActivity.class);
        intent.putExtra("RETURN_TO_PREVIOUS_CLASS", ContactsListActivity.class);
        intent.putExtra("OPEN_FREE_GIFT_READY_POPUP", true);
        NotificationCompat.h p2 = p(NotificationChannelEnum.DEFAULT_NOTIFICATION_CHANNEL);
        PendingIntent activity = PendingIntent.getActivity(CallAppApplication.get(), 0, intent, c(134217728));
        p2.e = NotificationCompat.h.d(str2);
        p2.z = true;
        p2.A = true;
        p2.D = ThemeUtils.getColor(R.color.sms_blue);
        p2.f = NotificationCompat.h.d(str);
        p2.g = activity;
        p2.i(16, true);
        p2.i(2, true);
        Notification notification = p2.Q;
        notification.icon = R.drawable.ic_callapp_icon_notification;
        p2.k((Uri) null);
        notification.vibrate = new long[]{1};
        p2.l = 2;
        M(80, p2);
    }

    public final void X() {
        String string = Activities.getString(R.string.sync_no_internet_connection_notification_message);
        e(9);
        NotificationCompat.h p2 = p(NotificationChannelEnum.SYNC_PROGRESS_NOTIFICATION_CHANNEL);
        String f = Activities.f(R.string.sync_pause_title, Prefs.x1.get(), Prefs.w1.get());
        p2.f = NotificationCompat.h.d(string);
        p2.e = NotificationCompat.h.d(f);
        p2.i(2, false);
        p2.Q.icon = R.drawable.ic_callapp_icon_notification;
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) ContactsListActivity.class);
        intent.putExtra(ContactsListActivity.FROM_SYNC_PROGRESS_INTENT_EXTRA, true);
        intent.putExtra(ContactsListActivity.SYNC_PROGRESS_NO_INTERNET_INTENT_EXTRA, true);
        y(ContactsListActivity.class, intent, p2, 0, c(134217728), false);
        M(8, p2);
    }

    public final void Y(String str) {
        SplitCompatApplication splitCompatApplication = CallAppApplication.get();
        if (Activities.l(new Intent("android.intent.action.VIEW", Uri.parse(str)))) {
            int incrementAndGet = this.i.incrementAndGet();
            Intent action = new Intent((Context) splitCompatApplication, (Class<?>) ContactsListActivity.class).setAction("NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_UPGRADE");
            action.setData(Uri.parse(str));
            String string = Activities.getString(R.string.new_callapp_version_available_);
            String string2 = Activities.getString(R.string.click_to_upgrade_now);
            NotificationCompat.h p2 = p(NotificationChannelEnum.VALIDATE_CLIENT_TASK_NOTIFICATION_CHANNEL);
            CurrentCallDynamicObject currentCallDynamicObject = this.k;
            currentCallDynamicObject.getClass();
            d a = GlideUtils.a(R.mipmap.ic_launcher_round, null);
            CurrentCallDynamicObject.a((d) currentCallDynamicObject.d.put(Integer.valueOf(incrementAndGet), a));
            Bitmap b = CurrentCallDynamicObject.b(a);
            action.putExtra("future_target_index_key", incrementAndGet);
            PendingIntent activity = PendingIntent.getActivity(splitCompatApplication, 0, action, c(134217728));
            p2.Q.icon = R.drawable.ic_callapp_icon_notification;
            p2.j(b);
            p2.e = NotificationCompat.h.d(string);
            p2.f = NotificationCompat.h.d(string2);
            p2.g = activity;
            p2.i(2, true);
            p2.e(true);
            p2.h(7);
            M(7, p2);
        }
    }

    public final void Z() {
        PendingIntent activity = PendingIntent.getActivity(CallAppApplication.get(), 0, new Intent((Context) CallAppApplication.get(), (Class<?>) SmsConversationsActivity.class), c(134217728));
        NotificationCompat.h p2 = p(NotificationChannelEnum.SECOND_NUMBER_PERMISSION_NOTIFICATION_CHANNEL);
        p2.Q.icon = R.drawable.ic_callapp_icon_notification;
        p2.e = NotificationCompat.h.d(Activities.getString(R.string.second_number_sms_received_title));
        p2.f = NotificationCompat.h.d(Activities.getString(R.string.second_number_default_sms_app_title));
        p2.g = activity;
        p2.i(2, true);
        x(p2, 94, "com.callapp.contacts.ACTION_DISMISS_PERMISSION_SMS_NOTIFICATION", -1);
        M(94, p2);
        AnalyticsManager.get().o(Constants.SECOND_NUMBER, "NotificationSmsAppShown");
    }

    public final void a0(String str, boolean z) {
        b0(new VirtualNumberNotificationType.Expired(str, z), str, this.o);
    }

    public final void b0(VirtualNumberNotificationType virtualNumberNotificationType, String str, Intent intent) {
        NotificationChannelEnum notificationChannelEnum = NotificationChannelEnum.SECOND_NUMBER_NOTIFICATION_CHANNEL;
        NotificationCompat.h p2 = p(notificationChannelEnum);
        String string = Activities.getString(virtualNumberNotificationType.getNotificationTitle());
        String string2 = str == null ? Activities.getString(virtualNumberNotificationType.getNotificationBody()) : Activities.f(virtualNumberNotificationType.getNotificationBody(), LocaleUtils.c(str));
        PendingIntent activity = PendingIntent.getActivity(CallAppApplication.get(), 0, intent, c(134217728));
        int i = (!(virtualNumberNotificationType instanceof VirtualNumberNotificationType.Expired) || ((VirtualNumberNotificationType.Expired) virtualNumberNotificationType).getShouldAlertUser()) ? notificationChannelEnum.importance : 2;
        p2.e = NotificationCompat.h.d(string);
        p2.f = NotificationCompat.h.d(string2);
        p2.Q.icon = R.drawable.ic_virtual_number_side_menu;
        p2.D = ThemeUtils.getColor(R.color.sms_blue);
        p2.i(16, true);
        p2.i(2, true);
        p2.l = i;
        p2.E = 1;
        p2.g = activity;
        p2.R = i == 2;
        if (virtualNumberNotificationType.getFirstAction() != null) {
            p2.a(virtualNumberNotificationType.getFirstAction());
        }
        if (virtualNumberNotificationType.getSecondAction() != null) {
            p2.a(virtualNumberNotificationType.getSecondAction());
        }
        O(p2, str, StringUtils.x(str) ? 93 + Math.abs(str.hashCode()) : 93);
    }

    public final void c0(int i, String str, PendingIntent pendingIntent) {
        StringBuilder sb2 = new StringBuilder();
        sb2.append(Activities.getString(R.string.notification_voicemail_new_title));
        sb2.append(i > 0 ? d0.k(i, " (", ")") : "");
        String sb3 = sb2.toString();
        NotificationCompat.h p2 = p(NotificationChannelEnum.SHOW_VOICEMAIL_NOTIFICATION_CHANNEL);
        p2.g(sb3);
        if (StringUtils.x(str)) {
            Phone e = PhoneManager.get().e(str);
            p2.f(Activities.f(R.string.notification_voicemail_dial_title, e.e()));
            if (pendingIntent == null) {
                pendingIntent = k(70, Activities.getString(R.string.voice_mail_text), e, "NOTIFICATION_PREFIX_com.callapp.contacts.NOTIFICATION_ACTION_CALL_VOICEMAIL");
            }
        }
        if (pendingIntent != null) {
            p2.g = pendingIntent;
            p2.a(h(0, R.string.notification_voicemail_call_button, pendingIntent));
        }
        p2.a(h(0, R.string.notification_voicemail_manage_button, PendingIntent.getActivity(CallAppApplication.get(), 0, new Intent((Context) CallAppApplication.get(), (Class<?>) SettingsActivity.class).putExtra(SettingsActivity.EXTRA_NOTIFICATIONS_SETTINGS, true), c(134217728))));
        GlideUtils.GlideRequestBuilder glideRequestBuilder = new GlideUtils.GlideRequestBuilder(ImageUtils.getResourceUri(R.drawable.ic_contact_voice_mail));
        glideRequestBuilder.f = CallAppApplication.get();
        glideRequestBuilder.i = Integer.valueOf(ThemeUtils.getColor(2131100078));
        int color = ThemeUtils.getColor(2131099744);
        PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
        glideRequestBuilder.j = color;
        glideRequestBuilder.k = mode;
        glideRequestBuilder.r = true;
        Bitmap bitmap = glideRequestBuilder.getBitmap();
        p2.i(16, true);
        Notification notification = p2.Q;
        notification.icon = R.drawable.ic_callapp_icon_notification;
        p2.j(bitmap);
        p2.k((Uri) null);
        notification.vibrate = new long[]{1};
        p2.l = 2;
        M(70, p2);
    }

    public final void d0(CallData callData) {
        D(callData, null, false, false, true);
    }

    public final void e(int i) {
        if (i == 12) {
            synchronized (s) {
                CurrentCallDynamicObject currentCallDynamicObject = this.k;
                if (!StringUtils.k(currentCallDynamicObject.getPhotoUrl(), null)) {
                    currentCallDynamicObject.d(new Date().getTime(), null);
                }
                currentCallDynamicObject.e(new Date().getTime(), null);
                currentCallDynamicObject.setContact(null);
                d dVar = (d) currentCallDynamicObject.d.get(0);
                if (dVar != null) {
                    CurrentCallDynamicObject.a(dVar);
                }
                CallAppApplication.get().showCallAppServiceNotification(false, null);
            }
        }
        try {
            this.f.cancel(i);
        } catch (Exception unused) {
            FeedbackManager.get().a("111111111 cancelNotification error");
        }
    }

    public final String f(int i) {
        NotificationChannel notificationChannel;
        NotificationChannelEnum channelEnumFromNotificationId = getChannelEnumFromNotificationId(i);
        NotificationChannelEnum notificationChannelEnum = NotificationChannelEnum.DEFAULT_NOTIFICATION_CHANNEL;
        if (channelEnumFromNotificationId == null) {
            Objects.requireNonNull(notificationChannelEnum, "defaultObj");
            channelEnumFromNotificationId = notificationChannelEnum;
        }
        String notificationChannelIdWithPrefix = getNotificationChannelIdWithPrefix(channelEnumFromNotificationId.getId());
        try {
            notificationChannel = this.f.getNotificationChannel(notificationChannelIdWithPrefix);
        } catch (Exception e) {
            CLog.b(NotificationManager.class, e);
            notificationChannel = null;
        }
        if (notificationChannel == null) {
            w();
        }
        return notificationChannelIdWithPrefix;
    }

    public NotificationCompat.h getSyncNotificicationBuilder() {
        return new NotificationCompat.h(CallAppApplication.get(), getNotificationChannelIdWithPrefix(NotificationChannelEnum.SYNC_PROGRESS_NOTIFICATION_CHANNEL.id));
    }

    public boolean isBirthdayChannelAllowedNotifications() {
        NotificationChannelGroup b;
        NotificationChannelEnum notificationChannelEnum = NotificationChannelEnum.BIRTHDAY_REMINDER_NOTIFICATION_CHANNEL;
        String notificationChannelIdWithPrefix = getNotificationChannelIdWithPrefix(notificationChannelEnum.getId());
        android.app.NotificationManager notificationManager = this.f;
        NotificationChannel notificationChannel = notificationManager.getNotificationChannel(notificationChannelIdWithPrefix);
        if (notificationChannel != null) {
            int importance = notificationChannel.getImportance();
            return (importance == 3 || importance == 4) && !((Build.VERSION.SDK_INT < 28 || (b = c7.a.b(notificationManager, NotificationChannelGroupEnum.REMINDERS.getId())) == null) ? false : c7.a.y(b)) && notificationManager.areNotificationsEnabled();
        }
        NotificationChannel notificationChannel2 = new NotificationChannel(getNotificationChannelIdWithPrefix(notificationChannelEnum.getId()), notificationChannelEnum.getName(), notificationChannelEnum.getImportance());
        notificationChannel2.setSound(Uri.parse("android.resource://" + CallAppApplication.get().getPackageName() + "/raw/2131951618"), new AudioAttributes.Builder().setUsage(5).build());
        notificationManager.createNotificationChannel(notificationChannel2);
        return true;
    }

    public boolean isNotificationVisible(int i) {
        for (StatusBarNotification statusBarNotification : this.f.getActiveNotifications()) {
            if (statusBarNotification.getId() == i) {
                return true;
            }
        }
        return false;
    }

    public final void j(MissedCallUtils.MissedCallsListParams missedCallsListParams, int i, NotificationCompat.h hVar, List list, int i2, int i3) {
        Bitmap bitmap;
        int i4;
        NotificationCompat.h hVar2;
        int i5;
        Bitmap bitmap2;
        Bitmap bitmap3;
        String string;
        String c;
        String string2;
        String str;
        String f;
        int i6 = missedCallsListParams.c;
        boolean z = missedCallsListParams.a;
        MissedCallUtils.MissedCallNotificationType missedCallNotificationType = i6 == 1 ? z ? MissedCallUtils.MissedCallNotificationType.SINGLE_CALL_PRIVATE_NUMBER : MissedCallUtils.MissedCallNotificationType.SINGLE_CALL_NON_PRIVATE_NUMBER : z ? MissedCallUtils.MissedCallNotificationType.MULTIPLE_CALLS_ALL_PRIVATE_NUMBERS : missedCallsListParams.b > 1 ? MissedCallUtils.MissedCallNotificationType.MULTIPLE_CALLS_MIXED_CALLERS : MissedCallUtils.MissedCallNotificationType.MULTIPLE_CALLS_ALL_SAME_CALLER;
        MissedCallUtils.MissedCallDataForNotification missedCallDataForNotification = (MissedCallUtils.MissedCallDataForNotification) list.get(0);
        Phone phone = ((CallLogUtils.MissedCallData) missedCallDataForNotification.a).b;
        String fullName = ContactUtils.i(phone).getFullName();
        ArrayList o = o(i3, fullName, phone, i, i2, true);
        boolean equals = missedCallNotificationType.equals(MissedCallUtils.MissedCallNotificationType.SINGLE_CALL_NON_PRIVATE_NUMBER);
        CurrentCallDynamicObject currentCallDynamicObject = this.k;
        if (equals || missedCallNotificationType.equals(MissedCallUtils.MissedCallNotificationType.MULTIPLE_CALLS_ALL_SAME_CALLER)) {
            bitmap = null;
            Bitmap c2 = currentCallDynamicObject.c(missedCallDataForNotification.getPhotoUrl(), R.drawable.profile_pic_default, i, missedCallDataForNotification.getContactData());
            ExtractedInfo build = ExtractedInfo.Builder.getBuilderAccordingToOrigin(phone, IMDataExtractionUtils.RecognizedPersonOrigin.CALL).build();
            ArrayList o2 = o(i3, fullName, phone, i, i2, false);
            Intent type = new Intent((Context) CallAppApplication.get(), (Class<?>) ContactsListActivity.class).setType(ContactsListActivity.CALLLOG_INTENT_TYPE);
            Intent createIntent = ContactDetailsActivity.createIntent(CallAppApplication.get(), 0L, phone.getRawNumber(), build, true, null, "NotificationMissedCall", ENTRYPOINT.MISSED_CALL_NOT_ANSWERED);
            type.putExtra(Constants.EXTRA_PHONE_NUMBER, phone.c());
            type.putExtra(i2 == 3 ? "EXTRA_MISSED_CALL_NOTIFICATION_CLICKED" : "EXTRA_NOT_ANSWERED_NOTIFICATION_CLICKED", true);
            createIntent.putExtra(i2 != 3 ? "EXTRA_NOT_ANSWERED_NOTIFICATION_CLICKED" : "EXTRA_MISSED_CALL_NOTIFICATION_CLICKED", true);
            createIntent.putExtra("future_target_index_key", i);
            i4 = i2;
            hVar2 = hVar;
            i5 = i;
            y(type, createIntent, hVar2, 12, c(134217728), false);
            Iterator it = o2.iterator();
            while (it.hasNext()) {
                hVar2.a((NotificationCompat.a) it.next());
            }
            bitmap2 = c2;
        } else {
            bitmap2 = currentCallDynamicObject.c(null, R.drawable.profile_pic_multiple, i, null);
            SplitCompatApplication splitCompatApplication = CallAppApplication.get();
            Intent type2 = new Intent((Context) CallAppApplication.get(), (Class<?>) ContactsListActivity.class).setType(ContactsListActivity.CALLLOG_INTENT_TYPE);
            type2.putExtra("future_target_index_key", i);
            type2.putExtra("EXTRA_MISSED_CALL_NOTIFICATION_CLICKED", true);
            hVar.g = PendingIntent.getActivity(splitCompatApplication, 12, type2, c(134217728));
            i4 = i2;
            hVar2 = hVar;
            bitmap = null;
            i5 = i;
        }
        if (bitmap2 != null) {
            hVar2.j(bitmap2);
            bitmap3 = bitmap2;
        } else {
            bitmap3 = bitmap;
        }
        hVar2.Q.icon = i4 == 3 ? R.drawable.ic_status_missed_call : R.drawable.notification_icons_didnt_answer_w;
        hVar2.e(true);
        hVar2.l = 1;
        hVar2.B = "call";
        hVar2.j(bitmap2);
        hVar2.D = ThemeUtils.getColor(R.color.sms_blue);
        String str2 = "";
        String g = ((MissedCallUtils.MissedCallDataForNotification) list.get(0)).getSourcePhone() != null ? ((MissedCallUtils.MissedCallDataForNotification) list.get(0)).getSourcePhone().g() : "";
        MissedCallUtils.MissedCallDataForNotification missedCallDataForNotification2 = (MissedCallUtils.MissedCallDataForNotification) list.get(0);
        if (missedCallDataForNotification2.getContactData() != null && missedCallDataForNotification2.getContactData().isVoiceMail()) {
            string = Activities.getString(R.string.voice_mail_text);
        } else if (StringUtils.x(missedCallDataForNotification2.getCallappName())) {
            string = StringUtils.b(missedCallDataForNotification2.getCallappName());
        } else {
            CallLogUtils.MissedCallData missedCallData = (CallLogUtils.MissedCallData) missedCallDataForNotification2.a;
            if (StringUtils.x(missedCallData.c)) {
                string = StringUtils.b(missedCallData.c);
            } else {
                Phone phone2 = missedCallData.b;
                string = (phone2 == null || CallLogUtils.s(phone2.getRawNumber())) ? CallAppApplication.get().getString(R.string.calllog_unknown_name) : phone2.g();
            }
        }
        String c3 = LocaleUtils.c(StringUtils.x(g) ? com.mobilefuse.sdk.assetsmanager.a.m("(", g, ")") : "");
        Date sourceDate = ((MissedCallUtils.MissedCallDataForNotification) list.get(0)).getSourceDate();
        String n = n(sourceDate);
        String c4 = LocaleUtils.c(string);
        int i7 = AnonymousClass3.a[missedCallNotificationType.ordinal()];
        Notification notification = hVar2.Q;
        if (i7 == 1) {
            c = y.c(c4, " ", n);
            string2 = i4 == 3 ? Activities.getString(R.string.single_missed_call_notification_title) : Activities.getString(R.string.single_user_unanswered_title);
            notification.when = sourceDate.getTime();
        } else if (i7 == 2) {
            c = d0.p(c4, " ", c3, " ", n);
            string2 = i4 == 3 ? Activities.getString(R.string.single_missed_call_notification_title) : Activities.getString(R.string.single_user_unanswered_title);
            notification.when = sourceDate.getTime();
        } else {
            if (i7 != 3 && i7 != 4 && i7 != 5) {
                str = "";
                hVar2.g(str2);
                hVar2.f(str);
                g(hVar2, bitmap3, o);
                x(hVar2, i3, "com.callapp.contacts.ACTION_DISMISS_FROM_MISSED_CALL_NOTIFICATION", i5);
            }
            if (i4 == 3) {
                string2 = Activities.getString(R.string.multiple_missed_call_notification_title);
                f = Activities.f(R.string.multiple_missed_calls_from_mixed_caller_description, Integer.valueOf(list.size()));
            } else {
                string2 = Activities.getString(R.string.not_answer_notification_title);
                f = Activities.f(R.string.not_answer_notification_multi_sub_title, Integer.valueOf(list.size()));
            }
            c = f;
            if (list.size() > 1) {
                NotificationCompat.k kVar = new NotificationCompat.k();
                kVar.d(c);
                Iterator it2 = list.iterator();
                while (it2.hasNext()) {
                    ContactDataForNotification contactDataForNotification = (ContactDataForNotification) it2.next();
                    kVar.c(Html.fromHtml(ContactDataForNotification.a(contactDataForNotification) + n(contactDataForNotification.getSourceDate())));
                }
                hVar2.l(kVar);
            }
        }
        String str3 = c;
        str2 = string2;
        str = str3;
        hVar2.g(str2);
        hVar2.f(str);
        g(hVar2, bitmap3, o);
        x(hVar2, i3, "com.callapp.contacts.ACTION_DISMISS_FROM_MISSED_CALL_NOTIFICATION", i5);
    }

    public final String n(Date date) {
        return date.getTime() > this.c ? this.a.format(date) : this.b.format(date);
    }

    public final NotificationCompat.h p(NotificationChannelEnum notificationChannelEnum) {
        return new NotificationCompat.h(CallAppApplication.get(), getNotificationChannelIdWithPrefix(notificationChannelEnum.getId()));
    }

    public final NotificationCompat.h u(int i, boolean z) {
        NotificationChannelEnum notificationChannelEnum = NotificationChannelEnum.SMS_NOTIFICATION_CHANNEL;
        NotificationCompat.h p2 = p(notificationChannelEnum);
        p2.e = NotificationCompat.h.d("");
        p2.Q.icon = R.drawable.ic_sms_shortcut;
        p2.D = ThemeUtils.getColor(R.color.sms_blue);
        NotificationCompat.k kVar = new NotificationCompat.k();
        kVar.e(CallAppApplication.get().getString(R.string.sms_messages));
        p2.l(kVar);
        p2.i(16, true);
        p2.v = "com.callapp.contacts.SMS_NOTIFICATION_GROUP_ID";
        p2.w = true;
        p2.l = notificationChannelEnum.importance;
        p2.g = getSmsOpenConversationListPendingIntent(i);
        p2.I = NotificationChannelGroupEnum.SMS.name();
        p2.b();
        if (z) {
            p2.R = true;
        }
        return p2;
    }

    public final NotificationCompat.h v(int i, int i2, String str, boolean z) {
        NotificationCompat.h p2 = p(NotificationChannelEnum.SYNC_PROGRESS_NOTIFICATION_CHANNEL);
        p2.e = NotificationCompat.h.d(Activities.getString(R.string.syncer_notification_title));
        p2.Q.icon = R.drawable.ic_callapp_icon_notification;
        p2.i(2, true);
        Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) ContactsListActivity.class);
        intent.putExtra(ContactsListActivity.FROM_SYNC_PROGRESS_INTENT_EXTRA, true);
        y(ContactsListActivity.class, intent, p2, 0, c(134217728), false);
        if (!z) {
            p2.f(str);
        }
        p2.s = i;
        p2.t = i2;
        p2.u = z;
        return p2;
    }

    public final void w() {
        synchronized (this.g) {
            this.h = new CountDownLatch(1);
            CallAppApplication.get().runOnBackgroundThread(new Runnable() {
                @Override
                public final void run() {
                    android.app.NotificationManager notificationManager;
                    NotificationManager notificationManager2 = NotificationManager.this;
                    try {
                        Iterator<NotificationChannelGroup> it = notificationManager2.f.getNotificationChannelGroups().iterator();
                        while (true) {
                            boolean hasNext = it.hasNext();
                            notificationManager = notificationManager2.f;
                            if (!hasNext) {
                                break;
                            } else {
                                try {
                                    notificationManager.deleteNotificationChannelGroup(it.next().getId());
                                } catch (Exception unused) {
                                }
                            }
                        }
                        Iterator<NotificationChannel> it2 = notificationManager.getNotificationChannels().iterator();
                        while (it2.hasNext()) {
                            try {
                                notificationManager.deleteNotificationChannel(it2.next().getId());
                            } catch (Exception unused2) {
                            }
                        }
                    } catch (Exception e) {
                        CLog.b(NotificationManager.class, e);
                    }
                    Prefs.w0.a(1);
                    try {
                        for (NotificationChannelGroupEnum notificationChannelGroupEnum : NotificationChannelGroupEnum.values()) {
                            notificationManager2.f.createNotificationChannelGroup(new NotificationChannelGroup(notificationChannelGroupEnum.getId(), notificationChannelGroupEnum.getName()));
                        }
                    } catch (Exception unused3) {
                    }
                    try {
                        for (NotificationChannelEnum notificationChannelEnum : NotificationChannelEnum.values()) {
                            NotificationChannel notificationChannel = new NotificationChannel(notificationManager2.getNotificationChannelIdWithPrefix(notificationChannelEnum.getId()), notificationChannelEnum.getName(), notificationChannelEnum.getImportance());
                            notificationChannel.setGroup(notificationChannelEnum.getGroupId());
                            notificationChannel.setName(notificationChannelEnum.getName());
                            notificationChannel.setShowBadge(notificationChannelEnum.isShowBadge());
                            if (notificationChannelEnum == NotificationChannelEnum.BIRTHDAY_REMINDER_NOTIFICATION_CHANNEL) {
                                notificationChannel.setSound(Uri.parse("android.resource://" + CallAppApplication.get().getPackageName() + "/raw/" + R.raw.birthday), new AudioAttributes.Builder().setUsage(5).build());
                            }
                            if (notificationChannelEnum == NotificationChannelEnum.INCALL_NOTIFICATION_CHANNEL || notificationChannelEnum == NotificationChannelEnum.IM_NOTIFICATION_CHANNEL) {
                                notificationChannel.setSound(null, null);
                            }
                            if (notificationChannelEnum == NotificationChannelEnum.CALLER_ID_NOTIFICATION_CHANNEL || notificationChannelEnum == NotificationChannelEnum.OTP_SMS_NOTIFICATION_CHANNEL) {
                                notificationChannel.setLockscreenVisibility(1);
                                notificationChannel.enableVibration(false);
                                notificationChannel.setSound(null, null);
                            }
                            if (notificationChannelEnum == NotificationChannelEnum.SMS_NOTIFICATION_CHANNEL) {
                                notificationChannel.setLockscreenVisibility(1);
                            }
                            try {
                                notificationManager2.f.createNotificationChannel(notificationChannel);
                            } catch (IllegalArgumentException unused4) {
                            }
                        }
                    } catch (Exception unused5) {
                    }
                    notificationManager2.h.countDown();
                }
            });
        }
    }

    public final void z() {
        String string = Activities.getString(R.string.callapp_backup);
        String string2 = Activities.getString(R.string.backup_complete);
        NotificationCompat.h p2 = p(NotificationChannelEnum.BACKUP_NOTIFICATION_CHANNEL);
        PendingIntent activity = PendingIntent.getActivity(CallAppApplication.get(), 0, BackupUtils.getBackupSettingsIntent(), c(134217728));
        p2.e = NotificationCompat.h.d(string);
        p2.f = NotificationCompat.h.d(string2);
        p2.Q.icon = R.drawable.ic_callapp_icon_notification;
        p2.j(BitmapFactory.decodeResource(CallAppApplication.get().getResources(), R.drawable.ic_app_menu_dot));
        p2.i(16, true);
        p2.g = activity;
        p2.R = true;
        M(60, p2);
    }
}