Picsart v24.6版本的 MD5 值为:21a61631d94e54da68d2ad9268b8b9d9

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


package myobfuscated.oj;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import com.facebook.FacebookSdkNotInitializedException;
import com.facebook.GraphRequest;
import com.facebook.internal.AttributionIdentifiers;
import com.facebook.internal.FetchedAppSettingsManager;
import com.facebook.internal.l0;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.Intrinsics;
import myobfuscated.oj.y;
import org.jetbrains.annotations.NotNull;
import org.json.JSONException;
import org.json.JSONObject;
public final class y {
    @NotNull
    public static final y a = new y();
    public static final String b = y.class.getName();
    @NotNull
    public static final AtomicBoolean c = new AtomicBoolean(false);
    @NotNull
    public static final AtomicBoolean d = new AtomicBoolean(false);
    @NotNull
    public static final a e = new a(true, "com.facebook.sdk.AutoInitEnabled");
    @NotNull
    public static final a f = new a(true, "com.facebook.sdk.AutoLogAppEventsEnabled");
    @NotNull
    public static final a g = new a(true, "com.facebook.sdk.AdvertiserIDCollectionEnabled");
    @NotNull
    public static final a h = new a(false, "auto_event_setup_enabled");
    @NotNull
    public static final a i = new a(true, "com.facebook.sdk.MonitorEnabled");
    public static SharedPreferences j;

    public static final class a {
        public final boolean a;
        @NotNull
        public final String b;
        public Boolean c;
        public long d;

        public a(boolean z, @NotNull String key) {
            Intrinsics.checkNotNullParameter(key, "key");
            this.a = z;
            this.b = key;
        }

        public final boolean a() {
            Boolean bool = this.c;
            return bool == null ? this.a : bool.booleanValue();
        }
    }

    public static final boolean a() {
        a.getClass();
        c();
        return f.a();
    }

    public static void b() {
        a aVar = h;
        e(aVar);
        final long currentTimeMillis = System.currentTimeMillis();
        if (aVar.c == null || currentTimeMillis - aVar.d >= 604800000) {
            aVar.c = null;
            aVar.d = 0L;
            if (d.compareAndSet(false, true)) {
                j.c().execute(new Runnable() {
                    @Override
                    public final void run() {
                        if (y.g.a()) {
                            FetchedAppSettingsManager fetchedAppSettingsManager = FetchedAppSettingsManager.a;
                            com.facebook.internal.s f2 = FetchedAppSettingsManager.f(j.b(), false);
                            if (f2 != null && f2.h) {
                                AttributionIdentifiers a2 = AttributionIdentifiers.a.a(j.a());
                                String a3 = (a2 == null || a2.a() == null) ? null : a2.a();
                                if (a3 != null) {
                                    Bundle bundle = new Bundle();
                                    bundle.putString("advertiser_id", a3);
                                    bundle.putString("fields", "auto_event_setup_enabled");
                                    String str = GraphRequest.j;
                                    GraphRequest g2 = GraphRequest.c.g(null, "app", null);
                                    Intrinsics.checkNotNullParameter(bundle, "<set-?>");
                                    g2.d = bundle;
                                    JSONObject jSONObject = g2.c().b;
                                    if (jSONObject != null) {
                                        Boolean valueOf = Boolean.valueOf(jSONObject.optBoolean("auto_event_setup_enabled", false));
                                        y.a aVar2 = y.h;
                                        aVar2.c = valueOf;
                                        aVar2.d = currentTimeMillis;
                                        y.a.getClass();
                                        y.f(aVar2);
                                    }
                                }
                            }
                        }
                        y.d.set(false);
                    }
                });
            }
        }
    }

    public static void c() {
        if (!j.r.get()) {
            return;
        }
        AtomicBoolean atomicBoolean = c;
        int i2 = 0;
        if (!atomicBoolean.compareAndSet(false, true)) {
            return;
        }
        SharedPreferences sharedPreferences = j.a().getSharedPreferences("com.facebook.sdk.USER_SETTINGS", 0);
        Intrinsics.checkNotNullExpressionValue(sharedPreferences, "FacebookSdk.getApplicationContext()\n            .getSharedPreferences(USER_SETTINGS, Context.MODE_PRIVATE)");
        j = sharedPreferences;
        a aVar = g;
        a[] aVarArr = {f, aVar, e};
        while (true) {
            String str = b;
            if (i2 >= 3) {
                b();
                try {
                    Context a2 = j.a();
                    ApplicationInfo applicationInfo = a2.getPackageManager().getApplicationInfo(a2.getPackageName(), 128);
                    Intrinsics.checkNotNullExpressionValue(applicationInfo, "ctx.packageManager.getApplicationInfo(ctx.packageName, PackageManager.GET_META_DATA)");
                    Bundle bundle = applicationInfo.metaData;
                    if (bundle != null) {
                        if (!bundle.containsKey("com.facebook.sdk.AutoLogAppEventsEnabled")) {
                            Log.w(str, "Please set a value for AutoLogAppEventsEnabled. Set the flag to TRUE if you want to collect app install, app launch and in-app purchase events automatically. To request user consent before collecting data, set the flag value to FALSE, then change to TRUE once user consent is received. Learn more: https://developers.facebook.com/docs/app-events/getting-started-app-events-android#disable-auto-events.");
                        }
                        if (!applicationInfo.metaData.containsKey("com.facebook.sdk.AdvertiserIDCollectionEnabled")) {
                            Log.w(str, "You haven't set a value for AdvertiserIDCollectionEnabled. Set the flag to TRUE if you want to collect Advertiser ID for better advertising and analytics results. To request user consent before collecting data, set the flag value to FALSE, then change to TRUE once user consent is received. Learn more: https://developers.facebook.com/docs/app-events/getting-started-app-events-android#disable-auto-events.");
                        }
                        a.getClass();
                        c();
                        if (!aVar.a()) {
                            Log.w(str, "The value for AdvertiserIDCollectionEnabled is currently set to FALSE so you're sending app events without collecting Advertiser ID. This can affect the quality of your advertising and analytics results.");
                        }
                    }
                } catch (PackageManager.NameNotFoundException unused) {
                }
                d();
                return;
            }
            a aVar2 = aVarArr[i2];
            i2++;
            if (aVar2 == h) {
                b();
            } else {
                Boolean bool = aVar2.c;
                String str2 = aVar2.b;
                if (bool == null) {
                    e(aVar2);
                    if (aVar2.c != null) {
                        continue;
                    } else if (!atomicBoolean.get()) {
                        throw new FacebookSdkNotInitializedException("The UserSettingManager has not been initialized successfully");
                    } else {
                        try {
                            Context a3 = j.a();
                            ApplicationInfo applicationInfo2 = a3.getPackageManager().getApplicationInfo(a3.getPackageName(), 128);
                            Intrinsics.checkNotNullExpressionValue(applicationInfo2, "ctx.packageManager.getApplicationInfo(ctx.packageName, PackageManager.GET_META_DATA)");
                            Bundle bundle2 = applicationInfo2.metaData;
                            if (bundle2 != null && bundle2.containsKey(str2)) {
                                aVar2.c = Boolean.valueOf(applicationInfo2.metaData.getBoolean(str2, aVar2.a));
                            }
                        } catch (PackageManager.NameNotFoundException e2) {
                            l0.C(str, e2);
                        }
                    }
                } else {
                    f(aVar2);
                }
            }
        }
    }

    public static void d() {
        int i2;
        int i3;
        Bundle parameters;
        ApplicationInfo applicationInfo;
        if (c.get() && j.r.get()) {
            Context a2 = j.a();
            int a3 = e.a() | ((f.a() ? 1 : 0) << 1) | ((g.a() ? 1 : 0) << 2) | ((i.a() ? 1 : 0) << 3);
            SharedPreferences sharedPreferences = j;
            if (sharedPreferences == null) {
                Intrinsics.n("userSettingPref");
                throw null;
            }
            int i4 = 0;
            int i5 = sharedPreferences.getInt("com.facebook.sdk.USER_SETTINGS_BITMASK", 0);
            if (i5 != a3) {
                SharedPreferences sharedPreferences2 = j;
                if (sharedPreferences2 == null) {
                    Intrinsics.n("userSettingPref");
                    throw null;
                }
                sharedPreferences2.edit().putInt("com.facebook.sdk.USER_SETTINGS_BITMASK", a3).apply();
                try {
                    applicationInfo = a2.getPackageManager().getApplicationInfo(a2.getPackageName(), 128);
                    Intrinsics.checkNotNullExpressionValue(applicationInfo, "ctx.packageManager.getApplicationInfo(ctx.packageName, PackageManager.GET_META_DATA)");
                } catch (PackageManager.NameNotFoundException unused) {
                    i2 = 0;
                }
                if (applicationInfo.metaData == null) {
                    i3 = 0;
                    com.facebook.appevents.n loggerImpl = new com.facebook.appevents.n(a2, (String) null);
                    Intrinsics.checkNotNullParameter(loggerImpl, "loggerImpl");
                    parameters = new Bundle();
                    parameters.putInt("usage", i4);
                    parameters.putInt("initial", i3);
                    parameters.putInt("previous", i5);
                    parameters.putInt("current", a3);
                    Intrinsics.checkNotNullParameter(parameters, "parameters");
                    if ((parameters.getInt("previous") & 2) == 0) {
                    }
                    loggerImpl.c("fb_sdk_settings_changed", parameters);
                }
                String[] strArr = {"com.facebook.sdk.AutoInitEnabled", "com.facebook.sdk.AutoLogAppEventsEnabled", "com.facebook.sdk.AdvertiserIDCollectionEnabled", "com.facebook.sdk.MonitorEnabled"};
                boolean[] zArr = {true, true, true, true};
                i2 = 0;
                i3 = 0;
                while (true) {
                    int i6 = i4 + 1;
                    try {
                        i2 |= (applicationInfo.metaData.containsKey(strArr[i4]) ? 1 : 0) << i4;
                        i3 |= (applicationInfo.metaData.getBoolean(strArr[i4], zArr[i4]) ? 1 : 0) << i4;
                        if (i6 > 3) {
                            break;
                        }
                        i4 = i6;
                    } catch (PackageManager.NameNotFoundException unused2) {
                        i4 = i3;
                        i3 = i4;
                        i4 = i2;
                        com.facebook.appevents.n loggerImpl2 = new com.facebook.appevents.n(a2, (String) null);
                        Intrinsics.checkNotNullParameter(loggerImpl2, "loggerImpl");
                        parameters = new Bundle();
                        parameters.putInt("usage", i4);
                        parameters.putInt("initial", i3);
                        parameters.putInt("previous", i5);
                        parameters.putInt("current", a3);
                        Intrinsics.checkNotNullParameter(parameters, "parameters");
                        if ((parameters.getInt("previous") & 2) == 0) {
                        }
                        loggerImpl2.c("fb_sdk_settings_changed", parameters);
                    }
                }
                i4 = i2;
                com.facebook.appevents.n loggerImpl22 = new com.facebook.appevents.n(a2, (String) null);
                Intrinsics.checkNotNullParameter(loggerImpl22, "loggerImpl");
                parameters = new Bundle();
                parameters.putInt("usage", i4);
                parameters.putInt("initial", i3);
                parameters.putInt("previous", i5);
                parameters.putInt("current", a3);
                Intrinsics.checkNotNullParameter(parameters, "parameters");
                if ((parameters.getInt("previous") & 2) == 0) {
                    j jVar = j.a;
                    if (!a()) {
                        return;
                    }
                }
                loggerImpl22.c("fb_sdk_settings_changed", parameters);
            }
        }
    }

    public static void e(a aVar) {
        String str = "";
        if (!c.get()) {
            throw new FacebookSdkNotInitializedException("The UserSettingManager has not been initialized successfully");
        }
        try {
            SharedPreferences sharedPreferences = j;
            if (sharedPreferences == null) {
                Intrinsics.n("userSettingPref");
                throw null;
            }
            String string = sharedPreferences.getString(aVar.b, "");
            if (string != null) {
                str = string;
            }
            if (str.length() > 0) {
                JSONObject jSONObject = new JSONObject(str);
                aVar.c = Boolean.valueOf(jSONObject.getBoolean("value"));
                aVar.d = jSONObject.getLong("last_timestamp");
            }
        } catch (JSONException e2) {
            l0.C(b, e2);
        }
    }

    public static void f(a aVar) {
        if (!c.get()) {
            throw new FacebookSdkNotInitializedException("The UserSettingManager has not been initialized successfully");
        }
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("value", aVar.c);
            jSONObject.put("last_timestamp", aVar.d);
            SharedPreferences sharedPreferences = j;
            if (sharedPreferences == null) {
                Intrinsics.n("userSettingPref");
                throw null;
            }
            sharedPreferences.edit().putString(aVar.b, jSONObject.toString()).apply();
            d();
        } catch (Exception e2) {
            l0.C(b, e2);
        }
    }
}