package gn; import a.f; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Rect; import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.Base64; import android.util.SparseIntArray; import android.webkit.WebView; import android.webkit.WebViewClient; import com.alibaba.sdk.android.oss.OSSClient; import com.alibaba.sdk.android.oss.common.auth.OSSFederationCredentialProvider; import com.alibaba.sdk.android.oss.model.ObjectMetadata; import com.alibaba.sdk.android.oss.model.PutObjectRequest; import com.alibaba.sdk.android.oss.model.PutObjectResult; import com.meituan.robust.ChangeQuickRedirect; import com.meituan.robust.PatchProxy; import com.meituan.robust.PatchProxyResult; import com.shizhuang.duapp.libs.duapm2.TaskConfig; import com.shizhuang.duapp.libs.duapm2.log.IssueLog; import com.shizhuang.duapp.libs.duapm2.model.Config; import com.shizhuang.duapp.libs.duapm2.model.WhiteScreenInfo; import com.shizhuang.duapp.libs.duapm2.task.BaseTask; import gn1.a; import java.lang.ref.WeakReference; import java.security.KeyFactory; import java.security.interfaces.RSAPublicKey; import java.security.spec.X509EncodedKeySpec; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import javax.crypto.Cipher; import kotlin.Unit; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.StringCompanionObject; import kotlin.text.StringsKt__StringsJVMKt; import kotlin.text.StringsKt__StringsKt; import mm.e; import mm.m; import mm.n; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.json.JSONArray; import org.json.JSONObject; import p4.g; /* compiled from: H5BlankTask.kt */ public final class o extends BaseTask<WhiteScreenInfo> { private static final a aliveCheckHandler = new a(Looper.getMainLooper()); private static Context applicationContext; public static ChangeQuickRedirect changeQuickRedirect; private static Config config; private static WeakReference<m> currentWebClient; private static WeakReference<WebView> currentWebView; @Nullable private static ExecutorService executor; @NotNull /* renamed from: g reason: collision with root package name */ public static final o f32739g = new o(); private static final b handler = new b(Looper.getMainLooper()); private static OSSClient ossClient; @Nullable private static OSSFederationCredentialProvider ossProvider; private static volatile WhiteScreenInfo whiteScreenInfo; /* compiled from: H5BlankTask.kt */ public static final class a extends Handler { public static ChangeQuickRedirect changeQuickRedirect; public a(Looper looper) { super(looper); } public void handleMessage(@NotNull Message message) { if (!PatchProxy.proxy(new Object[]{message}, this, changeQuickRedirect, false, 31666, new Class[]{Message.class}, Void.TYPE).isSupported) { try { Object obj = message.obj; if (obj != null) { Object[] objArr = (Object[]) obj; Object obj2 = objArr[0]; if (obj2 != null) { WhiteScreenInfo whiteScreenInfo = (WhiteScreenInfo) obj2; Object obj3 = objArr[1]; if (obj3 != null) { Object obj4 = ((WeakReference) obj3).get(); if (!(obj4 instanceof WebView)) { obj4 = null; } WebView webView = (WebView) obj4; if (webView == null) { whiteScreenInfo.setFinishing(true); return; } if (webView.getParent() != null) { if (Build.VERSION.SDK_INT < 26 || webView.getWebChromeClient() != null) { if (!Intrinsics.areEqual(webView.getUrl(), whiteScreenInfo.getCurrentUrl())) { whiteScreenInfo.setUrlChanged(true); return; } return; } } whiteScreenInfo.setFinishing(true); return; } throw new NullPointerException("null cannot be cast to non-null type java.lang.ref.WeakReference<*>"); } throw new NullPointerException("null cannot be cast to non-null type com.shizhuang.duapp.libs.duapm2.model.WhiteScreenInfo"); } throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<*>"); } catch (Exception e) { IssueLog.e("h5blank", "alive check error", e); } } } } /* compiled from: H5BlankTask.kt */ public static final class b extends Handler { public static ChangeQuickRedirect changeQuickRedirect; /* compiled from: H5BlankTask.kt */ public static final class a implements Runnable { public static ChangeQuickRedirect changeQuickRedirect; public final /* synthetic */ boolean b; /* renamed from: c reason: collision with root package name */ public final /* synthetic */ WhiteScreenInfo f32740c; public final /* synthetic */ WebView d; public a(boolean z, WhiteScreenInfo whiteScreenInfo, WebView webView) { this.b = z; this.f32740c = whiteScreenInfo; this.d = webView; } /* JADX WARNING: Removed duplicated region for block: B:10:0x0046 */ /* JADX WARNING: Removed duplicated region for block: B:22:0x00a0 */ /* JADX WARNING: Removed duplicated region for block: B:24:0x00bf */ public final void run() { Bitmap bitmap; if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 31668, new Class[0], Void.TYPE).isSupported) { if (!this.b) { this.f32740c.setFinalStartTime(System.currentTimeMillis()); bitmap = this.f32740c.getFinalSnapBitmap(o.q(o.f32739g)); if (bitmap != null) { WhiteScreenInfo whiteScreenInfo = this.f32740c; whiteScreenInfo.setFinalStartTime(whiteScreenInfo.getFinalStartTime() - this.f32740c.getSnapImageSpeedTime()); if (bitmap == null) { this.f32740c.getSnapTimes().put(System.currentTimeMillis()); try { bitmap = o.f32739g.x(this.d, this.f32740c); } catch (Throwable th2) { if (this.b) { this.f32740c.getSnapBitmaps().add(null); o.f32739g.y(this.f32740c); return; } this.f32740c.setType(10002); this.f32740c.setSystemError(th2.toString()); this.f32740c.setExtroInfo("snapshot fail"); this.f32740c.destroy(); o.f32739g.b(this.f32740c); return; } } if (!this.b) { ArrayList<Bitmap> snapBitmaps = this.f32740c.getSnapBitmaps(); e eVar = e.f35698a; o oVar = o.f32739g; snapBitmaps.add(eVar.b(bitmap, o.q(oVar).getSnapScaleWidth())); oVar.y(this.f32740c); return; } Message obtain = Message.obtain(); obtain.obj = new Object[]{this.f32740c, new WeakReference(this.d)}; o oVar2 = o.f32739g; o.aliveCheckHandler.sendMessage(obtain); try { oVar2.A(bitmap, this.f32740c); } catch (Throwable th3) { this.f32740c.destroy(); throw th3; } this.f32740c.destroy(); return; } } bitmap = null; if (bitmap == null) { } if (!this.b) { } } } } public b(Looper looper) { super(looper); } public void handleMessage(@NotNull Message message) { WebView webView; boolean z; boolean z4 = false; if (!PatchProxy.proxy(new Object[]{message}, this, changeQuickRedirect, false, 31667, new Class[]{Message.class}, Void.TYPE).isSupported) { Object obj = message.obj; if (!(obj instanceof WhiteScreenInfo)) { obj = null; } WhiteScreenInfo whiteScreenInfo = (WhiteScreenInfo) obj; if (whiteScreenInfo != null) { o oVar = o.f32739g; WeakReference weakReference = o.currentWebView; if (weakReference != null && (webView = (WebView) weakReference.get()) != null) { if (!(!Intrinsics.areEqual(whiteScreenInfo, o.whiteScreenInfo))) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{webView}, mm.o.f35712a, mm.o.changeQuickRedirect, false, 29460, new Class[]{WebView.class}, Boolean.TYPE); if (proxy.isSupported) { z = ((Boolean) proxy.result).booleanValue(); } else { if (webView.getWidth() > 0) { String url = webView.getUrl(); if (!(url == null || StringsKt__StringsJVMKt.isBlank(url))) { z4 = true; } } z = z4; } if (z) { boolean hasNextSnapTime = whiteScreenInfo.hasNextSnapTime(); if (!hasNextSnapTime) { oVar.B(webView, whiteScreenInfo); } String url2 = webView.getUrl(); if (whiteScreenInfo.getCurrentUrl() != null && (!Intrinsics.areEqual(url2, whiteScreenInfo.getCurrentUrl()))) { whiteScreenInfo.getReferer().put(whiteScreenInfo.getCurrentUrl()); whiteScreenInfo.setUrlChanged(true); } whiteScreenInfo.setCurrentUrl(url2); oVar.C().execute(new a(hasNextSnapTime, whiteScreenInfo, webView)); return; } } whiteScreenInfo.destroy(); } } } } } public static final /* synthetic */ Context p(o oVar) { Context context = applicationContext; if (context == null) { Intrinsics.throwUninitializedPropertyAccessException("applicationContext"); } return context; } public static final /* synthetic */ Config q(o oVar) { Config config2 = config; if (config2 == null) { Intrinsics.throwUninitializedPropertyAccessException("config"); } return config2; } public static final /* synthetic */ OSSClient s(o oVar) { OSSClient oSSClient = ossClient; if (oSSClient == null) { Intrinsics.throwUninitializedPropertyAccessException("ossClient"); } return oSSClient; } public final void A(Bitmap bitmap, WhiteScreenInfo whiteScreenInfo2) { boolean z; String str; String str2; e.a aVar; String str3; float f; if (!PatchProxy.proxy(new Object[]{bitmap, whiteScreenInfo2}, this, changeQuickRedirect, false, 31662, new Class[]{Bitmap.class, WhiteScreenInfo.class}, Void.TYPE).isSupported) { whiteScreenInfo2.setStep(2); gn1.a.h("H5BlankMonitor").a("bitmap size ::: %s", Integer.valueOf(bitmap.getByteCount())); e eVar = e.f35698a; Config config2 = config; if (config2 == null) { Intrinsics.throwUninitializedPropertyAccessException("config"); } Bitmap b2 = eVar.b(bitmap, config2.getSnapScaleWidth()); whiteScreenInfo2.setImg_width(b2.getWidth()); whiteScreenInfo2.setImg_height(b2.getHeight()); gn1.a.h("H5BlankMonitor").a("scale bitmap size ::: %s", Integer.valueOf(b2.getByteCount())); whiteScreenInfo2.setStep(3); Config config3 = config; if (config3 == null) { Intrinsics.throwUninitializedPropertyAccessException("config"); } if (config3.getClientCheckPix()) { long currentTimeMillis = System.currentTimeMillis(); Config config4 = config; if (config4 == null) { Intrinsics.throwUninitializedPropertyAccessException("config"); } int clientCheckPixCount = config4.getClientCheckPixCount(); Config config5 = config; if (config5 == null) { Intrinsics.throwUninitializedPropertyAccessException("config"); } float clientCheckMaxPresent = config5.getClientCheckMaxPresent(); PatchProxyResult proxy = PatchProxy.proxy(new Object[]{b2, new Integer(clientCheckPixCount), new Float(clientCheckMaxPresent)}, eVar, e.changeQuickRedirect, false, 29317, new Class[]{Bitmap.class, Integer.TYPE, Float.TYPE}, e.a.class); if (proxy.isSupported) { aVar = (e.a) proxy.result; } else { int width = b2.getWidth(); int height = (b2.getHeight() * width) / clientCheckPixCount; SparseIntArray sparseIntArray = new SparseIntArray(); for (int i = 0; i < clientCheckPixCount; i++) { int i3 = height * i; int pixel = b2.getPixel(i3 % width, i3 / width); sparseIntArray.put(pixel, sparseIntArray.get(pixel) + 1); } int i12 = 0; int i13 = 0; int i14 = 0; for (int size = sparseIntArray.size(); i12 < size; size = size) { int keyAt = sparseIntArray.keyAt(i12); int valueAt = sparseIntArray.valueAt(i12); if (valueAt > i13) { i13 = valueAt; i14 = keyAt; } i12++; } float f12 = (float) i13; float f13 = (float) clientCheckPixCount; boolean z4 = f12 > (clientCheckMaxPresent * f13) / ((float) 100); StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE; aVar = new e.a(z4, String.format("#%08X", Arrays.copyOf(new Object[]{Integer.valueOf(i14)}, 1)), f12 / f13); } whiteScreenInfo2.setClientFilterSpeedTime(System.currentTimeMillis() - currentTimeMillis); whiteScreenInfo2.setClientFilterResult(aVar.a() ? 20001 : 20002); PatchProxyResult proxy2 = PatchProxy.proxy(new Object[0], aVar, e.a.changeQuickRedirect, false, 29320, new Class[0], String.class); if (proxy2.isSupported) { str3 = (String) proxy2.result; } else { str3 = aVar.b; } whiteScreenInfo2.setClientFilterColor(str3); PatchProxyResult proxy3 = PatchProxy.proxy(new Object[0], aVar, e.a.changeQuickRedirect, false, 29321, new Class[0], Float.TYPE); if (proxy3.isSupported) { f = ((Float) proxy3.result).floatValue(); } else { f = aVar.f35700c; } whiteScreenInfo2.setClientFilterMaxPresent(Float.valueOf(f)); Config config6 = config; if (config6 == null) { Intrinsics.throwUninitializedPropertyAccessException("config"); } if (!config6.isUseClientFilterResult() || aVar.a()) { Config config7 = config; if (config7 == null) { Intrinsics.throwUninitializedPropertyAccessException("config"); } if (!config7.getClientIsUploadImage()) { b(whiteScreenInfo2); return; } } else { b(whiteScreenInfo2); return; } } whiteScreenInfo2.setStep(4); PatchProxyResult proxy4 = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 31663, new Class[0], Boolean.TYPE); if (proxy4.isSupported) { z = ((Boolean) proxy4.result).booleanValue(); } else { if (ossClient == null) { if (ossProvider == null) { z = false; } else { Context context = applicationContext; if (context == null) { Intrinsics.throwUninitializedPropertyAccessException("applicationContext"); } ossClient = new OSSClient(context, "http://oss-cn-shanghai.aliyuncs.com/", ossProvider); } } z = true; } if (!z) { whiteScreenInfo2.setExtroInfo("access token fail"); b(whiteScreenInfo2); return; } whiteScreenInfo2.setStep(5); String a5 = nm.a.a(); long currentTimeMillis2 = System.currentTimeMillis(); byte[] a12 = e.f35698a.a(b2, a5); gn1.a.h("H5BlankMonitor").a("byteArray size ::: %s", Integer.valueOf(a12.length)); whiteScreenInfo2.setImg_size(a12.length); whiteScreenInfo2.setSymmetricalEncryptionSpeedTime(System.currentTimeMillis() - currentTimeMillis2); whiteScreenInfo2.setStep(6); if (!PatchProxy.proxy(new Object[]{a5, a12, whiteScreenInfo2}, this, changeQuickRedirect, false, 31664, new Class[]{String.class, byte[].class, WhiteScreenInfo.class}, Void.TYPE).isSupported) { long currentTimeMillis3 = System.currentTimeMillis(); PatchProxyResult proxy5 = PatchProxy.proxy(new Object[]{a5, "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCEJhWM++miVuz2UKiVOvjGFrBeBB63WSj/TXEiarXiWXaYL+woVU0ukVTjX5zN3n52KVIlbzRLciaKIdialr8VDmYPpCTqI+hJH5hFkW/Hj9U6bK4QZ4qycQMeeyhTZ4QdnSCQhT+rACm7/0PCaH0xZx2c6L1cFr5U6A2TnauuXwIDAQAB"}, null, nm.b.changeQuickRedirect, true, 29471, new Class[]{String.class, String.class}, String.class); if (proxy5.isSupported) { str = (String) proxy5.result; } else { byte[] decode = Base64.decode("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCEJhWM++miVuz2UKiVOvjGFrBeBB63WSj/TXEiarXiWXaYL+woVU0ukVTjX5zN3n52KVIlbzRLciaKIdialr8VDmYPpCTqI+hJH5hFkW/Hj9U6bK4QZ4qycQMeeyhTZ4QdnSCQhT+rACm7/0PCaH0xZx2c6L1cFr5U6A2TnauuXwIDAQAB", 0); Cipher instance = Cipher.getInstance("RSA/ECB/PKCS1Padding"); instance.init(1, (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decode))); str = Base64.encodeToString(instance.doFinal(a5.getBytes("UTF-8")), 2); } whiteScreenInfo2.setRsaEncryptionSpeedTime(System.currentTimeMillis() - currentTimeMillis3); gn1.a.h("H5BlankMonitor").a("secret ::: %s", str); ObjectMetadata objectMetadata = new ObjectMetadata(); String str4 = "encodeKey"; objectMetadata.addUserMetadata(str4, str); StringBuilder h12 = f.h("wireless/screenshot/android_"); h12.append(UUID.randomUUID().toString()); String sb2 = h12.toString(); gn1.a.h("H5BlankMonitor").a("objetKey ::: %s", sb2); long currentTimeMillis4 = System.currentTimeMillis(); PutObjectRequest putObjectRequest = new PutObjectRequest("du-front", sb2, a12, objectMetadata); OSSClient oSSClient = ossClient; if (oSSClient == null) { Intrinsics.throwUninitializedPropertyAccessException("ossClient"); } PutObjectResult putObject = oSSClient.putObject(putObjectRequest); whiteScreenInfo2.setUploadImageSpeedTime(System.currentTimeMillis() - currentTimeMillis4); if (putObject == null) { gn1.a.h("H5BlankMonitor").a("result = null", new Object[0]); whiteScreenInfo2.setType(10005); whiteScreenInfo2.setExtroInfo("upload img fail"); b(whiteScreenInfo2); return; } for (T t : whiteScreenInfo2.getSnapBitmaps()) { if (t == null) { whiteScreenInfo2.getSnapImages().put((Object) null); str2 = str4; } else { try { String str5 = "wireless/screenshot/android_" + UUID.randomUUID().toString(); OSSClient oSSClient2 = ossClient; if (oSSClient2 == null) { Intrinsics.throwUninitializedPropertyAccessException("ossClient"); } byte[] a13 = e.f35698a.a(t, a5); ObjectMetadata objectMetadata2 = new ObjectMetadata(); objectMetadata2.addUserMetadata(str4, str); Unit unit = Unit.INSTANCE; str2 = str4; try { oSSClient2.putObject(new PutObjectRequest("du-front", str5, a13, objectMetadata2)); whiteScreenInfo2.getSnapImages().put(str5); } catch (Throwable unused) { } } catch (Throwable unused2) { str2 = str4; whiteScreenInfo2.getSnapImages().put((Object) null); str4 = str2; } } str4 = str2; } whiteScreenInfo2.setEncodeKey(str); whiteScreenInfo2.getSnapImages().put(sb2); whiteScreenInfo2.calcTotalTime(); gn1.a.h("H5BlankMonitor").a("result = %s", putObject.getETag()); whiteScreenInfo2.setStep(7); b(whiteScreenInfo2); } } } public final void B(WebView webView, WhiteScreenInfo whiteScreenInfo2) { m mVar; int i; String url; boolean z = false; if (!PatchProxy.proxy(new Object[]{webView, whiteScreenInfo2}, this, changeQuickRedirect, false, 31661, new Class[]{WebView.class, WhiteScreenInfo.class}, Void.TYPE).isSupported) { whiteScreenInfo2.setFinalStartTime(System.currentTimeMillis()); whiteScreenInfo2.setStep(1); mm.o oVar = mm.o.f35712a; if (!PatchProxy.proxy(new Object[]{webView, whiteScreenInfo2}, oVar, mm.o.changeQuickRedirect, false, 29461, new Class[]{WebView.class, WhiteScreenInfo.class}, Void.TYPE).isSupported && (url = webView.getUrl()) != null) { List split$default = StringsKt__StringsKt.split$default((CharSequence) url, new String[]{"?"}, false, 0, 6, (Object) null); whiteScreenInfo2.setUrl((String) split$default.get(0)); if (split$default.size() > 1) { whiteScreenInfo2.setQuery((String) split$default.get(1)); } } if (mm.b.j()) { whiteScreenInfo2.setAppDisplayState(2); whiteScreenInfo2.recordFrontAndBackgroundTime(true); } else { whiteScreenInfo2.setAppDisplayState(1); whiteScreenInfo2.recordFrontAndBackgroundTime(false); } if (!PatchProxy.proxy(new Object[]{webView, whiteScreenInfo2}, oVar, mm.o.changeQuickRedirect, false, 29464, new Class[]{WebView.class, WhiteScreenInfo.class}, Void.TYPE).isSupported) { webView.evaluateJavascript("try{__get_page_screen_context__()}catch(err){}", new n(whiteScreenInfo2)); } WeakReference<m> weakReference = currentWebClient; if (!(weakReference == null || (mVar = weakReference.get()) == null)) { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], mVar, m.changeQuickRedirect, false, 29434, new Class[0], Integer.TYPE); if (proxy.isSupported) { i = ((Integer) proxy.result).intValue(); } else { i = mVar.f35710a; } whiteScreenInfo2.setPageLoadFinished(i); } if (!PatchProxy.proxy(new Object[]{webView, whiteScreenInfo2}, oVar, mm.o.changeQuickRedirect, false, 29465, new Class[]{WebView.class, WhiteScreenInfo.class}, Void.TYPE).isSupported) { if (webView.isShown() && webView.getLocalVisibleRect(new Rect())) { z = true; } whiteScreenInfo2.setVisible(z); } whiteScreenInfo2.calcTotalTime(); } } @NotNull public final ExecutorService C() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 31658, new Class[0], ExecutorService.class); if (proxy.isSupported) { return (ExecutorService) proxy.result; } if (executor == null) { executor = new g(0, 1, 0, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(), "com.shizhuang.duapp.libs.duapm2.task.H5BlankTask", true); } return executor; } public final void D(@Nullable ExecutorService executorService) { if (!PatchProxy.proxy(new Object[]{executorService}, this, changeQuickRedirect, false, 31649, new Class[]{ExecutorService.class}, Void.TYPE).isSupported) { executor = executorService; } } public final void E(@Nullable OSSFederationCredentialProvider oSSFederationCredentialProvider) { if (!PatchProxy.proxy(new Object[]{oSSFederationCredentialProvider}, this, changeQuickRedirect, false, 31651, new Class[]{OSSFederationCredentialProvider.class}, Void.TYPE).isSupported) { ossProvider = oSSFederationCredentialProvider; } } public final void F(@NotNull WebView webView) { m mVar; WebViewClient webViewClient; Config config2; if (!PatchProxy.proxy(new Object[]{webView}, this, changeQuickRedirect, false, 31654, new Class[]{WebView.class}, Void.TYPE).isSupported && this.b != null && h()) { String str = null; if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 31659, new Class[0], Void.TYPE).isSupported && config == null) { try { TaskConfig b2 = com.shizhuang.duapp.libs.duapm2.e.a().b("h5blank_v2"); JSONObject extras = b2 != null ? b2.getExtras() : null; gn1.a.h("H5BlankMonitor").a("loadConfig ::: %s", extras); if (extras == null) { config2 = new Config(); } else { config2 = new Config().fromJson(extras); } } catch (Throwable unused) { config2 = new Config(); } config = config2; } Context context = webView.getContext(); if (!PatchProxy.proxy(new Object[]{context}, this, changeQuickRedirect, false, 31653, new Class[]{Context.class}, Void.TYPE).isSupported && applicationContext == null) { applicationContext = context.getApplicationContext(); mm.b.i().k(new p()); } currentWebView = new WeakReference<>(webView); PatchProxyResult proxy = PatchProxy.proxy(new Object[]{webView}, mm.o.f35712a, mm.o.changeQuickRedirect, false, 29459, new Class[]{WebView.class}, m.class); if (proxy.isSupported) { mVar = (m) proxy.result; } else if (Build.VERSION.SDK_INT >= 26 && (webViewClient = webView.getWebViewClient()) != null) { m mVar2 = new m(webViewClient); webView.setWebViewClient(mVar2); mVar = mVar2; } else { mVar = null; } if (mVar != null) { currentWebClient = new WeakReference<>(mVar); } a.b h12 = gn1.a.h("H5BlankMonitor"); Object[] objArr = new Object[1]; Config config3 = config; if (config3 == null) { Intrinsics.throwUninitializedPropertyAccessException("config"); } JSONArray snapTimes = config3.getSnapTimes(); if (snapTimes != null) { str = snapTimes.toString(); } objArr[0] = str; h12.a("snapTimes ::: %s", objArr); Config config4 = config; if (config4 == null) { Intrinsics.throwUninitializedPropertyAccessException("config"); } WhiteScreenInfo whiteScreenInfo2 = new WhiteScreenInfo(config4.getSnapTimes()); whiteScreenInfo2.recordFrontAndBackgroundTime(mm.b.j()); o oVar = f32739g; Config config5 = config; if (config5 == null) { Intrinsics.throwUninitializedPropertyAccessException("config"); } oVar.z(whiteScreenInfo2, whiteScreenInfo2.getNextSnapTime(config5)); whiteScreenInfo = whiteScreenInfo2; } } @Override // com.shizhuang.duapp.libs.duapm2.task.BaseTask @NotNull public String f() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 31665, new Class[0], String.class); return proxy.isSupported ? (String) proxy.result : "h5blank_v2"; } public final Bitmap x(WebView webView, WhiteScreenInfo whiteScreenInfo2) { Bitmap bitmap; PatchProxyResult proxy = PatchProxy.proxy(new Object[]{webView, whiteScreenInfo2}, this, changeQuickRedirect, false, 31660, new Class[]{WebView.class, WhiteScreenInfo.class}, Bitmap.class); if (proxy.isSupported) { return (Bitmap) proxy.result; } long currentTimeMillis = System.currentTimeMillis(); Object[] objArr = {webView}; PatchProxyResult proxy2 = PatchProxy.proxy(objArr, mm.o.f35712a, mm.o.changeQuickRedirect, false, 29462, new Class[]{WebView.class}, Bitmap.class); if (proxy2.isSupported) { bitmap = (Bitmap) proxy2.result; } else { Bitmap createBitmap = Bitmap.createBitmap(webView.getWidth(), webView.getHeight(), Bitmap.Config.ARGB_8888); webView.draw(new Canvas(createBitmap)); bitmap = createBitmap; } whiteScreenInfo2.setSnapImageSpeedTime(System.currentTimeMillis() - currentTimeMillis); return bitmap; } public final void y(WhiteScreenInfo whiteScreenInfo2) { if (!PatchProxy.proxy(new Object[]{whiteScreenInfo2}, this, changeQuickRedirect, false, 31657, new Class[]{WhiteScreenInfo.class}, Void.TYPE).isSupported && whiteScreenInfo2.hasNextSnapTime()) { long j = -1; while (j < 0) { Config config2 = config; if (config2 == null) { Intrinsics.throwUninitializedPropertyAccessException("config"); } long startTime = (whiteScreenInfo2.getStartTime() + whiteScreenInfo2.getNextSnapTime(config2)) - System.currentTimeMillis(); j = (startTime >= 0 || whiteScreenInfo2.hasNextSnapTime()) ? startTime : 0; if (j < 0) { whiteScreenInfo2.getSnapBitmaps().add(null); } } z(whiteScreenInfo2, j); } } public final void z(WhiteScreenInfo whiteScreenInfo2, long j) { if (!PatchProxy.proxy(new Object[]{whiteScreenInfo2, new Long(j)}, this, changeQuickRedirect, false, 31656, new Class[]{WhiteScreenInfo.class, Long.TYPE}, Void.TYPE).isSupported) { Message obtain = Message.obtain(); obtain.obj = whiteScreenInfo2; handler.sendMessageDelayed(obtain, j); } } }