Kufar v3.2.0版本的 MD5 值为:6a4d203db1c561c7e3bcd50d23fed59f

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


package com.tapjoy;

import android.content.Context;
import android.content.SharedPreferences;

public class TapjoyGpsHelper {

    private Context f55902a;

    private String f55903b;

    private boolean f55904c;

    private int f55905d = 0;

    private int f55906e = 0;

    private boolean f55907f;

    private Boolean f55908g;

    private Boolean f55909h;

    private Boolean f55910i;

    public TapjoyGpsHelper(Context context) {
        this.f55902a = context;
    }

    public void checkGooglePlayIntegration() {
        if (isGooglePlayServicesAvailable()) {
            if (isGooglePlayManifestConfigured()) {
                return;
            } else {
                throw new TapjoyIntegrationException("Failed to load manifest.xml meta-data, 'com.google.android.gms.version' not found. For more information about including the Google Play services client library visit http://developer.android.com/google/play-services/setup.html or http://tech.tapjoy.com/product-overview/sdk-change-log/tapjoy-and-identifiers");
            }
        }
        throw new TapjoyIntegrationException("Tapjoy SDK is disabled because Google Play Services was not found. For more information about including the Google Play services client library visit http://developer.android.com/google/play-services/setup.html or http://tech.tapjoy.com/product-overview/sdk-change-log/tapjoy-and-identifiers");
    }

    public String getAdvertisingId() {
        return this.f55903b;
    }

    public int getDeviceGooglePlayServicesVersion() {
        return this.f55905d;
    }

    public int getPackagedGooglePlayServicesVersion() {
        return this.f55906e;
    }

    public boolean isAdIdAvailable() {
        return this.f55907f;
    }

    public boolean isAdTrackingEnabled() {
        return this.f55904c;
    }

    public boolean isAdvertisingIdAllowed() {
        SharedPreferences sharedPreferences = this.f55902a.getSharedPreferences(TapjoyConstants.TJC_PREFERENCE, 0);
        if (!sharedPreferences.contains(TapjoyConstants.PREF_OPTOUT_ADVERTISING_ID)) {
            return true;
        }
        Boolean valueOf = Boolean.valueOf(sharedPreferences.getBoolean(TapjoyConstants.PREF_OPTOUT_ADVERTISING_ID, false));
        this.f55910i = valueOf;
        if (valueOf.booleanValue()) {
            return false;
        }
        return true;
    }

    public boolean isGooglePlayManifestConfigured() {
        if (this.f55909h == null) {
            try {
                this.f55906e = this.f55902a.getPackageManager().getApplicationInfo(this.f55902a.getPackageName(), 128).metaData.getInt("com.google.android.gms.version");
                this.f55909h = Boolean.TRUE;
            } catch (Exception unused) {
                this.f55909h = Boolean.FALSE;
            }
        }
        return this.f55909h.booleanValue();
    }

    public boolean isGooglePlayServicesAvailable() {
        if (this.f55908g == null) {
            try {
                this.f55902a.getClassLoader().loadClass("com.google.android.gms.ads.identifier.AdvertisingIdClient");
                this.f55908g = Boolean.TRUE;
            } catch (Error unused) {
                this.f55908g = Boolean.FALSE;
            } catch (Exception unused2) {
                this.f55908g = Boolean.FALSE;
            }
        }
        return this.f55908g.booleanValue();
    }

    public void loadAdvertisingId(boolean z11) {
        TapjoyLog.i("TapjoyGpsHelper", "Looking for Google Play Services...");
        if (isGooglePlayServicesAvailable() && isGooglePlayManifestConfigured()) {
            TapjoyLog.i("TapjoyGpsHelper", "Packaged Google Play Services found, fetching advertisingID...");
            TapjoyLog.i("TapjoyGpsHelper", "Packaged Google Play Services version: " + this.f55906e);
            TapjoyAdIdClient tapjoyAdIdClient = new TapjoyAdIdClient(this.f55902a);
            if (isAdvertisingIdAllowed()) {
                this.f55907f = tapjoyAdIdClient.setupAdIdInfo();
            } else {
                this.f55907f = false;
            }
            try {
                this.f55905d = this.f55902a.getPackageManager().getPackageInfo("com.google.android.gms", 0).versionCode;
                TapjoyLog.i("TapjoyGpsHelper", "Device's Google Play Services version: " + this.f55905d);
            } catch (Exception unused) {
                TapjoyLog.i("TapjoyGpsHelper", "Error getting device's Google Play Services version");
            }
            if (this.f55907f) {
                this.f55904c = tapjoyAdIdClient.isAdTrackingEnabled();
                this.f55903b = tapjoyAdIdClient.getAdvertisingId();
                TapjoyLog.i("TapjoyGpsHelper", "Found advertising ID: " + this.f55903b);
                TapjoyLog.i("TapjoyGpsHelper", "Is ad tracking enabled: " + Boolean.toString(this.f55904c));
                return;
            }
            TapjoyLog.i("TapjoyGpsHelper", "Error getting advertisingID from Google Play Services");
            if (z11) {
                this.f55904c = false;
                if (isAdvertisingIdAllowed()) {
                    this.f55903b = "00000000-0000-0000-0000-000000000000";
                    this.f55907f = true;
                    return;
                } else {
                    resetAdvertisingID();
                    this.f55907f = false;
                    return;
                }
            }
            return;
        }
        TapjoyLog.i("TapjoyGpsHelper", "Google Play Services not found");
    }

    public void resetAdvertisingID() {
        this.f55903b = "";
    }
}