version:1.5.0705

bugfixes:优化报错和网络优化
This commit is contained in:
2025-07-07 10:19:30 +08:00
parent d041a3b1c8
commit a2ad1c705f
20 changed files with 563 additions and 324 deletions

View File

@@ -29,8 +29,8 @@ android {
defaultConfig {
applicationId "com.aoleyun.sn"
versionCode 179
versionName "1.5.0610"
versionCode 184
versionName "1.5.0705"
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
minSdkVersion 24
@@ -248,7 +248,7 @@ android {
}
U1302 {
storeFile file("keystore/U1302.jks")
storeFile file("keystore/U1302.keystore")
storePassword "123456"
keyAlias "u1302"
keyPassword "123456"

Binary file not shown.

BIN
app/keystore/U1302.keystore Normal file

Binary file not shown.

View File

@@ -382,19 +382,20 @@
</intent-filter>
</receiver>
<!-- <service -->
<!-- android:name=".push.alipush.AliMessageIntentService" -->
<!-- android:exported="false"> -->
<!-- <intent-filter> -->
<!-- <action android:name="com.alibaba.push2.action.NOTIFICATION_OPENED" /> -->
<!-- </intent-filter> -->
<!-- <intent-filter> -->
<!-- <action android:name="com.alibaba.push2.action.NOTIFICATION_REMOVED" /> -->
<!-- </intent-filter> -->
<!-- <intent-filter> -->
<!-- <action android:name="com.alibaba.sdk.android.push.RECEIVE" /> -->
<!-- </intent-filter> -->
<!-- </service> -->
<service
android:name=".push.alipush.AliMessageIntentService"
android:exported="false">
<intent-filter>
<action android:name="com.alibaba.push2.action.NOTIFICATION_OPENED" />
</intent-filter>
<intent-filter>
<action android:name="com.alibaba.push2.action.NOTIFICATION_REMOVED" />
</intent-filter>
<intent-filter>
<action android:name="com.alibaba.sdk.android.push.RECEIVE" />
</intent-filter>
</service>
<meta-data
android:name=".base.CustomGlideModule"
android:value="AppGlideModule" />

View File

@@ -8,6 +8,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.IBinder;
import android.os.SystemClock;
@@ -129,6 +130,15 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
@Override
public void initView() {
if (BuildConfig.DEBUG){
// Uri uri = Uri.parse("https://www.baidu.com");
// Intent intent = new Intent(Intent.ACTION_VIEW, uri);
// startActivity(intent);
JgyUtils.getInstance().getAllRunningAppProcessInfo();
JgyUtils.getInstance().getAllRunningServices();
}
String defaultDesktop = mMMKV.decodeString(CommonConfig.DEFAULT_DESKTOP_PACKAGE_NAME, "");
Log.e(TAG, "initView: defaultDesktop = " + defaultDesktop);
String defaultLauncher = mMMKV.decodeString(CommonConfig.DEFAULT_LAUNCHER_PACKAGE_NAME, "");

View File

@@ -222,7 +222,7 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
} else {
NetInterfaceManager.getInstance()
.getDefaultDesktop(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
.getDefaultDesktop( getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {

View File

@@ -1,5 +1,6 @@
package com.aoleyun.sn.base;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Process;
@@ -62,6 +63,9 @@ public class BaseApplication extends MultiDexApplication {
Toaster.init(this);
CrashReport.initCrashReport(getApplicationContext(), "b16b3c7f1a", false);
CrashReport.setDeviceId(this, Utils.getSerial(this));
CrashReport.setDeviceModel(this, Utils.getSerial(this));
CrashReport.setAppChannel(this, Build.MODEL);
xcrash.XCrash.init(this);
PushManager.init(this);

View File

@@ -79,6 +79,11 @@ public class CommonConfig {
public static final String OPEN_LAUNCHER_STATUS = "frist_open_default_launcher";
/*存放后台上传的app包名 set*/
public static final String ALL_APP_PKG_SET = "all_app_pkg_set_key";
/*默认输入法*/
public static final String DEFAULT_IME_PACKAGE_NAME_KEY = "aoleyun_default_ime_package_name";
/*默认浏览器*/
public static final String DEFAULT_BROWSER_PACKAGE_NAME_KEY = "aoleyun_default_browser_package_name";
/*壁纸地址*/
public static final String WALLPAPER_URL_KEY = "wallpaper_url";

View File

@@ -12,6 +12,7 @@ public class PackageNames {
public static final String DEVICE_INFO = "com.aoleyun.sn";
public static final String APPSTORE = "com.aoleyun.appstore";
public static final String DESKTOP = "com.aoleyun.os";
public static final String ALLWINNER_15_DESKTOP = "com.schoolos.cmcc";
public static final String AIUDUDESKTOP = "com.aoleyun.audos";
public static final String NOTIFICATIONS = "com.aoleyun.info";
public static final String BROWSER = "com.aoleyun.browser";

View File

@@ -72,7 +72,6 @@ import com.aoleyun.sn.network.api.GetWhoisApi;
import com.aoleyun.sn.network.api.aolelearn.ExclusiveAdminAppApi;
import com.aoleyun.sn.network.api.get.AppSettingApi;
import com.aoleyun.sn.network.api.get.BlackListApi;
import com.aoleyun.sn.network.api.get.SnApi;
import com.aoleyun.sn.network.api.get.CloudLessonApi;
import com.aoleyun.sn.network.api.get.CloudLessonAppApi;
import com.aoleyun.sn.network.api.get.DefaultAppApi;
@@ -85,6 +84,7 @@ import com.aoleyun.sn.network.api.get.GetSnRunLogApi;
import com.aoleyun.sn.network.api.get.GetWiFiAliasApi;
import com.aoleyun.sn.network.api.get.LogoImgApi;
import com.aoleyun.sn.network.api.get.ScreenLockStateApi;
import com.aoleyun.sn.network.api.get.SnApi;
import com.aoleyun.sn.network.api.get.SnAppAttrApi;
import com.aoleyun.sn.network.api.get.SnSettingApi;
import com.aoleyun.sn.network.api.get.SnTimeControlApi;
@@ -949,6 +949,9 @@ public class NetInterfaceManager {
if (JgyUtils.getInstance().isAiuduPlatform()) {
desktopUpdateObservable = NetInterfaceManager.getInstance()
.getUpdateApi().getUpdate(PackageNames.AIUDUDESKTOP, JgyUtils.getInstance().checkAppPlatform());
} else if (JgyUtils.isAllWinnerDevice()) {
desktopUpdateObservable = NetInterfaceManager.getInstance()
.getUpdateApi().getUpdate(PackageNames.ALLWINNER_15_DESKTOP, JgyUtils.getInstance().checkAppPlatform());
} else {
desktopUpdateObservable = NetInterfaceManager.getInstance()
.getUpdateApi().getUpdate(PackageNames.DESKTOP, JgyUtils.getInstance().checkAppPlatform());
@@ -1044,6 +1047,9 @@ public class NetInterfaceManager {
if (JgyUtils.getInstance().isAiuduPlatform()) {
desktopUpdateObservable = NetInterfaceManager.getInstance()
.getUpdateApi().getUpdate(PackageNames.AIUDUDESKTOP, JgyUtils.getInstance().checkAppPlatform());
} else if (JgyUtils.isAllWinnerDevice()) {
desktopUpdateObservable = NetInterfaceManager.getInstance()
.getUpdateApi().getUpdate(PackageNames.ALLWINNER_15_DESKTOP, JgyUtils.getInstance().checkAppPlatform());
} else {
desktopUpdateObservable = NetInterfaceManager.getInstance()
.getUpdateApi().getUpdate(PackageNames.DESKTOP, JgyUtils.getInstance().checkAppPlatform());
@@ -1317,6 +1323,7 @@ public class NetInterfaceManager {
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setForbidUnInstallPackageList(forceApp);
Log.e(TAG, "setForbidUnInstallPackageList: " + forceApp);
}
} else if (forceDownloadBean.code == -200) {
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, "");
@@ -1366,10 +1373,19 @@ public class NetInterfaceManager {
List<String> forceApp = forceDownloadBean.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));
Log.e("getForceDownload", "aole_force_app:" + aole_force_app);
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setForbidUnInstallPackageList(forceApp);
Log.e(TAG, "setForbidUnInstallPackageList: " + forceApp);
}
} else {
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, "");
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()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setForbidUnInstallPackageList(new ArrayList<>());
}
}
}
@@ -1389,29 +1405,29 @@ public class NetInterfaceManager {
};
}
public void getDefaultDesktop(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_DESKTOP, connectMode)) {
getDefaultDesktop(lifecycle, callback);
} else {
String jsonString = cacheHelper.getAsString(UrlAddress.GET_DESKTOP);
//为 "" 是已经请求成功的
if (jsonString == null) {
getDefaultDesktop(lifecycle, callback);
} else {
if (!TextUtils.isEmpty(jsonString)) {
JsonObject data = GsonUtils.getJsonObject(jsonString);
if (data != null) {
JgyUtils.getInstance().installDesktop(data);
}
}
callback.onComplete();
}
}
}
// public void getDefaultDesktop(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
// ConnectMode connectMode = ConnectMode.ONE_MINUTE;
// if (refresh) {
// connectMode = ConnectMode.DEFAULT;
// }
// if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_DESKTOP, connectMode)) {
// getDefaultDesktop(lifecycle, callback);
// } else {
// String jsonString = cacheHelper.getAsString(UrlAddress.GET_DESKTOP);
// //为 "" 是已经请求成功的
// if (jsonString == null) {
// getDefaultDesktop(lifecycle, callback);
// } else {
// if (!TextUtils.isEmpty(jsonString)) {
// JsonObject data = GsonUtils.getJsonObject(jsonString);
// if (data != null) {
// JgyUtils.getInstance().installDesktop(data);
// }
// }
// callback.onComplete();
// }
// }
// }
public void getDefaultDesktop(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
Observable.zip(getDesktopObservable(), getDesktopsDiyUpdate(), new BiFunction<BaseResponse<ForceDownloadData>, BaseResponse<ForceDownloadData>, List<ForceDownloadData>>() {
@@ -1829,66 +1845,87 @@ public class NetInterfaceManager {
};
}
public void getAppAutoStartUpdateAndNet(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.DEFAULT;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.NET_AND_LAUNCH_API, connectMode)) {
getAppAutoStartUpdateAndNet(lifecycle, callback);
} else {
String jsonString = cacheHelper.getAsString(UrlAddress.NET_AND_LAUNCH_API);
//为 "" 是已经请求成功的
if (jsonString == null) {
getAppAutoStartUpdateAndNet(lifecycle, callback);
} else {
Gson gson = new Gson();
Type type = new TypeToken<NetAndLaunchBean>() {
}.getType();
NetAndLaunchBean netAndLaunchBean = gson.fromJson(jsonString, type);
if (netAndLaunchBean != null) {
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchBean);
}
callback.onComplete();
}
}
}
public void getAppAutoStartUpdateAndNet(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
getAppAutoStartUpdateAndNetObservable()
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribe(getAppAutoStartUpdateAndNetObserver(callback));
}
public void getAppAutoStartUpdateAndNet(List<AppListInfo> appListInfos) {
getAppAutoStartUpdateAndNetObservable()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<NetAndLaunchBean>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getAppAutoStart", "onSubscribe: ");
Log.e("getAutoUpdateAndNet", "onSubscribe: ");
}
@Override
public void onNext(@NonNull NetAndLaunchBean netAndLaunchBean) {
Log.e("getAppAutoStart", "onNext: " + netAndLaunchBean.toString());
if (netAndLaunchBean.getCode() == OK) {
cacheHelper.put(UrlAddress.NET_AND_LAUNCH_API, GsonUtils.toJSONString(netAndLaunchBean));
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchBean);
Log.e("getAutoUpdateAndNet", "onNext: " + netAndLaunchBean.toString());
if (netAndLaunchBean.getCode() == 200) {
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchBean, appListInfos);
} else {
cacheHelper.put(UrlAddress.NET_AND_LAUNCH_API, "");
Log.e("getAppAutoStart", "onNext: " + netAndLaunchBean.toString());
Log.e("getAutoUpdateAndNet", "onNext: " + netAndLaunchBean.toString());
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getAppAutoStart", "onError: " + e.getMessage());
Log.e("getAutoUpdateAndNet", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getAppAutoStart", "onComplete: ");
callback.onComplete();
Log.e("getAutoUpdateAndNet", "onComplete: ");
}
});
}
public void getNetAndLaunchSetting() {
getAppAutoStartUpdateAndNetObservable()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getAppAutoStartUpdateAndNetObserver(null));
}
private Observer<NetAndLaunchBean> getAppAutoStartUpdateAndNetObserver(onCompleteCallback callback) {
return new Observer<NetAndLaunchBean>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getAppAutoStart", "onSubscribe: ");
}
@Override
public void onNext(@NonNull NetAndLaunchBean netAndLaunchBean) {
Log.e("getAppAutoStart", "onNext: " + netAndLaunchBean.toString());
if (netAndLaunchBean.getCode() == OK) {
cacheHelper.put(UrlAddress.NET_AND_LAUNCH_API, GsonUtils.toJSONString(netAndLaunchBean));
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchBean);
} else {
cacheHelper.put(UrlAddress.NET_AND_LAUNCH_API, "");
Log.e("getAppAutoStart", "onNext: " + netAndLaunchBean.toString());
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getAppAutoStart", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getAppAutoStart", "onComplete: ");
if (callback != null) {
callback.onComplete();
}
}
};
}
public void getAppIDControl(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
if (refresh) {
@@ -2247,15 +2284,27 @@ public class NetInterfaceManager {
return;
}
String default_IME = defaultApp.getDefault_IME();
if (!TextUtils.isEmpty(default_IME)) {
Intent intent = new Intent("setDefaultInputMethod");
intent.putExtra("package", default_IME);
intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent);
mMMKV.encode(CommonConfig.DEFAULT_IME_PACKAGE_NAME_KEY, default_IME);
if (JgyUtils.isAllWinnerDevice()) {
JgyUtils.getInstance().setAllwinnerDefaulInputMeth(default_IME);
} else {
Intent intent = new Intent("setDefaultInputMethod");
intent.putExtra("package", default_IME);
intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent);
}
} else {
Log.e(TAG, "setDefaultApp: default_IME is empty");
mMMKV.encode(CommonConfig.DEFAULT_IME_PACKAGE_NAME_KEY, "");
}
JgyUtils.getInstance().setDefaultBrowser(default_IME);
String default_browser = defaultApp.getDefault_browser();
mMMKV.encode(CommonConfig.DEFAULT_BROWSER_PACKAGE_NAME_KEY, default_browser);
JgyUtils.getInstance().setDefaultBrowser(default_browser);
JgyUtils.getInstance().setAllwinnerDefaulBrowser(default_browser);
String default_launcher = defaultApp.getDefault_launcher();
if (!TextUtils.isEmpty(default_launcher)) {
@@ -2578,7 +2627,7 @@ public class NetInterfaceManager {
}
public void setPushTags(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, PushTagCallback callback) {
ConnectMode connectMode = ConnectMode.DEFAULT;
ConnectMode connectMode = ConnectMode.SIX_HOUR;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
}
@@ -3731,72 +3780,6 @@ public class NetInterfaceManager {
});
}
public void getAppAutoStartUpdateAndNet(List<AppListInfo> appListInfos) {
getAppAutoStartUpdateAndNetObservable()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<NetAndLaunchBean>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getAutoUpdateAndNet", "onSubscribe: ");
}
@Override
public void onNext(@NonNull NetAndLaunchBean netAndLaunchBean) {
Log.e("getAutoUpdateAndNet", "onNext: " + netAndLaunchBean.toString());
if (netAndLaunchBean.getCode() == 200) {
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchBean, appListInfos);
} else {
Log.e("getAutoUpdateAndNet", "onNext: " + netAndLaunchBean.toString());
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getAutoUpdateAndNet", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getAutoUpdateAndNet", "onComplete: ");
}
});
}
public void getNetAndLaunchSetting() {
getAppAutoStartUpdateAndNetObservable()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<NetAndLaunchBean>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getNetAndLaunchSetting", "onSubscribe: ");
}
@Override
public void onNext(@NonNull NetAndLaunchBean netAndLaunchBean) {
Log.e("getNetAndLaunchSetting", "onNext: " + netAndLaunchBean.toString());
if (netAndLaunchBean.getCode() == 200) {
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchBean);
} else {
Log.e("getNetAndLaunchSetting", "onNext: " + netAndLaunchBean.toString());
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getNetAndLaunchSetting", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getNetAndLaunchSetting", "onComplete: ");
}
});
}
public void getPoweroffTime(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
if (refresh) {

View File

@@ -1154,14 +1154,17 @@ public class PushManager {
JgyUtils.getInstance().openLauncher3();
} else {
String default_launcher = launcherElement.getAsString();
mMMKV.encode(CommonConfig.DEFAULT_LAUNCHER_PACKAGE_NAME, default_launcher);
JgyUtils.getInstance().setDefaultDesktop(default_launcher);
ComponentName cn = new ComponentName(default_launcher, JgyUtils.getInstance().getStartClassName(default_launcher));
Intent intent = new Intent();
intent.setComponent(cn);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
mMMKV.encode(CommonConfig.DEFAULT_LAUNCHER_PACKAGE_NAME, default_launcher);
}
}
}

View File

@@ -8,6 +8,7 @@ import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.utils.ApkUtils;
@@ -72,6 +73,7 @@ public class NewAppReceiver extends BroadcastReceiver {
}
Log.e(TAG, "sendAppInfo: " + state + packageName);
NetInterfaceManager.getInstance().checkUpdate();
JgyUtils.getInstance().setAllowPermissionsPackage();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (!PackageNames.APPSTORE.equals(packageName) || !PackageNames.DEVICE_INFO.equals(packageName)) {
ApkUtils.addShortcut(context);
@@ -80,8 +82,15 @@ public class NewAppReceiver extends BroadcastReceiver {
JgyUtils.getInstance().wakeUpAoleyunAPP();
//启动教官壹
}
newAppListener.setNewAppListener(packageName);
launcherListener.setDefaultLauncher(packageName);
switch (action){
case Intent.ACTION_PACKAGE_ADDED:
case Intent.ACTION_PACKAGE_REMOVED:
newAppListener.setNewAppListener(packageName);
launcherListener.setDefaultLauncher(packageName);
break;
default:
}
}
private void checkDefaultDesktop(String pkg) {
@@ -97,8 +106,7 @@ public class NewAppReceiver extends BroadcastReceiver {
private static void sendAppInfo() {
Observable.create((ObservableEmitter<String> emitter) -> {
newAppListener = emitter::onNext;
})
.throttleLast(5, TimeUnit.MINUTES)
}).throttleLast(5, TimeUnit.MINUTES)
//这句很关键这是RxJava中的操作符在规定时间内观察者不在接收被观察者发送的事件
.subscribe(new Observer<String>() {
@Override
@@ -112,7 +120,8 @@ public class NewAppReceiver extends BroadcastReceiver {
// JgyUtils.getInstance().checkForceDownload();
NetInterfaceManager.getInstance().getForceDownload();
NetInterfaceManager.getInstance().getAppLimit();
NetInterfaceManager.getInstance().getDefaultDesktop();
// NetInterfaceManager.getInstance().getDefaultDesktop();
NetInterfaceManager.getInstance().getNetAndLaunchSetting();
NetInterfaceManager.getInstance().sendInstalledAppInfo(new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
@@ -152,7 +161,6 @@ public class NewAppReceiver extends BroadcastReceiver {
@Override
public void onNext(@NonNull String pkg) {
Log.e("setLauncher", "onNext: " + pkg);
JgyUtils.getInstance().setAllowPermissionsPackage();
JgyUtils.getInstance().checkDefaultDesktop(pkg);
String oldDesktop = JgyUtils.getInstance().getDefaultDesktop();
// String oldDesktop = (String) SPUtils.get(mContext, "default_launcher", "");
@@ -161,6 +169,12 @@ public class NewAppReceiver extends BroadcastReceiver {
ApkUtils.openPackage(mContext, pkg);
}
JgyUtils.getInstance().updateNetworkWhiteList();
String ime = JgyUtils.getInstance().getDefaultIme();
if (!TextUtils.isEmpty(ime)) {
if (ime.equals(pkg)) {
JgyUtils.getInstance().setAllwinnerDefaulInputMeth(pkg);
}
}
}
@Override

View File

@@ -321,13 +321,13 @@ public class GuardService extends Service {
LocationClient locationClient = MapManager.getInstance().getLocationClient();
locationClient.stop();
locationClient.start();
getLockState("2", String.valueOf(time));
// getLockState("2", String.valueOf(time));
// sendScreenStatus(1);
}
break;
case Intent.ACTION_SCREEN_OFF: {
long time = System.currentTimeMillis();
getLockState("1", String.valueOf(time));
// getLockState("1", String.valueOf(time));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// JgyUtils.getInstance().wakeUpAoleyunAPP();
JgyUtils.getInstance().deleteScreenshots();
@@ -417,6 +417,7 @@ public class GuardService extends Service {
* @param status
* @param time 和锁屏状态无关,记录设备使用时长的
*/
@Deprecated
private void getLockState(String status, String time) {
if (JgyUtils.isOfficialVersion() || JgyUtils.getInstance().tagEmpty()) {
return;

View File

@@ -380,7 +380,7 @@ public class MainSPresenter implements MainSContact.Presenter {
mView.getDefaultDesktopFinish();
} else {
NetInterfaceManager.getInstance()
.getDefaultDesktop(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
.getDefaultDesktop( getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
mView.getDefaultDesktopFinish();
@@ -459,7 +459,7 @@ public class MainSPresenter implements MainSContact.Presenter {
@Override
public void getAppAutoStartUpdateAndNet() {
NetInterfaceManager.getInstance()
.getAppAutoStartUpdateAndNet(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
.getAppAutoStartUpdateAndNet( getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
mView.getAppAutoStartUpdateAndNetFinish();

View File

@@ -215,7 +215,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
Log.e("killObserver", "onNext: " + action);
JgyUtils.getInstance().killPackage(PackageNames.APPSTORE);
JgyUtils.getInstance().killPackage(PackageNames.NOTIFICATIONS);
JgyUtils.getInstance().killPackage(PackageNames.BROWSER);
JgyUtils.getInstance().killPackage(PackageNames.AILOG);
JgyUtils.getInstance().killPackage("com.ygyb.yischool");
}
@Override
@@ -443,7 +445,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
TimeTask task = new TimeTask();
task.execute("ntp.aliyun.com");
mPresenter.getLockedState();
Settings.Global.putString(getContentResolver(), "AOLE_SERIAL", Utils.getSerial(MainService.this));
PackageManager pm = getPackageManager();

View File

@@ -114,6 +114,7 @@ public class ApkUtils {
this.add("com.aoleyunos.dop8");
this.add("com.aoleyunos.dop9");
this.add("com.aoleyunos.dop10");
this.add("com.schoolos.cmcc");
// this.add("com.uiuios.jgy1");
// this.add("com.uiuios.jgy2");
// this.add("com.android.uiuios");
@@ -1394,7 +1395,7 @@ public class ApkUtils {
this.add("com.alarmclock.uiui");
this.add("com.uiui.speed");
this.add("com.books.wisdom");
this.add("com.schoolos.cmcc");
}};
public static final HashSet<String> G30_APP = new HashSet<String>() {{

View File

@@ -25,7 +25,15 @@ public class ForegroundAppUtil {
//系统应用可以直接获取
ActivityManager mActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> runningTaskInfos = mActivityManager.getRunningTasks(1);
return runningTaskInfos.get(0).topActivity.getPackageName();
if (runningTaskInfos != null && !runningTaskInfos.isEmpty()) {
ActivityManager.RunningTaskInfo taskInfo = runningTaskInfos.get(0);
if (taskInfo != null) {
if (taskInfo.topActivity != null) {
return taskInfo.topActivity.getPackageName();
}
}
}
return "";
}
public static void openTopApp(Context context) {

View File

@@ -25,6 +25,7 @@ import android.net.NetworkInfo;
import android.net.Uri;
import android.os.BatteryManager;
import android.os.Build;
import android.os.Debug;
import android.os.Environment;
import android.os.IBinder;
import android.os.PowerManager;
@@ -35,6 +36,8 @@ import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
@@ -69,6 +72,7 @@ import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
@@ -100,6 +104,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.function.BiConsumer;
@@ -833,6 +838,7 @@ public class JgyUtils {
this.add("com.aoleyunos.dop8");
this.add("com.aoleyunos.dop9");
this.add("com.aoleyunos.dop10");
this.add("com.schoolos.cmcc");
}};
public void setAppNetwork(HashSet<String> blackList, HashSet<String> whiteList) {
@@ -861,6 +867,15 @@ public class JgyUtils {
}
}
if (blackList != null) {
List<String> installedBlackApps = blackList.stream().filter(s -> ApkUtils.isAvailable(mContext, s)).collect(Collectors.toList());
Log.e(TAG, "setAppNetwork: installedBlackApps = " + installedBlackApps);
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setBlackNetApp(installedBlackApps);
}
}
mMMKV.encode(CommonConfig.AOLE_ACTION_NETWORK_ALLOW, whiteList);
Set<String> pkgs;
int is_app_install = Settings.System.getInt(crv, CommonConfig.AOLE_APP_ALLOW_INSTALL, 0);
@@ -884,6 +899,7 @@ public class JgyUtils {
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
}
}
}
/**
@@ -1404,6 +1420,7 @@ public class JgyUtils {
this.add("com.aoleyunos.dop8");
this.add("com.aoleyunos.dop9");
this.add("com.aoleyunos.dop10");
this.add("com.schoolos.cmcc");
this.add("com.aoleyun.info");
this.add("com.calculator.uiui");
this.add("com.notepad.uiui");
@@ -1464,12 +1481,19 @@ public class JgyUtils {
pkgSet.addAll(pkgs);
pkgSet.addAll(getWhitePkgList());
pkgSet.removeIf(TextUtils::isEmpty);
String aole_app_forbid = String.join(",", pkgSet);
Log.e(TAG, "writeAppPackageList: " + aole_app_forbid);
boolean b = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid);
setAppRestriction(2);
addAppInstallWhiteList(new ArrayList<>(pkgSet));
Log.e("writeAppPackageList: ", "aole_app_forbid: " + b + " " + Settings.System.getString(crv, CommonConfig.AOLE_ACTION_APP_FORBID));
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setInstallPackageWhiteList(new ArrayList<>(pkgSet));
Log.e(TAG, "setInstallPackageWhiteList: " + pkgSet);
} else {
String aole_app_forbid = String.join(",", pkgSet);
Log.e(TAG, "writeAppPackageList: " + aole_app_forbid);
boolean b = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid);
setAppRestriction(2);
addAppInstallWhiteList(new ArrayList<>(pkgSet));
Log.e("writeAppPackageList: ", "aole_app_forbid: " + b + " " + Settings.System.getString(crv, CommonConfig.AOLE_ACTION_APP_FORBID));
}
}
public void writeAppPackageList() {
@@ -1482,9 +1506,16 @@ public class JgyUtils {
pkgSet.addAll(getWhitePkgList());
pkgSet.removeIf(TextUtils::isEmpty);
String aole_app_forbid = String.join(",", pkgSet);
Log.e(TAG, "writeAppPackageList: " + aole_app_forbid);
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid);
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setInstallPackageWhiteList(new ArrayList<>(pkgSet));
Log.e(TAG, "setInstallPackageWhiteList: " + pkgSet);
} else {
String aole_app_forbid = String.join(",", pkgSet);
Log.e(TAG, "writeAppPackageList: " + aole_app_forbid);
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid);
}
}
public void checkForceDownload() {
@@ -1801,7 +1832,7 @@ public class JgyUtils {
this.add("com.aoleyunos.dop8");
this.add("com.aoleyunos.dop9");
this.add("com.aoleyunos.dop10");
this.add("com.schoolos.cmcc");
}};
HashSet<String> aihuaAppList = new HashSet<String>() {{
@@ -2061,18 +2092,19 @@ public class JgyUtils {
Log.e(TAG, "setDeveloperOptions: DEVELOPMENT_SETTINGS_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0));
Log.e(TAG, "setDeveloperOptions: ADB_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0));
if (!BuildConfig.DEBUG) {
if (Settings.Global.getInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != state) {
Settings.Global.putInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, state);
}
if (Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0) != state) {
Settings.Global.putInt(crv, Settings.Global.ADB_ENABLED, state);
}
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setDeveloperEnable(state == 1);
}
// if (!BuildConfig.DEBUG) {
if (Settings.Global.getInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != state) {
Settings.Global.putInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, state);
}
if (Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0) != state) {
Settings.Global.putInt(crv, Settings.Global.ADB_ENABLED, state);
}
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setDeveloperEnable(state == 1);
Log.e(TAG, "setDeveloperEnable: " + (state == 1));
}
// }
}
private String chromium_pkg = "org.chromium.browser";
@@ -2487,6 +2519,9 @@ public class JgyUtils {
private String AiUDuOs = "com.aoleyun.audos";
private String AiUDuOsClass = "com.aoleyun.audos.Launcher";
private String schoolosOs = "com.schoolos.cmcc";
private String schoolosClass = "com.schoolos.cmcc.activity.main.MainActivity";
public void setDefaultLauncher(Context context, String defPackageName, String defClassName) {
try {
if (!TextUtils.isEmpty(defPackageName) && !TextUtils.isEmpty(defClassName)) {
@@ -2523,23 +2558,23 @@ public class JgyUtils {
boolean add = true;
int flags = 0;
UserHandle user = Process.myUserHandle();
Log.i("settingssssssstemf", (add ? "Adding" : "Removing") + " package as role holder, role: "
Log.i("setRoleHolderAsUser", (add ? "Adding" : "Removing") + " package as role holder, role: "
+ roleName + ", package: " + packageName);
if (JgyUtils.getInstance().checkAppPlatform() != JgyUtils.MTKPlatform) {
RoleManager roleManager = context.getSystemService(RoleManager.class);
Executor executor = context.getMainExecutor();
Consumer<Boolean> callback = successful -> {
if (successful) {
Log.d("settingssssssstemf", "Package " + (add ? "added" : "removed")
Log.d("setRoleHolderAsUser", "Package " + (add ? "added" : "removed")
+ " as role holder, role: " + roleName + ", package: " + packageName);
} else {
Log.d("settingssssssstemf", "Failed to " + (add ? "add" : "remove")
Log.d("setRoleHolderAsUser", "Failed to " + (add ? "add" : "remove")
+ " package as role holder, role: " + roleName + ", package: "
+ packageName);
}
};
roleManager.addRoleHolderAsUser(roleName, packageName, flags, user, executor, callback);
Log.i("settingssssssstemf", "addRoleHolderAsUser done");
Log.i("setRoleHolderAsUser", "addRoleHolderAsUser done");
}
}
}
@@ -2656,6 +2691,8 @@ public class JgyUtils {
setDefaultDesktop(AoleyunOs, AoleyunOsClass);
} else if (JgyUtils.getInstance().isAiuduPlatform()) {
setDefaultDesktop(AiUDuOs, AiUDuOsClass);
} else if (JgyUtils.isAllWinnerDevice()) {
setDefaultDesktop(schoolosOs, schoolosClass);
} else {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
setDefaultDesktop(Launcher3, Launcher3QuickstepClass);
@@ -2671,6 +2708,8 @@ public class JgyUtils {
ApkUtils.openPackage(mContext, AoleyunOs, AoleyunOsClass);
} else if (JgyUtils.getInstance().isAiuduPlatform()) {
setDefaultDesktop(AiUDuOs, AiUDuOsClass);
} else if (JgyUtils.isAllWinnerDevice()) {
setDefaultDesktop(schoolosOs, schoolosClass);
} else {
ApkUtils.openPackage(mContext, Launcher3, Launcher3Class);
}
@@ -2741,8 +2780,13 @@ public class JgyUtils {
intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent);
if (JgyUtils.isAllWinnerDevice()) {
if (!ApkUtils.isAvailable(mContext, pkg)) {
Log.e(TAG, "cubeMdmManager setDefaultLauncher: " + pkg + " is not installed");
return;
}
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
cubeMdmManager.setDefaultLauncher(pkg);
Log.e(TAG, "cubeMdmManager setDefaultLauncher: " + pkg);
}
// ApkUtils.openPackage(mContext, pkg);
@@ -3083,11 +3127,17 @@ public class JgyUtils {
Gson gson = new Gson();
Type listType = new TypeToken<List<Long>>() {
}.getType();
List<Long> longList = gson.fromJson(jsonString, listType);
if (longList == null) {
try {
List<Long> longList = gson.fromJson(jsonString, listType);
if (longList == null) {
connectedTime = new ArrayList<>();
} else {
connectedTime = longList;
}
} catch (Exception e) {
Log.e(TAG, "initConnectedTimeCache: " + e.getMessage());
cacheHelper.remove(CONNECTED_TIME_KEY);
connectedTime = new ArrayList<>();
} else {
connectedTime = longList;
}
}
@@ -3341,7 +3391,9 @@ public class JgyUtils {
if (C2Tag.equals(BuildConfig.platform)) {
Log.e("ITools", "addAppInstallWhiteList: " + packageNameList);
try {
mITools.addAppInstallWhiteList(packageNameList);
if (mITools!=null) {
mITools.addAppInstallWhiteList(packageNameList);
}
} catch (RemoteException e) {
e.printStackTrace();
}
@@ -3616,4 +3668,139 @@ public class JgyUtils {
}
public void setAllwinnerDefaulInputMeth(String pkg) {
if (!ApkUtils.isAvailable(mContext, pkg)) {
Log.e(TAG, "cubeMdmManager setDefaultInputMethod: " + pkg + " is not installed");
return;
}
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
String componentName = JgyUtils.getInstance().getInputMethComponentName(pkg);
Log.e(TAG, "setDefaultInputMethod: " + componentName);
cubeMdmManager.setDefaultInputMethod(componentName);
Log.e(TAG, "cubeMdmManager setDefaultInputMethod: " + componentName);
}
public String getInputMethComponentName(String pkg) {
InputMethodManager imeManager = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
List<InputMethodInfo> InputMethods = imeManager.getInputMethodList();
Optional<InputMethodInfo> inputMethodInfoOptional = InputMethods.stream().filter(new Predicate<InputMethodInfo>() {
@Override
public boolean test(InputMethodInfo inputMethodInfo) {
return pkg.equals(inputMethodInfo.getPackageName());
}
}).findAny();
if (inputMethodInfoOptional.isPresent()) {
InputMethodInfo inputMethodInfo = inputMethodInfoOptional.get();
return inputMethodInfo.getComponent().toString();
} else {
return "";
}
}
public String getDefaultIme() {
return mMMKV.decodeString(CommonConfig.DEFAULT_IME_PACKAGE_NAME_KEY, "");
}
public void setAllwinnerDefaulBrowser(String pkg) {
if (JgyUtils.isAllWinnerDevice()) {
if (!ApkUtils.isAvailable(mContext, pkg)) {
Log.e(TAG, "cubeMdmManager setAllwinnerDefaulBrowser: " + pkg + " is not installed");
return;
}
CubeMdmManager cubeMdmManager = (CubeMdmManager) mContext.getSystemService("cube_mdm");
Log.e(TAG, "setAllwinnerDefaulBrowser: " + pkg);
cubeMdmManager.setDefaultInputMethod(pkg);
Log.e(TAG, "cubeMdmManager setAllwinnerDefaulBrowser: " + pkg);
}
}
public List<ProcessInfo> getAllRunningAppProcessInfo() {
ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
PackageManager pm = mContext.getPackageManager();
List<ActivityManager.RunningAppProcessInfo> processes = am.getRunningAppProcesses();
List<ProcessInfo> processList = new ArrayList<>();
for (ActivityManager.RunningAppProcessInfo process : processes) {
String[] pkgList = process.pkgList;
for (String pkg : pkgList) {
try {
ApplicationInfo appInfo = pm.getApplicationInfo(pkg, 0);
processList.add(new ProcessInfo(
pkg,
appInfo.loadLabel(pm).toString(),
process.pid,
getProcessMemory(am, process.pid),
(appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0
));
} catch (Exception ignored) {
}
}
}
String jsonString = GsonUtils.toJSONString(processList);
Log.e(TAG, "getAllRunningAppProcessInfo: " + jsonString);
return processList;
}
// 获取进程内存占用KB
private static long getProcessMemory(ActivityManager am, int pid) {
Debug.MemoryInfo[] memoryInfo = am.getProcessMemoryInfo(new int[]{pid});
return memoryInfo[0].getTotalPss();
}
public static class ProcessInfo {
public String packageName, appName;
public int pid;
public long memory;
public boolean isSystem;
public ProcessInfo(String pkg, String name, int pid, long memory, boolean isSystem) {
this.packageName = pkg;
this.appName = name;
this.pid = pid;
this.memory = memory;
this.isSystem = isSystem;
}
@androidx.annotation.NonNull
@Override
public String toString() {
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
}
}
// 获取所有正在运行的服务
public List<ServiceInfo> getAllRunningServices() {
ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningServiceInfo> runningServices = am.getRunningServices(Integer.MAX_VALUE);
List<ServiceInfo> serviceList = new ArrayList<>();
for (ActivityManager.RunningServiceInfo service : runningServices) {
serviceList.add(new ServiceInfo(
service.service.getClassName(),
service.service.getPackageName(),
service.pid,
service.uid
));
}
String jsonString = GsonUtils.toJSONString(serviceList);
Log.e(TAG, "getAllRunningServices: " + jsonString);
return serviceList;
}
public static class ServiceInfo {
public String className, packageName;
public int pid, uid;
public ServiceInfo(String cls, String pkg, int pid, int uid) {
this.className = cls;
this.packageName = pkg;
this.pid = pid;
this.uid = uid;
}
@androidx.annotation.NonNull
@Override
public String toString() {
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
}
}
}

View File

@@ -67,7 +67,7 @@ public class SysSettingUtils {
setStatusBar(context, navJson);
setBrowserInput(context, jsonObject);
// TODO: 2022/4/11 不是酷比定制的会报错,无法抛出异常
setUSBstate(context, jsonObject);
setUsbStatus(context, jsonObject);
setAdminApp(context, jsonObject);
setSystemAppDisable(context, jsonObject);
setNotification(context, jsonObject);
@@ -82,7 +82,7 @@ public class SysSettingUtils {
Toaster.debugShow("关闭所有功能");
Log.e("setDisableSetting", "Close all settings: ");
setPhoneList(context, 1);
setUSBstate(context, 1);
setUsbStatus(context, 1);
if (JgyUtils.getInstance().getAppPlatform().equals(JgyUtils.YXPD1TAG)
|| JgyUtils.getInstance().getAppPlatform().equals(JgyUtils.C2Tag)
|| JgyUtils.getInstance().getAppPlatform().equals(JgyUtils.ZR6016Tag)
@@ -189,7 +189,7 @@ public class SysSettingUtils {
}
}
private static void setUSBstate(Context context, int state) {
private static void setUsbStatus(Context context, int state) {
//USB数据功能管控
//仅充电usb_charge
//MTP模式usb_mtp
@@ -199,7 +199,7 @@ public class SysSettingUtils {
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
cubeMdmManager.setUsbStatus(state);
Log.e(TAG, "setUSBstate: state = " + state);
Log.e(TAG, "setUsbStatus: state = " + state);
} else {
SuperPower mService = (SuperPower) context.getSystemService("mdm");
mService.setUsbDataDisabled(true);
@@ -207,11 +207,11 @@ public class SysSettingUtils {
} else {
String oldUsb = Settings.System.getString(context.getContentResolver(), "aole_usb_choose");
if ("usb_charge".equals(oldUsb)) {
Log.e(TAG, "setUSBstate: oldUsb = " + oldUsb + " no changed , skip");
Log.e(TAG, "setUsbStatus: oldUsb = " + oldUsb + " no changed , skip");
return;
}
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", "usb_charge");
Log.e("setUSBstate", "aole_usb_choose: " + aole_usb_choose);
Log.e("setUsbStatus", "aole_usb_choose: " + aole_usb_choose);
String usbStatus;
switch (state) {
default:
@@ -238,75 +238,74 @@ public class SysSettingUtils {
}
}
private static void setUSBstate(Context context, JsonObject jsonObject) {
private static void setUsbStatus(Context context, JsonObject jsonObject) {
//USB数据功能管控
//仅充电usb_charge
//MTP模式usb_mtp
//Midi模式usb_midi
String setting_usb = jsonObject.get("setting_usb").getAsString();
String oldUsb = Settings.System.getString(context.getContentResolver(), "aole_usb_choose");
if (setting_usb.equals(oldUsb)) {
Log.e(TAG, "setUSBstate: oldUsb = " + oldUsb + " no changed , skip");
return;
}
if (!BuildConfig.DEBUG) {
if (JgyUtils.isCubeDevice()) {
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
switch (setting_usb) {
case "usb_charge":
cubeMdmManager.setUsbStatus(0);
break;
case "usb_mtp":
cubeMdmManager.setUsbStatus(1);
break;
case "usb_midi":
cubeMdmManager.setUsbStatus(2);
break;
default:
}
Log.e(TAG, "setUSBstate: setting_usb = " + setting_usb);
} else {
SuperPower mService = (SuperPower) context.getSystemService("mdm");
switch (setting_usb) {
case "usb_mtp":
mService.setUsbDataDisabled(false);
break;
default:
case "usb_midi":
case "usb_charge":
mService.setUsbDataDisabled(true);
break;
}
}
} else {
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", setting_usb);
Log.e("setUSBstate", "aole_usb_choose: " + aole_usb_choose);
String usbStatus;
switch (setting_usb) {
default:
case "usb_charge":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
JgyUtils.getInstance().setMtpEnable(false);
break;
case "usb_mtp":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
JgyUtils.getInstance().setMtpEnable(true);
break;
case "usb_midi":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MIDI;
JgyUtils.getInstance().setMtpEnable(false);
break;
}
Intent usbIntent = new Intent(usbStatus);
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TeclastP20sPlatform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.AH6016Platform
) {
usbIntent.setPackage("com.android.settings");
}
context.sendBroadcast(usbIntent);
// if (!BuildConfig.DEBUG) {
if (JgyUtils.isCubeDevice()) {
SuperPower mService = (SuperPower) context.getSystemService("mdm");
switch (setting_usb) {
case "usb_mtp":
mService.setUsbDataDisabled(false);
break;
default:
case "usb_midi":
case "usb_charge":
mService.setUsbDataDisabled(true);
break;
}
} else if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
switch (setting_usb) {
case "usb_charge":
cubeMdmManager.setUsbStatus(0);
break;
case "usb_mtp":
cubeMdmManager.setUsbStatus(1);
break;
case "usb_midi":
cubeMdmManager.setUsbStatus(2);
break;
default:
}
Log.e(TAG, "setUsbStatus: setting_usb = " + setting_usb);
} else {
String oldUsb = Settings.System.getString(context.getContentResolver(), "aole_usb_choose");
if (setting_usb.equals(oldUsb)) {
Log.e(TAG, "setUsbStatus: oldUsb = " + oldUsb + " no changed , skip");
return;
}
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", setting_usb);
Log.e("setUsbStatus", "aole_usb_choose: " + aole_usb_choose);
String usbStatus;
switch (setting_usb) {
default:
case "usb_charge":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
JgyUtils.getInstance().setMtpEnable(false);
break;
case "usb_mtp":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
JgyUtils.getInstance().setMtpEnable(true);
break;
case "usb_midi":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MIDI;
JgyUtils.getInstance().setMtpEnable(false);
break;
}
Intent usbIntent = new Intent(usbStatus);
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TeclastP20sPlatform
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.AH6016Platform
) {
usbIntent.setPackage("com.android.settings");
}
context.sendBroadcast(usbIntent);
}
// }
}
/**
@@ -365,6 +364,7 @@ public class SysSettingUtils {
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
cubeMdmManager.setBluetoothEnable(state == 0);
Log.e(TAG, "setBluetoothEnable: " + (state == 0));
}
}
@@ -472,6 +472,7 @@ public class SysSettingUtils {
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
cubeMdmManager.setBluetoothEnable(setting_bht == 0);
Log.e(TAG, "setBluetoothEnable: " + (setting_bht == 0));
}
}
@@ -487,6 +488,7 @@ public class SysSettingUtils {
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
cubeMdmManager.setWifiHotSpotStatus(state);
Log.e(TAG, "setWifiHotSpotStatus: " + state);
}
} catch (Exception e) {
Log.e(TAG, "setHotspot: " + e.getMessage());
@@ -509,6 +511,7 @@ public class SysSettingUtils {
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
cubeMdmManager.setWifiHotSpotStatus(setting_hotspot);
Log.e(TAG, "setWifiHotSpotStatus: " + setting_hotspot);
}
} catch (Exception e) {
Log.e(TAG, "setHotspot: " + e.getMessage());
@@ -669,41 +672,41 @@ public class SysSettingUtils {
private static void setTF(Context context, int state) {
//存储卡
JgyUtils.getInstance().setSDOTGEnable(state == 0);
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, state);
Log.e(TAG, "setTF: aole_sdcard_forbid_on = " + aole_sdcard_forbid_on);
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
cubeMdmManager.setSDEnable(state == 0);
}
Log.e(TAG, "setTF: setSDEnable = " + (state == 0));
} else {
JgyUtils.getInstance().setSDOTGEnable(state == 0);
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, state);
Log.e(TAG, "setTF: aole_sdcard_forbid_on = " + aole_sdcard_forbid_on);
try {
//tfmedia开关
try {
//tfmedia开关
// int setting_tfmedia = 1;
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", state);
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
String tfmediaStatus = "";
switch (state) {
case 0:
tfmediaStatus = "qch_tfmedia_open";
break;
case 1:
tfmediaStatus = "qch_tfmedia_forbid";
break;
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", state);
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
String tfmediaStatus = "";
switch (state) {
case 0:
tfmediaStatus = "qch_tfmedia_open";
break;
case 1:
tfmediaStatus = "qch_tfmedia_forbid";
break;
}
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
context.sendBroadcast(tfmediaIntent);
if (state == 1) {
boolean qch_tfmedia_filetypes = Settings.System.putString(context.getContentResolver(), "qch_tfmedia_filetypes", "Empty");//影音管控
Log.e(TAG, "qch_tfmedia_filetypes:" + qch_tfmedia_filetypes);
} else {
Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", 0);
}
} catch (Exception e) {
Log.e(TAG, "setTF: " + e.getMessage());
}
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
context.sendBroadcast(tfmediaIntent);
if (state == 1) {
boolean qch_tfmedia_filetypes = Settings.System.putString(context.getContentResolver(), "qch_tfmedia_filetypes", "Empty");//影音管控
Log.e(TAG, "qch_tfmedia_filetypes:" + qch_tfmedia_filetypes);
} else {
Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", 0);
}
} catch (Exception e) {
Log.e(TAG, "setTF: " + e.getMessage());
}
}
/**
@@ -713,51 +716,53 @@ public class SysSettingUtils {
private static void setTF(Context context, JsonObject jsonObject) {
//存储卡
int setting_memory = changeNum(jsonObject.get("setting_memory").getAsInt());
Log.e(TAG, "setTF: setting_memory = " + setting_memory);
JgyUtils.getInstance().setSDOTGEnable(setting_memory == 0);
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, setting_memory);
Log.e(TAG, "setTF: aole_sdcard_forbid_on = " + aole_sdcard_forbid_on);
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
cubeMdmManager.setSDEnable(setting_memory == 0);
}
Log.e(TAG, "setTF: setSDEnable = " + (setting_memory == 0));
} else {
Log.e(TAG, "setTF: setting_memory = " + setting_memory);
JgyUtils.getInstance().setSDOTGEnable(setting_memory == 0);
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, setting_memory);
Log.e(TAG, "setTF: aole_sdcard_forbid_on = " + aole_sdcard_forbid_on);
try {
int setting_tfmedia = jsonObject.get("setting_tfmedia").getAsInt();
try {
int setting_tfmedia = jsonObject.get("setting_tfmedia").getAsInt();
// if (JgyUtils.isOfficialVersion() ) {
// setting_tfmedia = changeNum(setting_tfmedia);
// }
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
String tfmediaStatus = "";
switch (setting_tfmedia) {
case 0:
Log.e(TAG, "setting_tfmedia: " + "打开");
tfmediaStatus = "qch_tfmedia_open";
break;
case 1:
Log.e(TAG, "setting_tfmedia: " + "禁止");
tfmediaStatus = "qch_tfmedia_forbid";
break;
}
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
context.sendBroadcast(tfmediaIntent);
if (setting_tfmedia == 1) {
JsonArray jSONArray = jsonObject.get("setting_tfmedia_format").getAsJsonArray();
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < jSONArray.size(); i++) {
stringBuffer.append(jSONArray.get(i).toString());
stringBuffer.append(",");
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
Log.e(TAG, "setting_tfmedia---------" + qch_tfmedia_forbid);
String tfmediaStatus = "";
switch (setting_tfmedia) {
case 0:
Log.e(TAG, "setting_tfmedia: " + "打开");
tfmediaStatus = "qch_tfmedia_open";
break;
case 1:
Log.e(TAG, "setting_tfmedia: " + "禁止");
tfmediaStatus = "qch_tfmedia_forbid";
break;
}
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
Settings.System.putString(context.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
Log.e(TAG, "qch_tfmedia_filetypes---------" + stringBuffer.toString());
} else {
Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", 0);
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
context.sendBroadcast(tfmediaIntent);
if (setting_tfmedia == 1) {
JsonArray jSONArray = jsonObject.get("setting_tfmedia_format").getAsJsonArray();
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < jSONArray.size(); i++) {
stringBuffer.append(jSONArray.get(i).toString());
stringBuffer.append(",");
}
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
Settings.System.putString(context.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
Log.e(TAG, "qch_tfmedia_filetypes---------" + stringBuffer.toString());
} else {
Settings.System.putInt(context.getContentResolver(), "qch_tfmedia_forbid", 0);
}
} catch (Exception e) {
Log.e(TAG, "setTF: " + e.getMessage());
}
} catch (Exception e) {
Log.e(TAG, "setTF: " + e.getMessage());
}
}

View File

@@ -16,6 +16,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.cubemdm.cubemdmmanager.CubeMdmManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@@ -1149,7 +1150,18 @@ public class Utils {
writeSucceed = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, list);
Log.e("fht", "aole_app_forbid:" + list);
} else {
writeSucceed = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, "Invalid");
writeSucceed = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, "");
}
if (JgyUtils.isAllWinnerDevice()) {
CubeMdmManager cubeMdmManager = (CubeMdmManager) context.getSystemService("cube_mdm");
try {
cubeMdmManager.setInstallPackageWhiteList(allList);
Log.e(TAG, "setInstallPackageWhiteList: " + allList);
writeSucceed = true;
} catch (Exception e) {
Log.e(TAG, "writeDisableUpdateList: " + e.getMessage());
writeSucceed = false;
}
}
return writeSucceed;