正在查看: CallApp v2.226 应用的 TransactionService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: CallApp v2.226 应用的 TransactionService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.android.mms.transaction;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.sqlite.SQLiteException;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.NetworkRequest;
import android.net.Uri;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
import android.preference.PreferenceManager;
import android.provider.Telephony;
import android.text.TextUtils;
import android.widget.Toast;
import com.android.internal.telephony.SmsConstants;
import com.klinker.android.send_message.R;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import nn.k;
import q6.f;
import q6.g;
import q6.l;
import q6.o;
import q6.q;
import q6.r;
public class TransactionService extends Service implements g {
public d f7683a;
public Looper f7684b;
public ConnectivityManager f7687e;
public b f7688f;
public boolean f7689g;
public PowerManager.WakeLock f7690h;
public com.android.mms.transaction.a f7692j;
public final ArrayList f7685c = new ArrayList();
public final ArrayList f7686d = new ArrayList();
public final a f7691i = new a();
public class a extends Handler {
public a() {
}
@Override
public final void handleMessage(Message message) {
int i8 = message.what;
TransactionService transactionService = TransactionService.this;
String string = i8 == 1 ? transactionService.getString(R.string.message_queued) : i8 == 2 ? transactionService.getString(R.string.download_later) : i8 == 3 ? transactionService.getString(R.string.no_apn) : null;
if (string != null) {
Toast.makeText(transactionService, string, 1).show();
}
}
}
public class b extends BroadcastReceiver {
public b(TransactionService transactionService, int i8) {
this();
}
@Override
public final void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("android.net.conn.CONNECTIVITY_CHANGE")) {
NetworkInfo networkInfo = (TransactionService.this.f7687e == null || !k.d(context).booleanValue()) ? null : TransactionService.this.f7687e.getNetworkInfo(2);
Objects.toString(networkInfo);
if (networkInfo == null) {
return;
}
if ("2GVoiceCallEnded".equals(networkInfo.getReason())) {
d dVar = TransactionService.this.f7683a;
dVar.sendMessageDelayed(dVar.obtainMessage(3), 30000L);
return;
}
if (!networkInfo.isConnected()) {
if (networkInfo.isAvailable()) {
d dVar2 = TransactionService.this.f7683a;
dVar2.sendMessageDelayed(dVar2.obtainMessage(3), 30000L);
return;
}
return;
}
q qVar = new q(TransactionService.this, networkInfo.getExtraInfo());
if (!TextUtils.isEmpty(qVar.f16069a)) {
TransactionService.this.f7683a.a(qVar);
return;
}
nn.a.b(TransactionService.this, new Intent(), "com.klinker.android.send_message.MMS_ERROR");
d dVar3 = TransactionService.this.f7683a;
synchronized (TransactionService.this.f7685c) {
while (TransactionService.this.f7686d.size() != 0) {
try {
o oVar = (o) TransactionService.this.f7686d.remove(0);
oVar.f16066f.c(2);
if (oVar instanceof l) {
Uri uri = ((l) oVar).f16056h;
oVar.f16066f.b(uri);
ContentValues contentValues = new ContentValues(1);
contentValues.put("resp_st", Integer.valueOf(SmsConstants.MAX_USER_DATA_BYTES_WITH_HEADER));
TransactionService transactionService = TransactionService.this;
d.a.d(transactionService, transactionService.getContentResolver(), uri, contentValues, null);
}
oVar.b();
} catch (Throwable th) {
throw th;
}
}
}
TransactionService.this.c();
TransactionService.this.stopSelf();
}
}
private b() {
}
}
public static class c extends ConnectivityManager.NetworkCallback {
public int f7695a;
public c(int i8) {
this();
}
private c() {
}
}
public final class d extends Handler {
public d(Looper looper) {
super(looper);
}
public final void a(q qVar) {
o oVar;
int size;
synchronized (TransactionService.this.f7685c) {
try {
oVar = TransactionService.this.f7686d.size() != 0 ? (o) TransactionService.this.f7686d.remove(0) : null;
size = TransactionService.this.f7685c.size();
} catch (Throwable th) {
throw th;
}
}
if (oVar == null) {
if (size == 0) {
TransactionService.this.c();
return;
}
return;
}
if (qVar != null) {
oVar.f16067g = qVar;
}
try {
b(oVar);
oVar.toString();
} catch (IOException e6) {
e6.getMessage();
}
}
public final void b(o oVar) {
synchronized (TransactionService.this.f7685c) {
try {
Iterator it = TransactionService.this.f7686d.iterator();
while (it.hasNext()) {
if (((o) it.next()).f16065e.equals(oVar.f16065e)) {
return;
}
}
Iterator it2 = TransactionService.this.f7685c.iterator();
while (it2.hasNext()) {
if (((o) it2.next()).f16065e.equals(oVar.f16065e)) {
return;
}
}
if (TransactionService.this.b() == 1) {
TransactionService.this.f7686d.add(oVar);
return;
}
if (TransactionService.this.f7685c.size() > 0) {
Objects.toString(oVar);
TransactionService.this.f7686d.add(oVar);
return;
}
Objects.toString(oVar);
TransactionService.this.f7685c.add(oVar);
sendMessageDelayed(obtainMessage(3), 30000L);
Objects.toString(oVar);
oVar.f16045a.add(TransactionService.this);
oVar.e();
} catch (Throwable th) {
throw th;
}
}
}
@Override
public final void handleMessage(android.os.Message r19) {
throw new UnsupportedOperationException("Method not decompiled: com.android.mms.transaction.TransactionService.d.handleMessage(android.os.Message):void");
}
}
@Override
public final void a(f fVar) {
Uri uri;
o oVar = (o) fVar;
int i8 = oVar.f16063c;
try {
synchronized (this.f7685c) {
try {
this.f7685c.remove(oVar);
if (this.f7686d.size() > 0) {
this.f7683a.sendMessage(this.f7683a.obtainMessage(4, oVar.f16067g));
} else if (this.f7685c.isEmpty()) {
c();
}
} finally {
}
}
Intent intent = new Intent("android.intent.action.TRANSACTION_COMPLETED_ACTION");
r rVar = oVar.f16066f;
int a8 = rVar.a();
intent.putExtra("state", a8);
if (a8 == 1) {
synchronized (rVar) {
uri = rVar.f16072a;
}
intent.putExtra("uri", uri);
if (oVar.d() == 2) {
r6.f.a(getApplicationContext());
r6.f fVar2 = r6.f.f16423d;
if (fVar2 == null) {
throw new IllegalStateException("Uninitialized.");
}
ContentValues contentValues = new ContentValues(1);
contentValues.put("sent_time", Long.valueOf(System.currentTimeMillis()));
Context context = fVar2.f16425a;
try {
context.getContentResolver().insert(Telephony.Mms.Rate.CONTENT_URI, contentValues);
} catch (SQLiteException e6) {
d.a.a(context, e6);
}
}
}
nn.a.b(this, intent, "android.intent.action.TRANSACTION_COMPLETED_ACTION");
} finally {
oVar.a(this);
d(i8);
}
}
public final int b() {
NetworkInfo networkInfo;
synchronized (this) {
if (this.f7690h == null) {
PowerManager.WakeLock newWakeLock = ((PowerManager) getSystemService("power")).newWakeLock(1, "MMS Connectivity");
this.f7690h = newWakeLock;
newWakeLock.setReferenceCounted(false);
}
}
Pattern pattern = k.a;
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("mms_over_wifi", false) && (networkInfo = this.f7687e.getNetworkInfo(1)) != null && networkInfo.isConnected()) {
return 0;
}
if (this.f7692j != null) {
CountDownLatch countDownLatch = new CountDownLatch(1);
NetworkRequest.Builder builder = new NetworkRequest.Builder();
builder.addCapability(0);
builder.addTransportType(0);
this.f7692j = new com.android.mms.transaction.a(this, countDownLatch);
this.f7687e.requestNetwork(builder.build(), this.f7692j);
try {
countDownLatch.await(2000L, TimeUnit.MILLISECONDS);
} catch (InterruptedException unused) {
}
}
int i8 = this.f7692j.f7695a;
if (i8 != 0 && i8 != 1) {
throw new IOException("Cannot establish MMS connectivity");
}
this.f7690h.acquire();
return this.f7692j.f7695a;
}
public final void c() {
com.android.mms.transaction.a aVar;
try {
this.f7683a.removeMessages(3);
ConnectivityManager connectivityManager = this.f7687e;
if (connectivityManager != null && (aVar = this.f7692j) != null) {
connectivityManager.unregisterNetworkCallback(aVar);
this.f7692j = null;
}
} finally {
PowerManager.WakeLock wakeLock = this.f7690h;
if (wakeLock != null && wakeLock.isHeld()) {
this.f7690h.release();
}
}
}
public final void d(int i8) {
synchronized (this.f7685c) {
try {
if (this.f7685c.isEmpty() && this.f7686d.isEmpty()) {
stopSelf(i8);
}
} catch (Throwable th) {
throw th;
}
}
}
@Override
public final IBinder onBind(Intent intent) {
return null;
}
@Override
public final void onCreate() {
Pattern pattern = k.a;
if (!getPackageName().equals(Telephony.Sms.getDefaultSmsPackage(this))) {
stopSelf();
return;
}
HandlerThread handlerThread = new HandlerThread("TransactionService");
handlerThread.start();
this.f7684b = handlerThread.getLooper();
this.f7683a = new d(this.f7684b);
this.f7688f = new b(this, 0);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
registerReceiver(this.f7688f, intentFilter, null, null, 2);
}
@Override
public final void onDestroy() {
this.f7686d.isEmpty();
PowerManager.WakeLock wakeLock = this.f7690h;
if (wakeLock != null && wakeLock.isHeld()) {
this.f7690h.release();
}
try {
unregisterReceiver(this.f7688f);
} catch (Exception unused) {
}
this.f7683a.sendEmptyMessage(100);
if (this.f7689g) {
return;
}
k.e(this, false);
}
@Override
public final int onStartCommand(Intent intent, int i8, int i9) {
if (intent == null) {
return 2;
}
if (this.f7683a == null) {
HandlerThread handlerThread = new HandlerThread("TransactionService");
handlerThread.start();
this.f7684b = handlerThread.getLooper();
this.f7683a = new d(this.f7684b);
}
Message obtainMessage = this.f7683a.obtainMessage(5);
obtainMessage.arg1 = i9;
obtainMessage.obj = intent;
this.f7683a.sendMessage(obtainMessage);
return 2;
}
}