修复上传设备信息失败
This commit is contained in:
@@ -3,6 +3,8 @@ package com.uiui.sn.utils;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
|
import android.bluetooth.BluetoothAdapter;
|
||||||
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -84,8 +86,10 @@ import java.util.Collections;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static android.content.Context.WIFI_SERVICE;
|
import static android.content.Context.WIFI_SERVICE;
|
||||||
@@ -907,10 +911,10 @@ public class Utils {
|
|||||||
if (allList.size() > 0) {
|
if (allList.size() > 0) {
|
||||||
Log.e("writeDisableUpdateList", "allList: " + allList);
|
Log.e("writeDisableUpdateList", "allList: " + allList);
|
||||||
String list = String.join(",", allList);
|
String list = String.join(",", allList);
|
||||||
writeSucceed = JGYUtils.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, list);
|
writeSucceed = JGYUtils.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, list);
|
||||||
Log.e("writeDisableUpdateList", "aole_app_forbid: " + list);
|
Log.e("writeDisableUpdateList", "aole_app_forbid: " + list);
|
||||||
} else {
|
} else {
|
||||||
writeSucceed = JGYUtils.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, "Invalid");
|
writeSucceed = JGYUtils.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, "Invalid");
|
||||||
}
|
}
|
||||||
return writeSucceed;
|
return writeSucceed;
|
||||||
/*功能和应用安装白名单一样,首先会写入所有的app名单。
|
/*功能和应用安装白名单一样,首先会写入所有的app名单。
|
||||||
@@ -1009,6 +1013,7 @@ public class Utils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取电池容量
|
* 获取电池容量
|
||||||
|
*
|
||||||
* @param context
|
* @param context
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -1220,10 +1225,15 @@ public class Utils {
|
|||||||
long wifi_time = (long) com.uiui.sn.utils.SPUtils.get(context, "wifi_last_connect_time", 0L) / 1000;
|
long wifi_time = (long) com.uiui.sn.utils.SPUtils.get(context, "wifi_last_connect_time", 0L) / 1000;
|
||||||
Log.e(TAG, "getHardware: wifi_time" + wifi_time);
|
Log.e(TAG, "getHardware: wifi_time" + wifi_time);
|
||||||
int CPU = getNumCores();
|
int CPU = getNumCores();
|
||||||
|
WifiManager wifiManager = (WifiManager) context.getSystemService(WIFI_SERVICE);
|
||||||
|
// WifiInfo wifiInfo = wifiManager.getConnectionInfo();
|
||||||
|
WifiInfo info = wifiManager.getConnectionInfo();
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("electric", electric);
|
jsonObject.put("electric", electric);
|
||||||
jsonObject.put("charging", charging);
|
jsonObject.put("charging", charging);
|
||||||
jsonObject.put("memory", memory);
|
jsonObject.put("memory", memory);
|
||||||
|
jsonObject.put("mac", getMAC(context));
|
||||||
jsonObject.put("storage", storage);
|
jsonObject.put("storage", storage);
|
||||||
jsonObject.put("is_wifi", JGYUtils.getInstance().isWifiConnect());
|
jsonObject.put("is_wifi", JGYUtils.getInstance().isWifiConnect());
|
||||||
jsonObject.put("CPU", CPU + "核");
|
jsonObject.put("CPU", CPU + "核");
|
||||||
@@ -1232,7 +1242,9 @@ public class Utils {
|
|||||||
jsonObject.put("wifi_ssid", getWifiSSID(context));
|
jsonObject.put("wifi_ssid", getWifiSSID(context));
|
||||||
jsonObject.put("wifi_time", wifi_time);
|
jsonObject.put("wifi_time", wifi_time);
|
||||||
jsonObject.put("boot_time", SystemClock.elapsedRealtime());
|
jsonObject.put("boot_time", SystemClock.elapsedRealtime());
|
||||||
jsonObject.put("battery_capacity", Utils.getBatterymAh(context));
|
jsonObject.put("battery_capacity", getBatterymAh(context));
|
||||||
|
jsonObject.put("wifi_signal", info.getRssi());
|
||||||
|
jsonObject.put("bluetooth", getBluetoothList());
|
||||||
Log.e(TAG, "getHardware: " + jsonObject.toJSONString());
|
Log.e(TAG, "getHardware: " + jsonObject.toJSONString());
|
||||||
return jsonObject.toJSONString();
|
return jsonObject.toJSONString();
|
||||||
}
|
}
|
||||||
@@ -1247,6 +1259,30 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getBluetoothList() {
|
||||||
|
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
|
if (bluetoothAdapter == null) {
|
||||||
|
return "没有蓝牙设备";
|
||||||
|
} else {
|
||||||
|
if (!bluetoothAdapter.isEnabled())//判断蓝牙设备是否已开起
|
||||||
|
{
|
||||||
|
return "蓝牙未开启";
|
||||||
|
// //开起蓝牙设备
|
||||||
|
// Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
|
||||||
|
// context.startActivity(intent);
|
||||||
|
} else {
|
||||||
|
Set<BluetoothDevice> devices = bluetoothAdapter.getBondedDevices();
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
for (Iterator<BluetoothDevice> iterator = devices.iterator(); iterator.hasNext(); ) {
|
||||||
|
BluetoothDevice device = iterator.next();
|
||||||
|
stringBuilder.append(device.getAlias()).append(";");
|
||||||
|
}
|
||||||
|
Log.e(TAG, "getBluetoothList: " + stringBuilder.toString());
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static String getAppUsedStatistics(Context context) {
|
public static String getAppUsedStatistics(Context context) {
|
||||||
StatisticsInfo statisticsInfo = new StatisticsInfo(context, 0);
|
StatisticsInfo statisticsInfo = new StatisticsInfo(context, 0);
|
||||||
long totalTime = statisticsInfo.getTotalTime();
|
long totalTime = statisticsInfo.getTotalTime();
|
||||||
@@ -1314,6 +1350,7 @@ public class Utils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取公网IP并保存
|
* 获取公网IP并保存
|
||||||
|
*
|
||||||
* @param context
|
* @param context
|
||||||
*/
|
*/
|
||||||
public static void getPublicIP(Context context) {
|
public static void getPublicIP(Context context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user