翰林优商.apk(点击下载) / OADIDSDKHelper25.java


package com.kwad.sdk.oaid;

import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import com.bun.miitmdid.core.MdidSdkHelper;
import com.bun.miitmdid.interfaces.IIdentifierListener;
import com.bun.miitmdid.interfaces.IdSupplier;

public class OADIDSDKHelper25 {
    private static final String SUB_TAG = "OADIDSDKHelper25:";
    private static final String TAG = "KSAdSDK";
    private static boolean mIsRequestIng = false;
    private static boolean sGetOaidFail = false;

    /* access modifiers changed from: package-private */
    public static class IIdentifierListener25 implements IIdentifierListener {
        private final a mOaidListener;
        private final long mStartTime;

        public IIdentifierListener25(long j, a aVar) {
            this.mStartTime = j;
            this.mOaidListener = aVar;
        }

        @Override // com.bun.miitmdid.interfaces.IIdentifierListener
        public void OnSupport(boolean z, IdSupplier idSupplier) {
            long currentTimeMillis = System.currentTimeMillis() - this.mStartTime;
            if (idSupplier != null) {
                String oaid = idSupplier.getOAID();
                if (!TextUtils.isEmpty(oaid)) {
                    Log.d(OADIDSDKHelper25.TAG, "OADIDSDKHelper25:oaid time=" + currentTimeMillis + "--OAID:" + oaid);
                    this.mOaidListener.dE(oaid);
                } else {
                    boolean unused = OADIDSDKHelper25.sGetOaidFail = true;
                }
            }
            boolean unused2 = OADIDSDKHelper25.mIsRequestIng = false;
        }
    }

    public interface a {
        void dE(String str);
    }

    public static void getOAId(Context context, a aVar) {
        if (context != null && !sGetOaidFail) {
            if (!isSupport()) {
                sGetOaidFail = true;
            } else if (!mIsRequestIng) {
                mIsRequestIng = true;
                try {
                    long currentTimeMillis = System.currentTimeMillis();
                    int InitSdk = MdidSdkHelper.InitSdk(context.getApplicationContext(), true, new IIdentifierListener25(currentTimeMillis, aVar));
                    Log.d(TAG, "OADIDSDKHelper25:sdk init time=" + (System.currentTimeMillis() - currentTimeMillis) + "--result=" + InitSdk);
                } catch (Throwable unused) {
                    Log.d(TAG, "OADIDSDKHelper25:oaid sdk not find ");
                    mIsRequestIng = false;
                    sGetOaidFail = true;
                }
            }
        }
    }

    public static boolean isSupport() {
        String str;
        if (Build.VERSION.SDK_INT < 21) {
            return false;
        }
        try {
            new IIdentifierListener() {
                /* class com.kwad.sdk.oaid.OADIDSDKHelper25.AnonymousClass1 */

                @Override // com.bun.miitmdid.interfaces.IIdentifierListener
                public final void OnSupport(boolean z, IdSupplier idSupplier) {
                }
            }.OnSupport(true, null);
            try {
                Class.forName("com.bun.miitmdid.core.MdidSdkHelper", false, OADIDSDKHelper25.class.getClassLoader());
                return true;
            } catch (Throwable unused) {
                str = "OADIDSDKHelper25:com.bun.miitmdid.core.MdidSdkHelper oaid sdk not find ";
                Log.d(TAG, str);
                return false;
            }
        } catch (Throwable unused2) {
            str = "OADIDSDKHelper25:isSupport oaid sdk not find ";
            Log.d(TAG, str);
            return false;
        }
    }
}