OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

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


package com.github.shadowsocks.preference;

import android.os.Binder;
import androidx.preference.PreferenceDataStore;
import com.github.shadowsocks.Core;
import com.github.shadowsocks.database.PrivateDatabase;
import com.github.shadowsocks.database.PublicDatabase;
import com.github.shadowsocks.net.TcpFastOpen;
import com.github.shadowsocks.utils.DirectBoot;
import com.github.shadowsocks.utils.h;
import com.umeng.analytics.pro.o;
import java.net.InetSocketAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.g;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Lambda;
import kotlin.jvm.internal.k;
import kotlin.jvm.internal.r;
import kotlin.jvm.internal.t;
import kotlin.reflect.KProperty;
import org.apache.http.client.config.CookieSpecs;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Metadata(bv = {1, 0, 3}, d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\f\n\u0002\u0010\t\n\u0002\b\t\n\u0002\u0010\u000e\n\u0002\b\n\n\u0002\u0010\b\n\u0002\b\f\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u001b\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0018\u0010T\u001a\u00020&2\u0006\u0010U\u001a\u00020\u001b2\u0006\u0010V\u001a\u00020&H\u0002J\u0006\u0010W\u001a\u00020XJ\u001a\u0010Y\u001a\u00020X2\u0006\u0010Z\u001a\u00020[2\b\u0010U\u001a\u0004\u0018\u00010\u001bH\u0016R$\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u00048F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b\u0006\u0010\u0007\"\u0004\b\b\u0010\tR\u0011\u0010\n\u001a\u00020\u00048F¢\u0006\u0006\u001a\u0004\b\u000b\u0010\u0007R\u0011\u0010\f\u001a\u00020\u00048F¢\u0006\u0006\u001a\u0004\b\r\u0010\u0007R$\u0010\u000e\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u00048F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b\u000f\u0010\u0007\"\u0004\b\u0010\u0010\tR(\u0010\u0012\u001a\u0004\u0018\u00010\u00112\b\u0010\u0003\u001a\u0004\u0018\u00010\u00118F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b\u0013\u0010\u0014\"\u0004\b\u0015\u0010\u0016R\u001b\u0010\u0017\u001a\u00020\u00048FX\u0086\u0084\u0002¢\u0006\f\n\u0004\b\u0019\u0010\u001a\u001a\u0004\b\u0018\u0010\u0007R$\u0010\u001c\u001a\u00020\u001b2\u0006\u0010\u0003\u001a\u00020\u001b8F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b\u001d\u0010\u001e\"\u0004\b\u001f\u0010 R\u0011\u0010!\u001a\u00020\u001b8F¢\u0006\u0006\u001a\u0004\b\"\u0010\u001eR$\u0010#\u001a\u00020\u001b2\u0006\u0010\u0003\u001a\u00020\u001b8F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b$\u0010\u001e\"\u0004\b%\u0010 R$\u0010'\u001a\u00020&2\u0006\u0010\u0003\u001a\u00020&8F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b(\u0010)\"\u0004\b*\u0010+R$\u0010,\u001a\u00020&2\u0006\u0010\u0003\u001a\u00020&8F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b-\u0010)\"\u0004\b.\u0010+R$\u0010/\u001a\u00020&2\u0006\u0010\u0003\u001a\u00020&8F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b0\u0010)\"\u0004\b1\u0010+R\u0011\u00102\u001a\u000203¢\u0006\b\n\u0000\u001a\u0004\b4\u00105R$\u00106\u001a\u00020\u00112\u0006\u0010\u0003\u001a\u00020\u00118F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b7\u00108\"\u0004\b9\u0010:R\u0011\u0010;\u001a\u00020<8F¢\u0006\u0006\u001a\u0004\b=\u0010>R$\u0010?\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u00048F@FX\u0086\u000e¢\u0006\f\u001a\u0004\b@\u0010\u0007\"\u0004\bA\u0010\tR\u0011\u0010B\u001a\u000203¢\u0006\b\n\u0000\u001a\u0004\bC\u00105R$\u0010D\u001a\u00020\u001b2\u0006\u0010\u0003\u001a\u00020\u001b8F@FX\u0086\u000e¢\u0006\f\u001a\u0004\bE\u0010\u001e\"\u0004\bF\u0010 R\u0011\u0010G\u001a\u00020\u001b8F¢\u0006\u0006\u001a\u0004\bH\u0010\u001eR$\u0010I\u001a\u00020\u001b2\u0006\u0010\u0003\u001a\u00020\u001b8F@FX\u0086\u000e¢\u0006\f\u001a\u0004\bJ\u0010\u001e\"\u0004\bK\u0010 R\u0011\u0010L\u001a\u00020\u00048F¢\u0006\u0006\u001a\u0004\bM\u0010\u0007R(\u0010N\u001a\u0004\u0018\u00010\u00112\b\u0010\u0003\u001a\u0004\u0018\u00010\u00118F@FX\u0086\u000e¢\u0006\f\u001a\u0004\bO\u0010\u0014\"\u0004\bP\u0010\u0016R\u001b\u0010Q\u001a\u00020&8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bS\u0010\u001a\u001a\u0004\bR\u0010)¨\u0006\\"}, d2 = {"Lcom/github/shadowsocks/preference/DataStore;", "Lcom/github/shadowsocks/preference/OnPreferenceDataStoreChangeListener;", "()V", "value", "", "bypass", "getBypass", "()Z", "setBypass", "(Z)V", "canToggleLocked", "getCanToggleLocked", "directBootAware", "getDirectBootAware", "dirty", "getDirty", "setDirty", "", "editingId", "getEditingId", "()Ljava/lang/Long;", "setEditingId", "(Ljava/lang/Long;)V", "hasArc0", "getHasArc0", "hasArc0$delegate", "Lkotlin/Lazy;", "", "individual", "getIndividual", "()Ljava/lang/String;", "setIndividual", "(Ljava/lang/String;)V", "listenAddress", "getListenAddress", "plugin", "getPlugin", "setPlugin", "", "portLocalDns", "getPortLocalDns", "()I", "setPortLocalDns", "(I)V", "portProxy", "getPortProxy", "setPortProxy", "portTransproxy", "getPortTransproxy", "setPortTransproxy", "privateStore", "Lcom/github/shadowsocks/preference/RoomPreferenceDataStore;", "getPrivateStore", "()Lcom/github/shadowsocks/preference/RoomPreferenceDataStore;", "profileId", "getProfileId", "()J", "setProfileId", "(J)V", "proxyAddress", "Ljava/net/InetSocketAddress;", "getProxyAddress", "()Ljava/net/InetSocketAddress;", "proxyApps", "getProxyApps", "setProxyApps", "publicStore", "getPublicStore", "rid", "getRid", "setRid", "serviceMode", "getServiceMode", "targetPkg", "getTargetPkg", "setTargetPkg", "tcpFastOpen", "getTcpFastOpen", "udpFallback", "getUdpFallback", "setUdpFallback", "userIndex", "getUserIndex", "userIndex$delegate", "getLocalPort", "key", CookieSpecs.DEFAULT, "initGlobal", "", "onPreferenceDataStoreChanged", "store", "Landroidx/preference/PreferenceDataStore;", "core_release"}, k = 1, mv = {1, 1, 13})
public final class DataStore implements OnPreferenceDataStoreChangeListener {

    static final KProperty[] f16083a = {t.a(new r(t.a(DataStore.class), "userIndex", "getUserIndex()I")), t.a(new r(t.a(DataStore.class), "hasArc0", "getHasArc0()Z"))};

    public static final DataStore f16084b;

    @NotNull
    private static final RoomPreferenceDataStore c;

    @NotNull
    private static final RoomPreferenceDataStore d;
    private static final Lazy e;

    @NotNull
    private static final Lazy f;

    private final int w() {
        Lazy lazy = e;
        KProperty kProperty = f16083a[0];
        return ((Number) lazy.a()).intValue();
    }

    public final boolean h() {
        Lazy lazy = f;
        KProperty kProperty = f16083a[1];
        return ((Boolean) lazy.a()).booleanValue();
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u000b\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "invoke"}, k = 3, mv = {1, 1, 13})
    static final class a extends Lambda implements Function0<Boolean> {

        public static final a f16085a = new a();

        a() {
            super(0);
        }

        @Override
        public Boolean invoke() {
            return Boolean.valueOf(a());
        }

        public final boolean a() {
            int i = 0;
            while (i < 5) {
                try {
                    return NetworkInterface.getByName("arc0") != null;
                } catch (SocketException unused) {
                    i++;
                    Thread.sleep(100 << i);
                }
            }
            return false;
        }
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\b\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "invoke"}, k = 3, mv = {1, 1, 13})
    static final class b extends Lambda implements Function0<Integer> {

        public static final b f16086a = new b();

        b() {
            super(0);
        }

        @Override
        public Integer invoke() {
            return Integer.valueOf(a());
        }

        public final int a() {
            return Binder.getCallingUserHandle().hashCode();
        }
    }

    static {
        DataStore dataStore = new DataStore();
        f16084b = dataStore;
        c = new RoomPreferenceDataStore(PublicDatabase.f15918a.a());
        d = new RoomPreferenceDataStore(PrivateDatabase.f15908a.b());
        c.a(dataStore);
        e = g.a(b.f16086a);
        f = g.a(a.f16085a);
    }

    private DataStore() {
    }

    @NotNull
    public final RoomPreferenceDataStore a() {
        return c;
    }

    @NotNull
    public final RoomPreferenceDataStore b() {
        return d;
    }

    @Override
    public void a(@NotNull PreferenceDataStore preferenceDataStore, @Nullable String str) {
        k.b(preferenceDataStore, "store");
        if (str != null && str.hashCode() == -1005400924 && str.equals("profileId") && f16084b.e()) {
            DirectBoot.a(DirectBoot.f16096a, null, 1, null);
        }
    }

    private final int a(String str, int i) {
        Integer c2 = c.c(str);
        if (c2 != null) {
            c.putString(str, String.valueOf(c2.intValue()));
            return c2.intValue();
        }
        return h.a(c.e(str), i + w(), 0, 4, null);
    }

    public final long c() {
        Long d2 = c.d("profileId");
        if (d2 != null) {
            return d2.longValue();
        }
        return 0L;
    }

    public final void a(long j) {
        c.putLong("profileId", j);
    }

    public final boolean d() {
        return k.a((Object) c.a("directBootAware"), (Object) true);
    }

    public final boolean e() {
        return Core.d.f() && d();
    }

    public final boolean f() {
        return TcpFastOpen.f16041b.b() && c.getBoolean("tcp_fastopen", true);
    }

    @NotNull
    public final String g() {
        String e2 = c.e("serviceMode");
        return e2 != null ? e2 : "vpn";
    }

    @NotNull
    public final String i() {
        return c.getBoolean("shareOverLan", h()) ? "0.0.0.0" : "127.0.0.1";
    }

    public final int j() {
        return a("portProxy", 1080);
    }

    public final void a(int i) {
        c.putString("portProxy", String.valueOf(i));
    }

    @NotNull
    public final InetSocketAddress k() {
        return new InetSocketAddress("127.0.0.1", j());
    }

    public final int l() {
        return a("portLocalDns", 5450);
    }

    public final void b(int i) {
        c.putString("portLocalDns", String.valueOf(i));
    }

    public final int m() {
        return a("portTransproxy", o.a.v);
    }

    public final void c(int i) {
        c.putString("portTransproxy", String.valueOf(i));
    }

    @NotNull
    public final String n() {
        String e2 = c.e("targetPkg");
        return e2 != null ? e2 : "";
    }

    public final void a(@NotNull String str) {
        k.b(str, "value");
        c.putString("targetPkg", str);
    }

    public final void b(@NotNull String str) {
        k.b(str, "value");
        c.putString("rid", str);
    }

    public final void o() {
        if (c.a("tcp_fastopen") == null) {
            c.putBoolean("tcp_fastopen", f());
        }
        if (c.e("portProxy") == null) {
            a(j());
        }
        if (c.e("portLocalDns") == null) {
            b(l());
        }
        if (c.e("portTransproxy") == null) {
            c(m());
        }
    }

    @Nullable
    public final Long p() {
        return d.d("profileId");
    }

    public final void a(@Nullable Long l) {
        d.a("profileId", l);
    }

    public final boolean q() {
        Boolean a2 = d.a("isProxyApps");
        if (a2 != null) {
            return a2.booleanValue();
        }
        return false;
    }

    public final void a(boolean z) {
        d.putBoolean("isProxyApps", z);
    }

    public final boolean r() {
        Boolean a2 = d.a("isBypassApps");
        if (a2 != null) {
            return a2.booleanValue();
        }
        return false;
    }

    public final void b(boolean z) {
        d.putBoolean("isBypassApps", z);
    }

    @NotNull
    public final String s() {
        String e2 = d.e("Proxyed");
        return e2 != null ? e2 : "";
    }

    public final void c(@NotNull String str) {
        k.b(str, "value");
        d.putString("Proxyed", str);
    }

    @NotNull
    public final String t() {
        String e2 = d.e("plugin");
        return e2 != null ? e2 : "";
    }

    public final void d(@NotNull String str) {
        k.b(str, "value");
        d.putString("plugin", str);
    }

    @Nullable
    public final Long u() {
        return d.d("udpFallback");
    }

    public final void b(@Nullable Long l) {
        d.a("udpFallback", l);
    }

    public final boolean v() {
        Boolean a2 = d.a("profileDirty");
        if (a2 != null) {
            return a2.booleanValue();
        }
        return false;
    }

    public final void c(boolean z) {
        d.putBoolean("profileDirty", z);
    }
}