package androidx.core.app; import android.app.Notification; import android.app.RemoteInput; import android.content.Context; import android.graphics.drawable.Icon; import android.os.Build; import android.os.Bundle; import android.text.TextUtils; import android.widget.RemoteViews; import androidx.core.app.m; import androidx.core.graphics.drawable.IconCompat; import com.google.android.gms.ads.AdRequest; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /* loaded from: classes.dex */ class i0 implements l { /* renamed from: a, reason: collision with root package name */ private final Context f1421a; /* renamed from: b, reason: collision with root package name */ private final Notification.Builder f1422b; /* renamed from: c, reason: collision with root package name */ private final m.e f1423c; /* renamed from: d, reason: collision with root package name */ private RemoteViews f1424d; /* renamed from: e, reason: collision with root package name */ private RemoteViews f1425e; /* renamed from: f, reason: collision with root package name */ private final List f1426f = new ArrayList(); /* renamed from: g, reason: collision with root package name */ private final Bundle f1427g = new Bundle(); /* renamed from: h, reason: collision with root package name */ private int f1428h; /* renamed from: i, reason: collision with root package name */ private RemoteViews f1429i; i0(m.e eVar) { int i10; Notification.Builder badgeIconType; Notification.Builder settingsText; Notification.Builder shortcutId; Notification.Builder timeoutAfter; Icon icon; this.f1423c = eVar; this.f1421a = eVar.f1453a; if (Build.VERSION.SDK_INT >= 26) { v.a(); this.f1422b = u.a(eVar.f1453a, eVar.K); } else { this.f1422b = new Notification.Builder(eVar.f1453a); } Notification notification = eVar.R; this.f1422b.setWhen(notification.when).setSmallIcon(notification.icon, notification.iconLevel).setContent(notification.contentView).setTicker(notification.tickerText, eVar.f1461i).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(eVar.f1457e).setContentText(eVar.f1458f).setContentInfo(eVar.f1463k).setContentIntent(eVar.f1459g).setDeleteIntent(notification.deleteIntent).setFullScreenIntent(eVar.f1460h, (notification.flags & 128) != 0).setLargeIcon(eVar.f1462j).setNumber(eVar.f1464l).setProgress(eVar.f1472t, eVar.f1473u, eVar.f1474v); this.f1422b.setSubText(eVar.f1469q).setUsesChronometer(eVar.f1467o).setPriority(eVar.f1465m); Iterator it = eVar.f1454b.iterator(); while (it.hasNext()) { b((m.a) it.next()); } Bundle bundle = eVar.D; if (bundle != null) { this.f1427g.putAll(bundle); } int i11 = Build.VERSION.SDK_INT; this.f1424d = eVar.H; this.f1425e = eVar.I; this.f1422b.setShowWhen(eVar.f1466n); this.f1422b.setLocalOnly(eVar.f1478z).setGroup(eVar.f1475w).setGroupSummary(eVar.f1476x).setSortKey(eVar.f1477y); this.f1428h = eVar.O; this.f1422b.setCategory(eVar.C).setColor(eVar.E).setVisibility(eVar.F).setPublicVersion(eVar.G).setSound(notification.sound, notification.audioAttributes); List e10 = i11 < 28 ? e(g(eVar.f1455c), eVar.U) : eVar.U; if (e10 != null && !e10.isEmpty()) { Iterator it2 = e10.iterator(); while (it2.hasNext()) { this.f1422b.addPerson((String) it2.next()); } } this.f1429i = eVar.J; if (eVar.f1456d.size() > 0) { Bundle bundle2 = eVar.c().getBundle("android.car.EXTENSIONS"); bundle2 = bundle2 == null ? new Bundle() : bundle2; Bundle bundle3 = new Bundle(bundle2); Bundle bundle4 = new Bundle(); for (int i12 = 0; i12 < eVar.f1456d.size(); i12++) { bundle4.putBundle(Integer.toString(i12), j0.a((m.a) eVar.f1456d.get(i12))); } bundle2.putBundle("invisible_actions", bundle4); bundle3.putBundle("invisible_actions", bundle4); eVar.c().putBundle("android.car.EXTENSIONS", bundle2); this.f1427g.putBundle("android.car.EXTENSIONS", bundle3); } int i13 = Build.VERSION.SDK_INT; if (i13 >= 23 && (icon = eVar.T) != null) { this.f1422b.setSmallIcon(icon); } if (i13 >= 24) { this.f1422b.setExtras(eVar.D).setRemoteInputHistory(eVar.f1471s); RemoteViews remoteViews = eVar.H; if (remoteViews != null) { this.f1422b.setCustomContentView(remoteViews); } RemoteViews remoteViews2 = eVar.I; if (remoteViews2 != null) { this.f1422b.setCustomBigContentView(remoteViews2); } RemoteViews remoteViews3 = eVar.J; if (remoteViews3 != null) { this.f1422b.setCustomHeadsUpContentView(remoteViews3); } } if (i13 >= 26) { badgeIconType = this.f1422b.setBadgeIconType(eVar.L); settingsText = badgeIconType.setSettingsText(eVar.f1470r); shortcutId = settingsText.setShortcutId(eVar.M); timeoutAfter = shortcutId.setTimeoutAfter(eVar.N); timeoutAfter.setGroupAlertBehavior(eVar.O); if (eVar.B) { this.f1422b.setColorized(eVar.A); } if (!TextUtils.isEmpty(eVar.K)) { this.f1422b.setSound(null).setDefaults(0).setLights(0, 0, 0).setVibrate(null); } } if (i13 >= 28) { Iterator it3 = eVar.f1455c.iterator(); if (it3.hasNext()) { androidx.appcompat.app.m.a(it3.next()); throw null; } } if (i13 >= 29) { this.f1422b.setAllowSystemGeneratedContextualActions(eVar.Q); this.f1422b.setBubbleMetadata(m.d.a(null)); } if (v.a.c() && (i10 = eVar.P) != 0) { this.f1422b.setForegroundServiceBehavior(i10); } if (eVar.S) { if (this.f1423c.f1476x) { this.f1428h = 2; } else { this.f1428h = 1; } this.f1422b.setVibrate(null); this.f1422b.setSound(null); int i14 = notification.defaults & (-2) & (-3); notification.defaults = i14; this.f1422b.setDefaults(i14); if (i13 >= 26) { if (TextUtils.isEmpty(this.f1423c.f1475w)) { this.f1422b.setGroup("silent"); } this.f1422b.setGroupAlertBehavior(this.f1428h); } } } private void b(m.a aVar) { Notification.Action.Builder builder; int i10 = Build.VERSION.SDK_INT; IconCompat d10 = aVar.d(); if (i10 >= 23) { t.a(); builder = s.a(d10 != null ? d10.p() : null, aVar.h(), aVar.a()); } else { builder = new Notification.Action.Builder(d10 != null ? d10.e() : 0, aVar.h(), aVar.a()); } if (aVar.e() != null) { for (RemoteInput remoteInput : m0.b(aVar.e())) { builder.addRemoteInput(remoteInput); } } Bundle bundle = aVar.c() != null ? new Bundle(aVar.c()) : new Bundle(); bundle.putBoolean("android.support.allowGeneratedReplies", aVar.b()); int i11 = Build.VERSION.SDK_INT; if (i11 >= 24) { builder.setAllowGeneratedReplies(aVar.b()); } bundle.putInt("android.support.action.semanticAction", aVar.f()); if (i11 >= 28) { builder.setSemanticAction(aVar.f()); } if (i11 >= 29) { builder.setContextual(aVar.i()); } bundle.putBoolean("android.support.action.showsUserInterface", aVar.g()); builder.addExtras(bundle); this.f1422b.addAction(builder.build()); } private static List e(List list, List list2) { if (list == null) { return list2; } if (list2 == null) { return list; } androidx.collection.b bVar = new androidx.collection.b(list.size() + list2.size()); bVar.addAll(list); bVar.addAll(list2); return new ArrayList(bVar); } private static List g(List list) { if (list == null) { return null; } ArrayList arrayList = new ArrayList(list.size()); Iterator it = list.iterator(); if (!it.hasNext()) { return arrayList; } androidx.appcompat.app.m.a(it.next()); throw null; } private void h(Notification notification) { notification.sound = null; notification.vibrate = null; notification.defaults = notification.defaults & (-2) & (-3); } @Override // androidx.core.app.l public Notification.Builder a() { return this.f1422b; } public Notification c() { Bundle a10; RemoteViews f10; RemoteViews d10; m.f fVar = this.f1423c.f1468p; if (fVar != null) { fVar.b(this); } RemoteViews e10 = fVar != null ? fVar.e(this) : null; Notification d11 = d(); if (e10 != null) { d11.contentView = e10; } else { RemoteViews remoteViews = this.f1423c.H; if (remoteViews != null) { d11.contentView = remoteViews; } } if (fVar != null && (d10 = fVar.d(this)) != null) { d11.bigContentView = d10; } if (fVar != null && (f10 = this.f1423c.f1468p.f(this)) != null) { d11.headsUpContentView = f10; } if (fVar != null && (a10 = m.a(d11)) != null) { fVar.a(a10); } return d11; } protected Notification d() { int i10 = Build.VERSION.SDK_INT; if (i10 >= 26) { return this.f1422b.build(); } if (i10 >= 24) { Notification build = this.f1422b.build(); if (this.f1428h != 0) { if (build.getGroup() != null && (build.flags & AdRequest.MAX_CONTENT_URL_LENGTH) != 0 && this.f1428h == 2) { h(build); } if (build.getGroup() != null && (build.flags & AdRequest.MAX_CONTENT_URL_LENGTH) == 0 && this.f1428h == 1) { h(build); } } return build; } this.f1422b.setExtras(this.f1427g); Notification build2 = this.f1422b.build(); RemoteViews remoteViews = this.f1424d; if (remoteViews != null) { build2.contentView = remoteViews; } RemoteViews remoteViews2 = this.f1425e; if (remoteViews2 != null) { build2.bigContentView = remoteViews2; } RemoteViews remoteViews3 = this.f1429i; if (remoteViews3 != null) { build2.headsUpContentView = remoteViews3; } if (this.f1428h != 0) { if (build2.getGroup() != null && (build2.flags & AdRequest.MAX_CONTENT_URL_LENGTH) != 0 && this.f1428h == 2) { h(build2); } if (build2.getGroup() != null && (build2.flags & AdRequest.MAX_CONTENT_URL_LENGTH) == 0 && this.f1428h == 1) { h(build2); } } return build2; } Context f() { return this.f1421a; } }