package com.ifpdos.udi.service.vman;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Person;
import android.app.Service;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.Icon;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.text.TextUtils;
import b.f.b.d;
import b.f.b.e;
import b.f.b.f;
import com.cvte.vman.R;
import com.cvte.vman.instance.InvokeCmd;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Objects;

/* JADX INFO: loaded from: classes.dex */
public final class HotfixHolderService extends Service {
    @Override // android.app.Service
    public IBinder onBind(Intent intent) {
        return new Binder();
    }

    @Override // android.app.Service
    public void onCreate() {
        Bundle bundle;
        super.onCreate();
        String packageName = getPackageName();
        String packageName2 = getPackageName();
        Object systemService = getSystemService("notification");
        Objects.requireNonNull(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
        NotificationManager notificationManager = (NotificationManager) systemService;
        PendingIntent activity = PendingIntent.getActivity(this, 0, new Intent(this, (Class<?>) MainActivity.class), 67108864);
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        ArrayList arrayList3 = new ArrayList();
        Notification notification = new Notification();
        notification.when = System.currentTimeMillis();
        notification.audioStreamType = -1;
        ArrayList arrayList4 = new ArrayList();
        notification.icon = R.mipmap.ic_launcher;
        String string = getString(R.string.app_name);
        String strSubSequence = string;
        if (string != null) {
            int length = string.length();
            strSubSequence = string;
            if (length > 5120) {
                strSubSequence = string.subSequence(0, 5120);
            }
        }
        String string2 = getString(R.string.app_name);
        String strSubSequence2 = string2;
        if (string2 != null) {
            int length2 = string2.length();
            strSubSequence2 = string2;
            if (length2 > 5120) {
                strSubSequence2 = string2.subSequence(0, 5120);
            }
        }
        notification.flags |= 2;
        NotificationChannel notificationChannel = new NotificationChannel(packageName2, packageName, 4);
        notificationChannel.setLockscreenVisibility(1);
        notificationManager.createNotificationChannel(notificationChannel);
        new ArrayList();
        Bundle bundle2 = new Bundle();
        Notification.Builder builder = new Notification.Builder(this, packageName2);
        builder.setWhen(notification.when).setSmallIcon(notification.icon, notification.iconLevel).setContent(notification.contentView).setTicker(notification.tickerText, null).setVibrate(notification.vibrate).setLights(notification.ledARGB, notification.ledOnMS, notification.ledOffMS).setOngoing((notification.flags & 2) != 0).setOnlyAlertOnce((notification.flags & 8) != 0).setAutoCancel((notification.flags & 16) != 0).setDefaults(notification.defaults).setContentTitle(strSubSequence).setContentText(strSubSequence2).setContentInfo(null).setContentIntent(activity).setDeleteIntent(notification.deleteIntent).setFullScreenIntent(null, (notification.flags & InvokeCmd.CMD_SYSTEMCTRL_SET_HDMI_CLOCK_WAKEUP_STATE) != 0).setLargeIcon((Bitmap) null).setNumber(0).setProgress(0, 0, false);
        builder.setSubText(null).setUsesChronometer(false).setPriority(2);
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            Objects.requireNonNull((d) it.next());
            Notification.Action.Builder builder2 = new Notification.Action.Builder((Icon) null, (CharSequence) null, (PendingIntent) null);
            Bundle bundle3 = new Bundle();
            bundle3.putBoolean("android.support.allowGeneratedReplies", false);
            builder2.setAllowGeneratedReplies(false);
            bundle3.putInt("android.support.action.semanticAction", 0);
            builder2.setSemanticAction(0);
            builder2.setContextual(false);
            bundle3.putBoolean("android.support.action.showsUserInterface", false);
            builder2.addExtras(bundle3);
            builder.addAction(builder2.build());
        }
        builder.setShowWhen(true);
        builder.setLocalOnly(false).setGroup(null).setGroupSummary(false).setSortKey(null);
        builder.setCategory("service").setColor(0).setVisibility(1).setPublicVersion(null).setSound(notification.sound, notification.audioAttributes);
        if (!arrayList4.isEmpty()) {
            Iterator it2 = arrayList4.iterator();
            while (it2.hasNext()) {
                builder.addPerson((String) it2.next());
            }
        }
        if (arrayList3.size() > 0) {
            bundle = new Bundle();
            Bundle bundle4 = bundle.getBundle("android.car.EXTENSIONS");
            if (bundle4 == null) {
                bundle4 = new Bundle();
            }
            Bundle bundle5 = new Bundle(bundle4);
            Bundle bundle6 = new Bundle();
            int i = 0;
            while (i < arrayList3.size()) {
                String string3 = Integer.toString(i);
                d dVar = (d) arrayList3.get(i);
                Object obj = e.f904a;
                Bundle bundle7 = new Bundle();
                Objects.requireNonNull(dVar);
                bundle7.putInt("icon", 0);
                bundle7.putCharSequence("title", null);
                bundle7.putParcelable("actionIntent", null);
                Bundle bundle8 = new Bundle();
                bundle8.putBoolean("android.support.allowGeneratedReplies", false);
                bundle7.putBundle("extras", bundle8);
                bundle7.putParcelableArray("remoteInputs", e.a(null));
                bundle7.putBoolean("showsUserInterface", false);
                bundle7.putInt("semanticAction", 0);
                bundle6.putBundle(string3, bundle7);
                i++;
                arrayList3 = arrayList3;
            }
            bundle4.putBundle("invisible_actions", bundle6);
            bundle5.putBundle("invisible_actions", bundle6);
            bundle.putBundle("android.car.EXTENSIONS", bundle4);
            bundle2.putBundle("android.car.EXTENSIONS", bundle5);
        } else {
            bundle = null;
        }
        builder.setExtras(bundle).setRemoteInputHistory(null);
        builder.setBadgeIconType(0).setSettingsText(null).setShortcutId(null).setTimeoutAfter(0L).setGroupAlertBehavior(0);
        if (!TextUtils.isEmpty(packageName2)) {
            builder.setSound(null).setDefaults(0).setLights(0, 0, 0).setVibrate(null);
        }
        Iterator it3 = arrayList2.iterator();
        while (it3.hasNext()) {
            Objects.requireNonNull((f) it3.next());
            builder.addPerson(new Person.Builder().setName(null).setIcon(null).setUri(null).setKey(null).setBot(false).setImportant(false).build());
        }
        builder.setAllowSystemGeneratedContextualActions(true);
        builder.setBubbleMetadata(null);
        Notification notificationBuild = builder.build();
        d.e.b.e.c(notificationBuild, "builder.build()");
        startForeground(1, notificationBuild);
    }
}
