jxjajs 3 months ago
commit b15f12bf5f

@ -5,7 +5,7 @@ plugins {
// 10,00,000 major-minor-build // 10,00,000 major-minor-build
def AppMajorVersion = 1 def AppMajorVersion = 1
def AppMinorVersion = 3 def AppMinorVersion = 3
def AppBuildNumber = 62 def AppBuildNumber = 63
def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber
def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber

@ -66,8 +66,8 @@
#define CMD_SET_SYSTEM_RESET 202 #define CMD_SET_SYSTEM_RESET 202
#define CMD_GET_LIGHT_ADC 101 #define CMD_GET_LIGHT_ADC 101
#define CMD_SET_LIGHT_ADC 102 #define CMD_SET_LIGHT_ADC 102
#define CMD_GET_CHARGING_BUS_VOLTAGE_STATE 112 #define CMD_GET_CHARGING_BUS_VOLTAGE_STATE 112
#define CMD_GET_BAT_BUS_VOLTAGE_STATE 117 #define CMD_GET_BAT_BUS_VOLTAGE_STATE 117
//#define CMD_GET_CHARGING_BUS_VOLTAGE_STATE 117 //#define CMD_GET_CHARGING_BUS_VOLTAGE_STATE 117
//#define CMD_GET_BAT_BUS_VOLTAGE_STATE 112 //#define CMD_GET_BAT_BUS_VOLTAGE_STATE 112
#define CMD_SET_SPI_MODE 0 // TO BE ADDED #define CMD_SET_SPI_MODE 0 // TO BE ADDED
@ -349,11 +349,7 @@ public:
#endif #endif
static int getChargingBusVoltage() { static int getChargingBusVoltage() {
#ifndef USING_N938
return getInt(CMD_GET_CHARGING_BUS_VOLTAGE_STATE); return getInt(CMD_GET_CHARGING_BUS_VOLTAGE_STATE);
#else
return -1;
#endif
} }
#if 0 #if 0

@ -6,14 +6,20 @@ import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.LinkProperties;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.net.Uri; import android.net.Uri;
import android.net.wifi.WifiManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.format.Formatter;
import java.net.Inet4Address; import java.net.Inet4Address;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.NetworkInterface; import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.URI; import java.net.URI;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -55,7 +61,7 @@ public class NetworkUtils {
} }
public static String getMobileNetworkIp(Context context) { public static String getMobileNetworkIp(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
@SuppressLint("MissingPermission") NetworkInfo[] networkInfos = connectivityManager.getAllNetworkInfo(); @SuppressLint("MissingPermission") NetworkInfo[] networkInfos = connectivityManager.getAllNetworkInfo();
if (networkInfos == null || networkInfos.length == 0) { if (networkInfos == null || networkInfos.length == 0) {
@ -89,6 +95,29 @@ public class NetworkUtils {
} }
public static String getMobileIPAddress() {
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface networkInterface = interfaces.nextElement();
if (networkInterface.isUp() && !networkInterface.isLoopback()) {
if (networkInterface.getName() != null && !networkInterface.getName().contains("ap")) {
Enumeration<InetAddress> addresses = networkInterface.getInetAddresses();
while (addresses.hasMoreElements()) {
InetAddress address = addresses.nextElement();
if (!address.isLoopbackAddress() && address.getAddress().length == 4) { // IPv4
return address.getHostAddress();
}
}
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
return null;
}
public static int addAPN(Context context, String name, String desc, String numeric, String user, String pwd) { public static int addAPN(Context context, String name, String desc, String numeric, String user, String pwd) {
int id = -1; int id = -1;
String NUMERIC = getSIMInfo(context); String NUMERIC = getSIMInfo(context);

@ -687,7 +687,7 @@ public class SimUtil {
result.append(isActiveSlot ? ",默认" : ""); result.append(isActiveSlot ? ",默认" : "");
if (isActiveSlot) { if (isActiveSlot) {
result.append(",IP=" + NetworkUtils.getMobileNetworkIp(context)); result.append(",IP=" + NetworkUtils.getMobileIPAddress());
} }
result.append(" "); result.append(" ");

Loading…
Cancel
Save