version:zhanrui 6.3.1,MTK 2.3.1

fix:讯飞输入法加入白名单
update:接口优化,bug修复
This commit is contained in:
2023-01-07 16:44:01 +08:00
parent 5da1be5d70
commit 8d0579a0f5
11 changed files with 145 additions and 180 deletions

View File

@@ -82,16 +82,16 @@ android {
//酷比魔方
cube {
flavorDimensions "default"
versionCode 60
versionName "6.2.11.23"
versionCode 71
versionName "6.3.1"
buildConfigField "String", "platform", '"ZhanRuiCube"'
}
//MTK
MTKnewly {
flavorDimensions "default"
versionCode 33
versionName "2.2.11.23"
versionCode 41
versionName "2.3.1"
buildConfigField "String", "platform", '"MTK"'
}
}

View File

@@ -14,6 +14,7 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
@@ -164,7 +165,9 @@ public class SplashActivity extends AppCompatActivity {
String only_jgy_shortcut_list = Settings.System.getString(getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST);
Log.i(TAG, "debugTest: only_jgy_shortcut_list:" + only_jgy_shortcut_list);
String aole_app_forbid = Settings.System.getString(getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID);
Settings.System.putString(getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid + ",com.aoleyun.browser");
if (!TextUtils.isEmpty(aole_app_forbid)) {
Settings.System.putString(getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid + ",com.aoleyun.browser");
}
Log.e(TAG, "debugTest: aole_app_forbid:" + aole_app_forbid);
Log.i(TAG, "debugTest: ip = " + JGYUtils.getInstance().getIPAddress());
Log.i(TAG, "debugTest: getPackage = " + Utils.getPackage());

View File

@@ -287,7 +287,6 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
public void onServiceConnected(ComponentName name, IBinder service) {
Log.e(TAG, "onServiceConnected: ");
mMainBinder = (MainService.MainBinder) service;
mMainBinder.getService().getLockedState();
}
@Override
@@ -338,22 +337,22 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
settradeType(trade_type);
if (TextUtils.isEmpty(sno)) {
setNumberText("", View.GONE);
setNumberText("未设置", View.GONE);
} else {
setNumberText(sno, View.VISIBLE);
}
if (TextUtils.isEmpty(realname)) {
setNameText("", View.GONE);
setNameText("未设置", View.GONE);
} else {
setNameText(realname, View.VISIBLE);
}
if (TextUtils.isEmpty(classes)) {
setClassText("", View.GONE);
setClassText("未设置", View.GONE);
} else {
setClassText(classes, View.VISIBLE);
}
if (TextUtils.isEmpty(batch)) {
setBatchText("", View.GONE);
setBatchText("未设置", View.GONE);
} else {
setBatchText(batch, View.VISIBLE);
}

View File

@@ -115,37 +115,37 @@ public class ConnectManager {
/**
* @return 重启后是否连接
*/
public boolean isRebootFistConnect() {
long rebootTime = mMMKV.decodeLong(REBOOT_LAST_ONNECT_TIME, 0);
//只在开机后15内连接其他情况为service重启
long time = System.currentTimeMillis() - rebootTime;
return time < 15 * 1000;
}
// public boolean isRebootFistConnect() {
// long rebootTime = mMMKV.decodeLong(REBOOT_LAST_ONNECT_TIME, 0);
// //只在开机后15内连接其他情况为service重启
// long time = System.currentTimeMillis() - rebootTime;
// return time < 15 * 1000;
// }
/**
* @return 今天WiFi连接是否有连接
*/
public boolean isWiFiFistConnect() {
long time = mMMKV.decodeLong(WIFI_LAST_CONNECT_TIME, 0);
return !TimeUtils.isTodayTime(time);
}
// public boolean isWiFiFistConnect() {
// long time = mMMKV.decodeLong(WIFI_LAST_CONNECT_TIME, 0);
// return !TimeUtils.isTodayTime(time);
// }
/**
* @return 今天打开设备信息后是否连接
*/
public boolean isOpenInfoFistConnect() {
long time = mMMKV.decodeLong(OPENINFO_LAST_ONNECT_TIME, 0);
return !TimeUtils.isTodayTime(time);
}
// public boolean isOpenInfoFistConnect() {
// long time = mMMKV.decodeLong(OPENINFO_LAST_ONNECT_TIME, 0);
// return !TimeUtils.isTodayTime(time);
// }
/**
* @param WiFiAlias
* @return 今天切换WiFi后是否连接
*/
public boolean isWiFiCutoverFistConnect(String WiFiAlias) {
long time = mMMKV.decodeLong(WiFiAlias, 0);
return !TimeUtils.isTodayTime(time);
}
// public boolean isWiFiCutoverFistConnect(String WiFiAlias) {
// long time = mMMKV.decodeLong(WiFiAlias, 0);
// return !TimeUtils.isTodayTime(time);
// }
}

View File

@@ -699,9 +699,9 @@ public class NetInterfaceManager {
}
synchronized public void checkAoleyunUpdate(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.SIX_HOUR;
ConnectMode connectMode = ConnectMode.ONE_HOUR;
if (refresh) {
connectMode = ConnectMode.ONE_HOUR;
connectMode = ConnectMode.ONE_MINUTE;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.CHECK_UPDATE, connectMode)) {
checkAoleyunUpdate(lifecycle, callback);
@@ -715,9 +715,11 @@ public class NetInterfaceManager {
Type listType = new TypeToken<List<AppUpdateInfo>>() {
}.getType();
List<AppUpdateInfo> appUpdateInfos = gson.fromJson(jsonString, listType);
for (AppUpdateInfo info : appUpdateInfos) {
JsonObject jsonObject = parseString(new Gson().toJson(info)).getAsJsonObject();
JGYUtils.getInstance().installAPK(jsonObject);
if (appUpdateInfos!=null&&appUpdateInfos.size()!=0) {
for (AppUpdateInfo info : appUpdateInfos) {
JsonObject jsonObject = parseString(new Gson().toJson(info)).getAsJsonObject();
JGYUtils.getInstance().installAPK(jsonObject);
}
}
callback.onComplete();
}
@@ -777,11 +779,15 @@ public class NetInterfaceManager {
@Override
public void onNext(@NonNull List<AppUpdateInfo> appUpdateInfos) {
String jsonString = GsonUtils.toJSONString(appUpdateInfos);
cacheHelper.put(UrlAddress.CHECK_UPDATE, jsonString);
Log.e("checkAoleyunUpdate", "onNext: " + jsonString);
for (AppUpdateInfo info : appUpdateInfos) {
JsonObject jsonObject = parseString(new Gson().toJson(info)).getAsJsonObject();
JGYUtils.getInstance().installAPK(jsonObject);
if (appUpdateInfos != null && appUpdateInfos.size() != 0) {
cacheHelper.put(UrlAddress.CHECK_UPDATE, jsonString);
for (AppUpdateInfo info : appUpdateInfos) {
JsonObject jsonObject = parseString(new Gson().toJson(info)).getAsJsonObject();
JGYUtils.getInstance().installAPK(jsonObject);
}
} else {
cacheHelper.put(UrlAddress.CHECK_UPDATE, "");
}
}
@@ -816,9 +822,9 @@ public class NetInterfaceManager {
* 获取灰度测试更新
*/
public void checkTestUpdate(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.SIX_HOUR;
ConnectMode connectMode = ConnectMode.ONE_HOUR;
if (refresh) {
connectMode = ConnectMode.ONE_HOUR;
connectMode = ConnectMode.ONE_MINUTE;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_SN_APP_TEST, connectMode)) {
checkTestUpdate(lifecycle, callback);
@@ -879,7 +885,7 @@ public class NetInterfaceManager {
public void getForceDownload(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.ONE_MINUTE;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_FORCE_INSTALL_LIST, connectMode)) {
getForceDownload(lifecycle, callback);
@@ -921,7 +927,7 @@ public class NetInterfaceManager {
.subscribe(getForceDownloadObserver(null));
}
private Observer getForceDownloadObserver(onCompleteCallback callback) {
private Observer<BaseResponse<List<ForceDownloadData>>> getForceDownloadObserver(onCompleteCallback callback) {
return new Observer<BaseResponse<List<ForceDownloadData>>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
@@ -932,7 +938,7 @@ public class NetInterfaceManager {
public void onNext(@NonNull BaseResponse<List<ForceDownloadData>> forceDownloadBean) {
Log.e("getForceDownload", "onNext: " + forceDownloadBean);
if (forceDownloadBean.code == OK) {
cacheHelper.getAsString(UrlAddress.GET_FORCE_INSTALL_LIST);
Log.e("getForceDownload", "onNext: getAsString: "+cacheHelper.getAsString(UrlAddress.GET_FORCE_INSTALL_LIST) );
List<ForceDownloadData> forceDownloadData = forceDownloadBean.data;
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, GsonUtils.toJSONString(forceDownloadData));
Aria.download(this).resumeAllTask();
@@ -970,7 +976,7 @@ public class NetInterfaceManager {
public void getDefaultDesktop(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.ONE_MINUTE;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_DESKTOP, connectMode)) {
getDefaultDesktop(lifecycle, callback);
@@ -1005,7 +1011,7 @@ public class NetInterfaceManager {
.subscribe(getDefaultDesktopObserver(null));
}
public Observer getDefaultDesktopObserver(onCompleteCallback callback) {
public Observer<BaseResponse<ForceDownloadData>> getDefaultDesktopObserver(onCompleteCallback callback) {
return new Observer<BaseResponse<ForceDownloadData>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
@@ -1066,9 +1072,9 @@ public class NetInterfaceManager {
public void setLogoImg(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
ConnectMode connectMode = ConnectMode.HALF_DAY;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.SIX_HOUR;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_LOGO_IMG, connectMode)) {
setLogoImg(lifecycle, callback);
@@ -1140,7 +1146,7 @@ public class NetInterfaceManager {
public void getDeveloper(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.ONE_MINUTE;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_DEVELOPER, connectMode)) {
getDeveloper(lifecycle, callback);
@@ -1204,9 +1210,9 @@ public class NetInterfaceManager {
}
public void getCustomROMApp(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
ConnectMode connectMode = ConnectMode.HALF_DAY;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.SIX_HOUR;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_ROM_APP, connectMode)) {
getCustomROMApp(lifecycle, callback);
@@ -1265,9 +1271,9 @@ public class NetInterfaceManager {
}
public void getDesktopIcon(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
ConnectMode connectMode = ConnectMode.SIX_HOUR;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.ONE_HOUR;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_HIDE_DESKTOPICON, connectMode)) {
getDesktopIcon(lifecycle, callback);
@@ -1382,7 +1388,7 @@ public class NetInterfaceManager {
public void getAppAutoStartUpdateAndNet(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.ONE_MINUTE;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.NET_AND_LAUNCH_API, connectMode)) {
getAppAutoStartUpdateAndNet(lifecycle, callback);
@@ -1658,9 +1664,9 @@ public class NetInterfaceManager {
}
public void getEBagCode(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
ConnectMode connectMode = ConnectMode.HALF_DAY;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.SIX_HOUR;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_EBAG_CODE, connectMode)) {
getEBagCode(lifecycle, callback);
@@ -1812,9 +1818,9 @@ public class NetInterfaceManager {
* @param studesInfoListener
*/
public void getStudesInfo(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, StudesInfoListener studesInfoListener) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
ConnectMode connectMode = ConnectMode.FIFTEEN_MINUTES;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.ONE_MINUTE;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_STUDENTS_INFO, connectMode)) {
getInfo(lifecycle, studesInfoListener);
@@ -1947,7 +1953,7 @@ public class NetInterfaceManager {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.ONE_MINUTE;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.SEND_DEVICES, connectMode)) {
if (macJson.equals(macJsonString)) {
@@ -2009,10 +2015,10 @@ public class NetInterfaceManager {
if (refresh) {
connectMode = ConnectMode.ONE_DAY;
}
if (ConnectManager.getInstance().isNeedConnect(CommonConfig.DEVICES_TAG, connectMode)) {
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_DEVICES_TAGS, connectMode)) {
setPushTags(lifecycle, callback);
} else {
String jsonString = cacheHelper.getAsString(CommonConfig.DEVICES_TAG);
String jsonString = cacheHelper.getAsString(UrlAddress.GET_DEVICES_TAGS);
//为 "" 是已经请求成功的
if (jsonString == null) {
setPushTags(lifecycle, callback);
@@ -2057,7 +2063,7 @@ public class NetInterfaceManager {
public void onNext(@NonNull BaseResponse<Batch> response) {
if (response.code == OK) {
String batch = response.data.getBatch();
cacheHelper.put(CommonConfig.DEVICES_TAG, GsonUtils.toJSONString(response.data));
cacheHelper.put(UrlAddress.GET_DEVICES_TAGS, GsonUtils.toJSONString(response.data));
Log.e(TAG + ":" + "setPushTags", "onNext: " + batch);
if (!TextUtils.isEmpty(batch)) {
set.add(batch);
@@ -2065,7 +2071,7 @@ public class NetInterfaceManager {
Log.e(TAG + ":" + "setPushTags", "onNext: " + "batch empty");
}
} else {
cacheHelper.put(CommonConfig.DEVICES_TAG, "");
cacheHelper.put(UrlAddress.GET_DEVICES_TAGS, "");
Log.e(TAG + ":" + "setPushTags", "onNext: " + response.toString());
}
mMMKV.encode(CommonConfig.DEVICES_TAG, set);
@@ -2148,7 +2154,7 @@ public class NetInterfaceManager {
);
}
private Observer getUpdateDeviceObserver(onCompleteCallback callback) {
private Observer<BaseResponse> getUpdateDeviceObserver(onCompleteCallback callback) {
return new Observer<BaseResponse>() {
@Override
public void onSubscribe(Disposable d) {
@@ -2631,9 +2637,9 @@ public class NetInterfaceManager {
}
public void getAppLimit(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.HALF_HOUR;
ConnectMode connectMode = ConnectMode.HALF_DAY;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.SIX_HOUR;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.SET_WHITE_PACKAGE_LIST, connectMode)) {
getAppLimit(lifecycle, callback);
@@ -2671,7 +2677,7 @@ public class NetInterfaceManager {
.subscribe(getAppLimitObserver(null));
}
private Observer getAppLimitObserver(onCompleteCallback callback) {
private Observer<BaseResponse<AppLimit>> getAppLimitObserver(onCompleteCallback callback) {
return new Observer<BaseResponse<AppLimit>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
@@ -2717,9 +2723,9 @@ public class NetInterfaceManager {
* 获取所有app详细信息
*/
public void getAllAppList(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.HALF_HOUR;
ConnectMode connectMode = ConnectMode.ONE_HOUR;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.HALF_HOUR;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_ALL_APP, connectMode)) {
getAllAppList(lifecycle, callback);
@@ -2945,9 +2951,9 @@ public class NetInterfaceManager {
}
public void getTopApp(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
ConnectMode connectMode = ConnectMode.HALF_DAY;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
connectMode = ConnectMode.SIX_HOUR;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_TOP_APP_CONTROL, connectMode)) {
getTopApp(lifecycle, callback);
@@ -3238,8 +3244,7 @@ public class NetInterfaceManager {
};
}
private static int REQUEST_CODE = 12345;
private static final int REQUEST_CODE = 12345;
public void getRunLog() {
getSnRunLogControl()
@@ -3403,9 +3408,9 @@ public class NetInterfaceManager {
public void sendAppUsedTime(String random, String type) {
StatisticsInfo statisticsInfo = null;
if (type.equals("0")) {
if ("0".equals(type)) {
statisticsInfo = new StatisticsInfo(mContext);
} else if (type.equals("1")) {
} else if ("1".equals(type)) {
statisticsInfo = new StatisticsInfo(mContext, StatisticsInfo.WEEK);
}
List<AppInformation> list = null;
@@ -3506,7 +3511,6 @@ public class NetInterfaceManager {
}
}
public void sendBatteryInfo(BatteryInfo info) {
if (info == null) {
Log.e(TAG, "sendBatteryInfo: " + "BatteryInfo is NULL");

View File

@@ -43,12 +43,12 @@ public class BootReceiver extends BroadcastReceiver {
@Override
public void onNext(Long aLong) {
Log.e("getLockedState", "onNext: ");
if (MainService.mPresenter != null) {
// MainService.mPresenter.getLockedState();
Log.e("getLockedState", "mPresenter: " + "getLockedState");
} else {
Log.e("getLockedState", "mPresenter is NULL");
}
// if (MainService.mPresenter != null) {
//// MainService.mPresenter.getLockedState();
// Log.e("getLockedState", "mPresenter: " + "getLockedState");
// } else {
// Log.e("getLockedState", "mPresenter is NULL");
// }
}
@Override
@@ -82,9 +82,9 @@ public class BootReceiver extends BroadcastReceiver {
SPUtils.put(context, CommonConfig.FIRST_STARTUP, 1);
} else {
LogDBManager.getInstance().creatRebootLog("设备重启", TimeUtils.transferLongToDate(System.currentTimeMillis()));
Intent checkNetintent = new Intent(context, CheckNetActivity.class);
checkNetintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(checkNetintent);
// Intent checkNetintent = new Intent(context, CheckNetActivity.class);
// checkNetintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// context.startActivity(checkNetintent);
}
JGYUtils.startServices(context);
JGYUtils.getInstance().onBootOpenApp();

View File

@@ -64,9 +64,7 @@ public class NewAppReceiver extends BroadcastReceiver {
}
Log.e(TAG, "sendAppInfo: " + state + packageName);
JGYUtils.getInstance().checkDefaultDesktop(packageName);
JGYUtils.getInstance().checkForceDownload();
NetInterfaceManager.getInstance().checkUpdate();
NetInterfaceManager.getInstance().getDefaultDesktop();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (!PackageNames.APPSTORE.equals(packageName) || !PackageNames.DEVICE_INFO.equals(packageName)) {
ApkUtils.addShortcut(context);
@@ -97,6 +95,8 @@ public class NewAppReceiver extends BroadcastReceiver {
@Override
public void onNext(@NonNull String s) {
Log.e(TAG, "sendAppInfo: onNext: " + s);
JGYUtils.getInstance().checkForceDownload();
NetInterfaceManager.getInstance().getDefaultDesktop();
NetInterfaceManager.getInstance().sendInstalledAppInfo(new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {

View File

@@ -267,7 +267,6 @@ public class MainSPresenter implements MainSContact.Presenter {
}
});
}
}
}

View File

@@ -38,7 +38,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.R;
import com.aoleyun.sn.activity.checknet.CheckNetActivity;
import com.aoleyun.sn.activity.main.MainActivity;
import com.aoleyun.sn.bean.PoweroffBean;
import com.aoleyun.sn.comm.CommonConfig;
@@ -88,10 +87,8 @@ import io.reactivex.rxjava3.subjects.BehaviorSubject;
public class MainService extends Service implements MainSContact.MainView, NetworkUtils.OnNetworkStatusChangedListener, LifecycleProvider<ActivityEvent> {
private static final String TAG = MainService.class.getSimpleName();
private String connectKey;
@SuppressLint("StaticFieldLeak")
public static MainSPresenter mPresenter;
public MainSPresenter mPresenter;
private MMKV mMMKV = MMKV.defaultMMKV();
@Override
@@ -102,29 +99,24 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
@Override
public void onConnected(NetworkUtils.NetworkType networkType) {
// Debug.waitForDebugger();
ToastUtil.betaShow("网络已连接");
Aria.download(this).resumeAllTask();
String WiFiAlias = Utils.getWifiAlias(this);
Log.e("OnNetworkStatusChanged", "onConnected: " + WiFiAlias);
Utils.getPublicIP(this);
if (mMMKV.decodeInt(CommonConfig.DEVICES_FRIST_START, 1) == 1) {
Intent intent = new Intent(this, CheckNetActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
if (ConnectManager.getInstance().isWiFiFistConnect()) {
start.onstar(ConnectManager.WIFI_LAST_CONNECT_TIME);
} else {
if (ConnectManager.getInstance().isWiFiCutoverFistConnect(WiFiAlias)) {
start.onstar(WiFiAlias);
}
}
if (!checkAoleyunApp()) {
mPresenter.checkAoleyunUpdate();
}
Utils.getPublicIP(this);
TimeTask task = new TimeTask();
task.execute("ntp.aliyun.com");
mPresenter.getLockedState("onConnected");
if (mMMKV.decodeInt(CommonConfig.DEVICES_FRIST_START, 1) == 1) {
// Intent intent = new Intent(this, CheckNetActivity.class);
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// startActivity(intent);
}
}
private class TimeTask extends AsyncTask<String, Long, Long> {
@@ -245,9 +237,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
if (!oldSSID.equals(newSSID)) {
LogDBManager.getInstance().creatNetChangeLog("", oldSSID + " change to: " + newSSID);
//直接获取数据
if (ConnectManager.getInstance().isWiFiCutoverFistConnect(newSSID)) {
start.onstar(newSSID);
}
} else {
LogDBManager.getInstance().creatNetChangeLog("接入WiFi",
"connect to: " + newSSID + " time: "
@@ -270,45 +259,30 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
}
}
private interface Start {
void onstar(String key);
private RefreshReceiver mRefreshReceiver;
private void registerRefreshReceiver() {
if (mRefreshReceiver == null) {
mRefreshReceiver = new RefreshReceiver();
}
IntentFilter filter = new IntentFilter();
filter.addAction(RefreshReceiver.REFRESH_RECEIVER_ACTION);
registerReceiver(mRefreshReceiver, filter);
}
private Start start;
private ObservableOnSubscribe<String> timeSubscribe = new ObservableOnSubscribe<String>() {
@Override
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
start = emitter::onNext;
}
};
private Observer<String> timeObserver = new Observer<String>() {
@Override
public void onSubscribe(Disposable d) {
Log.e("timeObserver", "onSubscribe: ");
}
public class RefreshReceiver extends BroadcastReceiver {
public static final String REFRESH_RECEIVER_ACTION = "Receiver_Refresh_Action";
@Override
public void onNext(String string) {
connectKey = string;
if (!connectKey.equals(ConnectManager.REBOOT_LAST_ONNECT_TIME)) {
mMMKV.encode(connectKey, System.currentTimeMillis());
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.e("RefreshReceiver", "onReceive: " + action);
if (!TextUtils.isEmpty(action)) {
mPresenter.getLockedState("refresh");
}
Log.e("timeObserver", "onNext: " + string);
mPresenter.getLockedState(string);
}
@Override
public void onError(Throwable e) {
Log.e("timeObserver", "onError: " + e.getMessage());
}
@Override
public void onComplete() {
Log.e("timeObserver", "onComplete: ");
}
};
}
public MainService() {
@@ -327,15 +301,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
}
}
public void getLockedState() {
Log.e(TAG, "getLockedState: MainBinder");
if (!mPresenter.isRequesting()) {
mPresenter.getLockedState("MainBinder");
} else {
Log.e(TAG, "getLockedState: MainSPresenter is requesting now");
}
}
@Override
public void onCreate() {
super.onCreate();
@@ -347,6 +312,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
TimeTask task = new TimeTask();
task.execute("ntp.aliyun.com");
mPresenter.getLockedState("onCreate");
//根据要求卸载这两个应用
if (!JGYUtils.getInstance().getDeviceIsLocked()) {
@@ -360,9 +326,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
Log.e(TAG, "onCreate: " + e.getMessage());
}
Observable.create(timeSubscribe)
.throttleFirst(1, TimeUnit.MINUTES)
.subscribe(timeObserver);
Observable.create(topAppSubscribe)
.throttleFirst(1, TimeUnit.MINUTES)
.subscribe(topAppObserver);
@@ -371,10 +334,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
.subscribe(timeChangedObserver);
if ((int) SPUtils.get(this, CommonConfig.JGY_FIRST_CONNECT, 0) == 0) {
// TODO: 2021/5/26 待底层修改,临时解决办法
Log.e(TAG, "onCreate: " + "Disable All Settings");
SysSettingUtils.setDisableSetting(this);
start.onstar(ConnectManager.REBOOT_LAST_ONNECT_TIME);
// mPresenter.getLockedState(CommonConfig.JGY_FIRST_CONNECT);
}
int oldVersionCode = (int) SPUtils.get(this, CommonConfig.SN_VERSIONCODE, 0);
if (oldVersionCode < BuildConfig.VERSION_CODE) {
@@ -385,12 +347,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
Log.e(TAG, "onReceive: " + e.getMessage());
e.printStackTrace();
}
mPresenter.getLockedState("upgrade");
mPresenter.checkAoleyunUpdate();
// mPresenter.checkAoleyunUpdate();
} else {
if (ConnectManager.getInstance().isRebootFistConnect()) {
start.onstar(ConnectManager.REBOOT_LAST_ONNECT_TIME);
}
}
SPUtils.put(this, CommonConfig.SN_VERSIONCODE, BuildConfig.VERSION_CODE);
registerReceivers();
@@ -399,8 +358,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
timeChangedStart.onstar(System.currentTimeMillis());
setStatusbar();
setFloatingWindow();
notificationManager = NotificationManagerCompat.from(this);
createNotificationChannel();
// notificationManager = NotificationManagerCompat.from(this);
// createNotificationChannel();
}
@Override
@@ -410,7 +369,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
if (mMMKV.decodeInt(CommonConfig.DEVICES_FRIST_START, 1) == 0) {
if (!checkAoleyunApp()) {
Log.e(TAG, "onStartCommand: " + "checkAoleyunApp");
mPresenter.checkAoleyunUpdate();
// mPresenter.checkAoleyunUpdate();
}
}
NetInterfaceManager.getInstance().checkUpdate();
@@ -491,6 +450,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
registerLockScreenReceiver();
registerTimeReceiver();
registerInstallReceiver();
registerRefreshReceiver();
}
private void unRegisterReceivers() {
@@ -506,6 +466,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
if (null != mWifiReceiver) {
unregisterReceiver(mWifiReceiver);
}
if (null != mRefreshReceiver) {
unregisterReceiver(mRefreshReceiver);
}
}
private static WindowManager windowManager;
@@ -882,7 +845,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
Log.e(TAG, "setLockedState: " + loocked);
if (loocked) {
ToastUtil.betaShow("设备已上锁");
sendSimpleNotification();
// sendSimpleNotification();
mPresenter.setPushTags();
mPresenter.getDeveloper();
ApkUtils.UninstallAPP(this, "com.joytv.live");
@@ -902,7 +865,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
if (noTag) {
//没有批次就没有管控
Log.e(TAG, "setTagsFinish: " + "not set tag");
mPresenter.getStudesInfo(true);
// mPresenter.getStudesInfo(true);
} else {
mPresenter.getDeviceBatch();
}

View File

@@ -514,7 +514,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
MMKV.defaultMMKV().clearAll();
JGYUtils.getInstance().cleanAoleAppCache();
JGYUtils.getInstance().wakeUpAoleyunAPP();
MainService.mPresenter.getLockedState("MSG_PUSH_RESET");
sendRefreshBroadcast(context);
break;
case MSG_INSTALL:
ToastUtil.betaShow("收到管控:应用安装");
@@ -620,13 +620,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
case GET_DEVICES_INFO:
ToastUtil.betaShow("收到管控:获取设备信息");
getBatteryInfo(context);
if (MainService.mPresenter != null) {
MainService.mPresenter.getLockedState("XGPush");
MainService.mPresenter.sendMACAddress();
Log.e(TAG, "mPresenter: " + "getLockedState");
} else {
Log.e(TAG, "mPresenter is NULL");
}
sendRefreshBroadcast(context);
LocationClient locationClient = MapManager.getInstance().getLocationClient();
locationClient.stop();
locationClient.start();
@@ -779,12 +773,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
e.printStackTrace();
Log.e(TAG, "setHomepagtag: " + e.getMessage());
}
if (MainService.mPresenter != null) {
MainService.mPresenter.getLockedState("XGPush_RESTORE");
Log.e("getLockedState", "mPresenter: " + "getLockedState");
} else {
Log.e("getLockedState", "mPresenter is NULL");
}
sendRefreshBroadcast(context);
break;
case UPDATE_WIFI_PW:
NetInterfaceManager.getInstance().getWiFiPasswd();
@@ -1442,4 +1431,9 @@ public class MessageReceiver extends XGPushBaseReceiver {
NetInterfaceManager.getInstance().sendBatteryInfo(batteryInfo);
}
private void sendRefreshBroadcast(Context context) {
Intent intent = new Intent(MainService.RefreshReceiver.REFRESH_RECEIVER_ACTION);
context.sendBroadcast(intent);
}
}

View File

@@ -1,6 +1,5 @@
package com.aoleyun.sn.utils;
import android.app.ActivityManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
@@ -739,11 +738,12 @@ public class ApkUtils {
//桌面app
public static List<String> desktopAPP = new ArrayList<String>() {{
this.add("com.aoleyunos.dop1");
this.add("com.aoleyunos.dop2");
// this.add("com.aoleyunos.dop1");
// this.add("com.aoleyunos.dop2");
this.add("com.uiuios.jgy1");
this.add("com.uiuios.jgy2");
this.add("com.android.uiuios");
this.add("com.shoufei.aole");
}};
public static List<String> aoleyunAPP = new ArrayList<String>() {{
@@ -752,6 +752,7 @@ public class ApkUtils {
this.add("com.aoleyun.info");
this.add("com.aoleyun.os");
this.add("com.aoleyun.browser");
this.add("com.aoleyun.browser");
}};
//出厂自带的app
@@ -973,6 +974,8 @@ public class ApkUtils {
this.add("com.creative.strokeprovider");
this.add("com.ckl.oraltraining");
this.add("com.ckl.fcfilemanager");
this.add("com.iflytek.inputmethod");
}};
public static void showAllAPP(Context context) {