307 lines
12 KiB
Java
307 lines
12 KiB
Java
package androidx.core.app;
|
|
|
|
import android.app.Notification;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import android.util.SparseArray;
|
|
import android.widget.RemoteViews;
|
|
import androidx.core.app.NotificationCompat;
|
|
import com.ijm.dataencryption.de.DataDecryptTool;
|
|
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
class NotificationCompatBuilder implements NotificationBuilderWithBuilderAccessor {
|
|
private final Notification.Builder a;
|
|
private final NotificationCompat.Builder b;
|
|
private RemoteViews c;
|
|
private RemoteViews d;
|
|
private final List<Bundle> e = new ArrayList();
|
|
private final Bundle f = new Bundle();
|
|
private int g;
|
|
private RemoteViews h;
|
|
|
|
NotificationCompatBuilder(NotificationCompat.Builder builder) {
|
|
ArrayList<String> arrayList;
|
|
this.b = builder;
|
|
if (Build.VERSION.SDK_INT >= 26) {
|
|
this.a = new Notification.Builder(builder.a, builder.I);
|
|
} else {
|
|
this.a = new Notification.Builder(builder.a);
|
|
}
|
|
Notification notification = builder.N;
|
|
this.a.setWhen(notification.when).setSmallIcon(notification.icon, notification.iconLevel).setContent(notification.contentView).setTicker(notification.tickerText, builder.h).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(builder.d).setContentText(builder.e).setContentInfo(builder.j).setContentIntent(builder.f).setDeleteIntent(notification.deleteIntent).setFullScreenIntent(builder.g, (notification.flags & PeripheralType.SERVO) != 0).setLargeIcon(builder.i).setNumber(builder.k).setProgress(builder.r, builder.s, builder.t);
|
|
if (Build.VERSION.SDK_INT < 21) {
|
|
this.a.setSound(notification.sound, notification.audioStreamType);
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 16) {
|
|
this.a.setSubText(builder.p).setUsesChronometer(builder.n).setPriority(builder.l);
|
|
Iterator<NotificationCompat.Action> it = builder.b.iterator();
|
|
while (it.hasNext()) {
|
|
a(it.next());
|
|
}
|
|
Bundle bundle = builder.B;
|
|
if (bundle != null) {
|
|
this.f.putAll(bundle);
|
|
}
|
|
if (Build.VERSION.SDK_INT < 20) {
|
|
if (builder.x) {
|
|
this.f.putBoolean("android.support.localOnly", true);
|
|
}
|
|
String str = builder.u;
|
|
if (str != null) {
|
|
this.f.putString("android.support.groupKey", str);
|
|
if (builder.v) {
|
|
this.f.putBoolean("android.support.isGroupSummary", true);
|
|
} else {
|
|
this.f.putBoolean("android.support.useSideChannel", true);
|
|
}
|
|
}
|
|
String str2 = builder.w;
|
|
if (str2 != null) {
|
|
this.f.putString("android.support.sortKey", str2);
|
|
}
|
|
}
|
|
this.c = builder.F;
|
|
this.d = builder.G;
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 19) {
|
|
this.a.setShowWhen(builder.m);
|
|
if (Build.VERSION.SDK_INT < 21 && (arrayList = builder.O) != null && !arrayList.isEmpty()) {
|
|
Bundle bundle2 = this.f;
|
|
ArrayList<String> arrayList2 = builder.O;
|
|
bundle2.putStringArray("android.people", (String[]) arrayList2.toArray(new String[arrayList2.size()]));
|
|
}
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 20) {
|
|
this.a.setLocalOnly(builder.x).setGroup(builder.u).setGroupSummary(builder.v).setSortKey(builder.w);
|
|
this.g = builder.M;
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
this.a.setCategory(builder.A).setColor(builder.C).setVisibility(builder.D).setPublicVersion(builder.E).setSound(notification.sound, notification.audioAttributes);
|
|
Iterator<String> it2 = builder.O.iterator();
|
|
while (it2.hasNext()) {
|
|
this.a.addPerson(it2.next());
|
|
}
|
|
this.h = builder.H;
|
|
if (builder.c.size() > 0) {
|
|
Bundle bundle3 = builder.b().getBundle("android.car.EXTENSIONS");
|
|
bundle3 = bundle3 == null ? new Bundle() : bundle3;
|
|
Bundle bundle4 = new Bundle();
|
|
for (int i = 0; i < builder.c.size(); i++) {
|
|
bundle4.putBundle(Integer.toString(i), NotificationCompatJellybean.a(builder.c.get(i)));
|
|
}
|
|
bundle3.putBundle("invisible_actions", bundle4);
|
|
builder.b().putBundle("android.car.EXTENSIONS", bundle3);
|
|
this.f.putBundle("android.car.EXTENSIONS", bundle3);
|
|
}
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 24) {
|
|
this.a.setExtras(builder.B).setRemoteInputHistory(builder.q);
|
|
RemoteViews remoteViews = builder.F;
|
|
if (remoteViews != null) {
|
|
this.a.setCustomContentView(remoteViews);
|
|
}
|
|
RemoteViews remoteViews2 = builder.G;
|
|
if (remoteViews2 != null) {
|
|
this.a.setCustomBigContentView(remoteViews2);
|
|
}
|
|
RemoteViews remoteViews3 = builder.H;
|
|
if (remoteViews3 != null) {
|
|
this.a.setCustomHeadsUpContentView(remoteViews3);
|
|
}
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 26) {
|
|
this.a.setBadgeIconType(builder.J).setShortcutId(builder.K).setTimeoutAfter(builder.L).setGroupAlertBehavior(builder.M);
|
|
if (builder.z) {
|
|
this.a.setColorized(builder.y);
|
|
}
|
|
if (TextUtils.isEmpty(builder.I)) {
|
|
return;
|
|
}
|
|
this.a.setSound(null).setDefaults(0).setLights(0, 0, 0).setVibrate(null);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.core.app.NotificationBuilderWithBuilderAccessor
|
|
public Notification.Builder a() {
|
|
return this.a;
|
|
}
|
|
|
|
public Notification b() {
|
|
Bundle a;
|
|
RemoteViews d;
|
|
RemoteViews b;
|
|
NotificationCompat.Style style = this.b.o;
|
|
if (style != null) {
|
|
style.a(this);
|
|
}
|
|
RemoteViews c = style != null ? style.c(this) : null;
|
|
Notification c2 = c();
|
|
if (c != null) {
|
|
c2.contentView = c;
|
|
} else {
|
|
RemoteViews remoteViews = this.b.F;
|
|
if (remoteViews != null) {
|
|
c2.contentView = remoteViews;
|
|
}
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 16 && style != null && (b = style.b(this)) != null) {
|
|
c2.bigContentView = b;
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 21 && style != null && (d = this.b.o.d(this)) != null) {
|
|
c2.headsUpContentView = d;
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 16 && style != null && (a = NotificationCompat.a(c2)) != null) {
|
|
style.a(a);
|
|
}
|
|
return c2;
|
|
}
|
|
|
|
protected Notification c() {
|
|
int i = Build.VERSION.SDK_INT;
|
|
if (i >= 26) {
|
|
return this.a.build();
|
|
}
|
|
if (i >= 24) {
|
|
Notification build = this.a.build();
|
|
if (this.g != 0) {
|
|
if (build.getGroup() != null && (build.flags & DataDecryptTool.DECRYPT_DB_FILE) != 0 && this.g == 2) {
|
|
a(build);
|
|
}
|
|
if (build.getGroup() != null && (build.flags & DataDecryptTool.DECRYPT_DB_FILE) == 0 && this.g == 1) {
|
|
a(build);
|
|
}
|
|
}
|
|
return build;
|
|
}
|
|
if (i >= 21) {
|
|
this.a.setExtras(this.f);
|
|
Notification build2 = this.a.build();
|
|
RemoteViews remoteViews = this.c;
|
|
if (remoteViews != null) {
|
|
build2.contentView = remoteViews;
|
|
}
|
|
RemoteViews remoteViews2 = this.d;
|
|
if (remoteViews2 != null) {
|
|
build2.bigContentView = remoteViews2;
|
|
}
|
|
RemoteViews remoteViews3 = this.h;
|
|
if (remoteViews3 != null) {
|
|
build2.headsUpContentView = remoteViews3;
|
|
}
|
|
if (this.g != 0) {
|
|
if (build2.getGroup() != null && (build2.flags & DataDecryptTool.DECRYPT_DB_FILE) != 0 && this.g == 2) {
|
|
a(build2);
|
|
}
|
|
if (build2.getGroup() != null && (build2.flags & DataDecryptTool.DECRYPT_DB_FILE) == 0 && this.g == 1) {
|
|
a(build2);
|
|
}
|
|
}
|
|
return build2;
|
|
}
|
|
if (i >= 20) {
|
|
this.a.setExtras(this.f);
|
|
Notification build3 = this.a.build();
|
|
RemoteViews remoteViews4 = this.c;
|
|
if (remoteViews4 != null) {
|
|
build3.contentView = remoteViews4;
|
|
}
|
|
RemoteViews remoteViews5 = this.d;
|
|
if (remoteViews5 != null) {
|
|
build3.bigContentView = remoteViews5;
|
|
}
|
|
if (this.g != 0) {
|
|
if (build3.getGroup() != null && (build3.flags & DataDecryptTool.DECRYPT_DB_FILE) != 0 && this.g == 2) {
|
|
a(build3);
|
|
}
|
|
if (build3.getGroup() != null && (build3.flags & DataDecryptTool.DECRYPT_DB_FILE) == 0 && this.g == 1) {
|
|
a(build3);
|
|
}
|
|
}
|
|
return build3;
|
|
}
|
|
if (i >= 19) {
|
|
SparseArray<Bundle> a = NotificationCompatJellybean.a(this.e);
|
|
if (a != null) {
|
|
this.f.putSparseParcelableArray("android.support.actionExtras", a);
|
|
}
|
|
this.a.setExtras(this.f);
|
|
Notification build4 = this.a.build();
|
|
RemoteViews remoteViews6 = this.c;
|
|
if (remoteViews6 != null) {
|
|
build4.contentView = remoteViews6;
|
|
}
|
|
RemoteViews remoteViews7 = this.d;
|
|
if (remoteViews7 != null) {
|
|
build4.bigContentView = remoteViews7;
|
|
}
|
|
return build4;
|
|
}
|
|
if (i < 16) {
|
|
return this.a.getNotification();
|
|
}
|
|
Notification build5 = this.a.build();
|
|
Bundle a2 = NotificationCompat.a(build5);
|
|
Bundle bundle = new Bundle(this.f);
|
|
for (String str : this.f.keySet()) {
|
|
if (a2.containsKey(str)) {
|
|
bundle.remove(str);
|
|
}
|
|
}
|
|
a2.putAll(bundle);
|
|
SparseArray<Bundle> a3 = NotificationCompatJellybean.a(this.e);
|
|
if (a3 != null) {
|
|
NotificationCompat.a(build5).putSparseParcelableArray("android.support.actionExtras", a3);
|
|
}
|
|
RemoteViews remoteViews8 = this.c;
|
|
if (remoteViews8 != null) {
|
|
build5.contentView = remoteViews8;
|
|
}
|
|
RemoteViews remoteViews9 = this.d;
|
|
if (remoteViews9 != null) {
|
|
build5.bigContentView = remoteViews9;
|
|
}
|
|
return build5;
|
|
}
|
|
|
|
private void a(NotificationCompat.Action action) {
|
|
int i = Build.VERSION.SDK_INT;
|
|
if (i < 20) {
|
|
if (i >= 16) {
|
|
this.e.add(NotificationCompatJellybean.a(this.a, action));
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
Notification.Action.Builder builder = new Notification.Action.Builder(action.e(), action.i(), action.a());
|
|
if (action.f() != null) {
|
|
for (android.app.RemoteInput remoteInput : RemoteInput.a(action.f())) {
|
|
builder.addRemoteInput(remoteInput);
|
|
}
|
|
}
|
|
Bundle bundle = action.d() != null ? new Bundle(action.d()) : new Bundle();
|
|
bundle.putBoolean("android.support.allowGeneratedReplies", action.b());
|
|
if (Build.VERSION.SDK_INT >= 24) {
|
|
builder.setAllowGeneratedReplies(action.b());
|
|
}
|
|
bundle.putInt("android.support.action.semanticAction", action.g());
|
|
if (Build.VERSION.SDK_INT >= 28) {
|
|
builder.setSemanticAction(action.g());
|
|
}
|
|
bundle.putBoolean("android.support.action.showsUserInterface", action.h());
|
|
builder.addExtras(bundle);
|
|
this.a.addAction(builder.build());
|
|
}
|
|
|
|
private void a(Notification notification) {
|
|
notification.sound = null;
|
|
notification.vibrate = null;
|
|
notification.defaults &= -2;
|
|
notification.defaults &= -3;
|
|
}
|
|
}
|