Wolves Themes v1.0版本的 MD5 值为:cddc92b47f6b7c4a195c9625507eb51c

以下内容为反编译后的 cf.java 源代码,内容仅作参考


package com.flurry.sdk;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.net.Uri;
import android.support.customtabs.CustomTabsCallback;
import android.support.customtabs.CustomTabsClient;
import android.support.customtabs.CustomTabsIntent;
import android.support.customtabs.CustomTabsService;
import android.support.customtabs.CustomTabsServiceConnection;
import android.support.customtabs.CustomTabsSession;
import android.support.v4.app.ActivityCompat;
import android.text.TextUtils;
import com.flurry.android.FlurryAdSettings;
import com.flurry.android.FlurryCustomTabsServiceConnection;
import com.flurry.android.FlurryCustomTabsSetting;
import java.util.ArrayList;
import java.util.List;
public final class cf implements cg {
    private static final String c = "cf";
    private static String d;
    private static Boolean e;
    public a a;
    public c b;
    private CustomTabsClient f;
    private CustomTabsSession g;
    private CustomTabsServiceConnection h;

    public interface a {
        void a();

        void b();
    }

    public interface b {
        void a();
    }

    public interface c {
    }

    public final void a(Activity activity, Uri uri, b bVar) {
        if (!a((Context) activity)) {
            bVar.a();
            return;
        }
        if (this.f == null) {
            this.g = null;
        } else if (this.g == null) {
            this.g = this.f.newSession(new CustomTabsCallback() {
            });
        }
        CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(this.g);
        FlurryCustomTabsSetting customTabsSetting = FlurryAdSettings.getInstance().getCustomTabsSetting();
        if (customTabsSetting != null) {
            Integer toolbarColor = customTabsSetting.getToolbarColor();
            if (toolbarColor != null) {
                builder.setToolbarColor(toolbarColor.intValue());
            }
            Boolean showTitle = customTabsSetting.showTitle();
            if (showTitle != null) {
                builder.setShowTitle(showTitle.booleanValue());
            }
            if (customTabsSetting.enableUrlBarHiding()) {
                builder.enableUrlBarHiding();
            }
            Bitmap closeButtonIcon = customTabsSetting.getCloseButtonIcon();
            if (closeButtonIcon != null) {
                builder.setCloseButtonIcon(closeButtonIcon);
            }
            Integer startAnimationEnterResId = customTabsSetting.getStartAnimationEnterResId();
            Integer startAnimationExitResId = customTabsSetting.getStartAnimationExitResId();
            if (startAnimationEnterResId != null && startAnimationExitResId != null) {
                builder.setStartAnimations(activity, startAnimationEnterResId.intValue(), startAnimationExitResId.intValue());
            }
            Integer exitAnimationEnterResId = customTabsSetting.getExitAnimationEnterResId();
            Integer exitAnimationExitResId = customTabsSetting.getExitAnimationExitResId();
            if (exitAnimationEnterResId != null && exitAnimationExitResId != null) {
                builder.setExitAnimations(activity, exitAnimationEnterResId.intValue(), exitAnimationExitResId.intValue());
            }
            builder.setShowTitle(true);
        }
        Intent intent = builder.build().intent;
        intent.setPackage(b((Context) activity));
        intent.setData(uri);
        try {
            ActivityCompat.startActivityForResult(activity, intent, 100, null);
        } catch (ActivityNotFoundException e2) {
            kx.a(c, "Error launching Custom Tabs activity", e2);
            bVar.a();
        }
    }

    public final void a(Activity activity) {
        if (this.f != null) {
            if (this.a != null) {
                this.a.a();
                return;
            }
            return;
        }
        Context applicationContext = activity.getApplicationContext();
        String b2 = b(applicationContext);
        if (b2 == null) {
            return;
        }
        this.h = new FlurryCustomTabsServiceConnection(this);
        CustomTabsClient.bindCustomTabsService(applicationContext, b2, this.h);
    }

    public final void b(Activity activity) {
        if (this.h == null) {
            return;
        }
        activity.getApplicationContext().unbindService(this.h);
        this.f = null;
        this.g = null;
        this.h = null;
    }

    @Override
    public final void a(CustomTabsClient customTabsClient) {
        this.f = customTabsClient;
        this.f.warmup(0L);
        if (this.a != null) {
            this.a.a();
        }
    }

    @Override
    public final void a() {
        this.f = null;
        this.g = null;
        if (this.a != null) {
            this.a.b();
        }
    }

    public static boolean a(Context context) {
        if (e != null) {
            return e.booleanValue();
        }
        boolean z = true;
        e = true;
        try {
            Class.forName("android.support.customtabs.CustomTabsClient");
        } catch (ClassNotFoundException unused) {
            kx.b(c, "Couldn't find Chrome Custom Tab dependency. For better user experience include Chrome Custom Tab dependency in gradle");
            e = false;
        }
        if (!e.booleanValue() || b(context) == null) {
            z = false;
        }
        Boolean valueOf = Boolean.valueOf(z);
        e = valueOf;
        return valueOf.booleanValue();
    }

    private static String b(Context context) {
        if (d != null) {
            return d;
        }
        PackageManager packageManager = context.getPackageManager();
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("http://www.example.com"));
        ResolveInfo resolveActivity = packageManager.resolveActivity(intent, 0);
        String str = resolveActivity != null ? resolveActivity.activityInfo.packageName : null;
        List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(intent, 0);
        ArrayList arrayList = new ArrayList();
        for (ResolveInfo resolveInfo : queryIntentActivities) {
            Intent intent2 = new Intent();
            intent2.setAction(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION);
            intent2.setPackage(resolveInfo.activityInfo.packageName);
            if (packageManager.resolveService(intent2, 0) != null) {
                arrayList.add(resolveInfo.activityInfo.packageName);
            }
        }
        if (arrayList.isEmpty()) {
            d = null;
        } else if (arrayList.size() == 1) {
            d = (String) arrayList.get(0);
        } else if (!TextUtils.isEmpty(str) && !a(context, intent) && arrayList.contains(str)) {
            d = str;
        } else if (arrayList.contains("com.android.chrome")) {
            d = "com.android.chrome";
        } else if (arrayList.contains("com.chrome.beta")) {
            d = "com.chrome.beta";
        } else if (arrayList.contains("com.chrome.dev")) {
            d = "com.chrome.dev";
        } else if (arrayList.contains("com.google.android.apps.chrome")) {
            d = "com.google.android.apps.chrome";
        }
        return d;
    }

    private static boolean a(Context context, Intent intent) {
        List<ResolveInfo> queryIntentActivities;
        try {
            queryIntentActivities = context.getPackageManager().queryIntentActivities(intent, 64);
        } catch (RuntimeException e2) {
            kx.a(c, "Error in getting a specialized handler", e2);
        }
        if (queryIntentActivities != null && queryIntentActivities.size() != 0) {
            for (ResolveInfo resolveInfo : queryIntentActivities) {
                IntentFilter intentFilter = resolveInfo.filter;
                if (intentFilter != null && intentFilter.countDataAuthorities() != 0 && intentFilter.countDataPaths() != 0 && resolveInfo.activityInfo != null) {
                    return true;
                }
            }
            return false;
        }
        return false;
    }
}