package com.fyber.inneractive.sdk.click; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.text.TextUtils; import com.facebook.gamingservices.cloudgaming.internal.SDKConstants; import com.fyber.inneractive.sdk.click.l; import com.fyber.inneractive.sdk.util.IAlog; import com.google.android.gms.drive.DriveFile; import java.net.URISyntaxException; import java.util.ArrayList; /* loaded from: classes2.dex */ public final class g implements a { @Override // com.fyber.inneractive.sdk.click.a public final boolean a(Uri uri, l lVar) { return SDKConstants.PARAM_INTENT.equalsIgnoreCase(uri.getScheme()); } @Override // com.fyber.inneractive.sdk.click.a public final b a(Context context, Uri uri, ArrayList arrayList) { if (a(uri, null)) { try { Intent parseUri = Intent.parseUri(uri.toString(), 1); if (context != null && parseUri != null) { if (!(context instanceof Activity)) { parseUri.addFlags(DriveFile.MODE_READ_ONLY); } try { context.startActivity(parseUri); int i = IAlog.a; uri.toString(); if (arrayList != null) { arrayList.add(new i(uri.toString(), true, l.d.OPEN_IN_EXTERNAL_APPLICATION, null)); } return l.a(uri.toString(), l.d.OPEN_IN_EXTERNAL_APPLICATION, "IntentScheme"); } catch (ActivityNotFoundException unused) { } } String stringExtra = parseUri.getStringExtra("browser_fallback_url"); if (TextUtils.isEmpty(stringExtra)) { if (arrayList != null) { arrayList.add(new i(uri.toString(), false, l.d.OPEN_IN_EXTERNAL_APPLICATION, "tryToOpenExternalApp has failed (intent scheme)")); } return l.a(uri.toString(), "IntentScheme", "tryToOpenExternalApp has failed (intent scheme)"); } try { Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(stringExtra)); if (!(context instanceof Activity)) { intent.setFlags(DriveFile.MODE_READ_ONLY); } context.startActivity(intent); if (arrayList != null) { arrayList.add(new i(uri.toString(), false, l.d.DEEP_LINK, null)); arrayList.add(new i(stringExtra, true, l.d.OPEN_IN_EXTERNAL_APPLICATION, null)); } return l.a(uri.toString(), l.d.OPEN_IN_EXTERNAL_APPLICATION, "IntentScheme"); } catch (ActivityNotFoundException unused2) { } } catch (URISyntaxException e) { IAlog.a("failed parsing uri with error: %s", e.getLocalizedMessage()); if (arrayList != null) { arrayList.add(new i(uri.toString(), false, l.d.OPEN_IN_EXTERNAL_APPLICATION, null)); } return new b(uri.toString(), l.d.FAILED, "IntentScheme", e); } } return null; } }