6 Commits

Author SHA1 Message Date
055e63d1a0 fix: 修复更改批次不删除原来的app,修复升级会删除公共应用 2026-04-27 16:12:01 +08:00
d955edce80 feat: 增加公共应用写入白名单 2026-04-25 16:02:09 +08:00
4b4daa42cf feat: 显示通知,应用安装之后获取应用管控 2026-04-21 16:44:40 +08:00
5eb341ca72 feat: 增加高通平台 2026-04-10 10:12:42 +08:00
b9c5337032 version:1.6.0403
bugfixes:
add:增加时间管控
2026-04-09 15:43:24 +08:00
2029f7020f version:1.6.0317
bugfixes:修复网络黑白名单报错
add:增加设置菜单管控,增加中性桌面包名
2026-03-18 11:55:44 +08:00
23 changed files with 600 additions and 209 deletions

View File

@@ -29,8 +29,8 @@ android {
defaultConfig { defaultConfig {
applicationId "com.aoleyun.sn" applicationId "com.aoleyun.sn"
versionCode 206 versionCode 214
versionName "1.6.0226" versionName "1.6.0427"
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature. //There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
minSdkVersion 24 minSdkVersion 24
@@ -282,6 +282,20 @@ android {
} }
buildTypes { buildTypes {
QualcommDebug.initWith(debug)
QualcommDebug {
buildConfigField "String", "platform", '"QualcommA"'
versionNameSuffix "-debug"
debuggable true
signingConfig signingConfigs.zhanRui
}
QualcommRelease.initWith(release)
QualcommRelease {
buildConfigField "String", "platform", '"QualcommA"'
signingConfig signingConfigs.zhanRui
}
G128TDebug.initWith(debug) G128TDebug.initWith(debug)
G128TDebug { G128TDebug {
buildConfigField "String", "platform", '"G128T"' buildConfigField "String", "platform", '"G128T"'

View File

@@ -25,7 +25,6 @@ import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.R; import com.aoleyun.sn.R;
import com.aoleyun.sn.activity.main.MainActivity; import com.aoleyun.sn.activity.main.MainActivity;
import com.aoleyun.sn.comm.CommonConfig; import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.comm.PackageNames; import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.network.NetInterfaceManager; import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.service.LogcatService; import com.aoleyun.sn.service.LogcatService;
@@ -101,7 +100,7 @@ public class SplashActivity extends AppCompatActivity {
Utils.getAndroiodScreenProperty(SplashActivity.this); Utils.getAndroiodScreenProperty(SplashActivity.this);
Log.e(TAG, "getOperators: " + NetworkUtils.getOperators(this)); Log.e(TAG, "getOperators: " + NetworkUtils.getOperators(this));
Log.e(TAG, "PublicIP: " + mMMKV.decodeString(NetInterfaceManager.PublicIP, "")); Log.e(TAG, "PublicIP: " + mMMKV.decodeString(NetInterfaceManager.PublicIP, ""));
NetInterfaceManager.GetWhois(); NetInterfaceManager.getWhois();
Log.e(TAG, "initView: " + NetworkUtils.getPhoneNumber(this)); Log.e(TAG, "initView: " + NetworkUtils.getPhoneNumber(this));
FlowInfo flowInfo1 = GetFlowUtil.getAppFlowInfo(BuildConfig.APPLICATION_ID, this); FlowInfo flowInfo1 = GetFlowUtil.getAppFlowInfo(BuildConfig.APPLICATION_ID, this);
Log.e(TAG, "initView: " + GetFlowUtil.byteToMB(flowInfo1.getUpKb())); Log.e(TAG, "initView: " + GetFlowUtil.byteToMB(flowInfo1.getUpKb()));

View File

@@ -0,0 +1,26 @@
package com.aoleyun.sn.bean;
import java.io.Serializable;
public class TimeControlApp implements Serializable {
private static final long serialVersionUID = 5184143240402181001L;
String app_package;
String app_name;
public String getApp_package() {
return app_package;
}
public void setApp_package(String app_package) {
this.app_package = app_package;
}
public String getApp_name() {
return app_name;
}
public void setApp_name(String app_name) {
this.app_name = app_name;
}
}

View File

@@ -0,0 +1,18 @@
package com.aoleyun.sn.bean;
import java.io.Serializable;
import java.util.List;
public class TimeControlData implements Serializable {
private static final long serialVersionUID = 8902745668847718218L;
List<TimeControlInfo> periods;
public List<TimeControlInfo> getPeriods() {
return periods;
}
public void setPeriods(List<TimeControlInfo> periods) {
this.periods = periods;
}
}

View File

@@ -0,0 +1,36 @@
package com.aoleyun.sn.bean;
import java.io.Serializable;
import java.util.List;
public class TimeControlInfo implements Serializable {
private static final long serialVersionUID = 4988631077105878200L;
String start_time;
String end_time;
List<TimeControlApp> app;
public String getStart_time() {
return start_time;
}
public void setStart_time(String start_time) {
this.start_time = start_time;
}
public String getEnd_time() {
return end_time;
}
public void setEnd_time(String end_time) {
this.end_time = end_time;
}
public List<TimeControlApp> getApp() {
return app;
}
public void setApp(List<TimeControlApp> app) {
this.app = app;
}
}

View File

@@ -91,6 +91,9 @@ public class CommonConfig {
/*壁纸地址*/ /*壁纸地址*/
public static final String WALLPAPER_URL_KEY = "wallpaper_url"; public static final String WALLPAPER_URL_KEY = "wallpaper_url";
/*时间管控json*/
public static final String TIME_CONTROL_DATA_KEY = "time_dontrol_data_json_string";
/** /**
* 管控系统指令 * 管控系统指令
@@ -112,6 +115,8 @@ public class CommonConfig {
public final static String AOLE_APP_ALLOW_INSTALL = "aole_app_allow_install"; public final static String AOLE_APP_ALLOW_INSTALL = "aole_app_allow_install";
/*应用安装白名单*/ /*应用安装白名单*/
public final static String AOLE_ACTION_APP_FORBID = "aole_app_forbid"; public final static String AOLE_ACTION_APP_FORBID = "aole_app_forbid";
/*公共应用白名单*/
public final static String AOLE_PUBLIC_APP_INSTALL_WHITELIST = "aole_public_app_install_whitelist_set";
/*强制安装应用,禁止卸载*/ /*强制安装应用,禁止卸载*/
public final static String AOLE_ACTION_FORCE_APP = "aole_force_app"; public final static String AOLE_ACTION_FORCE_APP = "aole_force_app";
/*指定应用安装源 非指定包名不能安装apk*/ /*指定应用安装源 非指定包名不能安装apk*/

View File

@@ -6,6 +6,7 @@ import android.util.Log;
import com.aoleyun.sn.comm.CommonConfig; import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.utils.JgyUtils; import com.aoleyun.sn.utils.JgyUtils;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV; import com.tencent.mmkv.MMKV;
public class AoleyunActivityController extends IActivityController.Stub { public class AoleyunActivityController extends IActivityController.Stub {
@@ -20,12 +21,17 @@ public class AoleyunActivityController extends IActivityController.Stub {
// return false; // return false;
// } // }
if (JgyUtils.getInstance().checkTimePeriod(pkg)) {
//false 则不会启动,直接返回。 //false 则不会启动,直接返回。
if (JgyUtils.getInstance().isCloudLessonMod(pkg)) { if (JgyUtils.getInstance().isCloudLessonMod(pkg)) {
return true; return true;
} else { } else {
return false; return false;
} }
} else {
Toaster.show("专注模式只允许使用指定应用");
return false;
}
} }
@Override @Override

View File

@@ -55,6 +55,8 @@ import com.aoleyun.sn.bean.SnRunLog;
import com.aoleyun.sn.bean.SnSetting; import com.aoleyun.sn.bean.SnSetting;
import com.aoleyun.sn.bean.SnTimeControl; import com.aoleyun.sn.bean.SnTimeControl;
import com.aoleyun.sn.bean.StudentsInfo; import com.aoleyun.sn.bean.StudentsInfo;
import com.aoleyun.sn.bean.TimeControlData;
import com.aoleyun.sn.bean.TimeControlInfo;
import com.aoleyun.sn.bean.TopApp; import com.aoleyun.sn.bean.TopApp;
import com.aoleyun.sn.bean.Wallpaper; import com.aoleyun.sn.bean.Wallpaper;
import com.aoleyun.sn.bean.WhitelistBean; import com.aoleyun.sn.bean.WhitelistBean;
@@ -115,6 +117,7 @@ import com.aoleyun.sn.network.api.post.MACAddressApi;
import com.aoleyun.sn.network.api.post.NetAndLaunchApi; import com.aoleyun.sn.network.api.post.NetAndLaunchApi;
import com.aoleyun.sn.network.api.post.NetworkConnectApi; import com.aoleyun.sn.network.api.post.NetworkConnectApi;
import com.aoleyun.sn.network.api.post.NewAppinsideWebApi; import com.aoleyun.sn.network.api.post.NewAppinsideWebApi;
import com.aoleyun.sn.network.api.post.RankCommonAppApi;
import com.aoleyun.sn.network.api.post.SendDownloadInfoApi; import com.aoleyun.sn.network.api.post.SendDownloadInfoApi;
import com.aoleyun.sn.network.api.post.SendDownloadTimesApi; import com.aoleyun.sn.network.api.post.SendDownloadTimesApi;
import com.aoleyun.sn.network.api.post.SendRestoreTimesApi; import com.aoleyun.sn.network.api.post.SendRestoreTimesApi;
@@ -180,6 +183,7 @@ import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.Observer; import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.BiFunction; import io.reactivex.rxjava3.functions.BiFunction;
import io.reactivex.rxjava3.functions.Function3;
import io.reactivex.rxjava3.functions.Function6; import io.reactivex.rxjava3.functions.Function6;
import io.reactivex.rxjava3.functions.Function7; import io.reactivex.rxjava3.functions.Function7;
import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.schedulers.Schedulers;
@@ -623,6 +627,13 @@ public class NetInterfaceManager {
.observeOn(AndroidSchedulers.mainThread()); .observeOn(AndroidSchedulers.mainThread());
} }
public Observable<BaseResponse<TimeControlData>> getTimeObservable() {
return mRetrofit.create(SnTimeControlApi.class)
.getTimeControl(Utils.getSerial(mContext))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
public Observable<BaseResponse<ScreenLockState>> getScreenLockObservable() { public Observable<BaseResponse<ScreenLockState>> getScreenLockObservable() {
return mRetrofit.create(ScreenLockStateApi.class) return mRetrofit.create(ScreenLockStateApi.class)
.getScreenLockState(Utils.getSerial(mContext)) .getScreenLockState(Utils.getSerial(mContext))
@@ -709,7 +720,7 @@ public class NetInterfaceManager {
public Observable<BaseResponse<SnRunLog>> getSnRunLogControl() { public Observable<BaseResponse<SnRunLog>> getSnRunLogControl() {
return mRetrofit.create(GetSnRunLogApi.class) return mRetrofit.create(GetSnRunLogApi.class)
.GetSnRunLog(Utils.getSerial(mContext)) .getSnRunLog(Utils.getSerial(mContext))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()); .observeOn(AndroidSchedulers.mainThread());
} }
@@ -721,14 +732,14 @@ public class NetInterfaceManager {
.observeOn(AndroidSchedulers.mainThread()); .observeOn(AndroidSchedulers.mainThread());
} }
public Observable<BaseResponse<List<AppListInfo>>> GetAllAppApiControl() { public Observable<BaseResponse<List<AppListInfo>>> getAllAppApiControl() {
return mRetrofit.create(GetAllAppApi.class) return mRetrofit.create(GetAllAppApi.class)
.getAllAppList(NetInterfaceManager.HTTP_KEY, Utils.getSerial(mContext)) .getAllAppList(NetInterfaceManager.HTTP_KEY, Utils.getSerial(mContext))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()); .observeOn(AndroidSchedulers.mainThread());
} }
public Observable<BaseResponse> GetNetworkConnectControl(String time) { public Observable<BaseResponse> getNetworkConnectControl(String time) {
return mRetrofit.create(NetworkConnectApi.class) return mRetrofit.create(NetworkConnectApi.class)
.sendNetwork(Utils.getSerial(mContext), time) .sendNetwork(Utils.getSerial(mContext), time)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
@@ -792,6 +803,13 @@ public class NetInterfaceManager {
.observeOn(AndroidSchedulers.mainThread()); .observeOn(AndroidSchedulers.mainThread());
} }
public Observable<BaseResponse<List<AppDateInfo>>> getRankCommonAppObservable() {
return mRetrofit.create(RankCommonAppApi.class)
.getRankApp(HTTP_KEY, Utils.getSerial(mContext), "1")
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
/* /*
* *
* API * API
@@ -1353,26 +1371,20 @@ public class NetInterfaceManager {
public void onNext(@NonNull BaseResponse<List<ForceDownloadData>> forceDownloadBean) { public void onNext(@NonNull BaseResponse<List<ForceDownloadData>> forceDownloadBean) {
Log.e("getForceDownload", "onNext: " + forceDownloadBean); Log.e("getForceDownload", "onNext: " + forceDownloadBean);
if (forceDownloadBean.code == OK) { if (forceDownloadBean.code == OK) {
Log.e("getForceDownload", "onNext: getAsString: " + cacheHelper.getAsString(UrlAddress.GET_FORCE_INSTALL_LIST));
List<ForceDownloadData> forceDownloadData = forceDownloadBean.data; List<ForceDownloadData> forceDownloadData = forceDownloadBean.data;
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, GsonUtils.toJSONString(forceDownloadData));
Aria.download(this).resumeAllTask(); Aria.download(this).resumeAllTask();
JgyUtils.getInstance().forceDownload(forceDownloadData); JgyUtils.getInstance().forceDownload(forceDownloadData);
List<String> forceApp = forceDownloadData.stream().map(ForceDownloadData::getApp_package).collect(Collectors.toList()); List<String> forceApp = forceDownloadData.stream().map(ForceDownloadData::getApp_package).collect(Collectors.toList());
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceApp)); Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceApp));
Log.e("getForceDownload", "aole_force_app:" + aole_force_app);
if (JgyUtils.isAllWinnerDevice()) { if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(forceApp); AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(forceApp);
} }
} else if (forceDownloadBean.code == -200) { } else if (forceDownloadBean.code == -200) {
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, ""); Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "invalid");
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "invalid");
Log.e("getForceDownload", "aole_force_app:" + aole_force_app);
if (JgyUtils.isAllWinnerDevice()) { if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(new ArrayList<>()); AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(new ArrayList<>());
} }
} else { } else {
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, "");
Log.e("getForceDownload", forceDownloadBean.msg); Log.e("getForceDownload", forceDownloadBean.msg);
} }
} }
@@ -1404,8 +1416,6 @@ public class NetInterfaceManager {
public void onNext(@NonNull List<ForceDownloadData> forceDownloadBean) { public void onNext(@NonNull List<ForceDownloadData> forceDownloadBean) {
Log.e("getForceDownload", "onNext: " + forceDownloadBean); Log.e("getForceDownload", "onNext: " + forceDownloadBean);
if (forceDownloadBean != null && !forceDownloadBean.isEmpty()) { if (forceDownloadBean != null && !forceDownloadBean.isEmpty()) {
Log.e("getForceDownload", "onNext: getAsString: " + cacheHelper.getAsString(UrlAddress.GET_FORCE_INSTALL_LIST));
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, GsonUtils.toJSONString(forceDownloadBean));
Aria.download(this).resumeAllTask(); Aria.download(this).resumeAllTask();
JgyUtils.getInstance().forceDownload(forceDownloadBean); JgyUtils.getInstance().forceDownload(forceDownloadBean);
List<String> forceApp = forceDownloadBean.stream().map(ForceDownloadData::getApp_package).collect(Collectors.toList()); List<String> forceApp = forceDownloadBean.stream().map(ForceDownloadData::getApp_package).collect(Collectors.toList());
@@ -1415,7 +1425,6 @@ public class NetInterfaceManager {
AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(forceApp); AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(forceApp);
} }
} else { } else {
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, "");
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "invalid"); boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "invalid");
Log.e("getForceDownload", "aole_force_app:" + aole_force_app); Log.e("getForceDownload", "aole_force_app:" + aole_force_app);
if (JgyUtils.isAllWinnerDevice()) { if (JgyUtils.isAllWinnerDevice()) {
@@ -1763,6 +1772,7 @@ public class NetInterfaceManager {
}); });
} }
@Deprecated
public void getDesktopIcon(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) { public void getDesktopIcon(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.SIX_HOUR; ConnectMode connectMode = ConnectMode.SIX_HOUR;
if (refresh) { if (refresh) {
@@ -2019,7 +2029,7 @@ public class NetInterfaceManager {
public void onNext(@NonNull BaseResponse<List<AppID>> baseResponse) { public void onNext(@NonNull BaseResponse<List<AppID>> baseResponse) {
Log.e("getAppIDControl", "onNext: " + baseResponse); Log.e("getAppIDControl", "onNext: " + baseResponse);
// TODO: 2025/11/21 高木g104不需要id管控 // TODO: 2025/11/21 高木g104不需要id管控
if ("G104".equals(Build.MODEL)) { if ("G104".equals(Build.MODEL) || "HT01".equals(Build.MODEL)) {
try { try {
Settings.System.putString(mContext.getContentResolver(), CommonConfig.APP_VIEW_CLICK_DISABLED, null); Settings.System.putString(mContext.getContentResolver(), CommonConfig.APP_VIEW_CLICK_DISABLED, null);
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_view_click_disabled"); CmdUtil.Result result = CmdUtil.execute(" settings delete system app_view_click_disabled");
@@ -2027,6 +2037,8 @@ public class NetInterfaceManager {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} else if ("G10".equals(Build.MODEL) || "D1".equals(Build.MODEL) || "Aiud_A8_ag_1095".equals(Build.MODEL)) {
Settings.System.putString(mContext.getContentResolver(), CommonConfig.APP_VIEW_CLICK_DISABLED, "com.ttstd.utils:12345");
} else { } else {
Settings.System.putString(mContext.getContentResolver(), CommonConfig.APP_VIEW_CLICK_DISABLED, "com.arivoc.wordhd:2131624676,2131624689;com.ttstd.utils:12345"); Settings.System.putString(mContext.getContentResolver(), CommonConfig.APP_VIEW_CLICK_DISABLED, "com.arivoc.wordhd:2131624676,2131624689;com.ttstd.utils:12345");
} }
@@ -2706,15 +2718,15 @@ public class NetInterfaceManager {
public void setPushTags(BehaviorSubject<ActivityEvent> lifecycle, PushTagCallback callback) { public void setPushTags(BehaviorSubject<ActivityEvent> lifecycle, PushTagCallback callback) {
getPushTagsObservable() getPushTagsObservable()
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY)) .compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribe(getgetPushTagsObserver(callback)); .subscribe(getPushTagsObserver(callback));
} }
public void setPushTags() { public void setPushTags() {
getPushTagsObservable() getPushTagsObservable()
.subscribe(getgetPushTagsObserver(null)); .subscribe(getPushTagsObserver(null));
} }
private Observer<BaseResponse<Batch>> getgetPushTagsObserver(PushTagCallback callback) { private Observer<BaseResponse<Batch>> getPushTagsObserver(PushTagCallback callback) {
return new Observer<BaseResponse<Batch>>() { return new Observer<BaseResponse<Batch>>() {
@Override @Override
public void onSubscribe(@NonNull Disposable d) { public void onSubscribe(@NonNull Disposable d) {
@@ -2829,6 +2841,8 @@ public class NetInterfaceManager {
tagSets.add(JgyUtils.MT6765_TAG); tagSets.add(JgyUtils.MT6765_TAG);
} else if (platform == JgyUtils.G128TPlatform) { } else if (platform == JgyUtils.G128TPlatform) {
tagSets.add(JgyUtils.G128T_TAG); tagSets.add(JgyUtils.G128T_TAG);
} else if (platform == JgyUtils.QualcommTPlatform) {
tagSets.add(JgyUtils.Qualcomm_TAG);
} }
}); });
@@ -3441,7 +3455,7 @@ public class NetInterfaceManager {
} }
public void getAppLimit(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) { public void getAppLimit(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getBiFunction()) Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getBiFunction())
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY)) .compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribe(getAppLimitListObserver(callback)); .subscribe(getAppLimitListObserver(callback));
// getAppLimitObservable() // getAppLimitObservable()
@@ -3450,29 +3464,29 @@ public class NetInterfaceManager {
} }
public void getAppLimit(onCompleteCallback callback) { public void getAppLimit(onCompleteCallback callback) {
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getBiFunction()) Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getBiFunction())
.subscribe(getAppLimitListObserver(callback)); .subscribe(getAppLimitListObserver(callback));
// getAppLimitObservable() // getAppLimitObservable()
// .subscribe(getAppLimitObserver(callback)); // .subscribe(getAppLimitObserver(callback));
} }
public void getAppLimit() { public void getAppLimit() {
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getBiFunction()) Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getBiFunction())
.subscribe(getAppLimitListObserver(null)); .subscribe(getAppLimitListObserver(null));
// getAppLimitObservable() // getAppLimitObservable()
// .subscribe(getAppLimitObserver(null)); // .subscribe(getAppLimitObserver(null));
} }
private void getAppLimitList() { private void getAppLimitList() {
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getBiFunction()) Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getBiFunction())
.subscribe(getAppLimitListObserver(null)); .subscribe(getAppLimitListObserver(null));
} }
private BiFunction<BaseResponse<AppLimit>, BaseResponse<List<AppDateInfo>>, List<String>> getBiFunction() { private Function3<BaseResponse<AppLimit>, BaseResponse<List<AppDateInfo>>, BaseResponse<List<AppDateInfo>>, List<String>> getBiFunction() {
return new BiFunction<BaseResponse<AppLimit>, BaseResponse<List<AppDateInfo>>, List<String>>() { return new Function3<BaseResponse<AppLimit>, BaseResponse<List<AppDateInfo>>, BaseResponse<List<AppDateInfo>>, List<String>>() {
@Override @Override
public List<String> apply(BaseResponse<AppLimit> appLimitBaseResponse, BaseResponse<List<AppDateInfo>> listBaseResponse) throws Throwable { public List<String> apply(BaseResponse<AppLimit> appLimitBaseResponse, BaseResponse<List<AppDateInfo>> listBaseResponse, BaseResponse<List<AppDateInfo>> appDateInfoResponse) throws Throwable {
List<String> appNames = new ArrayList<>(); List<String> appNames = new ArrayList<>();
if (appLimitBaseResponse.code == 200) { if (appLimitBaseResponse.code == 200) {
AppLimit appLimit = appLimitBaseResponse.data; AppLimit appLimit = appLimitBaseResponse.data;
@@ -3490,6 +3504,19 @@ public class NetInterfaceManager {
}).collect(Collectors.toSet()); }).collect(Collectors.toSet());
appNames.addAll(pkgs); appNames.addAll(pkgs);
} }
if (appDateInfoResponse.code == 200) {
List<AppDateInfo> appDateInfos = appDateInfoResponse.data;
Set<String> pkgs = appDateInfos.stream().map(new Function<AppDateInfo, String>() {
@Override
public String apply(AppDateInfo appDateInfo) {
return appDateInfo.getApp_baoming();
}
}).collect(Collectors.toSet());
mMMKV.encode(CommonConfig.AOLE_PUBLIC_APP_INSTALL_WHITELIST, pkgs);
appNames.addAll(pkgs);
} else {
mMMKV.remove(CommonConfig.AOLE_PUBLIC_APP_INSTALL_WHITELIST);
}
return appNames; return appNames;
} }
}; };
@@ -3557,18 +3584,18 @@ public class NetInterfaceManager {
} }
public void getAllAppList(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) { public void getAllAppList(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
GetAllAppApiControl() getAllAppApiControl()
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY)) .compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribe(getAllAppListObserver(callback)); .subscribe(getAllAppListObserver(callback));
} }
public void getAllAppList(onCompleteCallback callback) { public void getAllAppList(onCompleteCallback callback) {
GetAllAppApiControl() getAllAppApiControl()
.subscribe(getAllAppListObserver(callback)); .subscribe(getAllAppListObserver(callback));
} }
public void getAllAppList() { public void getAllAppList() {
GetAllAppApiControl() getAllAppApiControl()
.subscribe(getAllAppListObserver(null)); .subscribe(getAllAppListObserver(null));
} }
@@ -3584,12 +3611,11 @@ public class NetInterfaceManager {
Log.e("getAllAppList", "onNext: " + listBaseResponse); Log.e("getAllAppList", "onNext: " + listBaseResponse);
if (listBaseResponse.code == 200) { if (listBaseResponse.code == 200) {
List<AppListInfo> appListInfos = listBaseResponse.data; List<AppListInfo> appListInfos = listBaseResponse.data;
cacheHelper.put(UrlAddress.GET_ALL_APP, GsonUtils.toJSONString(appListInfos));
getAppAutoStartUpdateAndNet(appListInfos); getAppAutoStartUpdateAndNet(appListInfos);
Set<String> pkgList = appListInfos.stream().map(AppListInfo::getApp_package).collect(Collectors.toSet()); Set<String> pkgList = appListInfos.stream().map(AppListInfo::getApp_package).collect(Collectors.toSet());
mMMKV.encode(CommonConfig.ALL_APP_PKG_SET, pkgList); mMMKV.encode(CommonConfig.ALL_APP_PKG_SET, pkgList);
} else { } else {
cacheHelper.put(UrlAddress.GET_ALL_APP, ""); mMMKV.remove(CommonConfig.ALL_APP_PKG_SET);
} }
} }
@@ -3609,7 +3635,7 @@ public class NetInterfaceManager {
}; };
} }
@Deprecated
public void getSnTimeControl(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) { public void getSnTimeControl(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_MINUTE; ConnectMode connectMode = ConnectMode.ONE_MINUTE;
if (refresh) { if (refresh) {
@@ -3630,13 +3656,14 @@ public class NetInterfaceManager {
} }
} }
@Deprecated
public void getSnTimeControl(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) { public void getSnTimeControl(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
getSnTimeObservable() getSnTimeObservable()
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY)) .compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribe(getSnTimeObserver(callback)); .subscribe(getSnTimeObserver(callback));
} }
@Deprecated
public void getSnTimeControl() { public void getSnTimeControl() {
getSnTimeObservable() getSnTimeObservable()
.subscribe(getSnTimeObserver(null)); .subscribe(getSnTimeObserver(null));
@@ -3689,6 +3716,54 @@ public class NetInterfaceManager {
}; };
} }
public void getTimeControl(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
getTimeObservable()
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribe(getTimeObserver(callback));
}
public void getTimeControl() {
getTimeObservable()
.subscribe(getTimeObserver(null));
}
private Observer<BaseResponse<TimeControlData>> getTimeObserver(onCompleteCallback callback) {
return new Observer<BaseResponse<TimeControlData>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getTimeObserver", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<TimeControlData> response) {
Log.e("getTimeObserver", "onNext: " + response);
if (response.code == OK) {
TimeControlData timeControlData = response.data;
List<TimeControlInfo> periods = timeControlData.getPeriods();
mMMKV.encode(CommonConfig.TIME_CONTROL_DATA_KEY, GsonUtils.toJSONString(periods));
} else {
mMMKV.remove(CommonConfig.TIME_CONTROL_DATA_KEY);
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getTimeObserver", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getTimeObserver", "onComplete: ");
JgyUtils.getInstance().syncTimePeriod();
if (callback != null) {
callback.onComplete();
}
}
};
}
public interface GetAppinsideWebCallback { public interface GetAppinsideWebCallback {
void onComplete(); void onComplete();
} }
@@ -4049,7 +4124,7 @@ public class NetInterfaceManager {
public static final String WHOIS_ADDR = "whois_ip_addr"; public static final String WHOIS_ADDR = "whois_ip_addr";
public static void GetWhois() { public static void getWhois() {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.client(NetInterfaceManager.getInstance().getOkHttpClient()) .client(NetInterfaceManager.getInstance().getOkHttpClient())
.baseUrl(UrlAddress.PCONLINE_WHOIS) .baseUrl(UrlAddress.PCONLINE_WHOIS)
@@ -4063,12 +4138,12 @@ public class NetInterfaceManager {
.subscribe(new Observer<WhoisBean>() { .subscribe(new Observer<WhoisBean>() {
@Override @Override
public void onSubscribe(@NonNull Disposable d) { public void onSubscribe(@NonNull Disposable d) {
Log.e("GetWhois", "onSubscribe: "); Log.e("getWhois", "onSubscribe: ");
} }
@Override @Override
public void onNext(@NonNull WhoisBean whoisBean) { public void onNext(@NonNull WhoisBean whoisBean) {
Log.e("GetWhois", "onNext: " + whoisBean); Log.e("getWhois", "onNext: " + whoisBean);
if (whoisBean != null && !TextUtils.isEmpty(whoisBean.getAddr())) { if (whoisBean != null && !TextUtils.isEmpty(whoisBean.getAddr())) {
MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE).encode(WHOIS_ADDR, whoisBean.getAddr()); MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE).encode(WHOIS_ADDR, whoisBean.getAddr());
} }
@@ -4076,12 +4151,12 @@ public class NetInterfaceManager {
@Override @Override
public void onError(@NonNull Throwable e) { public void onError(@NonNull Throwable e) {
Log.e("GetWhois", "onError: "); Log.e("getWhois", "onError: ");
} }
@Override @Override
public void onComplete() { public void onComplete() {
Log.e("GetWhois", "onComplete: "); Log.e("getWhois", "onComplete: ");
} }
}); });
} }

View File

@@ -39,6 +39,8 @@ public class UrlAddress {
public static final String SET_WHITE_PACKAGE_LIST = "firmware/index"; public static final String SET_WHITE_PACKAGE_LIST = "firmware/index";
/*获取全部应用*/ /*获取全部应用*/
public static final String GET_ALL_APP = "recommend/index"; public static final String GET_ALL_APP = "recommend/index";
/*公共应用*/
public static final String HTTP_TAG_COMMOAPP = "Rank/commonApp";
/*强制安装应用*/ /*强制安装应用*/
public static final String GET_FORCE_INSTALL_LIST = "forceinstall/index"; public static final String GET_FORCE_INSTALL_LIST = "forceinstall/index";
/*分组应用强制安装*/ /*分组应用强制安装*/
@@ -103,7 +105,9 @@ public class UrlAddress {
/*获取系统设置*/ /*获取系统设置*/
public static final String GET_FIRMWARE = "firmware/get"; public static final String GET_FIRMWARE = "firmware/get";
/*获取时间管控*/ /*获取时间管控*/
@Deprecated
public static final String GET_SN_TIME_CONTROL = "Sn/getSnTimeControl"; public static final String GET_SN_TIME_CONTROL = "Sn/getSnTimeControl";
public static final String GET_TIME_CONTROL = "android/control/time-control";
/*获取WiFi名和密码*/ /*获取WiFi名和密码*/
public static final String GET_WIFI_ALIAS_PW = "And/SnControl/getWifi"; public static final String GET_WIFI_ALIAS_PW = "And/SnControl/getWifi";
/*获取远程关机时间*/ /*获取远程关机时间*/

View File

@@ -10,7 +10,7 @@ import retrofit2.http.Query;
public interface GetSnRunLogApi { public interface GetSnRunLogApi {
@GET(UrlAddress.GET_LOG_ORDER) @GET(UrlAddress.GET_LOG_ORDER)
Observable<BaseResponse<SnRunLog>> GetSnRunLog( Observable<BaseResponse<SnRunLog>> getSnRunLog(
@Query("sn") String sn @Query("sn") String sn
); );
} }

View File

@@ -2,6 +2,7 @@ package com.aoleyun.sn.network.api.get;
import com.aoleyun.sn.bean.BaseResponse; import com.aoleyun.sn.bean.BaseResponse;
import com.aoleyun.sn.bean.SnTimeControl; import com.aoleyun.sn.bean.SnTimeControl;
import com.aoleyun.sn.bean.TimeControlData;
import com.aoleyun.sn.network.UrlAddress; import com.aoleyun.sn.network.UrlAddress;
import io.reactivex.rxjava3.core.Observable; import io.reactivex.rxjava3.core.Observable;
@@ -13,4 +14,9 @@ public interface SnTimeControlApi {
Observable<BaseResponse<SnTimeControl>> getSnTimeControl( Observable<BaseResponse<SnTimeControl>> getSnTimeControl(
@Query("sn") String sn @Query("sn") String sn
); );
@GET(UrlAddress.GET_TIME_CONTROL)
Observable<BaseResponse<TimeControlData>> getTimeControl(
@Query("sn") String sn
);
} }

View File

@@ -0,0 +1,22 @@
package com.aoleyun.sn.network.api.post;
import com.aoleyun.sn.bean.AppDateInfo;
import com.aoleyun.sn.bean.BaseResponse;
import com.aoleyun.sn.network.UrlAddress;
import java.util.List;
import io.reactivex.rxjava3.core.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
public interface RankCommonAppApi {
@FormUrlEncoded
@POST(UrlAddress.HTTP_TAG_COMMOAPP)
Observable<BaseResponse<List<AppDateInfo>>> getRankApp(
@Field("key") String key,
@Field("sn") String sn,
@Field("page") String page
);
}

View File

@@ -1113,6 +1113,7 @@ public class PushManager {
private void getTimeControl(String extras) { private void getTimeControl(String extras) {
NetInterfaceManager.getInstance().getSnTimeControl(); NetInterfaceManager.getInstance().getSnTimeControl();
NetInterfaceManager.getInstance().getTimeControl();
} }
private void getTopApp(String extras) { private void getTopApp(String extras) {

View File

@@ -8,11 +8,9 @@ import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.PackageNames; import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.network.NetInterfaceManager; import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.utils.ApkUtils; import com.aoleyun.sn.utils.ApkUtils;
import com.aoleyun.sn.utils.CmdUtil;
import com.aoleyun.sn.utils.JgyUtils; import com.aoleyun.sn.utils.JgyUtils;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@@ -76,7 +74,6 @@ public class NewAppReceiver extends BroadcastReceiver {
JgyUtils.getInstance().setAllowPermissionsPackage(); JgyUtils.getInstance().setAllowPermissionsPackage();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (!PackageNames.APPSTORE.equals(packageName) || !PackageNames.DEVICE_INFO.equals(packageName)) { if (!PackageNames.APPSTORE.equals(packageName) || !PackageNames.DEVICE_INFO.equals(packageName)) {
ApkUtils.addShortcut(context);
ApkUtils.RemoveTask(context, packageName); ApkUtils.RemoveTask(context, packageName);
} }
JgyUtils.getInstance().wakeUpAoleyunAPP(); JgyUtils.getInstance().wakeUpAoleyunAPP();
@@ -122,6 +119,7 @@ public class NewAppReceiver extends BroadcastReceiver {
NetInterfaceManager.getInstance().getAppLimit(); NetInterfaceManager.getInstance().getAppLimit();
// NetInterfaceManager.getInstance().getDefaultDesktop(); // NetInterfaceManager.getInstance().getDefaultDesktop();
NetInterfaceManager.getInstance().getNetAndLaunchSetting(); NetInterfaceManager.getInstance().getNetAndLaunchSetting();
NetInterfaceManager.getInstance().getDesktopIcon();
NetInterfaceManager.getInstance().sendInstalledAppInfo(new NetInterfaceManager.onCompleteCallback() { NetInterfaceManager.getInstance().sendInstalledAppInfo(new NetInterfaceManager.onCompleteCallback() {
@Override @Override
public void onComplete() { public void onComplete() {

View File

@@ -97,7 +97,6 @@ import static android.os.BatteryManager.EXTRA_TECHNOLOGY;
import static android.os.BatteryManager.EXTRA_TEMPERATURE; import static android.os.BatteryManager.EXTRA_TEMPERATURE;
import static android.os.BatteryManager.EXTRA_VOLTAGE; import static android.os.BatteryManager.EXTRA_VOLTAGE;
/** /**
* 守护进程 双进程通讯 * 守护进程 双进程通讯
* *
@@ -222,13 +221,15 @@ public class GuardService extends Service {
Observable.create(restSubscribe) Observable.create(restSubscribe)
.throttleFirst(1, TimeUnit.MINUTES) .throttleFirst(1, TimeUnit.MINUTES)
.subscribe(resetObserver); .subscribe(resetObserver);
Aria.download(this).register();
Aria.download(this).resumeAllTask();
} }
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
Log.e(TAG, "onStartCommand: "); Log.e(TAG, "onStartCommand: ");
Aria.download(this).register();
Aria.download(this).resumeAllTask();
// 绑定建立链接 // 绑定建立链接
bindService(new Intent(this, StepService.class), mServiceConnection, Context.BIND_IMPORTANT); bindService(new Intent(this, StepService.class), mServiceConnection, Context.BIND_IMPORTANT);
return START_STICKY; return START_STICKY;

View File

@@ -99,9 +99,9 @@ public class MainSPresenter implements MainSContact.Presenter {
Log.e("getLockedState", "onComplete: "); Log.e("getLockedState", "onComplete: ");
int locked = Settings.System.getInt(crv, JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED); int locked = Settings.System.getInt(crv, JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
Log.e("getLockedState", "locked: " + locked); Log.e("getLockedState", "locked: " + locked);
if (locked == 0) { // if (locked == 0) {
JgyUtils.getInstance().deleteOtherApp(); // JgyUtils.getInstance().deleteOtherApp();
} // }
mView.setLockedState(locked == JGYActions.FRAME_CODE_LOCKED); mView.setLockedState(locked == JGYActions.FRAME_CODE_LOCKED);
} }
}); });
@@ -109,7 +109,7 @@ public class MainSPresenter implements MainSContact.Presenter {
@Override @Override
public void setPushTags() { public void setPushTags() {
NetInterfaceManager.getInstance().setPushTags( getLifecycle(), new NetInterfaceManager.PushTagCallback() { NetInterfaceManager.getInstance().setPushTags(getLifecycle(), new NetInterfaceManager.PushTagCallback() {
@Override @Override
public void setPushTag(String tag) { public void setPushTag(String tag) {
mView.setTagsFinish(TextUtils.isEmpty(tag)); mView.setTagsFinish(TextUtils.isEmpty(tag));
@@ -184,7 +184,7 @@ public class MainSPresenter implements MainSContact.Presenter {
Log.e(TAG, "sendNetwork: " + "time empty"); Log.e(TAG, "sendNetwork: " + "time empty");
return; return;
} }
NetInterfaceManager.getInstance().GetNetworkConnectControl(time.toString()) NetInterfaceManager.getInstance().getNetworkConnectControl(time.toString())
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY)) .compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribe(new Observer<BaseResponse>() { .subscribe(new Observer<BaseResponse>() {
@Override @Override
@@ -380,7 +380,7 @@ public class MainSPresenter implements MainSContact.Presenter {
mView.getDefaultDesktopFinish(); mView.getDefaultDesktopFinish();
} else { } else {
NetInterfaceManager.getInstance() NetInterfaceManager.getInstance()
.getDefaultDesktop( getLifecycle(), new NetInterfaceManager.onCompleteCallback() { .getDefaultDesktop(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override @Override
public void onComplete() { public void onComplete() {
mView.getDefaultDesktopFinish(); mView.getDefaultDesktopFinish();
@@ -418,7 +418,7 @@ public class MainSPresenter implements MainSContact.Presenter {
@Override @Override
public void getAllAppList() { public void getAllAppList() {
NetInterfaceManager.getInstance() NetInterfaceManager.getInstance()
.getAllAppList(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() { .getAllAppList(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override @Override
public void onComplete() { public void onComplete() {
mView.getAllAppListFinish(); mView.getAllAppListFinish();
@@ -459,7 +459,7 @@ public class MainSPresenter implements MainSContact.Presenter {
@Override @Override
public void getAppAutoStartUpdateAndNet() { public void getAppAutoStartUpdateAndNet() {
NetInterfaceManager.getInstance() NetInterfaceManager.getInstance()
.getAppAutoStartUpdateAndNet( getLifecycle(), new NetInterfaceManager.onCompleteCallback() { .getAppAutoStartUpdateAndNet(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override @Override
public void onComplete() { public void onComplete() {
mView.getAppAutoStartUpdateAndNetFinish(); mView.getAppAutoStartUpdateAndNetFinish();
@@ -556,7 +556,14 @@ public class MainSPresenter implements MainSContact.Presenter {
mView.getSnTimeControlFinish(); mView.getSnTimeControlFinish();
} else { } else {
NetInterfaceManager.getInstance() NetInterfaceManager.getInstance()
.getSnTimeControl(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() { .getSnTimeControl(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
mView.getSnTimeControlFinish();
}
});
NetInterfaceManager.getInstance()
.getTimeControl(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override @Override
public void onComplete() { public void onComplete() {
mView.getSnTimeControlFinish(); mView.getSnTimeControlFinish();

View File

@@ -109,7 +109,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
String WiFiAlias = Utils.getWifiAlias(this); String WiFiAlias = Utils.getWifiAlias(this);
Log.e("OnNetworkStatusChanged", "onConnected: " + WiFiAlias); Log.e("OnNetworkStatusChanged", "onConnected: " + WiFiAlias);
JgyUtils.getInstance().addNetworkConnectedTime(System.currentTimeMillis() / 1000); JgyUtils.getInstance().addNetworkConnectedTime(System.currentTimeMillis() / 1000);
mPresenter.sendNetwork(JgyUtils.getInstance().getNetworkConnectedTime()); // mPresenter.sendNetwork(JgyUtils.getInstance().getNetworkConnectedTime());
if (JgyUtils.getInstance().isScreenOn()) { if (JgyUtils.getInstance().isScreenOn()) {
TimeTask task = new TimeTask(); TimeTask task = new TimeTask();
task.execute("ntp.aliyun.com"); task.execute("ntp.aliyun.com");
@@ -599,13 +599,14 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
registerReceivers(); registerReceivers();
NetworkUtils.registerNetworkStatusChangedListener(this); NetworkUtils.registerNetworkStatusChangedListener(this);
addShortcut();
timeChangedStart.onstar(System.currentTimeMillis()); timeChangedStart.onstar(System.currentTimeMillis());
setStatusbar(); setStatusbar();
setFloatingWindow(); setFloatingWindow();
JgyUtils.getInstance().writeAppPackageList(); JgyUtils.getInstance().writeAppPackageList();
// notificationManager = NotificationManagerCompat.from(this); notificationManager = NotificationManagerCompat.from(this);
// createNotificationChannel(); createNotificationChannel();
sendSimpleNotification();
// aliyunPushInit(); // aliyunPushInit();
IActivityManager activityManager = ActivityManagerNative.getDefault(); IActivityManager activityManager = ActivityManagerNative.getDefault();
@@ -673,7 +674,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
channel.setDescription(CHANNEL_DESCRIPTION); channel.setDescription(CHANNEL_DESCRIPTION);
// Register the channel with the system; you can't change the importance // Register the channel with the system; you can't change the importance
// or other notification behaviors after this // or other notification behaviors after this
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel); notificationManager.createNotificationChannel(channel);
} }
} }
@@ -691,11 +691,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
.setOngoing(true) .setOngoing(true)
.setPriority(NotificationCompat.PRIORITY_MAX); .setPriority(NotificationCompat.PRIORITY_MAX);
// notificationId is a unique int for each notification that you must define // notificationId is a unique int for each notification that you must define
notificationManager.notify(NotificationID, builder.build()); // notificationManager.notify(NotificationID, builder.build());
} startForeground(NotificationID, builder.build());
private void addShortcut() {
ApkUtils.addShortcut(this);
} }
private void setStatusbar() { private void setStatusbar() {
@@ -922,22 +919,25 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
@SuppressLint("NewApi") @SuppressLint("NewApi")
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Log.e(TAG, "onReceive: " + intent.getAction()); Log.e("TimeChangedReceiver", "onReceive: " + intent.getAction());
if (Intent.ACTION_DATE_CHANGED.equals(intent.getAction())) { String action = intent.getAction();
Log.e("TimeChangedReceiver", "onReceive:" + "data changed"); if (TextUtils.isEmpty(action)) {
} else if (Intent.ACTION_TIME_CHANGED.equals(intent.getAction())) { return;
Log.e("TimeChangedReceiver", "onReceive:" + "time changed"); }
} else if (Intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) { switch (action) {
Log.e("TimeChangedReceiver", "onReceive:" + "timezone changed"); case Intent.ACTION_DATE_CHANGED:
} else if (Intent.ACTION_TIME_TICK.equals(intent.getAction())) { case Intent.ACTION_TIME_CHANGED:
Log.e("TimeChangedReceiver", "onReceive:" + "time tick"); case Intent.ACTION_TIMEZONE_CHANGED:
case Intent.ACTION_TIME_TICK:
checkShutdownTime(); checkShutdownTime();
checkUploadLogTime(); checkUploadLogTime();
setFloatingWindow(); setFloatingWindow();
} else if (ACTION_UPDATE.equals(intent.getAction())) { JgyUtils.getInstance().checkTimePeriod();
break;
case ACTION_UPDATE:
setFloatingWindow(); setFloatingWindow();
// mPresenter.getScreenLockState(); // mPresenter.getScreenLockState();
Log.e("TimeChangedReceiver", "onReceive:" + "date update"); break;
} }
timeChangedStart.onstar(System.currentTimeMillis()); timeChangedStart.onstar(System.currentTimeMillis());
} }
@@ -1064,6 +1064,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
} }
} }
private interface TopApp { private interface TopApp {
void open(Long time); void open(Long time);
} }
@@ -1168,7 +1169,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
Log.e(TAG, "setLockedState: " + loocked); Log.e(TAG, "setLockedState: " + loocked);
if (loocked) { if (loocked) {
Toaster.debugShow("设备已上锁"); Toaster.debugShow("设备已上锁");
// sendSimpleNotification();
mPresenter.setPushTags(); mPresenter.setPushTags();
ApkUtils.UninstallAPP(this, "com.joytv.live"); ApkUtils.UninstallAPP(this, "com.joytv.live");
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader"); ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
@@ -1192,6 +1192,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
// mPresenter.getStudesInfo(true); // mPresenter.getStudesInfo(true);
mPresenter.checkAoleyunUpdate(); mPresenter.checkAoleyunUpdate();
// SysSettingUtils.setEnableSetting(this); // SysSettingUtils.setEnableSetting(this);
Settings.System.putString(getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "");
mPresenter.getForceDownload();
mPresenter.getAppLimit();
} else { } else {
mPresenter.getFirstConnect(); mPresenter.getFirstConnect();
mPresenter.getStudesInfo(); mPresenter.getStudesInfo();

View File

@@ -26,7 +26,6 @@ import androidx.core.content.FileProvider;
import com.aoleyun.sn.BuildConfig; import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.bean.UploadAppInfo; import com.aoleyun.sn.bean.UploadAppInfo;
import com.aoleyun.sn.comm.CommonConfig; import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.comm.PackageNames; import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.gson.GsonUtils; import com.aoleyun.sn.gson.GsonUtils;
import com.aoleyun.sn.push.PushManager; import com.aoleyun.sn.push.PushManager;
@@ -47,12 +46,10 @@ import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.function.Predicate;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
@@ -116,6 +113,7 @@ public class ApkUtils {
this.add("com.aoleyunos.dop9"); this.add("com.aoleyunos.dop9");
this.add("com.aoleyunos.dop10"); this.add("com.aoleyunos.dop10");
this.add("com.schoolos.cmcc"); this.add("com.schoolos.cmcc");
this.add("com.aoleyunos.natuer");
// this.add("com.uiuios.jgy1"); // this.add("com.uiuios.jgy1");
// this.add("com.uiuios.jgy2"); // this.add("com.uiuios.jgy2");
// this.add("com.android.uiuios"); // this.add("com.android.uiuios");
@@ -1367,10 +1365,6 @@ public class ApkUtils {
} }
} }
public static void addShortcut(Context context) {
}
private static final Set<String> AoleyunOSApp = new HashSet<String>() {{ private static final Set<String> AoleyunOSApp = new HashSet<String>() {{
this.add("com.aoleyun.info"); this.add("com.aoleyun.info");
this.add("com.aoleyun.os"); this.add("com.aoleyun.os");
@@ -1397,6 +1391,7 @@ public class ApkUtils {
this.add("com.uiui.speed"); this.add("com.uiui.speed");
this.add("com.books.wisdom"); this.add("com.books.wisdom");
this.add("com.schoolos.cmcc"); this.add("com.schoolos.cmcc");
this.add("com.aoleyunos.natuer");
}}; }};
public static final HashSet<String> G30_APP = new HashSet<String>() {{ public static final HashSet<String> G30_APP = new HashSet<String>() {{

View File

@@ -55,6 +55,8 @@ import com.aoleyun.sn.bean.LessonJson;
import com.aoleyun.sn.bean.NetAndLaunchBean; import com.aoleyun.sn.bean.NetAndLaunchBean;
import com.aoleyun.sn.bean.NetAndLaunchData; import com.aoleyun.sn.bean.NetAndLaunchData;
import com.aoleyun.sn.bean.TTAppground; import com.aoleyun.sn.bean.TTAppground;
import com.aoleyun.sn.bean.TimeControlApp;
import com.aoleyun.sn.bean.TimeControlInfo;
import com.aoleyun.sn.comm.CommonConfig; import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.JGYActions; import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.comm.PackageNames; import com.aoleyun.sn.comm.PackageNames;
@@ -98,6 +100,9 @@ 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.SocketException;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Enumeration; import java.util.Enumeration;
@@ -143,6 +148,8 @@ public class JgyUtils {
private LessonJson mLessonJson; private LessonJson mLessonJson;
private TimeUtils.ContralTime mContralTime; private TimeUtils.ContralTime mContralTime;
private List<TimeControlInfo> mAppPeriods;
public static final int UnknowPlatform = 0; public static final int UnknowPlatform = 0;
public static final int MTKPlatform = 1; public static final int MTKPlatform = 1;
@@ -166,6 +173,7 @@ public class JgyUtils {
public static final int U1302Platform = 26; public static final int U1302Platform = 26;
public static final int MT6765Platform = 28; public static final int MT6765Platform = 28;
public static final int G128TPlatform = 29; public static final int G128TPlatform = 29;
public static final int QualcommTPlatform = 30;
public static final String Other = "其他"; public static final String Other = "其他";
@@ -191,6 +199,7 @@ public class JgyUtils {
public static final String allwinner_U1302 = "QZA15"; public static final String allwinner_U1302 = "QZA15";
public static final String MT6765_TAG = "MT6765"; public static final String MT6765_TAG = "MT6765";
public static final String G128T_TAG = "G128T"; public static final String G128T_TAG = "G128T";
public static final String Qualcomm_TAG = "QualcommA";
private CacheHelper cacheHelper; private CacheHelper cacheHelper;
@@ -230,14 +239,19 @@ public class JgyUtils {
bindEbaifenService(); bindEbaifenService();
} }
refresh(); refresh();
syncTimePeriod();
} }
public static void init(Context context) { public static void init(Context context) {
if (sInstance == null) { if (sInstance == null) {
Log.e(TAG, "init: "); Log.e(TAG, "init: ");
synchronized (JgyUtils.class) {
if (sInstance == null) {
sInstance = new JgyUtils(context); sInstance = new JgyUtils(context);
} }
} }
}
}
public static JgyUtils getInstance() { public static JgyUtils getInstance() {
if (sInstance == null) { if (sInstance == null) {
@@ -342,6 +356,9 @@ public class JgyUtils {
} else if (G128T_TAG.equalsIgnoreCase(platform)) { } else if (G128T_TAG.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "G128T"); Log.i(TAG, "checkAppPlatform: " + "G128T");
return G128TPlatform; return G128TPlatform;
} else if (Qualcomm_TAG.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "QualcommA");
return QualcommTPlatform;
} else { } else {
Log.i(TAG, "checkAppPlatform: " + "没有数据"); Log.i(TAG, "checkAppPlatform: " + "没有数据");
return UnknowPlatform; return UnknowPlatform;
@@ -408,6 +425,8 @@ public class JgyUtils {
getAppPlatformCallback.AppPlatform(MT6765Platform); getAppPlatformCallback.AppPlatform(MT6765Platform);
} else if (G128T_TAG.equalsIgnoreCase(platform)) { } else if (G128T_TAG.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(G128TPlatform); getAppPlatformCallback.AppPlatform(G128TPlatform);
} else if (Qualcomm_TAG.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(QualcommTPlatform);
} else { } else {
getAppPlatformCallback.AppPlatform(UnknowPlatform); getAppPlatformCallback.AppPlatform(UnknowPlatform);
} }
@@ -864,6 +883,7 @@ public class JgyUtils {
this.add("com.aoleyunos.dop9"); this.add("com.aoleyunos.dop9");
this.add("com.aoleyunos.dop10"); this.add("com.aoleyunos.dop10");
this.add("com.schoolos.cmcc"); this.add("com.schoolos.cmcc");
this.add("com.aoleyunos.natuer");
}}; }};
public void setAppNetwork(HashSet<String> blackList, HashSet<String> whiteList) { public void setAppNetwork(HashSet<String> blackList, HashSet<String> whiteList) {
@@ -1027,9 +1047,6 @@ public class JgyUtils {
return; return;
} }
if (appIDList == null || appIDList.isEmpty()) { if (appIDList == null || appIDList.isEmpty()) {
if ("G10".equals(Build.MODEL) || "D1".equals(Build.MODEL)) {
Settings.System.putString(mContext.getContentResolver(), CommonConfig.APP_VIEW_CLICK_DISABLED, "com.arivoc.wordhd:2131624676,2131624689;com.ttstd.utils:12345");
} else {
try { try {
Settings.System.putString(crv, CommonConfig.APP_VIEW_CLICK_DISABLED, null); Settings.System.putString(crv, CommonConfig.APP_VIEW_CLICK_DISABLED, null);
// TODO: 2024/9/11 修复1.4.0907版本数据为空系统报错 // TODO: 2024/9/11 修复1.4.0907版本数据为空系统报错
@@ -1038,7 +1055,6 @@ public class JgyUtils {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}
} else { } else {
String s = appIDList.stream().map(new Function<AppID, String>() { String s = appIDList.stream().map(new Function<AppID, String>() {
@Override @Override
@@ -1456,6 +1472,7 @@ public class JgyUtils {
this.add("com.aoleyunos.dop9"); this.add("com.aoleyunos.dop9");
this.add("com.aoleyunos.dop10"); this.add("com.aoleyunos.dop10");
this.add("com.schoolos.cmcc"); this.add("com.schoolos.cmcc");
this.add("com.aoleyunos.natuer");
this.add("com.aoleyun.info"); this.add("com.aoleyun.info");
this.add("com.calculator.uiui"); this.add("com.calculator.uiui");
this.add("com.notepad.uiui"); this.add("com.notepad.uiui");
@@ -1514,7 +1531,6 @@ public class JgyUtils {
setAppRestriction(0); setAppRestriction(0);
return; return;
} }
ApkUtils.addShortcut(mContext);
HashSet<String> pkgSet = new HashSet<>(defaultPackages); HashSet<String> pkgSet = new HashSet<>(defaultPackages);
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
pkgSet.add("com.reqable.android"); pkgSet.add("com.reqable.android");
@@ -1581,6 +1597,7 @@ public class JgyUtils {
if (data == null || data.size() <= 0) { if (data == null || data.size() <= 0) {
return; return;
} }
Log.e(TAG, "forceDownload: data size = " + data.size());
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
for (int i = 0; i < data.size(); i++) { for (int i = 0; i < data.size(); i++) {
ForceDownloadData forceDownloadData = data.get(i); ForceDownloadData forceDownloadData = data.get(i);
@@ -1620,11 +1637,14 @@ public class JgyUtils {
if (app_version_code > appVersionCode) { if (app_version_code > appVersionCode) {
Log.e("forceDownload ", "download URL " + app_url); Log.e("forceDownload ", "download URL " + app_url);
Utils.ariaDownload(mContext, app_url, jsonObject); Utils.ariaDownload(mContext, app_url, jsonObject);
} else {
Log.e(TAG, "forceDownload: installed skip");
} }
} else { } else {
Log.e("forceDownload ", "download URL " + app_url); Log.e("forceDownload ", "download URL " + app_url);
Utils.ariaDownload(mContext, app_url, jsonObject); Utils.ariaDownload(mContext, app_url, jsonObject);
} }
startServices(mContext);
} }
} }
@@ -1788,6 +1808,8 @@ public class JgyUtils {
Log.e(TAG, "deleteOtherApp: " + "start"); Log.e(TAG, "deleteOtherApp: " + "start");
Set<String> allAppWhiteSet = mMMKV.decodeStringSet(CommonConfig.AOLE_ALL_APP_WHITE_LIST_KEY, new HashSet<>()); Set<String> allAppWhiteSet = mMMKV.decodeStringSet(CommonConfig.AOLE_ALL_APP_WHITE_LIST_KEY, new HashSet<>());
Log.e("deleteOtherApp", "allAppWhiteSet:" + allAppWhiteSet); Log.e("deleteOtherApp", "allAppWhiteSet:" + allAppWhiteSet);
Set<String> pubAppSet = mMMKV.decodeStringSet(CommonConfig.AOLE_PUBLIC_APP_INSTALL_WHITELIST, new HashSet<>());
Log.e(TAG, "deleteOtherApp: pubAppSet = " + pubAppSet);
List<String> resulWhitetList = new ArrayList<>(defaultPackages); List<String> resulWhitetList = new ArrayList<>(defaultPackages);
resulWhitetList.addAll(allAppWhiteSet); resulWhitetList.addAll(allAppWhiteSet);
@@ -1874,6 +1896,7 @@ public class JgyUtils {
this.add("com.aoleyunos.dop9"); this.add("com.aoleyunos.dop9");
this.add("com.aoleyunos.dop10"); this.add("com.aoleyunos.dop10");
this.add("com.schoolos.cmcc"); this.add("com.schoolos.cmcc");
this.add("com.aoleyunos.natuer");
}}; }};
HashSet<String> aihuaAppList = new HashSet<String>() {{ HashSet<String> aihuaAppList = new HashSet<String>() {{
@@ -2991,6 +3014,7 @@ public class JgyUtils {
} }
} }
@Deprecated
public List<String> getHidePackage() { public List<String> getHidePackage() {
String jsonString = cacheHelper.getAsString(UrlAddress.GET_HIDE_DESKTOPICON); String jsonString = cacheHelper.getAsString(UrlAddress.GET_HIDE_DESKTOPICON);
//为 "" 是已经请求成功的 //为 "" 是已经请求成功的
@@ -3138,14 +3162,25 @@ public class JgyUtils {
Log.e(TAG, "wakeUpNotify: "); Log.e(TAG, "wakeUpNotify: ");
//启动通知 //启动通知
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED); Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
bootIntent.setPackage("com.aoleyun.info");
bootIntent.setComponent(new ComponentName(PACKAGE_NOTIFY, CLASS_NOTIFY)); bootIntent.setComponent(new ComponentName(PACKAGE_NOTIFY, CLASS_NOTIFY));
mContext.sendBroadcast(bootIntent); mContext.sendBroadcast(bootIntent);
// Intent intent = new Intent();
// intent.setComponent(new ComponentName("com.aoleyun.info", "com.aoleyun.info.service.main.MainService"));
// intent.setPackage("com.aoleyun.info");
//// intent.setClassName("com.aoleyun.info", "com.aoleyun.info.service.main.MainService");
// try {
// mContext.startService(intent);
// } catch (Exception e) {
// Log.e(TAG, "wakeUpNotify: " + e.getMessage());
// }
} }
@Deprecated @Deprecated
public void wakeUpAoleyunAPP() { public void wakeUpAoleyunAPP() {
// wakeUpAppstore(); wakeUpAppstore();
// wakeUpNotify(); wakeUpNotify();
} }
public static String getModel() { public static String getModel() {
@@ -3898,4 +3933,133 @@ public class JgyUtils {
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString(); return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
} }
} }
private String getTopActivityInfo() {
ActivityManager manager = (ActivityManager) mContext.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> runningTaskInfos = manager.getRunningTasks(1);
if (runningTaskInfos != null && !runningTaskInfos.isEmpty()) {
ComponentName componentName = runningTaskInfos.get(0).topActivity;
if (componentName != null) {
String currentClassName = componentName.getPackageName();
return currentClassName;
}
}
return "";
}
public boolean inOpenTimePeriod(TimeControlInfo timeControlInfo) {
String startTimeStr = timeControlInfo.getStart_time();
String endTimeStr = timeControlInfo.getEnd_time();
// 获取当前日期和时间
LocalDate currentDate = LocalDate.now();
LocalTime currentTime = LocalTime.now();
// 解析时间并比较
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
LocalTime startTime = LocalTime.parse(startTimeStr, formatter);
LocalTime endTime = LocalTime.parse(endTimeStr, formatter);
boolean inTime = !currentTime.isBefore(startTime) && !currentTime.isAfter(endTime);
return inTime;
}
public void syncTimePeriod() {
String jsonString = mMMKV.decodeString(CommonConfig.TIME_CONTROL_DATA_KEY, "");
if (TextUtils.isEmpty(jsonString)) {
mAppPeriods = null;
return;
}
Gson gson = new Gson();
Type type = new TypeToken<List<TimeControlInfo>>() {
}.getType();
try {
mAppPeriods = gson.fromJson(jsonString, type);
Log.e(TAG, "checkTimePeriod: periods = " + mAppPeriods);
checkTimePeriod();
} catch (Exception e) {
Log.e(TAG, "checkTimePeriod: Exception = " + e.getMessage());
}
}
public void checkTimePeriod() {
if (mAppPeriods == null || mAppPeriods.isEmpty()) {
return;
}
String foregroundPackage = getTopActivityInfo();
if (ApkUtils.isSystemApp(mContext, foregroundPackage)) {
Log.d(TAG, "checkTimePeriod: " + foregroundPackage + " is system app, skip");
return;
}
Set<String> packageNames = mAppPeriods.stream()
.filter(new Predicate<TimeControlInfo>() {
@Override
public boolean test(TimeControlInfo timeControlInfo) {
return inOpenTimePeriod(timeControlInfo);
}
})
.map(new Function<TimeControlInfo, List<String>>() {
@Override
public List<String> apply(TimeControlInfo timeControlInfo) {
return timeControlInfo.getApp().stream().map(new Function<TimeControlApp, String>() {
@Override
public String apply(TimeControlApp timeControlApp) {
return timeControlApp.getApp_package();
}
}).collect(Collectors.toList());
}
})
//使用 stream 和 flatMap 将所有元素合并
.flatMap(List::stream)
.collect(Collectors.toSet());
Log.d(TAG, "checkTimePeriod: " + packageNames);
if (packageNames.contains(foregroundPackage)) {
Log.e(TAG, "checkTimePeriod: " + foregroundPackage + " skip");
} else {
gotoLauncher();
}
}
/**
* @param pkgName
* @return true为可以打开
*/
public boolean checkTimePeriod(String pkgName) {
if (mAppPeriods == null || mAppPeriods.isEmpty()) {
return true;
}
if (ApkUtils.isSystemApp(mContext, pkgName)) {
Log.d(TAG, "checkTimePeriod: " + pkgName + " is system app, skip");
return true;
}
Set<String> packageNames = mAppPeriods.stream()
.filter(new Predicate<TimeControlInfo>() {
@Override
public boolean test(TimeControlInfo timeControlInfo) {
return inOpenTimePeriod(timeControlInfo);
}
})
.map(new Function<TimeControlInfo, List<String>>() {
@Override
public List<String> apply(TimeControlInfo timeControlInfo) {
return timeControlInfo.getApp().stream().map(new Function<TimeControlApp, String>() {
@Override
public String apply(TimeControlApp timeControlApp) {
return timeControlApp.getApp_package();
}
}).collect(Collectors.toList());
}
})
//使用 stream 和 flatMap 将所有元素合并
.flatMap(List::stream)
.collect(Collectors.toSet());
Log.d(TAG, "checkTimePeriod: " + packageNames);
if (packageNames.contains(pkgName)) {
return true;
} else {
return false;
}
}
} }

View File

@@ -5,7 +5,6 @@ import android.app.StatusBarManager;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.cube.SuperPower;
import android.provider.Settings; import android.provider.Settings;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@@ -205,8 +204,12 @@ public class SysSettingUtils {
if (JgyUtils.isAllWinnerDevice()) { if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setUsbStatus(state); AllwinnerCubeMdmManager.getInstance().setUsbStatus(state);
} else { } else {
SuperPower mService = (SuperPower) context.getSystemService("mdm"); // try {
mService.setUsbDataDisabled(true); // SuperPower mService = (SuperPower) context.getSystemService("mdm");
// mService.setUsbDataDisabled(true);
// } catch (Exception e) {
// Log.e(TAG, "setUsbStatus: " + e.getMessage());
// }
} }
} else { } else {
if (state == 0) { if (state == 0) {
@@ -257,15 +260,15 @@ public class SysSettingUtils {
// if (!BuildConfig.DEBUG) { // if (!BuildConfig.DEBUG) {
if (JgyUtils.isCubeDevice()) { if (JgyUtils.isCubeDevice()) {
SuperPower mService = (SuperPower) context.getSystemService("mdm"); // SuperPower mService = (SuperPower) context.getSystemService("mdm");
switch (setting_usb) { switch (setting_usb) {
case "usb_mtp": case "usb_mtp":
mService.setUsbDataDisabled(false); // mService.setUsbDataDisabled(false);
break; break;
default: default:
case "usb_midi": case "usb_midi":
case "usb_charge": case "usb_charge":
mService.setUsbDataDisabled(true); // mService.setUsbDataDisabled(true);
break; break;
} }
} else if (JgyUtils.isAllWinnerDevice()) { } else if (JgyUtils.isAllWinnerDevice()) {
@@ -1167,16 +1170,16 @@ public class SysSettingUtils {
//MTP模式usb_mtp //MTP模式usb_mtp
//Midi模式usb_midi //Midi模式usb_midi
if (JgyUtils.isCubeDevice()) { if (JgyUtils.isCubeDevice()) {
SuperPower mService = (SuperPower) context.getSystemService("mdm"); // SuperPower mService = (SuperPower) context.getSystemService("mdm");
switch (status) { // switch (status) {
case 0: // case 0:
mService.setUsbDataDisabled(true); // mService.setUsbDataDisabled(true);
break; // break;
case 1: // case 1:
mService.setUsbDataDisabled(false); // mService.setUsbDataDisabled(false);
break; // break;
default: // default:
} // }
} else { } else {
String usbStatus; String usbStatus;
switch (status) { switch (status) {
@@ -1269,46 +1272,46 @@ public class SysSettingUtils {
*/ */
private static void setSettingsMenuShow(Context context, JsonObject jsonObject) { private static void setSettingsMenuShow(Context context, JsonObject jsonObject) {
List<String> menus = new ArrayList<>(); List<String> menus = new ArrayList<>();
// OTA升级管控 (默认允许) // // OTA升级管控 (默认允许)
int ota_upgrade_control = jsonObject.get("ota_upgrade_control").getAsInt(); // int ota_upgrade_control = jsonObject.get("ota_upgrade_control").getAsInt();
if (ota_upgrade_control == 0) { // if (ota_upgrade_control == 0) {
menus.add("system_updates"); // menus.add("system_updates");
} // }
// 生物识别和密码 (默认允许) // // 生物识别和密码 (默认允许)
int biometric_and_password = jsonObject.get("biometric_and_password").getAsInt(); // int biometric_and_password = jsonObject.get("biometric_and_password").getAsInt();
if (biometric_and_password == 0) { // if (biometric_and_password == 0) {
menus.add("biometrics_password"); // menus.add("biometrics_password");
} // }
// 省电模式 (默认允许) // 省电模式 (默认允许)
int power_saving_mode = jsonObject.get("power_saving_mode").getAsInt(); int power_saving_mode = jsonObject.get("power_saving_mode").getAsInt();
if (power_saving_mode == 0) { if (power_saving_mode == 0) {
menus.add("battery"); menus.add("battery");
} }
// 安全 (默认允许) // // 安全 (默认允许)
int security = jsonObject.get("security").getAsInt(); // int security = jsonObject.get("security").getAsInt();
if (security == 0) { // if (security == 0) {
menus.add("security"); // menus.add("security");
} // }
// 大屏特色功能 (默认允许) // // 大屏特色功能 (默认允许)
int large_screen_features = jsonObject.get("large_screen_features").getAsInt(); // int large_screen_features = jsonObject.get("large_screen_features").getAsInt();
if (large_screen_features == 0) { // if (large_screen_features == 0) {
// menus.add(""); //// menus.add("");
} // }
// 辅助功能 (默认允许) // // 辅助功能 (默认允许)
int accessibility = jsonObject.get("accessibility").getAsInt(); // int accessibility = jsonObject.get("accessibility").getAsInt();
if (accessibility == 0) { // if (accessibility == 0) {
menus.add("accessibility"); // menus.add("accessibility");
} // }
// 隐私 (默认允许) // // 隐私 (默认允许)
int privacy = jsonObject.get("privacy").getAsInt(); // int privacy = jsonObject.get("privacy").getAsInt();
if (privacy == 0) { // if (privacy == 0) {
menus.add("privacy"); // menus.add("privacy");
} // }
// 更多链接 (默认允许) // // 更多链接 (默认允许)
int more_links = jsonObject.get("more_links").getAsInt(); // int more_links = jsonObject.get("more_links").getAsInt();
if (more_links == 0) { // if (more_links == 0) {
menus.add("more_connections"); // menus.add("more_connections");
} // }
// 通知和状态栏 (默认允许) // 通知和状态栏 (默认允许)
int notification_and_status_bar = jsonObject.get("notification_and_status_bar").getAsInt(); int notification_and_status_bar = jsonObject.get("notification_and_status_bar").getAsInt();
if (notification_and_status_bar == 0) { if (notification_and_status_bar == 0) {
@@ -1319,46 +1322,47 @@ public class SysSettingUtils {
if (app_management_general == 0) { if (app_management_general == 0) {
menus.add("apps"); menus.add("apps");
} }
// 荣耀账号登录 (默认禁止) // // 荣耀账号登录 (默认禁止)
int honor_account_login = jsonObject.get("honor_account_login").getAsInt(); // int honor_account_login = jsonObject.get("honor_account_login").getAsInt();
if (honor_account_login == 0) { // if (honor_account_login == 0) {
menus.add("honor_id"); // menus.add("honor_id");
} // }
// 智慧互联 (默认禁止) // // 智慧互联 (默认禁止)
int smart_interconnect = jsonObject.get("smart_interconnect").getAsInt(); // int smart_interconnect = jsonObject.get("smart_interconnect").getAsInt();
if (smart_interconnect == 0) { // if (smart_interconnect == 0) {
menus.add("super_device"); // menus.add("super_device");
} // }
// VPN管控 (默认禁止) // // VPN管控 (默认禁止)
int vpn_control = jsonObject.get("vpn_control").getAsInt(); // int vpn_control = jsonObject.get("vpn_control").getAsInt();
if (vpn_control == 0) { // if (vpn_control == 0) {
menus.add("vpn_settings"); // menus.add("vpn_settings");
} // }
// 默认应用 (默认禁止) // // 默认应用 (默认禁止)
int default_applications = jsonObject.get("default_applications").getAsInt(); // int default_applications = jsonObject.get("default_applications").getAsInt();
if (default_applications == 0) { // if (default_applications == 0) {
// menus.add(""); //// menus.add("");
} // }
// 应用分身 (默认禁止) // // 应用分身 (默认禁止)
int app_cloning = jsonObject.get("app_cloning").getAsInt(); // int app_cloning = jsonObject.get("app_cloning").getAsInt();
if (app_cloning == 0) { // if (app_cloning == 0) {
menus.add("apps_clone"); // menus.add("apps_clone");
} // }
// 应用启动管理 (默认禁止) // // 应用启动管理 (默认禁止)
int app_startup_management = jsonObject.get("app_startup_management").getAsInt(); // int app_startup_management = jsonObject.get("app_startup_management").getAsInt();
if (app_startup_management == 0) { // if (app_startup_management == 0) {
menus.add("apps_startup_management"); // menus.add("apps_startup_management");
} // }
// 应用管理 (默认禁止) // 应用管理 (默认禁止)
int app_management_control = jsonObject.get("app_management_control").getAsInt(); // int app_management_control = jsonObject.get("app_management_control").getAsInt();
if (app_management_control == 0) { // if (app_management_control == 0) {
menus.add("apps_management"); // menus.add("apps_management");
menus.add("apps_honor_tips"); // menus.add("apps_honor_tips");
} // }
// Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_SETTINGS_DISALLOW, String.join(",", menus)); Log.e(TAG, "setSettingsMenuShow: " + menus);
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_SETTINGS_DISALLOW, String.join(",", menus));
} }
private static void setSettingsMenuShow(Context context) { private static void setSettingsMenuShow(Context context) {
// Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_SETTINGS_DISALLOW, ""); Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_SETTINGS_DISALLOW, "");
} }
} }

View File

@@ -56,6 +56,9 @@ public class URLUtils {
} }
whiteIPList.removeIf(TextUtils::isEmpty); whiteIPList.removeIf(TextUtils::isEmpty);
Log.e(TAG, "getBrowserWhiteList: " + "oldwhiteList is : " + oldwhiteList); Log.e(TAG, "getBrowserWhiteList: " + "oldwhiteList is : " + oldwhiteList);
if (TextUtils.isEmpty(oldwhiteList)) {
return;
}
HashSet<String> URLList = new HashSet<>(Arrays.asList(oldwhiteList.trim().split(","))); HashSet<String> URLList = new HashSet<>(Arrays.asList(oldwhiteList.trim().split(",")));
URLList.removeIf(TextUtils::isEmpty); URLList.removeIf(TextUtils::isEmpty);
if (URLList.size() == 0 && whiteIPList.size() == 0) { if (URLList.size() == 0 && whiteIPList.size() == 0) {

View File

@@ -873,6 +873,9 @@ public class Utils {
@SuppressLint({"MissingPermission", "HardwareIds"}) @SuppressLint({"MissingPermission", "HardwareIds"})
public static String getSn() { public static String getSn() {
// if (BuildConfig.DEBUG) {
// return "LTPHR23040000006";
// }
String serial = "unknow"; String serial = "unknow";
try { try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+
@@ -1834,6 +1837,7 @@ public class Utils {
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.U1302Platform || JgyUtils.getInstance().checkAppPlatform() == JgyUtils.U1302Platform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform || JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G128TPlatform || JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G128TPlatform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommTPlatform
) { ) {
return Utils.getProperty("ro.build.display.id", "获取失败"); return Utils.getProperty("ro.build.display.id", "获取失败");
} else { } else {

View File

@@ -28,7 +28,7 @@ allprojects {
repositories { repositories {
google() google()
mavenCentral() // mavenCentral()
maven { url "https://jitpack.io" } maven { url "https://jitpack.io" }
maven { url 'https://developer.huawei.com/repo/' } maven { url 'https://developer.huawei.com/repo/' }
maven { url 'https://maven.aliyun.com/repository/central/' } maven { url 'https://maven.aliyun.com/repository/central/' }