what-the-bank/sources/androidx/window/layout/SidecarCompat.java

475 lines
27 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package androidx.window.layout;
import android.app.Activity;
import android.content.ComponentCallbacks;
import android.content.Context;
import android.content.res.Configuration;
import android.os.IBinder;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import androidx.window.sidecar.SidecarDeviceState;
import androidx.window.sidecar.SidecarDisplayFeature;
import androidx.window.sidecar.SidecarInterface;
import androidx.window.sidecar.SidecarProvider;
import androidx.window.sidecar.SidecarWindowLayoutInfo;
import java.lang.ref.WeakReference;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import o.C14851gaI;
import o.C14866gag;
import o.C14953gcr;
import o.C14957gcv;
import o.DcR;
import o.gQi;
import o.gdZ;
import o.oEt;
import o.xxy;
/* loaded from: classes.dex */
public final class SidecarCompat implements gQi {
public static final LWm c = new LWm(null);
private final SidecarInterface a;
private final Map<Activity, ComponentCallbacks> b;
private gQi.Sts d;
private final DcR e;
private final Map<IBinder, Activity> f;
public SidecarCompat(SidecarInterface sidecarInterface, DcR dcR) {
C14957gcv.e(dcR, "");
this.a = sidecarInterface;
this.e = dcR;
this.f = new LinkedHashMap();
this.b = new LinkedHashMap();
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public SidecarCompat(Context context) {
this(SidecarProvider.getSidecarImpl(context.getApplicationContext()), new DcR());
C14957gcv.e(context, "");
}
@Override // o.gQi
public final void b(gQi.Sts sts) {
C14957gcv.e(sts, "");
this.d = new HBt(sts);
SidecarInterface sidecarInterface = this.a;
if (sidecarInterface != null) {
sidecarInterface.setSidecarCallback(new DistinctSidecarElementCallback(this.e, new TranslatingCallback(this)));
}
}
public final oEt CO_(Activity activity) {
C14957gcv.e(activity, "");
IBinder CS_ = c.CS_(activity);
if (CS_ == null) {
return new oEt(C14851gaI.c);
}
SidecarInterface sidecarInterface = this.a;
SidecarWindowLayoutInfo windowLayoutInfo = sidecarInterface == null ? null : sidecarInterface.getWindowLayoutInfo(CS_);
SidecarInterface sidecarInterface2 = this.a;
SidecarDeviceState deviceState = sidecarInterface2 != null ? sidecarInterface2.getDeviceState() : null;
if (deviceState == null) {
deviceState = new SidecarDeviceState();
}
return DcR.e(windowLayoutInfo, deviceState);
}
@Override // o.gQi
public final void CP_(Activity activity) {
C14957gcv.e(activity, "");
IBinder CS_ = c.CS_(activity);
if (CS_ != null) {
CR_(CS_, activity);
} else {
activity.getWindow().getDecorView().addOnAttachStateChangeListener(new RVV(this, activity));
}
}
public final void CR_(IBinder iBinder, Activity activity) {
SidecarInterface sidecarInterface;
C14957gcv.e(iBinder, "");
C14957gcv.e(activity, "");
this.f.put(iBinder, activity);
SidecarInterface sidecarInterface2 = this.a;
if (sidecarInterface2 != null) {
sidecarInterface2.onWindowLayoutChangeListenerAdded(iBinder);
}
if (this.f.size() == 1 && (sidecarInterface = this.a) != null) {
sidecarInterface.onDeviceStateListenersChanged(false);
}
gQi.Sts sts = this.d;
if (sts != null) {
sts.CV_(activity, CO_(activity));
}
CM_(activity);
}
private final void CM_(Activity activity) {
if (this.b.get(activity) == null) {
Sts sts = new Sts(this, activity);
this.b.put(activity, sts);
activity.registerComponentCallbacks(sts);
}
}
/* loaded from: classes.dex */
public static final class Sts implements ComponentCallbacks {
final SidecarCompat a;
final Activity d;
@Override // android.content.ComponentCallbacks
public final void onLowMemory() {
}
Sts(SidecarCompat sidecarCompat, Activity activity) {
this.a = sidecarCompat;
this.d = activity;
}
@Override // android.content.ComponentCallbacks
public final void onConfigurationChanged(Configuration configuration) {
C14957gcv.e(configuration, "");
gQi.Sts sts = this.a.d;
if (sts != null) {
Activity activity = this.d;
sts.CV_(activity, this.a.CO_(activity));
}
}
}
@Override // o.gQi
public final void CQ_(Activity activity) {
SidecarInterface sidecarInterface;
C14957gcv.e(activity, "");
IBinder CS_ = c.CS_(activity);
if (CS_ == null) {
return;
}
SidecarInterface sidecarInterface2 = this.a;
if (sidecarInterface2 != null) {
sidecarInterface2.onWindowLayoutChangeListenerRemoved(CS_);
}
CN_(activity);
boolean z = this.f.size() == 1;
this.f.remove(CS_);
if (!z || (sidecarInterface = this.a) == null) {
return;
}
sidecarInterface.onDeviceStateListenersChanged(true);
}
private final void CN_(Activity activity) {
activity.unregisterComponentCallbacks(this.b.get(activity));
this.b.remove(activity);
}
/* JADX WARN: Removed duplicated region for block: B:11:0x002c A[Catch: all -> 0x019a, TryCatch #2 {all -> 0x019a, blocks: (B:3:0x0001, B:9:0x0024, B:11:0x002c, B:13:0x0030, B:14:0x0033, B:16:0x0037, B:17:0x003a, B:23:0x005b, B:25:0x0063, B:31:0x0084, B:33:0x008c, B:39:0x00ac, B:41:0x00b4, B:44:0x00ba, B:45:0x00f0, B:47:0x010c, B:52:0x010f, B:54:0x0140, B:56:0x014a, B:57:0x0151, B:58:0x0152, B:59:0x0159, B:61:0x00bd, B:63:0x00e8, B:65:0x015a, B:66:0x0161, B:67:0x0162, B:68:0x0169, B:69:0x016a, B:70:0x0175, B:71:0x00a8, B:72:0x0091, B:74:0x0097, B:75:0x0176, B:76:0x0181, B:77:0x0080, B:78:0x0068, B:80:0x006e, B:81:0x0182, B:82:0x018d, B:83:0x0057, B:84:0x003f, B:86:0x0045, B:87:0x018e, B:88:0x0199, B:89:0x0020, B:90:0x0008, B:92:0x000e), top: B:2:0x0001, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:22:0x0055 */
/* JADX WARN: Removed duplicated region for block: B:25:0x0063 A[Catch: all -> 0x019a, TryCatch #2 {all -> 0x019a, blocks: (B:3:0x0001, B:9:0x0024, B:11:0x002c, B:13:0x0030, B:14:0x0033, B:16:0x0037, B:17:0x003a, B:23:0x005b, B:25:0x0063, B:31:0x0084, B:33:0x008c, B:39:0x00ac, B:41:0x00b4, B:44:0x00ba, B:45:0x00f0, B:47:0x010c, B:52:0x010f, B:54:0x0140, B:56:0x014a, B:57:0x0151, B:58:0x0152, B:59:0x0159, B:61:0x00bd, B:63:0x00e8, B:65:0x015a, B:66:0x0161, B:67:0x0162, B:68:0x0169, B:69:0x016a, B:70:0x0175, B:71:0x00a8, B:72:0x0091, B:74:0x0097, B:75:0x0176, B:76:0x0181, B:77:0x0080, B:78:0x0068, B:80:0x006e, B:81:0x0182, B:82:0x018d, B:83:0x0057, B:84:0x003f, B:86:0x0045, B:87:0x018e, B:88:0x0199, B:89:0x0020, B:90:0x0008, B:92:0x000e), top: B:2:0x0001, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:30:0x007e */
/* JADX WARN: Removed duplicated region for block: B:33:0x008c A[Catch: all -> 0x019a, TryCatch #2 {all -> 0x019a, blocks: (B:3:0x0001, B:9:0x0024, B:11:0x002c, B:13:0x0030, B:14:0x0033, B:16:0x0037, B:17:0x003a, B:23:0x005b, B:25:0x0063, B:31:0x0084, B:33:0x008c, B:39:0x00ac, B:41:0x00b4, B:44:0x00ba, B:45:0x00f0, B:47:0x010c, B:52:0x010f, B:54:0x0140, B:56:0x014a, B:57:0x0151, B:58:0x0152, B:59:0x0159, B:61:0x00bd, B:63:0x00e8, B:65:0x015a, B:66:0x0161, B:67:0x0162, B:68:0x0169, B:69:0x016a, B:70:0x0175, B:71:0x00a8, B:72:0x0091, B:74:0x0097, B:75:0x0176, B:76:0x0181, B:77:0x0080, B:78:0x0068, B:80:0x006e, B:81:0x0182, B:82:0x018d, B:83:0x0057, B:84:0x003f, B:86:0x0045, B:87:0x018e, B:88:0x0199, B:89:0x0020, B:90:0x0008, B:92:0x000e), top: B:2:0x0001, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:38:0x00a7 */
/* JADX WARN: Removed duplicated region for block: B:41:0x00b4 A[Catch: all -> 0x019a, TRY_LEAVE, TryCatch #2 {all -> 0x019a, blocks: (B:3:0x0001, B:9:0x0024, B:11:0x002c, B:13:0x0030, B:14:0x0033, B:16:0x0037, B:17:0x003a, B:23:0x005b, B:25:0x0063, B:31:0x0084, B:33:0x008c, B:39:0x00ac, B:41:0x00b4, B:44:0x00ba, B:45:0x00f0, B:47:0x010c, B:52:0x010f, B:54:0x0140, B:56:0x014a, B:57:0x0151, B:58:0x0152, B:59:0x0159, B:61:0x00bd, B:63:0x00e8, B:65:0x015a, B:66:0x0161, B:67:0x0162, B:68:0x0169, B:69:0x016a, B:70:0x0175, B:71:0x00a8, B:72:0x0091, B:74:0x0097, B:75:0x0176, B:76:0x0181, B:77:0x0080, B:78:0x0068, B:80:0x006e, B:81:0x0182, B:82:0x018d, B:83:0x0057, B:84:0x003f, B:86:0x0045, B:87:0x018e, B:88:0x0199, B:89:0x0020, B:90:0x0008, B:92:0x000e), top: B:2:0x0001, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:69:0x016a A[Catch: all -> 0x019a, TryCatch #2 {all -> 0x019a, blocks: (B:3:0x0001, B:9:0x0024, B:11:0x002c, B:13:0x0030, B:14:0x0033, B:16:0x0037, B:17:0x003a, B:23:0x005b, B:25:0x0063, B:31:0x0084, B:33:0x008c, B:39:0x00ac, B:41:0x00b4, B:44:0x00ba, B:45:0x00f0, B:47:0x010c, B:52:0x010f, B:54:0x0140, B:56:0x014a, B:57:0x0151, B:58:0x0152, B:59:0x0159, B:61:0x00bd, B:63:0x00e8, B:65:0x015a, B:66:0x0161, B:67:0x0162, B:68:0x0169, B:69:0x016a, B:70:0x0175, B:71:0x00a8, B:72:0x0091, B:74:0x0097, B:75:0x0176, B:76:0x0181, B:77:0x0080, B:78:0x0068, B:80:0x006e, B:81:0x0182, B:82:0x018d, B:83:0x0057, B:84:0x003f, B:86:0x0045, B:87:0x018e, B:88:0x0199, B:89:0x0020, B:90:0x0008, B:92:0x000e), top: B:2:0x0001, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:71:0x00a8 A[Catch: all -> 0x019a, TryCatch #2 {all -> 0x019a, blocks: (B:3:0x0001, B:9:0x0024, B:11:0x002c, B:13:0x0030, B:14:0x0033, B:16:0x0037, B:17:0x003a, B:23:0x005b, B:25:0x0063, B:31:0x0084, B:33:0x008c, B:39:0x00ac, B:41:0x00b4, B:44:0x00ba, B:45:0x00f0, B:47:0x010c, B:52:0x010f, B:54:0x0140, B:56:0x014a, B:57:0x0151, B:58:0x0152, B:59:0x0159, B:61:0x00bd, B:63:0x00e8, B:65:0x015a, B:66:0x0161, B:67:0x0162, B:68:0x0169, B:69:0x016a, B:70:0x0175, B:71:0x00a8, B:72:0x0091, B:74:0x0097, B:75:0x0176, B:76:0x0181, B:77:0x0080, B:78:0x0068, B:80:0x006e, B:81:0x0182, B:82:0x018d, B:83:0x0057, B:84:0x003f, B:86:0x0045, B:87:0x018e, B:88:0x0199, B:89:0x0020, B:90:0x0008, B:92:0x000e), top: B:2:0x0001, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:75:0x0176 A[Catch: all -> 0x019a, TryCatch #2 {all -> 0x019a, blocks: (B:3:0x0001, B:9:0x0024, B:11:0x002c, B:13:0x0030, B:14:0x0033, B:16:0x0037, B:17:0x003a, B:23:0x005b, B:25:0x0063, B:31:0x0084, B:33:0x008c, B:39:0x00ac, B:41:0x00b4, B:44:0x00ba, B:45:0x00f0, B:47:0x010c, B:52:0x010f, B:54:0x0140, B:56:0x014a, B:57:0x0151, B:58:0x0152, B:59:0x0159, B:61:0x00bd, B:63:0x00e8, B:65:0x015a, B:66:0x0161, B:67:0x0162, B:68:0x0169, B:69:0x016a, B:70:0x0175, B:71:0x00a8, B:72:0x0091, B:74:0x0097, B:75:0x0176, B:76:0x0181, B:77:0x0080, B:78:0x0068, B:80:0x006e, B:81:0x0182, B:82:0x018d, B:83:0x0057, B:84:0x003f, B:86:0x0045, B:87:0x018e, B:88:0x0199, B:89:0x0020, B:90:0x0008, B:92:0x000e), top: B:2:0x0001, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:77:0x0080 A[Catch: all -> 0x019a, TryCatch #2 {all -> 0x019a, blocks: (B:3:0x0001, B:9:0x0024, B:11:0x002c, B:13:0x0030, B:14:0x0033, B:16:0x0037, B:17:0x003a, B:23:0x005b, B:25:0x0063, B:31:0x0084, B:33:0x008c, B:39:0x00ac, B:41:0x00b4, B:44:0x00ba, B:45:0x00f0, B:47:0x010c, B:52:0x010f, B:54:0x0140, B:56:0x014a, B:57:0x0151, B:58:0x0152, B:59:0x0159, B:61:0x00bd, B:63:0x00e8, B:65:0x015a, B:66:0x0161, B:67:0x0162, B:68:0x0169, B:69:0x016a, B:70:0x0175, B:71:0x00a8, B:72:0x0091, B:74:0x0097, B:75:0x0176, B:76:0x0181, B:77:0x0080, B:78:0x0068, B:80:0x006e, B:81:0x0182, B:82:0x018d, B:83:0x0057, B:84:0x003f, B:86:0x0045, B:87:0x018e, B:88:0x0199, B:89:0x0020, B:90:0x0008, B:92:0x000e), top: B:2:0x0001, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:81:0x0182 A[Catch: all -> 0x019a, TryCatch #2 {all -> 0x019a, blocks: (B:3:0x0001, B:9:0x0024, B:11:0x002c, B:13:0x0030, B:14:0x0033, B:16:0x0037, B:17:0x003a, B:23:0x005b, B:25:0x0063, B:31:0x0084, B:33:0x008c, B:39:0x00ac, B:41:0x00b4, B:44:0x00ba, B:45:0x00f0, B:47:0x010c, B:52:0x010f, B:54:0x0140, B:56:0x014a, B:57:0x0151, B:58:0x0152, B:59:0x0159, B:61:0x00bd, B:63:0x00e8, B:65:0x015a, B:66:0x0161, B:67:0x0162, B:68:0x0169, B:69:0x016a, B:70:0x0175, B:71:0x00a8, B:72:0x0091, B:74:0x0097, B:75:0x0176, B:76:0x0181, B:77:0x0080, B:78:0x0068, B:80:0x006e, B:81:0x0182, B:82:0x018d, B:83:0x0057, B:84:0x003f, B:86:0x0045, B:87:0x018e, B:88:0x0199, B:89:0x0020, B:90:0x0008, B:92:0x000e), top: B:2:0x0001, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:83:0x0057 A[Catch: all -> 0x019a, TryCatch #2 {all -> 0x019a, blocks: (B:3:0x0001, B:9:0x0024, B:11:0x002c, B:13:0x0030, B:14:0x0033, B:16:0x0037, B:17:0x003a, B:23:0x005b, B:25:0x0063, B:31:0x0084, B:33:0x008c, B:39:0x00ac, B:41:0x00b4, B:44:0x00ba, B:45:0x00f0, B:47:0x010c, B:52:0x010f, B:54:0x0140, B:56:0x014a, B:57:0x0151, B:58:0x0152, B:59:0x0159, B:61:0x00bd, B:63:0x00e8, B:65:0x015a, B:66:0x0161, B:67:0x0162, B:68:0x0169, B:69:0x016a, B:70:0x0175, B:71:0x00a8, B:72:0x0091, B:74:0x0097, B:75:0x0176, B:76:0x0181, B:77:0x0080, B:78:0x0068, B:80:0x006e, B:81:0x0182, B:82:0x018d, B:83:0x0057, B:84:0x003f, B:86:0x0045, B:87:0x018e, B:88:0x0199, B:89:0x0020, B:90:0x0008, B:92:0x000e), top: B:2:0x0001, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:87:0x018e A[Catch: all -> 0x019a, TryCatch #2 {all -> 0x019a, blocks: (B:3:0x0001, B:9:0x0024, B:11:0x002c, B:13:0x0030, B:14:0x0033, B:16:0x0037, B:17:0x003a, B:23:0x005b, B:25:0x0063, B:31:0x0084, B:33:0x008c, B:39:0x00ac, B:41:0x00b4, B:44:0x00ba, B:45:0x00f0, B:47:0x010c, B:52:0x010f, B:54:0x0140, B:56:0x014a, B:57:0x0151, B:58:0x0152, B:59:0x0159, B:61:0x00bd, B:63:0x00e8, B:65:0x015a, B:66:0x0161, B:67:0x0162, B:68:0x0169, B:69:0x016a, B:70:0x0175, B:71:0x00a8, B:72:0x0091, B:74:0x0097, B:75:0x0176, B:76:0x0181, B:77:0x0080, B:78:0x0068, B:80:0x006e, B:81:0x0182, B:82:0x018d, B:83:0x0057, B:84:0x003f, B:86:0x0045, B:87:0x018e, B:88:0x0199, B:89:0x0020, B:90:0x0008, B:92:0x000e), top: B:2:0x0001, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:89:0x0020 A[Catch: all -> 0x019a, TryCatch #2 {all -> 0x019a, blocks: (B:3:0x0001, B:9:0x0024, B:11:0x002c, B:13:0x0030, B:14:0x0033, B:16:0x0037, B:17:0x003a, B:23:0x005b, B:25:0x0063, B:31:0x0084, B:33:0x008c, B:39:0x00ac, B:41:0x00b4, B:44:0x00ba, B:45:0x00f0, B:47:0x010c, B:52:0x010f, B:54:0x0140, B:56:0x014a, B:57:0x0151, B:58:0x0152, B:59:0x0159, B:61:0x00bd, B:63:0x00e8, B:65:0x015a, B:66:0x0161, B:67:0x0162, B:68:0x0169, B:69:0x016a, B:70:0x0175, B:71:0x00a8, B:72:0x0091, B:74:0x0097, B:75:0x0176, B:76:0x0181, B:77:0x0080, B:78:0x0068, B:80:0x006e, B:81:0x0182, B:82:0x018d, B:83:0x0057, B:84:0x003f, B:86:0x0045, B:87:0x018e, B:88:0x0199, B:89:0x0020, B:90:0x0008, B:92:0x000e), top: B:2:0x0001, inners: #0, #1 }] */
/* JADX WARN: Removed duplicated region for block: B:8:0x001e */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final boolean a() {
/*
Method dump skipped, instructions count: 411
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.window.layout.SidecarCompat.a():boolean");
}
/* loaded from: classes.dex */
static final class RVV implements View.OnAttachStateChangeListener {
private final SidecarCompat b;
private final WeakReference<Activity> e;
public RVV(SidecarCompat sidecarCompat, Activity activity) {
C14957gcv.e(sidecarCompat, "");
C14957gcv.e(activity, "");
this.b = sidecarCompat;
this.e = new WeakReference<>(activity);
}
@Override // android.view.View.OnAttachStateChangeListener
public final void onViewAttachedToWindow(View view) {
C14957gcv.e(view, "");
view.removeOnAttachStateChangeListener(this);
Activity activity = this.e.get();
IBinder CS_ = SidecarCompat.c.CS_(activity);
if (activity == null || CS_ == null) {
return;
}
this.b.CR_(CS_, activity);
}
@Override // android.view.View.OnAttachStateChangeListener
public final void onViewDetachedFromWindow(View view) {
C14957gcv.e(view, "");
}
}
/* loaded from: classes.dex */
public final class TranslatingCallback implements SidecarInterface.SidecarCallback {
final SidecarCompat b;
public TranslatingCallback(SidecarCompat sidecarCompat) {
C14957gcv.e(sidecarCompat, "");
this.b = sidecarCompat;
}
public final void onDeviceStateChanged(SidecarDeviceState sidecarDeviceState) {
SidecarInterface c;
C14957gcv.e(sidecarDeviceState, "");
Collection<Activity> values = this.b.f.values();
SidecarCompat sidecarCompat = this.b;
for (Activity activity : values) {
IBinder CS_ = SidecarCompat.c.CS_(activity);
SidecarWindowLayoutInfo windowLayoutInfo = (CS_ == null || (c = sidecarCompat.c()) == null) ? null : c.getWindowLayoutInfo(CS_);
gQi.Sts sts = sidecarCompat.d;
if (sts != null) {
DcR unused = sidecarCompat.e;
sts.CV_(activity, DcR.e(windowLayoutInfo, sidecarDeviceState));
}
}
}
public final void onWindowLayoutChanged(IBinder iBinder, SidecarWindowLayoutInfo sidecarWindowLayoutInfo) {
C14957gcv.e(iBinder, "");
C14957gcv.e(sidecarWindowLayoutInfo, "");
Activity activity = (Activity) this.b.f.get(iBinder);
if (activity == null) {
return;
}
DcR unused = this.b.e;
SidecarInterface c = this.b.c();
SidecarDeviceState deviceState = c == null ? null : c.getDeviceState();
if (deviceState == null) {
deviceState = new SidecarDeviceState();
}
oEt e = DcR.e(sidecarWindowLayoutInfo, deviceState);
gQi.Sts sts = this.b.d;
if (sts != null) {
sts.CV_(activity, e);
}
}
}
/* loaded from: classes.dex */
static final class HBt implements gQi.Sts {
private final WeakHashMap<Activity, oEt> a;
private final ReentrantLock c;
private final gQi.Sts d;
public HBt(gQi.Sts sts) {
C14957gcv.e(sts, "");
this.d = sts;
this.c = new ReentrantLock();
this.a = new WeakHashMap<>();
}
@Override // o.gQi.Sts
public final void CV_(Activity activity, oEt oet) {
C14957gcv.e(activity, "");
C14957gcv.e(oet, "");
ReentrantLock reentrantLock = this.c;
reentrantLock.lock();
try {
if (C14957gcv.b(oet, this.a.get(activity))) {
return;
}
this.a.put(activity, oet);
reentrantLock.unlock();
this.d.CV_(activity, oet);
} finally {
reentrantLock.unlock();
}
}
}
/* loaded from: classes.dex */
static final class DistinctSidecarElementCallback implements SidecarInterface.SidecarCallback {
private SidecarDeviceState a;
private final SidecarInterface.SidecarCallback b;
private final ReentrantLock c;
private final DcR d;
private final WeakHashMap<IBinder, SidecarWindowLayoutInfo> e;
public DistinctSidecarElementCallback(DcR dcR, SidecarInterface.SidecarCallback sidecarCallback) {
C14957gcv.e(dcR, "");
C14957gcv.e(sidecarCallback, "");
this.d = dcR;
this.b = sidecarCallback;
this.c = new ReentrantLock();
this.e = new WeakHashMap<>();
}
public final void onDeviceStateChanged(SidecarDeviceState sidecarDeviceState) {
C14957gcv.e(sidecarDeviceState, "");
ReentrantLock reentrantLock = this.c;
reentrantLock.lock();
try {
SidecarDeviceState sidecarDeviceState2 = this.a;
if (!C14957gcv.b(sidecarDeviceState2, sidecarDeviceState)) {
if (sidecarDeviceState2 != null && sidecarDeviceState != null) {
C14957gcv.e(sidecarDeviceState2, "");
int d = DcR.RVV.d(sidecarDeviceState2);
int i = 0;
if (d < 0 || d > 4) {
d = 0;
}
C14957gcv.e(sidecarDeviceState, "");
int d2 = DcR.RVV.d(sidecarDeviceState);
if (d2 >= 0 && d2 <= 4) {
i = d2;
}
}
this.a = sidecarDeviceState;
this.b.onDeviceStateChanged(sidecarDeviceState);
C14866gag c14866gag = C14866gag.c;
}
} finally {
reentrantLock.unlock();
}
}
public final void onWindowLayoutChanged(IBinder iBinder, SidecarWindowLayoutInfo sidecarWindowLayoutInfo) {
C14957gcv.e(iBinder, "");
C14957gcv.e(sidecarWindowLayoutInfo, "");
synchronized (this.c) {
SidecarWindowLayoutInfo sidecarWindowLayoutInfo2 = this.e.get(iBinder);
if (!C14957gcv.b(sidecarWindowLayoutInfo2, sidecarWindowLayoutInfo)) {
if (sidecarWindowLayoutInfo2 != null && sidecarWindowLayoutInfo != null) {
List<SidecarDisplayFeature> a = DcR.RVV.a(sidecarWindowLayoutInfo2);
List<SidecarDisplayFeature> a2 = DcR.RVV.a(sidecarWindowLayoutInfo);
if (a != a2) {
if (a != null && a2 != null && a.size() == a2.size()) {
int size = a.size() - 1;
if (size >= 0) {
int i = 0;
while (true) {
int i2 = i + 1;
SidecarDisplayFeature sidecarDisplayFeature = a.get(i);
SidecarDisplayFeature sidecarDisplayFeature2 = a2.get(i);
if (!C14957gcv.b(sidecarDisplayFeature, sidecarDisplayFeature2)) {
if (sidecarDisplayFeature != null) {
if (sidecarDisplayFeature2 != null) {
if (sidecarDisplayFeature.getType() == sidecarDisplayFeature2.getType()) {
if (!C14957gcv.b(sidecarDisplayFeature.getRect(), sidecarDisplayFeature2.getRect())) {
break;
}
} else {
break;
}
} else {
break;
}
} else {
break;
}
}
if (i2 > size) {
break;
} else {
i = i2;
}
}
}
}
}
}
this.e.put(iBinder, sidecarWindowLayoutInfo);
this.b.onWindowLayoutChanged(iBinder, sidecarWindowLayoutInfo);
}
}
}
}
/* loaded from: classes.dex */
public static final class LWm {
private LWm() {
}
public final xxy d() {
try {
String apiVersion = SidecarProvider.getApiVersion();
if (TextUtils.isEmpty(apiVersion)) {
return null;
}
xxy.IeS ieS = xxy.b;
if (apiVersion == null) {
return null;
}
String str = apiVersion;
if (gdZ.d((CharSequence) str)) {
return null;
}
Matcher matcher = Pattern.compile("(\\d+)(?:\\.(\\d+))(?:\\.(\\d+))(?:-(.+))?").matcher(str);
if (!matcher.matches()) {
return null;
}
String group = matcher.group(1);
Integer valueOf = group == null ? null : Integer.valueOf(Integer.parseInt(group));
if (valueOf == null) {
return null;
}
int intValue = valueOf.intValue();
String group2 = matcher.group(2);
Integer valueOf2 = group2 == null ? null : Integer.valueOf(Integer.parseInt(group2));
if (valueOf2 == null) {
return null;
}
int intValue2 = valueOf2.intValue();
String group3 = matcher.group(3);
Integer valueOf3 = group3 == null ? null : Integer.valueOf(Integer.parseInt(group3));
if (valueOf3 == null) {
return null;
}
int intValue3 = valueOf3.intValue();
String group4 = matcher.group(4) != null ? matcher.group(4) : "";
C14957gcv.c((Object) group4, "");
return new xxy(intValue, intValue2, intValue3, group4, (byte) 0);
} catch (NoClassDefFoundError | UnsupportedOperationException unused) {
return null;
}
}
public final IBinder CS_(Activity activity) {
Window window;
WindowManager.LayoutParams attributes;
if (activity == null || (window = activity.getWindow()) == null || (attributes = window.getAttributes()) == null) {
return null;
}
return attributes.token;
}
public /* synthetic */ LWm(C14953gcr c14953gcr) {
this();
}
}
public final SidecarInterface c() {
return this.a;
}
}