package com.facebook.internal;

import android.content.Context;
import android.content.SharedPreferences;
import com.tencent.matrix.trace.core.AppMethodBeat;
import org.json.JSONException;
import org.json.JSONObject;

class FetchedAppGateKeepersManager$1 implements Runnable {
    final /* synthetic */ String val$applicationId;
    final /* synthetic */ Context val$context;
    final /* synthetic */ String val$gateKeepersKey;

    FetchedAppGateKeepersManager$1(Context context, String str, String str2) {
        this.val$context = context;
        this.val$gateKeepersKey = str;
        this.val$applicationId = str2;
    }

    public final void run() {
        JSONObject jSONObject;
        AppMethodBeat.i(72293);
        SharedPreferences sharedPreferences = this.val$context.getSharedPreferences("com.facebook.internal.preferences.APP_GATEKEEPERS", 0);
        String string = sharedPreferences.getString(this.val$gateKeepersKey, null);
        if (!Utility.isNullOrEmpty(string)) {
            try {
                jSONObject = new JSONObject(string);
            } catch (JSONException e) {
                Utility.logd("FacebookSDK", e);
                jSONObject = null;
            }
            if (jSONObject != null) {
                FetchedAppGateKeepersManager.access$000(this.val$applicationId, jSONObject);
            }
        }
        jSONObject = FetchedAppGateKeepersManager.access$100(this.val$applicationId);
        if (jSONObject != null) {
            FetchedAppGateKeepersManager.access$000(this.val$applicationId, jSONObject);
            sharedPreferences.edit().putString(this.val$gateKeepersKey, jSONObject.toString()).apply();
        }
        AppMethodBeat.o(72293);
    }
}
