package com.ifpdos.udi.service.system.strategy;

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.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.text.TextUtils;
import c.c.b.b;
import c.c.b.c;
import c.c.b.d;
import c.c.b.e;
import e.s.c.i;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;

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

    /* JADX WARN: Type inference failed for: r15v1 */
    /* JADX WARN: Type inference failed for: r15v2, types: [android.app.PendingIntent, android.graphics.drawable.Icon, java.lang.CharSequence] */
    /* JADX WARN: Type inference failed for: r15v6 */
    @Override // android.app.Service
    public void onCreate() {
        Bundle bundle;
        int i2;
        super.onCreate();
        int i3 = Build.VERSION.SDK_INT;
        if (i3 >= 26) {
            ((NotificationManager) getSystemService(NotificationManager.class)).createNotificationChannel(new NotificationChannel("media_projection_service", "Media Projection Service", 3));
        }
        ArrayList<b> arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        ArrayList arrayList3 = new ArrayList();
        Notification notification = new Notification();
        notification.when = System.currentTimeMillis();
        notification.audioStreamType = -1;
        List arrayList4 = new ArrayList();
        CharSequence charSequenceSubSequence = "Media Projection".length() > 5120 ? "Media Projection".subSequence(0, 5120) : "Media Projection";
        CharSequence charSequenceSubSequence2 = "Capturing screen".length() > 5120 ? "Capturing screen".subSequence(0, 5120) : "Capturing screen";
        new ArrayList();
        Bundle bundle2 = new Bundle();
        Notification.Builder builder = i3 >= 26 ? new Notification.Builder(this, "media_projection_service") : new Notification.Builder(this);
        ?? r15 = 0;
        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(charSequenceSubSequence).setContentText(charSequenceSubSequence2).setContentInfo(null).setContentIntent(null).setDeleteIntent(notification.deleteIntent).setFullScreenIntent(null, (notification.flags & 128) != 0).setLargeIcon((Bitmap) null).setNumber(0).setProgress(0, 0, false);
        builder.setSubText(null).setUsesChronometer(false).setPriority(0);
        for (b bVar : arrayList) {
            int i4 = Build.VERSION.SDK_INT;
            Objects.requireNonNull(bVar);
            Notification.Action.Builder builder2 = new Notification.Action.Builder((Icon) r15, (CharSequence) r15, (PendingIntent) r15);
            Bundle bundle3 = new Bundle();
            bundle3.putBoolean("android.support.allowGeneratedReplies", false);
            builder2.setAllowGeneratedReplies(false);
            bundle3.putInt("android.support.action.semanticAction", 0);
            if (i4 >= 28) {
                builder2.setSemanticAction(0);
            }
            if (i4 >= 29) {
                builder2.setContextual(false);
            }
            bundle3.putBoolean("android.support.action.showsUserInterface", false);
            builder2.addExtras(bundle3);
            builder.addAction(builder2.build());
            r15 = 0;
        }
        int i5 = Build.VERSION.SDK_INT;
        builder.setShowWhen(true);
        builder.setLocalOnly(false).setGroup(null).setGroupSummary(false).setSortKey(null);
        builder.setCategory(null).setColor(0).setVisibility(0).setPublicVersion(null).setSound(notification.sound, notification.audioAttributes);
        if (i5 < 28) {
            arrayList4 = c.a(c.b(arrayList2), arrayList4);
        }
        if (arrayList4 != null && !arrayList4.isEmpty()) {
            Iterator it = arrayList4.iterator();
            while (it.hasNext()) {
                builder.addPerson((String) it.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 i6 = 0;
            while (i6 < arrayList3.size()) {
                String string = Integer.toString(i6);
                b bVar2 = (b) arrayList3.get(i6);
                Object obj = d.f5175a;
                Bundle bundle7 = new Bundle();
                Objects.requireNonNull(bVar2);
                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", d.a(null));
                bundle7.putBoolean("showsUserInterface", false);
                bundle7.putInt("semanticAction", 0);
                bundle6.putBundle(string, bundle7);
                i6++;
                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;
        }
        int i7 = Build.VERSION.SDK_INT;
        builder.setExtras(bundle).setRemoteInputHistory(null);
        if (i7 >= 26) {
            builder.setBadgeIconType(0).setSettingsText(null).setShortcutId(null).setTimeoutAfter(0L).setGroupAlertBehavior(0);
            if (!TextUtils.isEmpty("media_projection_service")) {
                builder.setSound(null).setDefaults(0).setLights(0, 0, 0).setVibrate(null);
            }
        }
        if (i7 >= 28) {
            Iterator it2 = arrayList2.iterator();
            while (it2.hasNext()) {
                Objects.requireNonNull((e) it2.next());
                builder.addPerson(new Person.Builder().setName(null).setIcon(null).setUri(null).setKey(null).setBot(false).setImportant(false).build());
            }
        }
        if (Build.VERSION.SDK_INT >= 29) {
            i2 = 1;
            builder.setAllowSystemGeneratedContextualActions(true);
            builder.setBubbleMetadata(null);
        } else {
            i2 = 1;
        }
        Notification notificationBuild = builder.build();
        i.d(notificationBuild, "Builder(this, channelId)\n            .setContentTitle(\"Media Projection\")\n            .setContentText(\"Capturing screen\")\n//            .setSmallIcon(R.drawable.ic_notification)\n            .build()");
        startForeground(i2, notificationBuild);
    }

    @Override // android.app.Service
    public int onStartCommand(Intent intent, int i2, int i3) {
        return 2;
    }
}
