version:m40se 2.9.2

fix:修复m40se 管控失效问题,修复魔术appsd卡问题
update:优化网络请求
This commit is contained in:
2023-01-13 17:55:33 +08:00
parent 74a0f631e2
commit d7f0daa80c
12 changed files with 163 additions and 21 deletions

View File

@@ -73,8 +73,8 @@ android {
official {
flavorDimensions "default"
versionCode 28
versionName "2.8"
versionCode 32
versionName "2.9.2"
}
}

View File

@@ -0,0 +1,13 @@
package com.fuying.sn.bean;
import java.io.Serializable;
public class SnBindState implements Serializable {
private static final long serialVersionUID = -4362927257861677376L;
int is_bind;
public int getIs_bind() {
return is_bind;
}
}

View File

@@ -28,6 +28,8 @@ public class CommonConfig {
public static final String KEY_IS_CONTROL = "is_control_key";
public static final String DEVICES_IS_BIND_KEY = "is_bind_state";
/**
* 管控系统指令
*/

View File

@@ -10,16 +10,15 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import com.google.gson.JsonObject;
import com.tencent.mmkv.MMKV;
import com.fuying.sn.BuildConfig;
import com.fuying.sn.bean.SystemSettings;
import com.fuying.sn.config.CommonConfig;
import com.fuying.sn.utils.ApkUtils;
import com.fuying.sn.gson.GsonUtils;
import com.fuying.sn.utils.ApkUtils;
import com.fuying.sn.utils.JGYUtils;
import com.fuying.sn.utils.SPUtils;
import com.fuying.sn.utils.ToastUtil;
import com.google.gson.JsonObject;
import com.tencent.mmkv.MMKV;
import java.util.Arrays;
import java.util.HashSet;
@@ -79,7 +78,7 @@ public class ControlManager {
setHotspot(systemSettings);
setBar(systemSettings);
setCamera(systemSettings);
setTF(systemSettings);
// setTF(systemSettings);
setIcon(systemSettings);
setCanReset(systemSettings);
setDeveloperOptions(systemSettings);
@@ -109,7 +108,7 @@ public class ControlManager {
setHotspot(systemSettings);
setBar(systemSettings);
setCamera(systemSettings);
setTF(systemSettings);
// setTF(systemSettings);
setIcon(systemSettings);
setCanReset(systemSettings);
setDeveloperOptions(systemSettings);
@@ -126,13 +125,14 @@ public class ControlManager {
*/
public void setDisableSetting() {
Log.e("setDisableSetting", "Close all settings: ");
//蓝牙投屏gps热点默认打开 USB默认关闭
setUSBstate(1);
setScreenShared(0);
setPhoneList(1);
setBluetooth(0);
setHotspot(0);
setCamera(1);
setTF(1);
// setTF(1);
setIcon(1);
setWallpaper(0);
setCanReset(1);
@@ -243,9 +243,14 @@ public class ControlManager {
boolean aole_white_list_Array = Settings.System.putString(mResolver, CommonConfig.AOLE_ACTION_WHITE_LIST_ARRAY, setting_phones);
Log.e("SystemSetting", "aole_white_list_Array: " + aole_white_list_Array + "=" + setting_phones);
int setting_memory = changeNum(settings.getSetting_memory());
boolean aole_sdcard_forbid_on = Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, setting_memory);
Log.e("SystemSetting", "aole_sdcard_forbid_on: " + setting_memory);
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, 0);
} else {
int setting_memory = changeNum(settings.getSetting_memory());
boolean aole_sdcard_forbid_on = Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, setting_memory);
Log.e("SystemSetting", "aole_sdcard_forbid_on: " + setting_memory);
}
}
private void setPhoneList(int state) {
@@ -260,14 +265,19 @@ public class ControlManager {
boolean aole_white_list_Array = Settings.System.putString(mResolver, CommonConfig.AOLE_ACTION_WHITE_LIST_ARRAY, "");
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+aole_white_list_Array+"---"+qch_call_forbid);
Log.e(TAG, "aole_white_list_Array:" + aole_white_list_Array + "---" + aole_white_list_Array);
boolean aole_sdcard_forbid_on = Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, state);
Log.e(TAG, "aole_sdcard_forbid_on:" + aole_sdcard_forbid_on);
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, 0);
} else {
boolean aole_sdcard_forbid_on = Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, state);
Log.e(TAG, "aole_sdcard_forbid_on:" + aole_sdcard_forbid_on);
}
} catch (Exception e) {
Log.e(TAG, "setPhoneList: " + e.getMessage());
}
}
// TODO: 2023/1/13 目前有定义反的是投屏,蓝牙,热点
private void setBluetooth(SystemSettings settings) {
try {
//蓝牙开关
@@ -277,9 +287,13 @@ public class ControlManager {
//蓝牙音频开关
int setting_bluetooth = changeNum(settings.getSetting_bluetooth());
//蓝牙传输开关
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
setting_bht = changeNum(setting_bht);
}
boolean aole_bht_forbid_on = Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_BHT_FORBID_ON, setting_bht);
//写入系统数据库
Log.e("SystemSetting", "aole_bht_forbid_on:" + aole_bht_forbid_on);
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (aole_bht_forbid_on) {
//成功
@@ -313,6 +327,9 @@ public class ControlManager {
private void setBluetooth(int state) {
try {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
state = changeNum(state);
}
boolean aole_bht_forbid_on = Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_BHT_FORBID_ON, state);
//写入系统数据库
Log.e(TAG, "aole_bht_forbid_on:" + aole_bht_forbid_on);
@@ -337,6 +354,9 @@ public class ControlManager {
private void setHotspot(SystemSettings settings) {
try {
int setting_hotspot = changeNum(settings.getSetting_hotspot());//热点
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
setting_hotspot = changeNum(setting_hotspot);
}
if (setting_hotspot == 1) {
Intent intent = new Intent();
intent.setAction("qch_hotspot_close");
@@ -352,6 +372,9 @@ public class ControlManager {
}
private void setHotspot(int state) {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
state = changeNum(state);
}
try {
Intent intent = new Intent();
intent.setAction("qch_hotspot_close");
@@ -669,6 +692,7 @@ public class ControlManager {
ToastUtil.debugShow("打开开发者模式");
}
}
setUSBstate("usb_mtp");
closeSettingsApp();
}
@@ -698,6 +722,7 @@ public class ControlManager {
ToastUtil.debugShow("打开开发者模式");
}
}
setUSBstate("usb_mtp");
closeSettingsApp();
}
@@ -802,6 +827,9 @@ public class ControlManager {
}
public void setScreenShared(int state) {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
state = changeNum(state);
}
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SCREEN_SHARE, state);
}

View File

@@ -29,6 +29,7 @@ import com.fuying.sn.bean.Label;
import com.fuying.sn.bean.MyAppUsageBean;
import com.fuying.sn.bean.OverallAppBean;
import com.fuying.sn.bean.ScreenPassword;
import com.fuying.sn.bean.SnBindState;
import com.fuying.sn.bean.SnInfo;
import com.fuying.sn.bean.SystemSettingsSet;
import com.fuying.sn.bean.UserAvatarInfo;
@@ -73,6 +74,7 @@ import com.fuying.sn.network.api.SNInfoApi;
import com.fuying.sn.network.api.ScreenLock;
import com.fuying.sn.network.api.ScreenState;
import com.fuying.sn.network.api.Setting;
import com.fuying.sn.network.api.SnBindApi;
import com.fuying.sn.network.api.TimeControl;
import com.fuying.sn.network.api.UpdateAdminSn;
import com.fuying.sn.network.api.UpdateLockScreen;
@@ -455,6 +457,13 @@ public class NetInterfaceManager {
.observeOn(AndroidSchedulers.mainThread());
}
public Observable<BaseResponse<SnBindState>> getSnBindObservable() {
return mRetrofit.create(SnBindApi.class)
.getSnBind(Utils.getSerial())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
/*
*
* execution
@@ -2080,10 +2089,16 @@ public class NetInterfaceManager {
public void onNext(BaseResponse<SystemSettingsSet> systemSettingsBaseResponse) {
Log.e("getSystemSettings", "onNext: " + systemSettingsBaseResponse);
SPUtils.put(mContext, "is_first_connection", 0);
//imei是否绑定
int is_bind = mMMKV.decodeInt(CommonConfig.DEVICES_IS_BIND_KEY, 0);
int code = systemSettingsBaseResponse.code;
if (code == 200) {
String data = new Gson().toJson(systemSettingsBaseResponse.data.getUser());
ControlManager.getInstance().setSystemSetting(data);
if (is_bind == 1) {
if (code == 200) {
String data = new Gson().toJson(systemSettingsBaseResponse.data.getUser());
ControlManager.getInstance().setSystemSetting(data);
} else {
ControlManager.getInstance().setDisableSetting();
}
} else {
ControlManager.getInstance().setDisableSetting();
}

View File

@@ -28,6 +28,8 @@ public class UrlAddress {
/*绑定设备消息*/
public final static String BIND_DEVICES = "sn/bindSn";
public final static String GET_SN_BIND = "sn/getSnBind";
/*获取批次*/
public static final String GET_BATCH = "sn/getBatch";
/*设备信息接口*/

View File

@@ -0,0 +1,16 @@
package com.fuying.sn.network.api;
import com.fuying.sn.bean.BaseResponse;
import com.fuying.sn.bean.SnBindState;
import com.fuying.sn.network.UrlAddress;
import io.reactivex.rxjava3.core.Observable;
import retrofit2.http.GET;
import retrofit2.http.Query;
public interface SnBindApi {
@GET(UrlAddress.GET_SN_BIND)
Observable<BaseResponse<SnBindState>> getSnBind(
@Query("sn") String sn
);
}

View File

@@ -18,6 +18,7 @@ public class MainSContact {
void setLockScreenPwd();
void setAppInside();
void setForceInstall();
void setSnBind();
void setSystemSettings();
void setBrowserLabel();
void setBrowserWhiteList();
@@ -56,6 +57,8 @@ public class MainSContact {
void getForceInstall();
//获取id管控
void getAppInside();
//获取设备绑定状态
void getSnBind();
//获取系统设置
void getSystemSettings();
//获取浏览器书签

View File

@@ -8,6 +8,7 @@ import android.util.Log;
import com.fuying.sn.bean.AppStart;
import com.fuying.sn.bean.BaseResponse;
import com.fuying.sn.bean.MyAppUsageBean;
import com.fuying.sn.bean.SnBindState;
import com.fuying.sn.config.CommonConfig;
import com.fuying.sn.desktop.RunningAppManager;
import com.fuying.sn.disklrucache.CacheHelper;
@@ -26,6 +27,7 @@ import com.trello.rxlifecycle4.android.ActivityEvent;
import java.util.List;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.schedulers.Schedulers;
@@ -207,6 +209,42 @@ public class MainSPresenter implements MainSContact.Presenter {
});
}
@Override
public void getSnBind() {
NetInterfaceManager.getInstance().getSnBindObservable()
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribe(new Observer<BaseResponse<SnBindState>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getSnBind", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<SnBindState> snBindStateBaseResponse) {
Log.e("getSnBind", "onNext: " + snBindStateBaseResponse);
if (snBindStateBaseResponse.code == 200) {
SnBindState snBindState = snBindStateBaseResponse.data;
int is_bind = snBindState.getIs_bind();
mMMKV.encode(CommonConfig.DEVICES_IS_BIND_KEY, is_bind);
} else {
mMMKV.encode(CommonConfig.DEVICES_IS_BIND_KEY, 0);
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getSnBind", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getSnBind", "onComplete: ");
mView.setSnBind();
}
});
}
@Override
public void getSystemSettings() {
NetInterfaceManager.getInstance()

View File

@@ -122,7 +122,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
Handler.getMain().postDelayed(new Runnable() {
@Override
public void run() {
NetInterfaceManager.getInstance().updateAdminInfo();
// NetInterfaceManager.getInstance().updateAdminInfo();
if (JGYUtils.getInstance().isScreenOn()) {
mPresenter.getSnInfo();
mPresenter.getAppAndWhite();
@@ -155,10 +155,17 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
mPresenter.setLifecycle(lifecycleSubject);
mPresenter.attachView(this);
// if (BuildConfig.DEBUG){
// Settings.Global.putInt(getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
// Settings.Global.putInt(getContentResolver(), Settings.Global.ADB_ENABLED, 1);
// Settings.System.putInt(getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
// }
Log.e(TAG, "onCreate run: 20秒后请求网络");
Handler.getMain().postDelayed(new Runnable() {
@Override
public void run() {
Log.e("TimeObserver", "run: "+NetStateUtils.isNetworkConnected(MainService.this) );
if (NetStateUtils.isNetworkConnected(MainService.this)) {
NetInterfaceManager.getInstance().getAppWhiteList(() -> {
Log.e("TimeObserver", "onNext: getAppWhiteList");
@@ -499,10 +506,12 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
}
//设备没有绑定
else if (code == 300) {
NetInterfaceManager.getInstance().updateAdminInfo();
ControlManager.getInstance().setDisableSetting();
}
//没有授权的设备
else if (code == 401) {
NetInterfaceManager.getInstance().updateAdminInfo();
ControlManager.getInstance().setDisableSetting();
}
}
@@ -543,6 +552,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
@Override
public void setAppInside() {
mPresenter.getSnBind();
}
@Override
public void setSnBind() {
mPresenter.getSystemSettings();
}

View File

@@ -916,6 +916,9 @@ public class MessageReceiver extends XGPushBaseReceiver {
}
JsonObject extra = GsonUtils.getJsonObject(jsonString);
int is_bluetooth = changeNum(extra.get("setting_bht").getAsInt());
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
is_bluetooth = changeNum(is_bluetooth);
}
Log.e(TAG, "aole_bht_forbid_on: " + is_bluetooth);
try {
//写入系统数据库
@@ -1393,6 +1396,9 @@ public class MessageReceiver extends XGPushBaseReceiver {
private void setHotspot(Context context, String jsonString) {
JsonObject jsonObject = GsonUtils.getJsonObject(jsonString);
int setting_hotspot = changeNum(jsonObject.get("setting_hotspot").getAsInt());//热点
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
setting_hotspot = changeNum(setting_hotspot);
}
try {
if (setting_hotspot == 1) {
Intent intent = new Intent();
@@ -1503,6 +1509,9 @@ public class MessageReceiver extends XGPushBaseReceiver {
private void setHotPoint(Context context, String jsonString) {
JsonObject jsonObject = GsonUtils.getJsonObject(jsonString);
int setting_hotspot = changeNum(jsonObject.get("hot_point").getAsInt());//热点
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
setting_hotspot = changeNum(setting_hotspot);
}
try {
if (setting_hotspot == 1) {
Intent intent = new Intent();

View File

@@ -523,7 +523,8 @@ public class JGYUtils {
}
public static String getCustomVersion() {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform) {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform
||JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
return getProperty("ro.build.display.id", "获取失败");
} else {
return getProperty("ro.custom.build.version", "获取失败");
@@ -531,7 +532,8 @@ public class JGYUtils {
}
public static String getRomVersion() {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform) {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform
||JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) {
return getProperty("ro.build.id", "获取失败");
} else {
return getProperty("ro.build.display.id", "获取失败");