package defpackage; import android.app.Activity; import android.app.ActivityManager; import android.content.ClipData; import android.content.ClipDescription; import android.content.ClipboardManager; import android.graphics.Bitmap; import android.os.Build; import android.view.View; import android.view.Window; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.view.WindowInsetsControllerCompat; import cn.xiaochuankeji.hermes.R2; import cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel; import com.meituan.robust.ChangeQuickRedirect; import com.meituan.robust.PatchProxy; import com.meituan.robust.PatchProxyResult; import java.io.FileNotFoundException; import java.lang.ref.WeakReference; import java.lang.reflect.Method; import java.util.List; /* renamed from: lb reason: default package */ public class lb { public static ChangeQuickRedirect changeQuickRedirect; /* renamed from: a reason: collision with root package name */ public WeakReference<Activity> f29058a; /* renamed from: b reason: collision with root package name */ public final PlatformChannel f29059b; public PlatformChannel.e c; public int d = R2.dimen.design_navigation_icon_size; public final PlatformChannel.d e; /* renamed from: lb$a */ public class a implements PlatformChannel.d { public static ChangeQuickRedirect changeQuickRedirect; public a() { } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public void a() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 9903, new Class[0], Void.TYPE).isSupported) { lb.i(lb.this); } } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public boolean b() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 9909, new Class[0], Boolean.TYPE); return proxy.isSupported ? ((Boolean) proxy.result).booleanValue() : lb.d(lb.this); } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public void c(@NonNull PlatformChannel.c cVar) { if (!PatchProxy.proxy(new Object[]{cVar}, this, changeQuickRedirect, false, 9900, new Class[]{PlatformChannel.c.class}, Void.TYPE).isSupported) { lb.f(lb.this, cVar); } } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public void d() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 9904, new Class[0], Void.TYPE).isSupported) { lb.j(lb.this); } } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public void e(@NonNull List<PlatformChannel.SystemUiOverlay> list) { if (!PatchProxy.proxy(new Object[]{list}, this, changeQuickRedirect, false, 9901, new Class[]{List.class}, Void.TYPE).isSupported) { lb.g(lb.this, list); } } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public void f(@NonNull PlatformChannel.e eVar) { if (!PatchProxy.proxy(new Object[]{eVar}, this, changeQuickRedirect, false, 9905, new Class[]{PlatformChannel.e.class}, Void.TYPE).isSupported) { lb.k(lb.this, eVar); } } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public void g(@NonNull PlatformChannel.SystemUiMode systemUiMode) { if (!PatchProxy.proxy(new Object[]{systemUiMode}, this, changeQuickRedirect, false, 9902, new Class[]{PlatformChannel.SystemUiMode.class}, Void.TYPE).isSupported) { lb.h(lb.this, systemUiMode); } } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public void h() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 9906, new Class[0], Void.TYPE).isSupported) { lb.l(lb.this); } } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public void i(@NonNull PlatformChannel.SoundType soundType) { if (!PatchProxy.proxy(new Object[]{soundType}, this, changeQuickRedirect, false, 9897, new Class[]{PlatformChannel.SoundType.class}, Void.TYPE).isSupported) { lb.a(lb.this, soundType); } } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public void j(@NonNull String str) { if (!PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 9908, new Class[]{String.class}, Void.TYPE).isSupported) { lb.c(lb.this, str); } } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public void k(@NonNull PlatformChannel.HapticFeedbackType hapticFeedbackType) { if (!PatchProxy.proxy(new Object[]{hapticFeedbackType}, this, changeQuickRedirect, false, 9898, new Class[]{PlatformChannel.HapticFeedbackType.class}, Void.TYPE).isSupported) { lb.this.D(hapticFeedbackType); } } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public CharSequence l(@Nullable PlatformChannel.ClipboardContentFormat clipboardContentFormat) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{clipboardContentFormat}, this, changeQuickRedirect, false, 9907, new Class[]{PlatformChannel.ClipboardContentFormat.class}, CharSequence.class); return proxy.isSupported ? (CharSequence) proxy.result : lb.m(lb.this, clipboardContentFormat); } @Override // cn.xiaochuankeji.octoflutter.embedding.engine.systemchannels.PlatformChannel.d public void m(int i) { if (!PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 9899, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) { lb.b(lb.this, i); } } } /* renamed from: lb$b */ public class b implements View.OnSystemUiVisibilityChangeListener { public static ChangeQuickRedirect changeQuickRedirect; public b() { } public void onSystemUiVisibilityChange(int i) { if (!PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 9910, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) { if ((i & 4) == 0) { lb.this.f29059b.q(false); } else { lb.this.f29059b.q(true); } } } } /* renamed from: lb$c */ public static /* synthetic */ class c { /* renamed from: a reason: collision with root package name */ public static final /* synthetic */ int[] f29062a; /* renamed from: b reason: collision with root package name */ public static final /* synthetic */ int[] f29063b; public static final /* synthetic */ int[] c; /* JADX WARNING: Can't wrap try/catch for region: R(18:0|(2:1|2)|3|(2:5|6)|7|9|10|(2:11|12)|13|15|16|17|18|19|20|21|22|(3:23|24|26)) */ /* JADX WARNING: Can't wrap try/catch for region: R(22:0|1|2|3|(2:5|6)|7|9|10|11|12|13|15|16|17|18|19|20|21|22|23|24|26) */ /* JADX WARNING: Failed to process nested try/catch */ /* JADX WARNING: Missing exception handler attribute for start block: B:11:0x002e */ /* JADX WARNING: Missing exception handler attribute for start block: B:17:0x0049 */ /* JADX WARNING: Missing exception handler attribute for start block: B:19:0x0053 */ /* JADX WARNING: Missing exception handler attribute for start block: B:21:0x005e */ /* JADX WARNING: Missing exception handler attribute for start block: B:23:0x0069 */ static { int[] iArr = new int[PlatformChannel.Brightness.values().length]; c = iArr; try { iArr[PlatformChannel.Brightness.DARK.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { c[PlatformChannel.Brightness.LIGHT.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } int[] iArr2 = new int[PlatformChannel.SystemUiOverlay.values().length]; f29063b = iArr2; iArr2[PlatformChannel.SystemUiOverlay.TOP_OVERLAYS.ordinal()] = 1; try { f29063b[PlatformChannel.SystemUiOverlay.BOTTOM_OVERLAYS.ordinal()] = 2; } catch (NoSuchFieldError unused3) { } int[] iArr3 = new int[PlatformChannel.HapticFeedbackType.values().length]; f29062a = iArr3; iArr3[PlatformChannel.HapticFeedbackType.STANDARD.ordinal()] = 1; f29062a[PlatformChannel.HapticFeedbackType.LIGHT_IMPACT.ordinal()] = 2; f29062a[PlatformChannel.HapticFeedbackType.MEDIUM_IMPACT.ordinal()] = 3; f29062a[PlatformChannel.HapticFeedbackType.HEAVY_IMPACT.ordinal()] = 4; try { f29062a[PlatformChannel.HapticFeedbackType.SELECTION_CLICK.ordinal()] = 5; } catch (NoSuchFieldError unused4) { } } } public lb(Activity activity, PlatformChannel platformChannel) { a aVar = new a(); this.e = aVar; this.f29058a = new WeakReference<>(activity); this.f29059b = platformChannel; platformChannel.p(aVar); } public static /* synthetic */ void a(lb lbVar, PlatformChannel.SoundType soundType) { if (!PatchProxy.proxy(new Object[]{lbVar, soundType}, null, changeQuickRedirect, true, 9885, new Class[]{lb.class, PlatformChannel.SoundType.class}, Void.TYPE).isSupported) { lbVar.r(soundType); } } public static /* synthetic */ void b(lb lbVar, int i) { if (!PatchProxy.proxy(new Object[]{lbVar, new Integer(i)}, null, changeQuickRedirect, true, 9886, new Class[]{lb.class, Integer.TYPE}, Void.TYPE).isSupported) { lbVar.A(i); } } public static /* synthetic */ void c(lb lbVar, String str) { if (!PatchProxy.proxy(new Object[]{lbVar, str}, null, changeQuickRedirect, true, 9895, new Class[]{lb.class, String.class}, Void.TYPE).isSupported) { lbVar.v(str); } } public static /* synthetic */ boolean d(lb lbVar) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{lbVar}, null, changeQuickRedirect, true, 9896, new Class[]{lb.class}, Boolean.TYPE); return proxy.isSupported ? ((Boolean) proxy.result).booleanValue() : lbVar.n(); } public static /* synthetic */ void f(lb lbVar, PlatformChannel.c cVar) { if (!PatchProxy.proxy(new Object[]{lbVar, cVar}, null, changeQuickRedirect, true, 9887, new Class[]{lb.class, PlatformChannel.c.class}, Void.TYPE).isSupported) { lbVar.w(cVar); } } public static /* synthetic */ void g(lb lbVar, List list) { if (!PatchProxy.proxy(new Object[]{lbVar, list}, null, changeQuickRedirect, true, 9888, new Class[]{lb.class, List.class}, Void.TYPE).isSupported) { lbVar.z(list); } } private Activity getActivity() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 9870, new Class[0], Activity.class); if (proxy.isSupported) { return (Activity) proxy.result; } WeakReference<Activity> weakReference = this.f29058a; if (weakReference != null) { return weakReference.get(); } return null; } public static /* synthetic */ void h(lb lbVar, PlatformChannel.SystemUiMode systemUiMode) { if (!PatchProxy.proxy(new Object[]{lbVar, systemUiMode}, null, changeQuickRedirect, true, 9889, new Class[]{lb.class, PlatformChannel.SystemUiMode.class}, Void.TYPE).isSupported) { lbVar.y(systemUiMode); } } public static /* synthetic */ void i(lb lbVar) { if (!PatchProxy.proxy(new Object[]{lbVar}, null, changeQuickRedirect, true, 9890, new Class[]{lb.class}, Void.TYPE).isSupported) { lbVar.x(); } } public static /* synthetic */ void j(lb lbVar) { if (!PatchProxy.proxy(new Object[]{lbVar}, null, changeQuickRedirect, true, 9891, new Class[]{lb.class}, Void.TYPE).isSupported) { lbVar.u(); } } public static /* synthetic */ void k(lb lbVar, PlatformChannel.e eVar) { if (!PatchProxy.proxy(new Object[]{lbVar, eVar}, null, changeQuickRedirect, true, 9892, new Class[]{lb.class, PlatformChannel.e.class}, Void.TYPE).isSupported) { lbVar.B(eVar); } } public static /* synthetic */ void l(lb lbVar) { if (!PatchProxy.proxy(new Object[]{lbVar}, null, changeQuickRedirect, true, 9893, new Class[]{lb.class}, Void.TYPE).isSupported) { lbVar.s(); } } public static /* synthetic */ CharSequence m(lb lbVar, PlatformChannel.ClipboardContentFormat clipboardContentFormat) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{lbVar, clipboardContentFormat}, null, changeQuickRedirect, true, 9894, new Class[]{lb.class, PlatformChannel.ClipboardContentFormat.class}, CharSequence.class); return proxy.isSupported ? (CharSequence) proxy.result : lbVar.q(clipboardContentFormat); } public static void o(Activity activity) { if (!PatchProxy.proxy(new Object[]{activity}, null, changeQuickRedirect, true, 9873, new Class[]{Activity.class}, Void.TYPE).isSupported) { try { Method declaredMethod = Activity.class.getDeclaredMethod("convertFromTranslucent", new Class[0]); declaredMethod.setAccessible(true); declaredMethod.invoke(activity, new Object[0]); } catch (Throwable unused) { } } } public final void A(int i) { Activity activity; boolean z = true; if (PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 9872, new Class[]{Integer.TYPE}, Void.TYPE).isSupported || (activity = getActivity()) == null) { return; } if (Build.VERSION.SDK_INT == 26) { if (!((activity.getWindow().getAttributes().flags & 1024) == 1024 || (activity.getWindow().getDecorView().getSystemUiVisibility() & 4) == 4)) { z = false; } if (z) { o(activity); activity.setRequestedOrientation(i); return; } return; } activity.setRequestedOrientation(i); } public final void B(PlatformChannel.e eVar) { if (!PatchProxy.proxy(new Object[]{eVar}, this, changeQuickRedirect, false, 9880, new Class[]{PlatformChannel.e.class}, Void.TYPE).isSupported) { Activity activity = getActivity(); if (activity != null) { Window window = activity.getWindow(); WindowInsetsControllerCompat windowInsetsControllerCompat = new WindowInsetsControllerCompat(window, window.getDecorView()); int i = Build.VERSION.SDK_INT; if (i < 30) { window.addFlags(Integer.MIN_VALUE); window.clearFlags(201326592); } if (i >= 23) { PlatformChannel.Brightness brightness = eVar.f3705b; if (brightness != null) { int i2 = c.c[brightness.ordinal()]; if (i2 == 1) { windowInsetsControllerCompat.setAppearanceLightStatusBars(true); } else if (i2 == 2) { windowInsetsControllerCompat.setAppearanceLightStatusBars(false); } } Integer num = eVar.f3704a; if (num != null) { window.setStatusBarColor(num.intValue()); } } Boolean bool = eVar.c; if (bool != null && i >= 29) { window.setStatusBarContrastEnforced(bool.booleanValue()); } if (i >= 26) { PlatformChannel.Brightness brightness2 = eVar.e; if (brightness2 != null) { int i3 = c.c[brightness2.ordinal()]; if (i3 == 1) { windowInsetsControllerCompat.setAppearanceLightNavigationBars(true); } else if (i3 == 2) { windowInsetsControllerCompat.setAppearanceLightNavigationBars(false); } } Integer num2 = eVar.d; if (num2 != null) { window.setNavigationBarColor(num2.intValue()); } } Integer num3 = eVar.f; if (num3 != null && i >= 28) { window.setNavigationBarDividerColor(num3.intValue()); } Boolean bool2 = eVar.g; if (bool2 != null && i >= 29) { window.setNavigationBarContrastEnforced(bool2.booleanValue()); } } this.c = eVar; } } public void C() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 9878, new Class[0], Void.TYPE).isSupported) { Activity activity = getActivity(); if (activity != null) { activity.getWindow().getDecorView().setSystemUiVisibility(this.d); } PlatformChannel.e eVar = this.c; if (eVar != null) { B(eVar); } } } public void D(@NonNull PlatformChannel.HapticFeedbackType hapticFeedbackType) { Activity activity; int i = Build.VERSION.SDK_INT; if (!PatchProxy.proxy(new Object[]{hapticFeedbackType}, this, changeQuickRedirect, false, 9871, new Class[]{PlatformChannel.HapticFeedbackType.class}, Void.TYPE).isSupported && (activity = getActivity()) != null) { View decorView = activity.getWindow().getDecorView(); int i2 = c.f29062a[hapticFeedbackType.ordinal()]; if (i2 == 1) { decorView.performHapticFeedback(0); } else if (i2 == 2) { decorView.performHapticFeedback(1); } else if (i2 == 3) { decorView.performHapticFeedback(3); } else if (i2 != 4) { if (i2 == 5 && i >= 21) { decorView.performHapticFeedback(4); } } else if (i >= 23) { decorView.performHapticFeedback(6); } } } public final boolean n() { ClipDescription primaryClipDescription; PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 9884, new Class[0], Boolean.TYPE); if (proxy.isSupported) { return ((Boolean) proxy.result).booleanValue(); } Activity activity = getActivity(); if (activity == null) { return false; } ClipboardManager clipboardManager = (ClipboardManager) activity.getSystemService("clipboard"); if (clipboardManager.hasPrimaryClip() && (primaryClipDescription = clipboardManager.getPrimaryClipDescription()) != null) { return primaryClipDescription.hasMimeType("text/*"); } return false; } public void p() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 9868, new Class[0], Void.TYPE).isSupported) { this.f29059b.p(null); } } public final CharSequence q(PlatformChannel.ClipboardContentFormat clipboardContentFormat) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{clipboardContentFormat}, this, changeQuickRedirect, false, 9882, new Class[]{PlatformChannel.ClipboardContentFormat.class}, CharSequence.class); if (proxy.isSupported) { return (CharSequence) proxy.result; } Activity activity = getActivity(); if (activity != null) { ClipboardManager clipboardManager = (ClipboardManager) activity.getSystemService("clipboard"); if (!clipboardManager.hasPrimaryClip()) { return null; } try { ClipData primaryClip = clipboardManager.getPrimaryClip(); if (primaryClip == null) { return null; } if (clipboardContentFormat == null || clipboardContentFormat == PlatformChannel.ClipboardContentFormat.PLAIN_TEXT) { ClipData.Item itemAt = primaryClip.getItemAt(0); if (itemAt.getUri() != null) { activity.getContentResolver().openTypedAssetFileDescriptor(itemAt.getUri(), "text/*", null); } return itemAt.coerceToText(activity); } } catch (SecurityException e2) { x8.g("PlatformPlugin", "Attempted to get clipboard data that requires additional permission(s).\nSee the exception details for which permission(s) are required, and consider adding them to your Android Manifest as described in:\nhttps://developer.android.com/guide/topics/permissions/overview", e2); } catch (FileNotFoundException unused) { return null; } } return null; } public final void r(@NonNull PlatformChannel.SoundType soundType) { Activity activity; if (!PatchProxy.proxy(new Object[]{soundType}, this, changeQuickRedirect, false, 9869, new Class[]{PlatformChannel.SoundType.class}, Void.TYPE).isSupported && soundType == PlatformChannel.SoundType.CLICK && (activity = getActivity()) != null) { activity.getWindow().getDecorView().playSoundEffect(0); } } public final void s() { Activity activity; if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 9881, new Class[0], Void.TYPE).isSupported && (activity = getActivity()) != null) { activity.finish(); } } public void t(Activity activity) { if (!PatchProxy.proxy(new Object[]{activity}, this, changeQuickRedirect, false, 9867, new Class[]{Activity.class}, Void.TYPE).isSupported) { if (activity != getActivity()) { this.f29058a = new WeakReference<>(activity); } this.f29059b.p(this.e); } } public final void u() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 9879, new Class[0], Void.TYPE).isSupported) { C(); } } public final void v(String str) { Activity activity; if (!PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 9883, new Class[]{String.class}, Void.TYPE).isSupported && (activity = getActivity()) != null) { ((ClipboardManager) activity.getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText("text label?", str)); } } public final void w(PlatformChannel.c cVar) { int i; Activity activity; if (!PatchProxy.proxy(new Object[]{cVar}, this, changeQuickRedirect, false, 9874, new Class[]{PlatformChannel.c.class}, Void.TYPE).isSupported && (i = Build.VERSION.SDK_INT) >= 21) { if (i < 28 && i > 21 && (activity = getActivity()) != null) { activity.setTaskDescription(new ActivityManager.TaskDescription(cVar.f3703b, (Bitmap) null, cVar.f3702a)); } if (i >= 28) { ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(cVar.f3703b, 0, cVar.f3702a); Activity activity2 = getActivity(); if (activity2 != null) { activity2.setTaskDescription(taskDescription); } } } } public final void x() { Activity activity; if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 9875, new Class[0], Void.TYPE).isSupported && (activity = getActivity()) != null) { activity.getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(new b()); } } public final void y(PlatformChannel.SystemUiMode systemUiMode) { int i; int i2 = Build.VERSION.SDK_INT; if (!PatchProxy.proxy(new Object[]{systemUiMode}, this, changeQuickRedirect, false, 9876, new Class[]{PlatformChannel.SystemUiMode.class}, Void.TYPE).isSupported) { if (systemUiMode == PlatformChannel.SystemUiMode.LEAN_BACK && i2 >= 16) { i = R2.id.ad_hot_area_top_view; } else if (systemUiMode == PlatformChannel.SystemUiMode.IMMERSIVE && i2 >= 19) { i = R2.styleable.ConstraintSet_layout_constraintCircle; } else if (systemUiMode == PlatformChannel.SystemUiMode.IMMERSIVE_STICKY && i2 >= 19) { i = 5894; } else if (systemUiMode == PlatformChannel.SystemUiMode.EDGE_TO_EDGE && i2 >= 29) { i = R2.id.actions; } else { return; } this.d = i; C(); } } public final void z(List<PlatformChannel.SystemUiOverlay> list) { if (!PatchProxy.proxy(new Object[]{list}, this, changeQuickRedirect, false, 9877, new Class[]{List.class}, Void.TYPE).isSupported) { int i = R2.id.ad_hot_area_top_view; if (list.size() == 0 && Build.VERSION.SDK_INT >= 19) { i = 5894; } for (int i2 = 0; i2 < list.size(); i2++) { int i3 = c.f29063b[list.get(i2).ordinal()]; if (i3 == 1) { i &= -5; } else if (i3 == 2) { i = i & -513 & -3; } } this.d = i; C(); } } }