jimu-decompiled/sources/com/tencent/open/b/a.java
2025-05-13 19:24:51 +02:00

170 lines
5.5 KiB
Java

package com.tencent.open.b;
import android.content.Context;
import android.database.Cursor;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import com.ijm.dataencryption.de.DataDecryptTool;
import com.ubt.jimu.transport.model.TransportFile;
import com.ubtrobot.jimu.robotapi.PeripheralType;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class a {
protected static final Uri a = Uri.parse("content://telephony/carriers/preferapn");
public static String a(Context context) {
int d = d(context);
if (d == 2) {
return "wifi";
}
if (d == 1) {
return "cmwap";
}
if (d == 4) {
return "cmnet";
}
if (d == 16) {
return "uniwap";
}
if (d == 8) {
return "uninet";
}
if (d == 64) {
return "wap";
}
if (d == 32) {
return "net";
}
if (d == 512) {
return "ctwap";
}
if (d == 256) {
return "ctnet";
}
if (d == 2048) {
return "3gnet";
}
if (d == 1024) {
return "3gwap";
}
String b = b(context);
return (b == null || b.length() == 0) ? TransportFile.TYPE_NONE : b;
}
public static String b(Context context) {
try {
Cursor query = context.getContentResolver().query(a, null, null, null, null);
if (query == null) {
return null;
}
query.moveToFirst();
if (query.isAfterLast()) {
if (query != null) {
query.close();
}
return null;
}
String string = query.getString(query.getColumnIndex("apn"));
if (query != null) {
query.close();
}
return string;
} catch (SecurityException e) {
com.tencent.open.a.f.e("openSDK_LOG.APNUtil", "getApn has exception: " + e.getMessage());
return "";
} catch (Exception e2) {
com.tencent.open.a.f.e("openSDK_LOG.APNUtil", "getApn has exception: " + e2.getMessage());
return "";
}
}
public static String c(Context context) {
try {
Cursor query = context.getContentResolver().query(a, null, null, null, null);
if (query == null) {
return null;
}
query.moveToFirst();
if (query.isAfterLast()) {
if (query != null) {
query.close();
}
return null;
}
String string = query.getString(query.getColumnIndex("proxy"));
if (query != null) {
query.close();
}
return string;
} catch (SecurityException e) {
com.tencent.open.a.f.e("openSDK_LOG.APNUtil", "getApnProxy has exception: " + e.getMessage());
return "";
}
}
public static int d(Context context) {
ConnectivityManager connectivityManager;
NetworkInfo activeNetworkInfo;
try {
connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
} catch (Exception e) {
com.tencent.open.a.f.e("openSDK_LOG.APNUtil", "getMProxyType has exception: " + e.getMessage());
}
if (connectivityManager == null || (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) == null) {
return PeripheralType.SERVO;
}
if (activeNetworkInfo.getTypeName().toUpperCase().equals("WIFI")) {
return 2;
}
String lowerCase = activeNetworkInfo.getExtraInfo().toLowerCase();
if (lowerCase.startsWith("cmwap")) {
return 1;
}
if (!lowerCase.startsWith("cmnet") && !lowerCase.startsWith("epc.tmobile.com")) {
if (lowerCase.startsWith("uniwap")) {
return 16;
}
if (lowerCase.startsWith("uninet")) {
return 8;
}
if (lowerCase.startsWith("wap")) {
return 64;
}
if (lowerCase.startsWith("net")) {
return 32;
}
if (lowerCase.startsWith("ctwap")) {
return DataDecryptTool.DECRYPT_DB_FILE;
}
if (lowerCase.startsWith("ctnet")) {
return DataDecryptTool.DECRYPT_ALL_FILE;
}
if (lowerCase.startsWith("3gwap")) {
return DataDecryptTool.DECRYPT_SP_FILE;
}
if (lowerCase.startsWith("3gnet")) {
return 2048;
}
if (lowerCase.startsWith("#777")) {
String c = c(context);
if (c != null) {
if (c.length() > 0) {
return DataDecryptTool.DECRYPT_DB_FILE;
}
}
return DataDecryptTool.DECRYPT_ALL_FILE;
}
return PeripheralType.SERVO;
}
return 4;
}
public static String e(Context context) {
NetworkInfo activeNetworkInfo;
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
return (connectivityManager == null || (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) == null) ? "MOBILE" : activeNetworkInfo.getTypeName();
}
}