package defpackage; import android.app.PendingIntent; import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.text.TextUtils; import org.chromium.chrome.stable.R; /* renamed from: FF reason: default package */ /* compiled from: chromium-ChromePublic.apk-stable-447210115 */ public class FF implements DF { public final PendingIntent a; public int b; public Bitmap c; public String d; public boolean e; public boolean f; public FF(int i, Bitmap bitmap, String str, PendingIntent pendingIntent, boolean z, boolean z2) { this.b = i; this.c = bitmap; this.d = str; this.a = pendingIntent; this.e = z; this.f = z2; } public static boolean a(Context context, Bitmap bitmap) { int dimensionPixelSize = context.getResources().getDimensionPixelSize(R.dimen.f27030_resource_name_obfuscated_RES_2131166304); if (bitmap.getHeight() >= dimensionPixelSize && (bitmap.getWidth() / bitmap.getHeight()) * dimensionPixelSize <= dimensionPixelSize * 2) { return true; } return false; } public static DF b(Context context, Bundle bundle, boolean z, boolean z2) { boolean z3; if (bundle == null) { return null; } if (z2 && !bundle.containsKey("android.support.customtabs.customaction.ID")) { return null; } int k = AbstractC0261Ea0.k(bundle, "android.support.customtabs.customaction.ID", 0); Bitmap d2 = d(bundle); if (d2 == null) { AbstractC5452vj0.a("CustomTabs", "Invalid action button: bitmap not present in bundle!", new Object[0]); return null; } String e2 = e(bundle); if (TextUtils.isEmpty(e2)) { AbstractC5452vj0.a("CustomTabs", "Invalid action button: content description not present in bundle!", new Object[0]); f(bundle); d2.recycle(); return null; } boolean z4 = k == 0 || AbstractC0261Ea0.g(bundle, "android.support.customtabs.customaction.SHOW_ON_TOOLBAR", false); if (!z4 || a(context, d2)) { z3 = z4; } else { AbstractC5452vj0.f("CustomTabs", "Button's icon not suitable for toolbar, putting it to bottom bar instead.See: https://developer.android.com/reference/android/support/customtabs/CustomTabsIntent.html#KEY_ICON", new Object[0]); z3 = false; } PendingIntent pendingIntent = (PendingIntent) AbstractC0261Ea0.o(bundle, "android.support.customtabs.customaction.PENDING_INTENT"); if (!z3 || pendingIntent != null) { return new FF(k, d2, e2, pendingIntent, z, z3); } AbstractC5452vj0.f("CustomTabs", "Invalid action button on toolbar: pending intent not present in bundle!", new Object[0]); f(bundle); d2.recycle(); return null; } public static Bitmap d(Bundle bundle) { Bitmap bitmap; if (bundle == null || (bitmap = (Bitmap) AbstractC0261Ea0.o(bundle, "android.support.customtabs.customaction.ICON")) == null) { return null; } return bitmap; } public static String e(Bundle bundle) { if (bundle == null) { return null; } String q = AbstractC0261Ea0.q(bundle, "android.support.customtabs.customaction.DESCRIPTION"); if (TextUtils.isEmpty(q)) { return null; } return q; } public static void f(Bundle bundle) { try { bundle.remove("android.support.customtabs.customaction.ICON"); } catch (Throwable unused) { AbstractC5452vj0.a("CustomTabs", "Failed to remove icon extra from the intent", new Object[0]); } } public Drawable c(Context context) { if (this.e) { return new C2872gs1(context, this.c); } return new BitmapDrawable(context.getResources(), this.c); } }