version:3.9
fix:修复系统设置管控失败 update:
This commit is contained in:
@@ -61,8 +61,8 @@ android {
|
|||||||
//新平台正式
|
//新平台正式
|
||||||
cube {
|
cube {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 28
|
versionCode 30
|
||||||
versionName "3.7"
|
versionName "3.9"
|
||||||
/*********************************极光推送************************************/
|
/*********************************极光推送************************************/
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
XG_ACCESS_ID : "1500026372",
|
XG_ACCESS_ID : "1500026372",
|
||||||
@@ -271,6 +271,7 @@ dependencies {
|
|||||||
//图片加载框架
|
//图片加载框架
|
||||||
implementation 'com.github.bumptech.glide:glide:4.13.1'
|
implementation 'com.github.bumptech.glide:glide:4.13.1'
|
||||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.1'
|
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.1'
|
||||||
|
|
||||||
// debugImplementation because LeakCanary should only run in debug builds.
|
// debugImplementation because LeakCanary should only run in debug builds.
|
||||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
|
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
|
||||||
//磁盘缓存
|
//磁盘缓存
|
||||||
|
|||||||
@@ -175,12 +175,8 @@ public class NetInterfaceManager {
|
|||||||
private NetInterfaceManager(Context context) {
|
private NetInterfaceManager(Context context) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
this.cacheHelper = new CacheHelper(mContext);
|
this.cacheHelper = new CacheHelper(mContext);
|
||||||
|
|
||||||
if (okHttpClient == null) {
|
if (okHttpClient == null) {
|
||||||
try {
|
|
||||||
mDiskLruCacheHelper = new DiskLruCacheHelper(mContext);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 有网时候的缓存
|
* 有网时候的缓存
|
||||||
*/
|
*/
|
||||||
@@ -518,6 +514,7 @@ public class NetInterfaceManager {
|
|||||||
* API
|
* API
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
|
|
||||||
public UploadAppInfoApi getUploadAppInfoApi() {
|
public UploadAppInfoApi getUploadAppInfoApi() {
|
||||||
return mRetrofit.create(UploadAppInfoApi.class);
|
return mRetrofit.create(UploadAppInfoApi.class);
|
||||||
}
|
}
|
||||||
@@ -1792,7 +1789,7 @@ public class NetInterfaceManager {
|
|||||||
Set<String> set = new HashSet<>();
|
Set<String> set = new HashSet<>();
|
||||||
JGYUtils.getInstance().getAppPlatform(new JGYUtils.GetAppPlatformCallback() {
|
JGYUtils.getInstance().getAppPlatform(new JGYUtils.GetAppPlatformCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void getAppPlatform(int platform) {
|
public void AppPlatform(int platform) {
|
||||||
if (platform == JGYUtils.MTKPlatform) {
|
if (platform == JGYUtils.MTKPlatform) {
|
||||||
set.add(JGYUtils.MTKTag);
|
set.add(JGYUtils.MTKTag);
|
||||||
} else if (platform == JGYUtils.ZhanruiPlatform) {
|
} else if (platform == JGYUtils.ZhanruiPlatform) {
|
||||||
|
|||||||
@@ -76,10 +76,11 @@ public class MainSContact {
|
|||||||
void getSnTimeControl();
|
void getSnTimeControl();
|
||||||
/*获取电子书包激活码*/
|
/*获取电子书包激活码*/
|
||||||
void getEBagCode();
|
void getEBagCode();
|
||||||
/*获取屏幕锁状态*/
|
|
||||||
void getScreenLockState();
|
|
||||||
/*获取wifi密码*/
|
/*获取wifi密码*/
|
||||||
void getWiFiPasswd();
|
void getWiFiPasswd();
|
||||||
|
|
||||||
|
/*获取屏幕锁状态*/
|
||||||
|
void getScreenLockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface MainView extends BaseView {
|
public interface MainView extends BaseView {
|
||||||
@@ -149,9 +150,10 @@ public class MainSContact {
|
|||||||
void getSnTimeControlFinish();
|
void getSnTimeControlFinish();
|
||||||
/*获取电子书包激活码*/
|
/*获取电子书包激活码*/
|
||||||
void getEBagCodeFinish();
|
void getEBagCodeFinish();
|
||||||
/*设置屏幕锁状态结束*/
|
|
||||||
void setScreenLockStateFinish(boolean locked, String tips);
|
|
||||||
/*获取wifi密码结束*/
|
/*获取wifi密码结束*/
|
||||||
void setWiFiPasswd();
|
void setWiFiPasswd();
|
||||||
|
|
||||||
|
/*设置屏幕锁状态结束*/
|
||||||
|
void setScreenLockStateFinish(boolean locked, String tips);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -444,16 +444,6 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getScreenLockState() {
|
|
||||||
NetInterfaceManager.getInstance().getScreenLockState(true, getLifecycle(), new NetInterfaceManager.ScreenLockStateListener() {
|
|
||||||
@Override
|
|
||||||
public void setScreenLockState(boolean locked, String tips) {
|
|
||||||
mView.setScreenLockStateFinish(locked, tips);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getWiFiPasswd() {
|
public void getWiFiPasswd() {
|
||||||
NetInterfaceManager.getInstance()
|
NetInterfaceManager.getInstance()
|
||||||
@@ -464,4 +454,15 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getScreenLockState() {
|
||||||
|
NetInterfaceManager.getInstance().getScreenLockState(true, getLifecycle(), new NetInterfaceManager.ScreenLockStateListener() {
|
||||||
|
@Override
|
||||||
|
public void setScreenLockState(boolean locked, String tips) {
|
||||||
|
mView.setScreenLockStateFinish(locked, tips);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -986,7 +986,12 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getEBagCodeFinish() {
|
public void getEBagCodeFinish() {
|
||||||
mPresenter.getScreenLockState();
|
mPresenter.getWiFiPasswd();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setWiFiPasswd() {
|
||||||
|
Log.e(TAG, "setWiFiPasswd: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1009,8 +1014,5 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
mPresenter.getWiFiPasswd();
|
mPresenter.getWiFiPasswd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWiFiPasswd() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ public class CacheUtils {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public boolean cleanApplicationUserData(Context context, String packageName) throws Exception {
|
public boolean cleanApplicationUserData(Context context, String packageName) throws Exception {
|
||||||
|
Log.e(TAG, "cleanApplicationUserData: " + packageName);
|
||||||
try {
|
try {
|
||||||
PackageDataObserver observer = new PackageDataObserver();
|
PackageDataObserver observer = new PackageDataObserver();
|
||||||
// wait on observer
|
// wait on observer
|
||||||
@@ -133,6 +134,5 @@ public class CacheUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,16 @@ package com.aoleyun.sn.utils;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
import static com.google.gson.JsonParser.parseString;
|
|
||||||
|
|
||||||
public class GsonUtils {
|
public class GsonUtils {
|
||||||
public static JsonObject getJsonObject(String jsonString) {
|
public static JsonObject getJsonObject(String jsonString) {
|
||||||
JsonObject jsonObject = parseString(new Gson().toJson(jsonString)).getAsJsonObject();
|
JsonObject jsonObject = JsonParser.parseString(jsonString).getAsJsonObject();
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1584,17 +1584,17 @@ public class JGYUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface GetAppPlatformCallback {
|
public interface GetAppPlatformCallback {
|
||||||
void getAppPlatform(int platform);
|
void AppPlatform(int platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAppPlatform(GetAppPlatformCallback getAppPlatformCallback) {
|
public void getAppPlatform(GetAppPlatformCallback getAppPlatformCallback) {
|
||||||
String platform = BuildConfig.platform;
|
String platform = BuildConfig.platform;
|
||||||
if ("MTK".equalsIgnoreCase(platform)) {
|
if ("MTK".equalsIgnoreCase(platform)) {
|
||||||
getAppPlatformCallback.getAppPlatform(MTKPlatform);
|
getAppPlatformCallback.AppPlatform(MTKPlatform);
|
||||||
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
|
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
|
||||||
getAppPlatformCallback.getAppPlatform(ZhanruiPlatform);
|
getAppPlatformCallback.AppPlatform(ZhanruiPlatform);
|
||||||
} else {
|
} else {
|
||||||
getAppPlatformCallback.getAppPlatform(UnknowPlatform);
|
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ public class SysSettingUtils {
|
|||||||
}
|
}
|
||||||
JSONObject jsonObject = JSON.parseObject(jsonObj);
|
JSONObject jsonObject = JSON.parseObject(jsonObj);
|
||||||
setPhoneList(context, jsonObject);
|
setPhoneList(context, jsonObject);
|
||||||
setUSBstate(context, jsonObject);
|
|
||||||
setBluetooth(context, jsonObject);
|
setBluetooth(context, jsonObject);
|
||||||
setHotspot(context, jsonObject);
|
setHotspot(context, jsonObject);
|
||||||
setBar(context, jsonObject);
|
setBar(context, jsonObject);
|
||||||
@@ -55,20 +54,8 @@ public class SysSettingUtils {
|
|||||||
SPUtils.put(context, JGYActions.ACTION_STATUSBAR_STATUS, jsonObject.getJSONObject("setting_nav").toJSONString());
|
SPUtils.put(context, JGYActions.ACTION_STATUSBAR_STATUS, jsonObject.getJSONObject("setting_nav").toJSONString());
|
||||||
setStatusBar(context, navJson);
|
setStatusBar(context, navJson);
|
||||||
setBrowserInput(context, jsonObject);
|
setBrowserInput(context, jsonObject);
|
||||||
//otg开关
|
// TODO: 2022/4/11 不是酷比定制的会报错,无法抛出异常
|
||||||
// int setting_otg = changeNum(jsonObject.getInteger("setting_otg"));
|
setUSBstate(context, jsonObject);
|
||||||
// Log.e(TAG, "setting_otg---------" + setting_otg);
|
|
||||||
// String otgStatus = "";
|
|
||||||
// switch (setting_otg) {
|
|
||||||
// case 0:
|
|
||||||
// otgStatus = "qch_otg_open";
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
// otgStatus = "qch_otg_forbid";
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// Intent otgIntent = new Intent(otgStatus);
|
|
||||||
// sendBroadcast(otgIntent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -194,7 +181,6 @@ public class SysSettingUtils {
|
|||||||
String setting_usb = jsonObject.getString("setting_usb");
|
String setting_usb = jsonObject.getString("setting_usb");
|
||||||
if (!BuildConfig.DEBUG) {
|
if (!BuildConfig.DEBUG) {
|
||||||
SuperPower mService = (SuperPower) context.getSystemService("mdm");
|
SuperPower mService = (SuperPower) context.getSystemService("mdm");
|
||||||
try {
|
|
||||||
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", setting_usb);
|
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", setting_usb);
|
||||||
Log.e("setUSBstate", "aole_usb_choose---------" + aole_usb_choose);
|
Log.e("setUSBstate", "aole_usb_choose---------" + aole_usb_choose);
|
||||||
String usbStatus = "";
|
String usbStatus = "";
|
||||||
@@ -214,9 +200,6 @@ public class SysSettingUtils {
|
|||||||
}
|
}
|
||||||
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
||||||
context.sendBroadcast(usbIntent);
|
context.sendBroadcast(usbIntent);
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "setUSBstate: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -928,22 +928,6 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取电量
|
|
||||||
*
|
|
||||||
* @param mContext
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
synchronized private static int getBatteryLevel(Context mContext) {
|
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
|
||||||
return ((BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE)).getIntProperty(4);
|
|
||||||
} else {
|
|
||||||
Intent intent = (new ContextWrapper(mContext)).registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
|
|
||||||
return intent.getIntExtra("level", -1) * 100 / intent.getIntExtra("scale", -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新应用白名单禁止升级
|
* 更新应用白名单禁止升级
|
||||||
*
|
*
|
||||||
@@ -1269,6 +1253,7 @@ public class Utils {
|
|||||||
jsonObject.put("charging", charging);
|
jsonObject.put("charging", charging);
|
||||||
jsonObject.put("memory", memory);
|
jsonObject.put("memory", memory);
|
||||||
jsonObject.put("storage", storage);
|
jsonObject.put("storage", storage);
|
||||||
|
jsonObject.put("battery_capacity", Utils.getBatterymAh(context));
|
||||||
jsonObject.put("CPU", CPU + "核");
|
jsonObject.put("CPU", CPU + "核");
|
||||||
String jsonString = jsonObject.toJSONString();
|
String jsonString = jsonObject.toJSONString();
|
||||||
Log.e(TAG, "getHardware: " + jsonString);
|
Log.e(TAG, "getHardware: " + jsonString);
|
||||||
@@ -1312,6 +1297,36 @@ public class Utils {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double getBatterymAh(Context context) {
|
||||||
|
Object mPowerProfile;
|
||||||
|
double batteryCapacity = 0; //电池的容量mAh
|
||||||
|
final String POWER_PROFILE_CLASS = "com.android.internal.os.PowerProfile";
|
||||||
|
try {
|
||||||
|
mPowerProfile = Class.forName(POWER_PROFILE_CLASS).getConstructor(Context.class).newInstance(context);
|
||||||
|
batteryCapacity = (double) Class.forName(POWER_PROFILE_CLASS).getMethod("getBatteryCapacity").invoke(mPowerProfile);
|
||||||
|
Log.e("getBattery", "battery mAh: " + batteryCapacity);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("getBattery", "get batteryCapacity mAh error:" + batteryCapacity);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return batteryCapacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取电量
|
||||||
|
*
|
||||||
|
* @param mContext
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
synchronized private static int getBatteryLevel(Context mContext) {
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
return ((BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE)).getIntProperty(4);
|
||||||
|
} else {
|
||||||
|
Intent intent = (new ContextWrapper(mContext)).registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
|
||||||
|
return intent.getIntExtra("level", -1) * 100 / intent.getIntExtra("scale", -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static int getBatteryPercentage(Context context) {
|
public static int getBatteryPercentage(Context context) {
|
||||||
|
|
||||||
IntentFilter iFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
|
IntentFilter iFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
|
||||||
|
|||||||
Reference in New Issue
Block a user