package o; import android.content.Context; import android.graphics.Bitmap; import android.net.Uri; import android.util.DisplayMetrics; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.LinearLayout; import java.util.concurrent.Callable; import o.C0366Fa; /* renamed from: o.fKU, reason: case insensitive filesystem */ /* loaded from: classes5.dex */ public abstract class AbstractC12886fKU { public C6204cLu d; public abstract View aAq_(ViewGroup viewGroup, T t, Context context); public abstract void b(C6204cLu c6204cLu); public final AbstractC13163fSk c(final T t, final Context context) { C14957gcv.e(t, ""); C14957gcv.e(context, ""); AbstractC13163fSk subscribeOn = AbstractC13163fSk.fromCallable(new Callable(this, t, context) { // from class: o.fKW private Context a; private C0366Fa b; private AbstractC12886fKU c; @Override // java.util.concurrent.Callable public final Object call() { return AbstractC12886fKU.aAp_(this.c, this.b, this.a); } { this.c = this; this.b = t; this.a = context; } }).observeOn(fRR.e()).subscribeOn(C13417fZt.b()); C14957gcv.c(subscribeOn, ""); return subscribeOn; } /* renamed from: o.fKU$Sts */ /* loaded from: classes5.dex */ public static final class Sts { private Sts() { } public /* synthetic */ Sts(byte b) { this(); } } /* JADX INFO: Access modifiers changed from: package-private */ public static final Uri aAp_(AbstractC12886fKU abstractC12886fKU, C0366Fa c0366Fa, Context context) { Throwable th; Bitmap bitmap; Uri VN_; C14957gcv.e(abstractC12886fKU, ""); C14957gcv.e(c0366Fa, ""); C14957gcv.e(context, ""); try { LinearLayout linearLayout = new LinearLayout(context); linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -1)); View aAq_ = abstractC12886fKU.aAq_(linearLayout, c0366Fa, context); DisplayMetrics displayMetrics = new DisplayMetrics(); Object systemService = context.getSystemService("window"); C14957gcv.d(systemService, ""); ((WindowManager) systemService).getDefaultDisplay().getMetrics(displayMetrics); int i = displayMetrics.widthPixels; int i2 = aAq_.getLayoutParams().height; C6204cLu c6204cLu = abstractC12886fKU.d; if (c6204cLu != null) { abstractC12886fKU.b(c6204cLu); } bitmap = C12946fLx.aAB_(aAq_, i, i2); C14957gcv.c(bitmap, ""); try { if (c0366Fa.c) { StringBuilder sb = new StringBuilder(c0366Fa.a); boolean z = c0366Fa.d; String obj = sb.toString(); C14957gcv.c((Object) obj, ""); StringBuilder sb2 = new StringBuilder(); sb2.append(obj); sb2.append(".jpg"); VN_ = C6582cXO.VO_(bitmap, context, sb2.toString()); C14957gcv.c(VN_, ""); } else { StringBuilder sb3 = new StringBuilder(c0366Fa.a); boolean z2 = c0366Fa.d; String obj2 = sb3.toString(); C14957gcv.c((Object) obj2, ""); StringBuilder sb4 = new StringBuilder(); sb4.append(obj2); sb4.append(".jpg"); VN_ = C6582cXO.VN_(bitmap, sb4.toString(), context); C14957gcv.c(VN_, ""); } if (bitmap != null) { bitmap.recycle(); } return VN_; } catch (Throwable th2) { th = th2; if (bitmap != null) { bitmap.recycle(); } throw th; } } catch (Throwable th3) { th = th3; bitmap = null; } } static { new Sts((byte) 0); } }