APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Wall
版本号:1.0.4
包名称:com.bundle.wallapp

MD5 校验值:b359069a22e95e2832438c301625aae5

反编译源代码说明

n3.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package com.onesignal;

import android.net.TrafficStats;
import android.os.Build;
import com.onesignal.c3;
import java.io.InputStream;
import java.lang.Thread;
import java.net.ConnectException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.Scanner;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONObject;

public class n3 {

    public class a implements Runnable {

        final String f12588k;

        final JSONObject f12589l;

        final g f12590m;

        a(String str, JSONObject jSONObject, g gVar) {
            this.f12588k = str;
            this.f12589l = jSONObject;
            this.f12590m = gVar;
        }

        @Override
        public void run() {
            n3.h(this.f12588k, "PUT", this.f12589l, this.f12590m, 120000, null);
        }
    }

    public class b implements Runnable {

        final String f12591k;

        final JSONObject f12592l;

        final g f12593m;

        b(String str, JSONObject jSONObject, g gVar) {
            this.f12591k = str;
            this.f12592l = jSONObject;
            this.f12593m = gVar;
        }

        @Override
        public void run() {
            n3.h(this.f12591k, "POST", this.f12592l, this.f12593m, 120000, null);
        }
    }

    class c implements Runnable {

        final String f12594k;

        final g f12595l;

        final String f12596m;

        c(String str, g gVar, String str2) {
            this.f12594k = str;
            this.f12595l = gVar;
            this.f12596m = str2;
        }

        @Override
        public void run() {
            n3.h(this.f12594k, null, null, this.f12595l, 60000, this.f12596m);
        }
    }

    public class d implements Runnable {

        final Thread[] f12597k;

        final String f12598l;

        final String f12599m;

        final JSONObject f12600n;

        final g f12601o;

        final int f12602p;

        final String f12603q;

        d(Thread[] threadArr, String str, String str2, JSONObject jSONObject, g gVar, int i10, String str3) {
            this.f12597k = threadArr;
            this.f12598l = str;
            this.f12599m = str2;
            this.f12600n = jSONObject;
            this.f12601o = gVar;
            this.f12602p = i10;
            this.f12603q = str3;
        }

        @Override
        public void run() {
            this.f12597k[0] = n3.n(this.f12598l, this.f12599m, this.f12600n, this.f12601o, this.f12602p, this.f12603q);
        }
    }

    public class e implements Runnable {

        final g f12604k;

        final String f12605l;

        e(g gVar, String str) {
            this.f12604k = gVar;
            this.f12605l = str;
        }

        @Override
        public void run() {
            this.f12604k.b(this.f12605l);
        }
    }

    public class f implements Runnable {

        final g f12606k;

        final int f12607l;

        final String f12608m;

        final Throwable f12609n;

        f(g gVar, int i10, String str, Throwable th) {
            this.f12606k = gVar;
            this.f12607l = i10;
            this.f12608m = str;
            this.f12609n = th;
        }

        @Override
        public void run() {
            this.f12606k.a(this.f12607l, this.f12608m, this.f12609n);
        }
    }

    public static abstract class g {
        void a(int i10, String str, Throwable th) {
        }

        void b(String str) {
        }
    }

    private static Thread c(g gVar, int i10, String str, Throwable th) {
        if (gVar == null) {
            return null;
        }
        Thread thread = new Thread(new f(gVar, i10, str, th), "OS_REST_FAILURE_CALLBACK");
        thread.start();
        return thread;
    }

    private static Thread d(g gVar, String str) {
        if (gVar == null) {
            return null;
        }
        Thread thread = new Thread(new e(gVar, str), "OS_REST_SUCCESS_CALLBACK");
        thread.start();
        return thread;
    }

    public static void e(String str, g gVar, String str2) {
        new Thread(new c(str, gVar, str2), "OS_REST_ASYNC_GET").start();
    }

    public static void f(String str, g gVar, String str2) {
        h(str, null, null, gVar, 60000, str2);
    }

    private static int g(int i10) {
        return i10 + 5000;
    }

    public static void h(String str, String str2, JSONObject jSONObject, g gVar, int i10, String str3) {
        if (OSUtils.H()) {
            throw new u2("Method: " + str2 + " was called from the Main Thread!");
        }
        if (str2 == null || !c3.L2(null)) {
            Thread[] threadArr = new Thread[1];
            Thread thread = new Thread(new d(threadArr, str, str2, jSONObject, gVar, i10, str3), "OS_HTTPConnection");
            thread.start();
            try {
                thread.join(g(i10));
                if (thread.getState() != Thread.State.TERMINATED) {
                    thread.interrupt();
                }
                if (threadArr[0] != null) {
                    threadArr[0].join();
                }
            } catch (InterruptedException e10) {
                e10.printStackTrace();
            }
        }
    }

    private static HttpURLConnection i(String str) {
        return (HttpURLConnection) new URL("https://api.onesignal.com/" + str).openConnection();
    }

    public static void j(String str, JSONObject jSONObject, g gVar) {
        new Thread(new b(str, jSONObject, gVar), "OS_REST_ASYNC_POST").start();
    }

    public static void k(String str, JSONObject jSONObject, g gVar) {
        h(str, "POST", jSONObject, gVar, 120000, null);
    }

    public static void l(String str, JSONObject jSONObject, g gVar) {
        new Thread(new a(str, jSONObject, gVar), "OS_REST_ASYNC_PUT").start();
    }

    public static void m(String str, JSONObject jSONObject, g gVar) {
        h(str, "PUT", jSONObject, gVar, 120000, null);
    }

    public static Thread n(String str, String str2, JSONObject jSONObject, g gVar, int i10, String str3) {
        HttpURLConnection httpURLConnection;
        Thread c10;
        String next;
        String headerField;
        Throwable th;
        int i11 = Build.VERSION.SDK_INT;
        if (i11 >= 26) {
            TrafficStats.setThreadStatsTag(10000);
        }
        int i12 = -1;
        try {
            c3.u0 u0Var = c3.u0.DEBUG;
            c3.a(u0Var, "OneSignalRestClient: Making request to: https://api.onesignal.com/" + str);
            httpURLConnection = i(str);
            if (i11 < 22) {
                try {
                    if (httpURLConnection instanceof HttpsURLConnection) {
                        HttpsURLConnection httpsURLConnection = (HttpsURLConnection) httpURLConnection;
                        httpsURLConnection.setSSLSocketFactory(new b4(httpsURLConnection.getSSLSocketFactory()));
                    }
                } catch (Throwable th2) {
                    th = th2;
                    try {
                        if (!(th instanceof ConnectException)) {
                            c3.b(c3.u0.WARN, "OneSignalRestClient: " + str2 + " Error thrown from network stack. ", th);
                            c10 = c(gVar, i12, null, th);
                        }
                        c3.a(c3.u0.INFO, "OneSignalRestClient: Could not send last request, device is offline. Throwable: " + th.getClass().getName());
                        c10 = c(gVar, i12, null, th);
                    } catch (Throwable th3) {
                        if (httpURLConnection != null) {
                            httpURLConnection.disconnect();
                        }
                        throw th3;
                    }
                }
            }
            httpURLConnection.setUseCaches(false);
            httpURLConnection.setConnectTimeout(i10);
            httpURLConnection.setReadTimeout(i10);
            httpURLConnection.setRequestProperty("SDK-Version", "onesignal/android/" + c3.J0());
            httpURLConnection.setRequestProperty("Accept", "application/vnd.onesignal.v1+json");
            if (jSONObject != null) {
                httpURLConnection.setDoInput(true);
            }
            if (str2 != null) {
                httpURLConnection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
                httpURLConnection.setRequestMethod(str2);
                httpURLConnection.setDoOutput(true);
            }
            if (jSONObject != null) {
                String g10 = a0.g(jSONObject);
                c3.a(u0Var, "OneSignalRestClient: " + str2 + " SEND JSON: " + g10);
                byte[] bytes = g10.getBytes("UTF-8");
                httpURLConnection.setFixedLengthStreamingMode(bytes.length);
                httpURLConnection.getOutputStream().write(bytes);
            }
            if (str3 != null) {
                String f10 = l3.f(l3.f12543a, "PREFS_OS_ETAG_PREFIX_" + str3, null);
                if (f10 != null) {
                    httpURLConnection.setRequestProperty("if-none-match", f10);
                    c3.a(u0Var, "OneSignalRestClient: Adding header if-none-match: " + f10);
                }
            }
            i12 = httpURLConnection.getResponseCode();
            try {
                c3.a(c3.u0.VERBOSE, "OneSignalRestClient: After con.getResponseCode to: https://api.onesignal.com/" + str);
                String str4 = "GET";
                if (i12 == 200 || i12 == 202) {
                    StringBuilder sb2 = new StringBuilder();
                    try {
                        sb2.append("OneSignalRestClient: Successfully finished request to: https://api.onesignal.com/");
                        sb2.append(str);
                        c3.a(u0Var, sb2.toString());
                        Scanner scanner = new Scanner(httpURLConnection.getInputStream(), "UTF-8");
                        next = scanner.useDelimiter("\\A").hasNext() ? scanner.next() : "";
                        scanner.close();
                        StringBuilder sb3 = new StringBuilder();
                        sb3.append("OneSignalRestClient: ");
                        if (str2 != null) {
                            str4 = str2;
                        }
                        sb3.append(str4);
                        sb3.append(" RECEIVED JSON: ");
                        sb3.append(next);
                        c3.a(u0Var, sb3.toString());
                        if (str3 != null && (headerField = httpURLConnection.getHeaderField("etag")) != null) {
                            c3.a(u0Var, "OneSignalRestClient: Response has etag of " + headerField + " so caching the response.");
                            String str5 = l3.f12543a;
                            l3.m(str5, "PREFS_OS_ETAG_PREFIX_" + str3, headerField);
                            l3.m(str5, "PREFS_OS_HTTP_CACHE_PREFIX_" + str3, next);
                        }
                        c10 = d(gVar, next);
                    } catch (Throwable th4) {
                        th = th4;
                        i12 = i12;
                        if (!(th instanceof ConnectException) && !(th instanceof UnknownHostException)) {
                            c3.b(c3.u0.WARN, "OneSignalRestClient: " + str2 + " Error thrown from network stack. ", th);
                            c10 = c(gVar, i12, null, th);
                        }
                        c3.a(c3.u0.INFO, "OneSignalRestClient: Could not send last request, device is offline. Throwable: " + th.getClass().getName());
                        c10 = c(gVar, i12, null, th);
                    }
                } else if (i12 != 304) {
                    c3.a(u0Var, "OneSignalRestClient: Failed request to: https://api.onesignal.com/" + str);
                    InputStream errorStream = httpURLConnection.getErrorStream();
                    if (errorStream == null) {
                        errorStream = httpURLConnection.getInputStream();
                    }
                    if (errorStream != null) {
                        Scanner scanner2 = new Scanner(errorStream, "UTF-8");
                        next = scanner2.useDelimiter("\\A").hasNext() ? scanner2.next() : "";
                        scanner2.close();
                        c3.a(c3.u0.WARN, "OneSignalRestClient: " + str2 + " RECEIVED JSON: " + next);
                        th = null;
                    } else {
                        c3.a(c3.u0.WARN, "OneSignalRestClient: " + str2 + " HTTP Code: " + i12 + " No response body!");
                        th = null;
                        next = null;
                    }
                    c10 = c(gVar, i12, next, th);
                } else {
                    String f11 = l3.f(l3.f12543a, "PREFS_OS_HTTP_CACHE_PREFIX_" + str3, null);
                    StringBuilder sb4 = new StringBuilder();
                    sb4.append("OneSignalRestClient: ");
                    if (str2 != null) {
                        str4 = str2;
                    }
                    sb4.append(str4);
                    sb4.append(" - Using Cached response due to 304: ");
                    sb4.append(f11);
                    c3.a(u0Var, sb4.toString());
                    c10 = d(gVar, f11);
                }
            } catch (Throwable th5) {
                th = th5;
            }
        } catch (Throwable th6) {
            th = th6;
            httpURLConnection = null;
        }
        httpURLConnection.disconnect();
        return c10;
    }
}