MD5 校验值:51aae3247d6bd20bca268c4c9a4dd21c
m.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package x1; import D1.C0252a; import D1.C0260i; import D1.InterfaceC0253b; import D1.InterfaceC0255d; import D1.InterfaceC0258g; import D1.InterfaceC0259h; import D1.InterfaceC0261j; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Handler; import android.os.Looper; import android.text.TextUtils; import android.util.Log; import com.android.billingclient.api.AbstractC0531a; import com.android.billingclient.api.C0533c; import com.android.billingclient.api.C0534d; import com.android.billingclient.api.C0537g; import com.android.billingclient.api.Purchase; import com.android.billingclient.api.SkuDetails; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.TimeZone; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import x1.m; public class m implements InterfaceC0259h { private static final String f17589n = "m"; private final Context f17592c; private final AbstractC0531a f17593d; private final LinkedList f17594e; private Activity f17595f; private final String f17597h; private List f17598i; private final boolean f17599j; private z f17600k; private final Executor f17590a = Executors.newSingleThreadExecutor(); private final Handler f17591b = new Handler(Looper.getMainLooper()); private boolean f17601l = true; private String f17602m = ""; private boolean f17596g = false; class a implements Runnable { a() { } @Override public void run() { m.this.U(); } } public class b implements InterfaceC0255d { final Runnable f17604a; b(Runnable runnable) { this.f17604a = runnable; } @Override public void a(C0534d c0534d) { Log.d(m.f17589n, "Billing setup finished. Response code: " + c0534d.b()); if (c0534d.b() == 0) { m.this.f17596g = true; Runnable runnable = this.f17604a; if (runnable != null) { runnable.run(); } } } @Override public void b() { Log.d(m.f17589n, "Billing service disconnected."); m.this.f17596g = false; } } public class c implements Runnable { c() { } @Override public void run() { while (!m.this.f17594e.isEmpty()) { ((Runnable) m.this.f17594e.removeFirst()).run(); } } } public class d implements Runnable { final C0537g f17607g; final Activity f17608h; final String f17609i; final String f17610j; final String f17611k; final String f17612l; class a implements InterfaceC0261j { a() { } public static void e(Activity activity, String str, C0534d c0534d) { AbstractC1157B.e(activity, str, "Error getting sku details: " + c0534d.a()); } public static void f(Activity activity, String str, String str2) { AbstractC1157B.e(activity, str, "Could not find details for product " + str2); } public static void g(Activity activity, String str, C0534d c0534d) { AbstractC1157B.e(activity, str, "Error initiating purchase: " + c0534d.a()); } @Override public void a(final C0534d c0534d, List list) { int i5; if (c0534d.b() != 0) { Log.e(m.f17589n, "Error get sku details: " + c0534d.a()); Handler handler = m.this.f17591b; d dVar = d.this; final Activity activity = dVar.f17608h; final String str = dVar.f17609i; handler.post(new Runnable() { @Override public final void run() { m.d.a.e(activity, str, c0534d); } }); return; } if (list.isEmpty()) { Log.e(m.f17589n, "Could not find details for product " + d.this.f17610j); Handler handler2 = m.this.f17591b; d dVar2 = d.this; final Activity activity2 = dVar2.f17608h; final String str2 = dVar2.f17609i; final String str3 = dVar2.f17610j; handler2.post(new Runnable() { @Override public final void run() { m.d.a.f(activity2, str2, str3); } }); return; } C0533c.a c5 = C0533c.a().c((SkuDetails) list.get(0)); C0533c.C0155c.a a5 = C0533c.C0155c.a(); String str4 = d.this.f17611k; if (str4 != null && !str4.isEmpty()) { a5.c(d.this.f17611k); String str5 = d.this.f17612l; if (str5 != null) { if (str5.equals("IMMEDIATE_WITH_TIME_PRORATION")) { i5 = 1; } else if (d.this.f17612l.equals("IMMEDIATE_AND_CHARGE_PRORATED_PRICE")) { i5 = 2; } else if (d.this.f17612l.equals("IMMEDIATE_WITHOUT_PRORATION")) { i5 = 3; } else if (d.this.f17610j.equals("DEFERRED")) { i5 = 4; } a5.e(i5); } c5.d(a5.a()); } final C0534d b5 = m.this.f17593d.b(d.this.f17608h, c5.a()); if (b5.b() != 0) { Log.e(m.f17589n, "Error initiating purchase: " + b5.a()); Handler handler3 = m.this.f17591b; d dVar3 = d.this; final Activity activity3 = dVar3.f17608h; final String str6 = dVar3.f17609i; handler3.post(new Runnable() { @Override public final void run() { m.d.a.g(activity3, str6, b5); } }); return; } d dVar4 = d.this; m.this.Y(dVar4.f17609i); } } d(C0537g c0537g, Activity activity, String str, String str2, String str3, String str4) { this.f17607g = c0537g; this.f17608h = activity; this.f17609i = str; this.f17610j = str2; this.f17611k = str3; this.f17612l = str4; } @Override public void run() { m.this.f17593d.f(this.f17607g, new a()); } } public class e implements InterfaceC0261j { final AtomicBoolean f17615a; final List f17616b; final AtomicInteger f17617c; e(AtomicBoolean atomicBoolean, List list, AtomicInteger atomicInteger) { this.f17615a = atomicBoolean; this.f17616b = list; this.f17617c = atomicInteger; } @Override public void a(C0534d c0534d, List list) { if (c0534d.b() != 0) { Log.e(m.f17589n, "Error getting sku details: " + c0534d.a()); this.f17615a.set(false); } else { Log.d(m.f17589n, "Got sku details response with " + list.size() + " items"); this.f17616b.addAll(list); } if (this.f17617c.decrementAndGet() <= 0 && this.f17615a.get()) { m.this.f17598i = this.f17616b; Log.d(m.f17589n, "Received product data for " + this.f17616b.size() + " products"); m.this.R(); } } } public class f implements Runnable { final C0537g f17619g; final InterfaceC0261j f17620h; f(C0537g c0537g, InterfaceC0261j interfaceC0261j) { this.f17619g = c0537g; this.f17620h = interfaceC0261j; } @Override public void run() { m.this.f17593d.f(this.f17619g, this.f17620h); } } public class g implements Runnable { final C0537g f17622g; final InterfaceC0261j f17623h; g(C0537g c0537g, InterfaceC0261j interfaceC0261j) { this.f17622g = c0537g; this.f17623h = interfaceC0261j; } @Override public void run() { m.this.f17593d.f(this.f17622g, this.f17623h); } } public class h implements InterfaceC0253b { h() { } @Override public void a(C0534d c0534d) { if (c0534d.b() != 0) { Log.e(m.f17589n, "Error acknowledging purchase: " + c0534d.a()); } } } public static class i { List f17626a; List f17627b; i() { } } public m(Context context, boolean z5, String str) { this.f17592c = context; this.f17599j = z5; this.f17597h = str; AbstractC0531a a5 = AbstractC0531a.c(context).b().c(this).a(); this.f17593d = a5; if (!z5) { this.f17600k = new z(this, a5); } this.f17594e = new LinkedList(); Z(new Runnable() { @Override public final void run() { m.this.J(); } }); } private void A(Purchase purchase) { if (purchase.d() == 1 && !purchase.h()) { final C0252a a5 = C0252a.b().b(purchase.e()).a(); v(new Runnable() { @Override public final void run() { m.this.I(a5); } }); } } public void C(String str) { ByteArrayOutputStream byteArrayOutputStream; try { URL url = new URL(str); HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setRequestMethod("GET"); httpURLConnection.setDoInput(true); httpURLConnection.setInstanceFollowRedirects(true); httpURLConnection.connect(); if (httpURLConnection.getResponseCode() == 200) { if (httpURLConnection.getContentLength() > 0) { byteArrayOutputStream = new ByteArrayOutputStream(httpURLConnection.getContentLength()); } else { byteArrayOutputStream = new ByteArrayOutputStream(); } BufferedInputStream bufferedInputStream = new BufferedInputStream(httpURLConnection.getInputStream()); B1.k.b(bufferedInputStream, byteArrayOutputStream); bufferedInputStream.close(); byteArrayOutputStream.close(); JSONObject jSONObject = new JSONObject(byteArrayOutputStream.toString()); i iVar = new i(); iVar.f17626a = Q(jSONObject.optJSONArray("inappProducts")); iVar.f17627b = Q(jSONObject.optJSONArray("subProducts")); if (this.f17599j) { T(iVar); return; } z zVar = this.f17600k; if (zVar != null) { zVar.y(iVar); return; } return; } throw new Error("Got status " + httpURLConnection.getResponseCode() + " when downloading " + url); } catch (Exception e5) { Log.e(f17589n, "Error getting products JSON", e5); } } public static void D(Activity activity, String str, C0534d c0534d) { AbstractC1157B.e(activity, str, c0534d.a()); } public static void E(Activity activity, String str, C0534d c0534d) { AbstractC1157B.e(activity, str, c0534d.a()); } public void G(final Activity activity, final String str, List list, List list2, final C0534d c0534d, List list3) { if (c0534d.b() != 0) { activity.runOnUiThread(new Runnable() { @Override public final void run() { m.E(activity, str, c0534d); } }); return; } list.addAll(list2); list.addAll(list3); final JSONObject t5 = t(list); activity.runOnUiThread(new Runnable() { @Override public final void run() { AbstractC1157B.d(activity, str, t5); } }); } public void H(final Activity activity, final String str, final List list, final C0534d c0534d, final List list2) { if (c0534d.b() != 0) { activity.runOnUiThread(new Runnable() { @Override public final void run() { m.D(activity, str, c0534d); } }); } else { this.f17593d.e(C0260i.a().b("subs").a(), new InterfaceC0258g() { @Override public final void a(C0534d c0534d2, List list3) { m.this.G(activity, str, list, list2, c0534d2, list3); } }); } } public void I(C0252a c0252a) { this.f17593d.a(c0252a, new h()); } public void J() { y(); U(); } public void K() { V(this.f17595f); } public void L(List list, C0534d c0534d, List list2) { if (c0534d.b() != 0) { Log.e(f17589n, "Error getting purchase data: " + c0534d.a()); return; } ArrayList arrayList = new ArrayList(list.size() + list2.size()); arrayList.addAll(list); arrayList.addAll(list2); W(arrayList); } public void M(C0534d c0534d, final List list) { if (c0534d.b() != 0) { Log.e(f17589n, "Error getting purchase data: " + c0534d.a()); return; } this.f17593d.e(C0260i.a().b("subs").a(), new InterfaceC0258g() { @Override public final void a(C0534d c0534d2, List list2) { m.this.L(list, c0534d2, list2); } }); } public void N(JSONObject jSONObject) { boolean z5; String url = ((B1.h) this.f17595f).d().getUrl(); if (url != null) { z5 = B1.l.a(url, this.f17595f); } else { z5 = true; } if (!z5) { return; } AbstractC1157B.d(this.f17595f, "median_iap_purchases", jSONObject); AbstractC1157B.d(this.f17595f, "gonative_iap_purchases", jSONObject); } private void P(String str, Activity activity) { Uri parse; if (str != null && !str.isEmpty() && (parse = Uri.parse(str)) != null) { try { activity.startActivity(new Intent("android.intent.action.VIEW", parse)); } catch (Exception e5) { Log.e(f17589n, e5.getMessage(), e5); } } } private List Q(JSONArray jSONArray) { String optString; if (jSONArray == null) { return new ArrayList(); } ArrayList arrayList = new ArrayList(jSONArray.length()); for (int i5 = 0; i5 < jSONArray.length(); i5++) { if (!jSONArray.isNull(i5) && (optString = jSONArray.optString(i5)) != null) { arrayList.add(optString); } } return arrayList; } private void S(Activity activity, String str, String str2, String str3, String str4) { if (str != null && !str.isEmpty()) { List<SkuDetails> list = this.f17598i; if (list == null) { Log.e(f17589n, "Attempt to purchase item without skuDetails"); AbstractC1157B.e(activity, str4, "Attempt to purchase item without skuDetails"); return; } SkuDetails skuDetails = null; for (SkuDetails skuDetails2 : list) { if (str.equals(skuDetails2.b())) { skuDetails = skuDetails2; } } if (skuDetails == null) { Log.e(f17589n, "Could not find details for product " + str); AbstractC1157B.e(activity, str4, "Could not find details for product " + str); return; } ArrayList arrayList = new ArrayList(1); arrayList.add(skuDetails.b()); v(new d(C0537g.c().b(arrayList).c(skuDetails.c()).a(), activity, str4, str, str2, str3)); return; } Log.e(f17589n, "Invalid product id"); AbstractC1157B.e(activity, str4, "Invalid product id"); } private void T(i iVar) { if (iVar == null) { return; } Log.d(f17589n, "Query Play Store for " + iVar.f17626a.size() + " in-apps and " + iVar.f17627b.size() + " subs"); for (String str : iVar.f17626a) { Log.d(f17589n, "inapp: " + str); } for (String str2 : iVar.f17627b) { Log.d(f17589n, "sub: " + str2); } AtomicInteger atomicInteger = new AtomicInteger(0); e eVar = new e(new AtomicBoolean(true), new ArrayList(), atomicInteger); if (iVar.f17626a.size() > 0) { C0537g a5 = C0537g.c().b(iVar.f17626a).c("inapp").a(); atomicInteger.getAndIncrement(); v(new f(a5, eVar)); } if (iVar.f17627b.size() > 0) { C0537g a6 = C0537g.c().b(iVar.f17627b).c("subs").a(); atomicInteger.getAndIncrement(); v(new g(a6, eVar)); } } private void W(List list) { final JSONObject t5 = t(list); this.f17595f.runOnUiThread(new Runnable() { @Override public final void run() { m.this.N(t5); } }); } private void Z(Runnable runnable) { Log.d(f17589n, "Start billing connection"); this.f17593d.g(new b(runnable)); } private JSONObject t(List list) { Object obj; String str; if (list == null) { return null; } JSONObject jSONObject = new JSONObject(); try { JSONArray jSONArray = new JSONArray(); Iterator it = list.iterator(); while (it.hasNext()) { Purchase purchase = (Purchase) it.next(); JSONObject jSONObject2 = new JSONObject(purchase.a()); if (jSONObject2.has("purchaseTime")) { long optLong = jSONObject2.optLong("purchaseTime", 0L); if (optLong > 0) { jSONObject2.put("purchaseTimeString", w(optLong)); } } if (jSONObject2.has("purchaseState")) { int optInt = jSONObject2.optInt("purchaseState", Integer.MIN_VALUE); if (optInt == 0) { str = "purchased"; } else if (optInt == 1) { str = "canceled"; } else if (optInt == 2) { str = "pending"; } else { str = "unknown"; } jSONObject2.put("purchaseStateString", str); } if (purchase.g().isEmpty()) { obj = ""; } else { obj = purchase.g().get(0); } jSONObject2.put("productID", obj); jSONObject2.put("productIDs", new JSONArray((Collection) purchase.g())); Log.d(f17589n, "Purchase Token: " + purchase.e()); jSONArray.put(jSONObject2); } jSONObject.put("platform", "GooglePlay"); if (this.f17599j) { jSONObject.put("libraryVersion", 4); } else { jSONObject.put("libraryVersion", 6); } jSONObject.put("allPurchases", jSONArray); } catch (JSONException e5) { Log.d(f17589n, "convertPurchasesToJSON: ", e5); } return jSONObject; } private void u(final String str) { this.f17590a.execute(new Runnable() { @Override public final void run() { m.this.C(str); } }); } private String w(long j5) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return simpleDateFormat.format(new Date(j5)); } private void y() { if (TextUtils.isEmpty(this.f17597h)) { return; } u(this.f17597h); } private void z(final Activity activity, final String str) { if (activity != null && !TextUtils.isEmpty(str)) { final ArrayList arrayList = new ArrayList(); this.f17593d.e(C0260i.a().b("inapp").a(), new InterfaceC0258g() { @Override public final void a(C0534d c0534d, List list) { m.this.H(activity, str, arrayList, c0534d, list); } }); } } public void B(Uri uri, Activity activity, JSONObject jSONObject) { JSONObject j5; String str; if ("purchase".equals(uri.getHost())) { List<String> pathSegments = uri.getPathSegments(); if (pathSegments.size() == 1) { String str2 = pathSegments.get(0); String optString = jSONObject.optString("previousPurchaseToken"); String optString2 = jSONObject.optString("prorationMode"); String optString3 = jSONObject.optString("callback"); if (this.f17599j) { S(activity, str2, optString, optString2, optString3); } else if (this.f17600k != null) { this.f17600k.x(activity, str2, jSONObject.optString("offerToken"), optString, jSONObject.optString("replacementMode"), optString3); } } else { AbstractC1157B.e(activity, jSONObject.optString("callback"), "Invalid product id"); } } if ("iap".equals(uri.getHost())) { if ("/manageAllSubscriptions".equals(uri.getPath())) { str = "http://play.google.com/store/account/subscriptions"; } else { if (!"/manageSubscription".equals(uri.getPath())) { if (!"/info".equals(uri.getPath()) || jSONObject == null) { if ("/refresh".equals(uri.getPath())) { y(); return; } else { if (!"/purchases".equals(uri.getPath()) || jSONObject == null) { return; } z(activity, jSONObject.optString("callback")); return; } } String optString4 = jSONObject.optString("callback", ""); if (TextUtils.isEmpty(optString4)) { return; } if (this.f17599j) { j5 = x(); } else { z zVar = this.f17600k; j5 = zVar != null ? zVar.j() : null; } if (j5 == null) { y(); return; } try { JSONObject jSONObject2 = new JSONObject(); jSONObject2.put("inAppPurchases", j5); AbstractC1157B.d(activity, optString4, jSONObject2); return; } catch (JSONException unused) { return; } } String optString5 = jSONObject.optString("productID"); String packageName = this.f17592c.getPackageName(); if (optString5 == null || optString5.isEmpty() || packageName == null || packageName.isEmpty()) { return; } str = "https://play.google.com/store/account/subscriptions?sku=" + optString5 + "&package=" + packageName; } P(str, activity); } } public void O() { v(new a()); } public void R() { if (this.f17601l) { this.f17601l = false; if (this.f17595f == null) { return; } this.f17591b.post(new Runnable() { @Override public final void run() { m.this.K(); } }); } } public void U() { this.f17593d.e(C0260i.a().b("inapp").a(), new InterfaceC0258g() { @Override public final void a(C0534d c0534d, List list) { m.this.M(c0534d, list); } }); } public void V(Activity activity) { JSONObject j5; if (this.f17599j) { j5 = x(); } else { j5 = this.f17600k.j(); } if (j5 == null) { this.f17601l = true; return; } JSONObject jSONObject = new JSONObject(); try { jSONObject.put("inAppPurchases", j5); AbstractC1157B.d(activity, "median_info_ready", jSONObject); AbstractC1157B.d(activity, "gonative_info_ready", jSONObject); } catch (JSONException e5) { Log.e(f17589n, "runIapInfoReady: ", e5); } } public void X(Activity activity) { this.f17595f = activity; } public void Y(String str) { this.f17602m = str; } @Override public void a(C0534d c0534d, List list) { String str = this.f17602m; this.f17602m = ""; if (c0534d.b() != 0) { Log.e(f17589n, "Purchase error: " + c0534d.a()); AbstractC1157B.e(this.f17595f, str, AbstractC1157B.b(c0534d.b())); return; } AbstractC1157B.d(this.f17595f, str, AbstractC1157B.a("success", Boolean.TRUE)); if (list == null) { return; } Iterator it = list.iterator(); while (it.hasNext()) { A((Purchase) it.next()); } U(); } public void v(Runnable runnable) { if (this.f17596g) { runnable.run(); } else { this.f17594e.add(runnable); Z(new c()); } } JSONObject x() { if (this.f17598i == null) { return null; } try { JSONArray jSONArray = new JSONArray(); for (SkuDetails skuDetails : this.f17598i) { JSONObject jSONObject = new JSONObject(skuDetails.a()); jSONObject.remove("skuDetailsToken"); jSONObject.put("productID", skuDetails.b()); jSONArray.put(jSONObject); } JSONObject jSONObject2 = new JSONObject(); jSONObject2.put("platform", "GooglePlay"); jSONObject2.put("libraryVersion", 4); jSONObject2.put("products", jSONArray); return jSONObject2; } catch (JSONException e5) { Log.e(f17589n, "Error creating sku details json", e5); return null; } } }