1.4.0429 修改一键加速界面,去掉ToastUtil,对接权限和通知

This commit is contained in:
2024-05-08 14:33:06 +08:00
parent 08f5867864
commit 004de0cc2e
32 changed files with 885 additions and 527 deletions

View File

@@ -29,8 +29,8 @@ android {
defaultConfig {
applicationId "com.aoleyun.sn"
versionCode 118
versionName "1.4.0329"
versionCode 128
versionName "1.4.0429"
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
minSdkVersion 24
@@ -177,7 +177,14 @@ android {
v2SigningEnabled false
}
Huaruian8768 {
storeFile file("keystore/Huaruian8768.jks")
storePassword "123456"
keyAlias "Huaruian8768"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
}
// Disable release builds for now
@@ -189,6 +196,20 @@ android {
}
buildTypes {
Huaruian8768Debug.initWith(debug)
Huaruian8768Debug {
versionNameSuffix "-debug"
debuggable true
signingConfig signingConfigs.Huaruian8768
buildConfigField "String", "platform", '"MT8768"'
}
Huaruian8768Release.initWith(release)
Huaruian8768Release {
signingConfig signingConfigs.Huaruian8768
buildConfigField "String", "platform", '"MT8768"'
}
YXPD1Debug.initWith(debug)
YXPD1Debug {
versionNameSuffix "-debug"
@@ -524,6 +545,9 @@ dependencies {
// implementation 'com.gyf.immersionbar:immersionbar-ktx:3.0.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'
implementation 'com.facebook.rebound:rebound:0.3.8'
implementation 'com.king.view:circleprogressview:1.1.2'
// 吐司框架https://github.com/getActivity/Toaster
implementation 'com.github.getActivity:Toaster:12.6'
}
preBuild {

Binary file not shown.

View File

@@ -1,20 +1,34 @@
package com.aoleyun.sn.activity;
import android.app.ActivityManager;
import android.content.Context;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.R;
import com.aoleyun.sn.base.BaseActivity;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.ApkUtils;
import com.aoleyun.sn.utils.AppUtil;
import com.hjq.toast.Toaster;
import com.king.view.circleprogressview.CircleProgressView;
import java.lang.reflect.Method;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
public class CleanupActivity extends BaseActivity {
private static final String TAG = CleanupActivity.class.getSimpleName();
@BindView(R.id.tv_clean)
TextView tv_clean;
@BindView(R.id.cpv)
CircleProgressView cpv;
/**
* 设置布局
@@ -33,11 +47,60 @@ public class CleanupActivity extends BaseActivity {
tv_clean.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
JGYUtils.getInstance().cleanBackgroundMemory();
ToastUtil.show("清理完成");
finish();
killBackgroundApp();
}
});
refreshMemory();
}
private void killBackgroundApp() {
List<String> pkgList = ApkUtils.queryFilterAppList(this);
for (String pkg : pkgList) {
if (pkg.equalsIgnoreCase(BuildConfig.APPLICATION_ID)
|| "com.tencent.mm".equals(pkg)
|| "com.uiui.sn".equals(pkg)
) {
continue;
}
killBackgroundProcesses(pkg);
}
Toaster.show(String.format(getString(R.string.clear_app_size), pkgList.size()));
refreshMemory();
Handler.getMain().postDelayed(new Runnable() {
@Override
public void run() {
finish();
}
}, 1500);
}
private void killBackgroundProcesses(String packageName) {
ActivityManager activityManager;
try {
activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
activityManager.killBackgroundProcesses(packageName);
Method forceStopPackage = activityManager.getClass()
.getDeclaredMethod("forceStopPackage", String.class);
// Log.e(TAG, "killBackgroundProcesses: " + packageName);
forceStopPackage.setAccessible(true);
forceStopPackage.invoke(activityManager, packageName);
} catch (Exception e) {
Log.e(TAG, "killBackgroundProcesses: " + e.getMessage());
e.printStackTrace();
}
}
private void refreshMemory() {
long avail = AppUtil.getAvailMemory(this);
long total = AppUtil.getTotalMemory(this);
int x = (int) (((total - avail) / (double) total) * 100);
// if (x > 80) {
// cpv.setProgressColor(mShaderColorsRed);
// } else {
// cpv.setProgressColor(mShaderColors);
// }
cpv.showAnimation(0, x, 1000);
float x2 = (((total - avail) / (float) total));
}
/**
@@ -47,4 +110,6 @@ public class CleanupActivity extends BaseActivity {
public void initData() {
}
}

View File

@@ -7,8 +7,8 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import com.aoleyun.sn.R;
import com.aoleyun.sn.base.BaseActivity;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.view.ToggleButton;
import com.hjq.toast.Toaster;
import butterknife.BindView;
import butterknife.ButterKnife;
@@ -48,27 +48,28 @@ public class EyeProtectionActivity extends BaseActivity {
@Override
public void onToggle(boolean on) {
Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, on ? 1 : 0);
Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, on ? 0 : 1);
}
});
toggleButton3.setDisable(true);
toggleButton3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ToastUtil.show("此功能暂未开放");
Toaster.show("此功能暂未开放");
}
});
toggleButton4.setDisable(true);
toggleButton4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ToastUtil.show("此功能暂未开放");
Toaster.show("此功能暂未开放");
}
});
toggleButton5.setDisable(true);
toggleButton5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ToastUtil.show("此功能暂未开放");
Toaster.show("此功能暂未开放");
}
});

View File

@@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
import android.app.StatusBarManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.media.AudioManager;
import android.os.Build;
@@ -12,7 +11,6 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
@@ -94,6 +92,7 @@ public class SplashActivity extends AppCompatActivity {
private void initView() {
if (BuildConfig.DEBUG) {
// JGYUtils.getInstance().showApp("com.gaomuxuexi34");
JGYUtils.getModel();
Log.e(TAG, "getOperators: " + NetworkUtils.getOperators(this));
Log.e(TAG, "PublicIP: " + MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE).decodeString(NetInterfaceManager.PublicIP, ""));
@@ -107,7 +106,7 @@ public class SplashActivity extends AppCompatActivity {
Log.e(TAG, "initView: " + GetFlowUtil.byteToMB(flowInfo2.getDownKb()));
Log.e(TAG, "initView: " + Utils.getCurrentChargingCurrent());
Log.e(TAG, "initView: " + Utils.getCurrentChargingVoltage());
ApkUtils.showAllAPP(this);
ApkUtils.showAllApp(this);
// JGYUtils.getInstance().cleanBackgroundMemory();
// NetInterfaceManager.getInstance().uploadLogFile();
bt_log = findViewById(R.id.bt_log);

View File

@@ -10,9 +10,9 @@ import com.aoleyun.sn.base.BaseActivity;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SysSettingUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.Utils;
import com.blankj.utilcode.util.NetworkUtils;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV;
import java.util.concurrent.TimeUnit;
@@ -378,7 +378,7 @@ public class CheckNetActivity extends BaseActivity implements CheckNetContact.Ma
private void lazyExit() {
if (System.currentTimeMillis() - mPreClickTime > 3000) {
ToastUtil.show("再按一次,退出");
Toaster.show("再按一次,退出");
mPreClickTime = System.currentTimeMillis();
} else {
finish();

View File

@@ -11,8 +11,8 @@ import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.SysSettingUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.URLUtils;
import com.hjq.toast.Toaster;
import com.trello.rxlifecycle4.LifecycleProvider;
import com.trello.rxlifecycle4.android.ActivityEvent;
@@ -197,7 +197,7 @@ public class CheckNetPresenter implements CheckNetContact.Presenter {
//重置设备
JGYUtils.getInstance().resetDevice();
mView.getSystemSettingbegin();
ToastUtil.debugShow("开始获取管控");
Toaster.debugShow("开始获取管控");
}
@Override
@@ -226,7 +226,7 @@ public class CheckNetPresenter implements CheckNetContact.Presenter {
int locked = Settings.System.getInt(crv, JGYActions.ACTION_QCH_UNLOCK_IPAD, 0);
Log.e(TAG, "getDeviceBatch: " + locked);
if (locked == 0) {
JGYUtils.getInstance().deleteOtherApp();
// JGYUtils.getInstance().deleteOtherApp();
mView.getDeviceBatchFinish();
}
}
@@ -277,7 +277,7 @@ public class CheckNetPresenter implements CheckNetContact.Presenter {
mNetInterfaceManager.getDesktopIcon(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
JGYUtils.getInstance().hideSystemAPP();
// JGYUtils.getInstance().hideSystemAPP();
mView.getDesktopIconFinish();
}
});

View File

@@ -42,11 +42,11 @@ import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.SysSettingUtils;
import com.aoleyun.sn.utils.TimeUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.Utils;
import com.blankj.utilcode.util.NetworkUtils;
import com.bumptech.glide.Glide;
import com.google.gson.JsonObject;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV;
import java.util.concurrent.TimeUnit;
@@ -234,7 +234,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
@Override
public void onClick(View v) {
if (updateApp) {
ToastUtil.show("你已经检查过更新,请稍后再试");
Toaster.show("你已经检查过更新,请稍后再试");
} else {
emitter.onNext(view);
}
@@ -251,7 +251,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
@Override
public void onNext(@NonNull View view) {
Log.e("mObserver", "onNext");
ToastUtil.show("正在检查更新");
Toaster.show("正在检查更新");
// mMainAPresenter.buttonCheckUpdate(bt_checkupdate);
}
@@ -509,7 +509,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
} else {
Observable.timer(5000, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> ToastUtil.show("已经是最新版本"));
.subscribe(aLong -> Toaster.show("已经是最新版本"));
}
}
@@ -629,7 +629,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
private void lazyExit() {
if (System.currentTimeMillis() - mPreClickTime > 3000) {
ToastUtil.show("再按一次,退出");
Toaster.show("再按一次,退出");
mPreClickTime = System.currentTimeMillis();
} else {
finish();

View File

@@ -23,12 +23,11 @@ import com.aoleyun.sn.bean.AppUpdateInfo;
import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.gson.GsonUtils;
import com.aoleyun.sn.utils.ApkUtils;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.Utils;
import com.bumptech.glide.Glide;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.hjq.toast.Toaster;
import java.util.List;
@@ -100,11 +99,11 @@ public class AppUpdateAdapter extends RecyclerView.Adapter<AppUpdateAdapter.Hold
public void onClick(View view) {
notifyDataSetChanged();
if (isUpdate(appInfo)) {
ToastUtil.show("开始下载:" + appInfo.getApp_name());
Toaster.show("开始下载:" + appInfo.getApp_name());
JsonObject jsonObject = GsonUtils.getJsonObject(new Gson().toJson(appInfo));
Utils.ariaDownload(mContext, appInfo.getUrl(), jsonObject);
} else {
ToastUtil.show(appInfo.getApp_name() + " 已是最新版本");
Toaster.show(appInfo.getApp_name() + " 已是最新版本");
Log.e(TAG, "onClick: 没有找到更新");
}
}

View File

@@ -19,11 +19,11 @@ import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.push.PushManager;
import com.aoleyun.sn.rlog.LogDBManager;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.Utils;
import com.aoleyun.sn.utils.WiFiUtils;
import com.aoleyun.sn.utils.XAPKUtils;
import com.arialyy.aria.core.Aria;
import com.hjq.toast.Toaster;
import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.mmkv.MMKV;
@@ -54,7 +54,8 @@ public class BaseApplication extends MultiDexApplication {
String rootDir = MMKV.initialize(this);
Log.e(TAG, "mmkv root: " + rootDir);
// 初始化 Toast 框架
Toaster.init(this);
CrashReport.initCrashReport(getApplicationContext(), "b16b3c7f1a", false);
CrashReport.setDeviceId(this, Utils.getSerial(this));
xcrash.XCrash.init(this);

View File

@@ -6,14 +6,18 @@ import com.google.gson.JsonParser;
import java.io.Serializable;
public class NetAndLaunchData implements Serializable {
private static final long serialVersionUID = 3377827489329306025L;
private String app_package;
private int is_auto;
private int is_network;
private int is_camera;
private int is_slide;
private int is_upgrade;
String app_package;
int is_auto;
int is_network;
int is_camera;
int is_slide;
int is_upgrade;
int is_appstore;
int is_notification;
int is_dynamic_perm;
public int getIs_slide() {
return is_slide;
@@ -24,7 +28,6 @@ public class NetAndLaunchData implements Serializable {
}
public int getIs_upgrade() {
return is_upgrade;
}
@@ -66,6 +69,30 @@ public class NetAndLaunchData implements Serializable {
this.is_camera = is_camera;
}
public int getIs_appstore() {
return is_appstore;
}
public void setIs_appstore(int is_appstore) {
this.is_appstore = is_appstore;
}
public int getIs_notification() {
return is_notification;
}
public void setIs_notification(int is_notification) {
this.is_notification = is_notification;
}
public int getIs_dynamic_perm() {
return is_dynamic_perm;
}
public void setIs_dynamic_perm(int is_dynamic_perm) {
this.is_dynamic_perm = is_dynamic_perm;
}
@Override
public String toString() {
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();

View File

@@ -2,6 +2,9 @@ package com.aoleyun.sn.bean;
import java.io.Serializable;
/**
* 所有都为 1打开 0关闭
*/
public class SnSetting implements Serializable {
private static final long serialVersionUID = -1984636328774813651L;

View File

@@ -80,6 +80,8 @@ public class CommonConfig {
/*电话白名单*/
/*保存之前旧版状态*/
public final static String AOLE_ACTION_USB_CODE = "aole_action_usb_code";
/*USB模式-充电*/
public final static String AOLE_ACTION_USB_USB_CHARGE = "aole_action_usb_usb_charge";
/*USB模式-MTP*/
@@ -110,7 +112,7 @@ public class CommonConfig {
/*存储卡管控*/
public final static String AOLE_ACTION_SDCARD_FORBID_ON = "aole_sdcard_forbid_on";
/*开发者选项管控*/
/*开发者选项管控 state为1关闭为0打开*/
public final static String AOLE_ACTION_DEVELOPER_OPTIONS = "aole_Developeroptions";
/*显示导航栏*/
public final static String AOLE_ACTION_SHOW_NAVIGATION_BAR = "aole_show_NavigationBar";
@@ -122,12 +124,14 @@ public class CommonConfig {
public final static String AOLE_ACTION_HIDE_STATUS_BAR = "aole_hide_statusBar";
/*热点*/
public final static String AOLE_ACTION_HOTSPOT_FORBID_ON = "aole_hotspot_forbid_on";
/*蓝牙总开关*/
public final static String AOLE_ACTION_BHT_FORBID_ON = "aole_bht_forbid_on";
/*蓝牙传输开关*/
public final static String AOLE_ACTION_BT_FORBID_ON = "aole_bt_forbid_on";
/*蓝牙音频开关*/
public final static String AOLE_ACTION_BHTVIDEO_FORBID_ON = "aole_bhtvideo_forbid_on";
/*电话白名单开关*/
public final static String AOLE_ACTION_WHITE_LIST_ON = "aole_white_list_on";
/*电话白名单列表*/

View File

@@ -1,13 +1,10 @@
package com.aoleyun.sn.hook;
import android.app.IActivityController;
import android.content.Context;
import android.content.Intent;
import android.provider.Settings;
import android.util.Log;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.ToastUtil;
public class AoleyunActivityController extends IActivityController.Stub {
private static final String TAG = AoleyunActivityController.class.getSimpleName();
@@ -17,13 +14,8 @@ public class AoleyunActivityController extends IActivityController.Stub {
Log.e(TAG, "activityStarting: " + pkg + ", intent= " + intent);
//false 则不会启动,直接返回。
if (JGYUtils.getInstance().isCloudLessonMod(pkg)) {
if (JGYUtils.getInstance().isForbid(pkg)) {
return true;
} else {
return false;
}
return true;
} else {
ToastUtil.show("专注模式只允许使用指定应用");
return false;
}
}

View File

@@ -130,7 +130,6 @@ import com.aoleyun.sn.utils.NetworkUtils;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.SysSettingUtils;
import com.aoleyun.sn.utils.TimeUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.URLUtils;
import com.aoleyun.sn.utils.Utils;
import com.aoleyun.sn.utils.WiFiUtils;
@@ -141,6 +140,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV;
import com.trello.rxlifecycle4.RxLifecycle;
import com.trello.rxlifecycle4.android.ActivityEvent;
@@ -1347,9 +1347,9 @@ public class NetInterfaceManager {
public void setLogoImg(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.HALF_DAY;
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
if (refresh) {
connectMode = ConnectMode.SIX_HOUR;
connectMode = ConnectMode.DEFAULT;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_LOGO_IMG, connectMode)) {
setLogoImg(lifecycle, callback);
@@ -1424,19 +1424,21 @@ public class NetInterfaceManager {
connectMode = ConnectMode.ONE_MINUTE;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_DEVELOPER, connectMode)) {
Log.e(TAG, "getDeveloper: cache2" );
getDeveloper(lifecycle, callback);
} else {
String jsonString = cacheHelper.getAsString(UrlAddress.GET_DEVELOPER);
//为 "" 是已经请求成功的
if (jsonString == null) {
Log.e(TAG, "getDeveloper: cache2" );
getDeveloper(lifecycle, callback);
} else {
Gson gson = new Gson();
Type type = new TypeToken<DeveloperBean>() {
}.getType();
DeveloperBean developerBean = gson.fromJson(jsonString, type);
JGYUtils.getInstance().setDeveloperOptions(developerBean.getIs_developer() == 0 ? 1 : 0);
callback.onComplete();
// Gson gson = new Gson();
// Type type = new TypeToken<DeveloperBean>() {
// }.getType();
// DeveloperBean developerBean = gson.fromJson(jsonString, type);
// JGYUtils.getInstance().setDeveloperOptions(developerBean.getIs_developer());
// callback.onComplete();
}
}
}
@@ -1452,27 +1454,22 @@ public class NetInterfaceManager {
@Override
public void onNext(BaseResponse<DeveloperBean> baseResponse) {
Log.e("getDeveloper", "onNext: " + baseResponse);
Log.e("getDeveloper1", "onNext: " + baseResponse);
if (baseResponse.code == OK) {
DeveloperBean developerBean = baseResponse.data;
cacheHelper.put(UrlAddress.GET_DEVELOPER, GsonUtils.toJSONString(developerBean));
int is_developer = developerBean.getIs_developer();
Log.e("getDeveloper", "onNext: " + is_developer);
Log.e("getDeveloper2", "onNext: " + is_developer);
//后台1是0否 底层0是1否
JGYUtils.getInstance().setDeveloperOptions(is_developer == 0 ? 1 : 0);
JGYUtils.getInstance().setDeveloperOptions(is_developer);
} else {
JGYUtils.getInstance().setDeveloperOptions(1);
JGYUtils.getInstance().setDeveloperOptions(0);
}
}
@Override
public void onError(Throwable e) {
Log.e("getDeveloper", "onError: " + e.getMessage());
if (!BuildConfig.DEBUG) {
int oldStatus = Settings.System.getInt(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
Log.e("getDeveloper", "oldStatus: " + oldStatus);
JGYUtils.getInstance().setDeveloperOptions(oldStatus);
}
onComplete();
}
@@ -1614,7 +1611,7 @@ public class NetInterfaceManager {
@Override
public void onNext(@NonNull BaseResponse response) {
Log.e("getDesktopIcon", "onNext: " + response);
ApkUtils.showAllAPP(mContext);
ApkUtils.showAllApp(mContext);
if (response.code == OK) {
String data = response.data.toString();
if (!TextUtils.isEmpty(data)) {
@@ -1935,9 +1932,9 @@ public class NetInterfaceManager {
JGYUtils.getInstance().SettingSysData("");
cacheHelper.put(UrlAddress.GET_FIRMWARE, "");
//获取系统管控先不要关闭开发人员选项
if (!BuildConfig.DEBUG) {
Settings.System.putInt(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
}
// if (!BuildConfig.DEBUG) {
// Settings.System.putInt(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
// }
}
}
@@ -1996,7 +1993,7 @@ public class NetInterfaceManager {
Log.e("getEBagCode", "onNext: " + baseResponse);
if (baseResponse.code == OK) {
EBagCode eBagCode = baseResponse.data;
if (JGYUtils.getInstance().checkAppPlatform()!=JGYUtils.YXPD1Platform) {
if (JGYUtils.getInstance().checkAppPlatform() != JGYUtils.YXPD1Platform) {
Settings.System.putString(mContext.getContentResolver(), CommonConfig.ACTIVATIONBEAN_CODE_KEY, eBagCode.getEbagCode());
}
cacheHelper.put(UrlAddress.GET_EBAG_CODE, GsonUtils.toJSONString(eBagCode));
@@ -2271,6 +2268,7 @@ public class NetInterfaceManager {
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.C2Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform
) {
JGYUtils.getInstance().showApp(PackageNames.YIXUEPAI_DESKTOP);
JGYUtils.getInstance().setYxpDefaultDesktop();
@@ -2284,6 +2282,7 @@ public class NetInterfaceManager {
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.C2Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform
) {
JGYUtils.getInstance().hideApp(PackageNames.YIXUEPAI_DESKTOP);
JGYUtils.getInstance().setDefaultDesktop();
@@ -2305,7 +2304,7 @@ public class NetInterfaceManager {
@Override
public void onError(@NonNull Throwable e) {
Log.e("getLockedState", "onError: " + e.getMessage());
onComplete();
// onComplete();
}
@Override
@@ -2443,8 +2442,14 @@ public class NetInterfaceManager {
cacheHelper.put(UrlAddress.GET_DEVICES_TAGS, GsonUtils.toJSONString(response.data));
String batch = response.data.getBatch();
Log.e("setPushTags", "onNext: " + batch);
String lastBatch = mMMKV.decodeString(CommonConfig.DEVICES_TAG, "");
if (!lastBatch.equals(batch)) {
Log.e("setPushTags", "onNext: change batch");
Aria.download(this).removeAllTask(true);
}
if (TextUtils.isEmpty(batch)) {
Log.e("setPushTags", "onNext: " + "batch empty");
mMMKV.encode(CommonConfig.DEVICES_TAG, "");
if (callback != null)
callback.setPushTag("");
} else {
@@ -2454,6 +2459,7 @@ public class NetInterfaceManager {
tags.add(batch);
}
} else {
mMMKV.encode(CommonConfig.DEVICES_TAG, "");
cacheHelper.put(UrlAddress.GET_DEVICES_TAGS, "");
if (callback != null)
callback.setPushTag("");
@@ -2510,6 +2516,8 @@ public class NetInterfaceManager {
tagSets.add(JGYUtils.YXPD1TAG);
} else if (platform == JGYUtils.G11Platform) {
tagSets.add(JGYUtils.G11TAG);
} else if (platform == JGYUtils.MT8768Platform) {
tagSets.add(JGYUtils.MT8768Tag);
}
});
Log.e(TAG, "clearAndAppendTags: " + tagSets);
@@ -2653,7 +2661,7 @@ public class NetInterfaceManager {
}
}
}).collect(Collectors.toList());
List<PackageInfo> filterJxwApp = filter.stream().filter(packageInfo -> !ApkUtils.jxwApp.contains(packageInfo.packageName)).collect(Collectors.toList());
List<PackageInfo> filterJxwApp = filter.stream().filter(packageInfo -> !ApkUtils.mJxwApp.contains(packageInfo.packageName)).collect(Collectors.toList());
for (PackageInfo packageInfo : filterJxwApp) {
if ("com.uiuipad.find".equals(packageInfo.packageName)
|| "com.uiuipad.os".equals(packageInfo.packageName)
@@ -3588,7 +3596,7 @@ public class NetInterfaceManager {
Log.e("getTopApp", "onComplete: ");
callback.onComplete();
Log.e("getTopApp", "onComplete: " + Settings.Global.getString(mContext.getContentResolver(), ForegroundAppUtil.TOPAPP_KEY));
ToastUtil.debugShow("获取app霸屏管控结束");
Toaster.debugShow("获取app霸屏管控结束");
}
});
}

View File

@@ -4,10 +4,6 @@ package com.aoleyun.sn.network;
* @author Administrator
*/
public class UrlAddress {
/*学习机*/
public static final String AOLELEARN_ROOT = "https://led.aolelearn.com/android/";
/*获取专属应用*/
public static final String GET_EXCLUSIVE_ADMIN_APP = "getExclusiveAdminApp";
/**
* 设备管控信息
@@ -162,4 +158,9 @@ public class UrlAddress {
public static final String PCONLINE_WHOIS = "http://whois.pconline.com.cn/";
public static final String WHOIS = "ipJson.jsp";
/*学习机*/
public static final String AOLELEARN_ROOT = "https://led.aolelearn.com/android/";
/*获取专属应用*/
public static final String GET_EXCLUSIVE_ADMIN_APP = "getExclusiveAdminApp";
}

View File

@@ -51,7 +51,6 @@ import com.aoleyun.sn.utils.MySQLData;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.ServiceAliveUtils;
import com.aoleyun.sn.utils.TimeUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.Utils;
import com.arialyy.aria.core.Aria;
import com.baidu.location.BDAbstractLocationListener;
@@ -62,6 +61,7 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV;
import java.io.File;
@@ -251,44 +251,46 @@ public class PushManager {
public void setPushContent(String title, String extras) {
switch (title) {
case MSG_DELETE:
ToastUtil.debugShow("收到管控:应用删除");
Toaster.debugShow("收到管控:应用删除");
deleteApp(extras);
break;
case MSG_SETTING:
ToastUtil.debugShow("收到管控:系统设置");
Toaster.debugShow("收到管控:系统设置");
if (!TextUtils.isEmpty(extras)) {
JGYUtils.getInstance().SettingSysData(extras);
JGYUtils.getInstance().removeAllTask();
}
break;
case MSG_BROWSER:
ToastUtil.debugShow("收到管控:浏览器网址管控");
Toaster.debugShow("收到管控:浏览器网址管控");
getDeselectBrowerID();
break;
case MSG_APPID:
ToastUtil.debugShow("收到管控APP ID管控");
Toaster.debugShow("收到管控APP ID管控");
getDeselectID();
break;
case MSG_NET_CONTROL:
ToastUtil.debugShow("收到管控:应用联网管控");
Toaster.debugShow("收到管控:应用联网管控");
settingNetControl(extras);
break;
case MSG_POWER_ON:
ToastUtil.debugShow("收到管控:应用自启管控");
Toaster.debugShow("收到管控:应用自启管控");
settingPowerOn(extras);
break;
case MSG_RESET:
ToastUtil.debugShow("收到管控:设备重置");
Toaster.debugShow("收到管控:设备重置");
JGYUtils.getInstance().cleanAoleLauncher3Cache();
Utils.doMasterClear(mContext);
Aria.download(this).removeAllTask(true);
mMMKV.clearAll();
JGYUtils.getInstance().cleanAoleAppCache();
JGYUtils.getInstance().wakeUpAoleyunAPP();
NetInterfaceManager.getInstance().setPushTags();
sendRefreshBroadcast(mContext);
break;
case MSG_INSTALL:
ToastUtil.debugShow("收到管控:应用安装");
Toaster.debugShow("收到管控:应用安装");
doDownloadAndInstall(extras);
Handler.getMain().postDelayed(new Runnable() {
@Override
@@ -301,26 +303,26 @@ public class PushManager {
mContext.sendBroadcast(new Intent(AOLEYUN_REFRESH_DESKTOP));
break;
case MSG_LOCK:
ToastUtil.debugShow("收到管控:设备锁定");
Toaster.debugShow("收到管控:设备锁定");
settingLock(extras);
break;
case MSG_CAMERA:
ToastUtil.debugShow("收到管控:相机管控");
Toaster.debugShow("收到管控:相机管控");
settingCamera(extras);
break;
case MSG_ONEPACKAGES:
ToastUtil.debugShow("收到管控:");
Toaster.debugShow("收到管控:");
settingOneNet(extras);
break;
case GET_APP_USEDTIME:
ToastUtil.debugShow("收到管控:获取应用使用时间");
Toaster.debugShow("收到管控:获取应用使用时间");
JsonObject usedTimeJson = GsonUtils.getJsonObject(extras);
String random = usedTimeJson.get("random").getAsString();
String sendType = usedTimeJson.get("type").getAsString();
NetInterfaceManager.getInstance().sendAppUsedTime(random, sendType);
break;
case GET_FORCEDOWNLOADURL:
ToastUtil.debugShow("收到管控:应用强制安装");
Toaster.debugShow("收到管控:应用强制安装");
File file = new File(JGYUtils.getInstance().getDownLoadPath());
if (!file.exists()) {
file.mkdirs();
@@ -352,21 +354,21 @@ public class PushManager {
Log.e(TAG, "setHomepagtag: " + e.getMessage());
}
setHomepagtag();
ToastUtil.debugShow("收到管控:浏览器主页书签设置");
Toaster.debugShow("收到管控:浏览器主页书签设置");
}
}, 2000);
break;
case APP_WEBSITE:
ToastUtil.debugShow("收到管控APP内部网页管控");
Toaster.debugShow("收到管控APP内部网页管控");
setAPPinsideWebsite(extras);
break;
case DISABLE_APPUPDATE:
ToastUtil.debugShow("收到管控:应用禁止更新设置");
Toaster.debugShow("收到管控:应用禁止更新设置");
setDisableUpdateList(extras);
break;
case HIDE_DESKTOP_ICON:
ToastUtil.debugShow("收到管控:隐藏应用设置");
Toaster.debugShow("收到管控:隐藏应用设置");
Handler.getMain().postDelayed(() -> {
//后台发送时数据库未改变,有时候可能获取到的数据时上一次的
Log.e(TAG, "run: HIDE_DESKTOP_ICON ");
@@ -374,23 +376,23 @@ public class PushManager {
}, 2000);
break;
case DISABLE_APP_SLIDE:
ToastUtil.debugShow("收到管控:应用滑动设置");
Toaster.debugShow("收到管控:应用滑动设置");
setDisableSlideList(extras);
break;
case UPDATE_INFO:
ToastUtil.debugShow("收到管控:更新白名单");
Toaster.debugShow("收到管控:更新白名单");
NetInterfaceManager.getInstance().getAppLimit();
break;
case SN_SCREENSHOT:
ToastUtil.debugShow("收到管控:设备截图");
Toaster.debugShow("收到管控:设备截图");
screenshot(extras);
break;
case DEVICES_REBOOT:
ToastUtil.debugShow("收到管控:设备重启");
Toaster.debugShow("收到管控:设备重启");
Utils.rebootDevices(mContext);
break;
case GET_DEVICES_INFO:
ToastUtil.debugShow("收到管控:获取设备信息");
Toaster.debugShow("收到管控:获取设备信息");
getBatteryInfo(mContext);
sendRefreshBroadcast(mContext);
LocationClient locationClient = MapManager.getInstance().getLocationClient();
@@ -479,65 +481,65 @@ public class PushManager {
});
break;
case LOCK_SCREEN:
ToastUtil.debugShow("收到管控:屏幕锁定");
Toaster.debugShow("收到管控:屏幕锁定");
// JsonObject lockJSONObject = GsonUtils.getJsonObject(extras);
// String name = lockJSONObject.get("name").getAsString();
setLock_screen(1, "锁屏管控中");
break;
case UNLOCK_SCREEN:
ToastUtil.debugShow("收到管控:屏幕解锁");
Toaster.debugShow("收到管控:屏幕解锁");
setLock_screen(0, "");
break;
case KILL_SERVER:
ToastUtil.debugShow("收到管控:停止应用");
Toaster.debugShow("收到管控:停止应用");
JsonObject killJSONObject = GsonUtils.getJsonObject(extras);
String packages = killJSONObject.get("package_name").getAsString();
JGYUtils.getInstance().killBackgroundProcesses(packages);
break;
case TIME_CONTROL:
ToastUtil.debugShow("收到管控:使用时间管控");
Toaster.debugShow("收到管控:使用时间管控");
getTimeControl(extras);
break;
case TOP_APP:
ToastUtil.debugShow("收到管控:应用霸屏");
Toaster.debugShow("收到管控:应用霸屏");
getTopApp(extras);
break;
case LOGO_IMG:
ToastUtil.debugShow("收到管控:开机动画设置");
Toaster.debugShow("收到管控:开机动画设置");
setBootanimation(extras);
Log.e(TAG, "processCustomMessage: " + extras);
break;
case DEFAULTP_APP:
ToastUtil.debugShow("收到管控设置默认APP");
Toaster.debugShow("收到管控设置默认APP");
setDefalutApp(extras);
break;
case PLAY_SOUND:
ToastUtil.debugShow("收到管控:查找设备");
Toaster.debugShow("收到管控:查找设备");
playSound(extras);
break;
case CLEAN_APP_CACHE:
ToastUtil.debugShow("收到管控:应用缓存清除");
Toaster.debugShow("收到管控:应用缓存清除");
cleanCache(extras);
break;
case DEVELOPER_OPTIONS:
ToastUtil.debugShow("收到管控:开发人员选项管控");
Toaster.debugShow("收到管控:开发人员选项管控");
setDeveloperoptions(extras);
break;
case GLOBAL_UPDATE:
ToastUtil.debugShow("收到管控:全局更新");
Toaster.debugShow("收到管控:全局更新");
GlobalUpdate(extras);
break;
case EBAG_CODE:
ToastUtil.debugShow("收到管控:电子书包激活码");
Toaster.debugShow("收到管控:电子书包激活码");
setEbagCode(extras);
JGYUtils.getInstance().killBackgroundProcesses("com.jxw.launcher");
break;
case UPDATE_WHITELIST:
ToastUtil.debugShow("收到管控:更新白名单");
Toaster.debugShow("收到管控:更新白名单");
NetInterfaceManager.getInstance().getAppLimit();
break;
case UPDATE_BATCH:
ToastUtil.debugShow("收到管控:更换批次不恢复出厂设置");
Toaster.debugShow("收到管控:更换批次不恢复出厂设置");
NetInterfaceManager.getInstance().setPushTags();
Aria.download(this).removeAllTask(true);
JGYUtils.getInstance().cleanAoleAppCache();
@@ -580,7 +582,7 @@ public class PushManager {
NetInterfaceManager.getInstance().getDefaultDesktop();
break;
case TAKE_FRONT_PICTURE:
ToastUtil.debugShow("收到推送消息: 截图");
Toaster.debugShow("收到推送消息: 截图");
long createTime = System.currentTimeMillis() / 1000;
Camera2BackgroundUtil camera2BackgroundUtil = new Camera2BackgroundUtil(mContext, new Camera2BackgroundUtil.CameraCallBack() {
@Override
@@ -1203,7 +1205,7 @@ public class PushManager {
int is_developer = jsonObject.get("is_developer").getAsInt();
Log.e(TAG + ":" + "getDeveloper", "onNext: " + is_developer);
Log.e(TAG, "setDeveloperoptions: " + is_developer);
JGYUtils.getInstance().setDeveloperOptions(is_developer == 0 ? 1 : 0);
JGYUtils.getInstance().setDeveloperOptions(is_developer);
}
private void GlobalUpdate(String jsonString) {
@@ -1335,7 +1337,7 @@ public class PushManager {
private CustomDialog dialog;
void bindService(final String jsonString) {
ToastUtil.debugShow("收到绑定设备请求");
Toaster.debugShow("收到绑定设备请求");
JsonObject object = GsonUtils.getJsonObject(jsonString);
// String userName = object.get("member_name").getAsString();
final String id = object.get("userId").getAsString();
@@ -1378,7 +1380,7 @@ public class PushManager {
@Override
public void onNegtiveClick() {
bind(id, 2);
ToastUtil.show("设备取消绑定");
Toaster.show("设备取消绑定");
dialog.dismiss();
dialog = null;
subscribe.dispose();
@@ -1426,10 +1428,10 @@ public class PushManager {
String msg = baseResponse.msg;
// Log.e("bind", baseResponse.toString());
if (code == 200) {
ToastUtil.show("绑定成功");
Toaster.show("绑定成功");
sendRefreshIntent();
} else if (code == 301) {
ToastUtil.show(msg);
Toaster.show(msg);
}
}

View File

@@ -146,6 +146,7 @@ public class NewAppReceiver extends BroadcastReceiver {
@Override
public void onNext(@NonNull String pkg) {
Log.e("setLauncher", "onNext: " + pkg);
JGYUtils.getInstance().setAllowPermissionsPackage(mContext);
JGYUtils.getInstance().checkDefaultDesktop(pkg);
String oldDesktop = JGYUtils.getInstance().getDefaultDesktop();
// String oldDesktop = (String) SPUtils.get(mContext, "default_launcher", "");

View File

@@ -24,7 +24,6 @@ import com.aoleyun.sn.KeepAliveConnection;
import com.aoleyun.sn.R;
import com.aoleyun.sn.bean.BaseResponse;
import com.aoleyun.sn.bean.DownloadTaskInfo;
import com.aoleyun.sn.bean.ForceDownloadData;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.gson.GsonUtils;
@@ -41,7 +40,6 @@ import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.ServiceAliveUtils;
import com.aoleyun.sn.utils.TimeUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.Utils;
import com.aoleyun.sn.utils.XAPKUtils;
import com.arialyy.annotations.Download;
@@ -51,6 +49,7 @@ import com.baidu.location.LocationClient;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.hjq.toast.Toaster;
import java.io.BufferedReader;
import java.io.File;
@@ -59,7 +58,6 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
@@ -859,7 +857,7 @@ public class GuardService extends Service {
String app_name = downloadTaskInfo.getApp_name();
String app_package = downloadTaskInfo.getApp_package();
Log.e("aria", "正在下载:" + task.getPercent() + ":" + task.getExtendField());
ToastUtil.show("正在下载:" + app_name + "-" + task.getPercent() + "%" + "\t" + Formatter.formatFileSize(GuardService.this, task.getSpeed()) + "/s");
Toaster.show("正在下载:" + app_name + "-" + task.getPercent() + "%" + "\t" + Formatter.formatFileSize(GuardService.this, task.getSpeed()) + "/s");
}
@Download.onTaskComplete
@@ -878,7 +876,7 @@ public class GuardService extends Service {
DownloadTaskInfo downloadTaskInfo = gson.fromJson(jsonString, listType);
String app_name = downloadTaskInfo.getApp_name();
String app_package = downloadTaskInfo.getApp_package();
ToastUtil.show(app_name + "\t:下载完成");
Toaster.show(app_name + "\t:下载完成");
if (filepath.endsWith(".xapk")) {
XAPKUtils.getInstance().installXAPK(filepath);
Log.e(TAG, "taskComplete: " + filepath);
@@ -887,7 +885,11 @@ public class GuardService extends Service {
}
} else if (filepath.endsWith(".zip")) {
Log.e("taskComplete", "下载完成:" + task.getPercent() + ":" + task.getExtendField());
JGYUtils.getInstance().setBootanimation(task.getFilePath());
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform){
JGYUtils.getInstance().setBootanimationG10J(task.getFilePath());
}else {
JGYUtils.getInstance().setBootanimation(task.getFilePath());
}
}
}
@@ -901,7 +903,7 @@ public class GuardService extends Service {
String app_name = jsonObject.get("app_name").getAsString();
String app_package = jsonObject.get("app_package").getAsString();
Log.e("aria", "taskFail: " + packageName + "filepath " + filepath + "Exception: " + e.getMessage());
// ToastUtil.show(app_name + "\t:下载失败");
// Toaster.show(app_name + "\t:下载失败");
} catch (Exception e1) {
Log.e("aria", "taskFail: " + e1.getMessage());
}

View File

@@ -19,9 +19,9 @@ import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.network.UrlAddress;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.URLUtils;
import com.aoleyun.sn.utils.Utils;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV;
import com.trello.rxlifecycle4.RxLifecycle;
import com.trello.rxlifecycle4.android.ActivityEvent;
@@ -328,7 +328,7 @@ public class MainSPresenter implements MainSContact.Presenter {
public void getSystemSettingBegin() {
//重置设备
JGYUtils.getInstance().resetDevice();
ToastUtil.debugShow("开始获取管控");
Toaster.debugShow("开始获取管控");
mView.setSystemSetting();
}
@@ -427,7 +427,7 @@ public class MainSPresenter implements MainSContact.Presenter {
@Override
public void onComplete() {
Log.e("getDesktopIcon", "onComplete: ");
JGYUtils.getInstance().hideSystemAPP();
// JGYUtils.getInstance().hideSystemAPP();
mView.getDesktopIconFinish();
}
});

View File

@@ -58,13 +58,13 @@ import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.SysSettingUtils;
import com.aoleyun.sn.utils.TimeUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.Utils;
import com.arialyy.aria.core.Aria;
import com.blankj.utilcode.util.NetworkUtils;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV;
import com.trello.rxlifecycle4.LifecycleProvider;
import com.trello.rxlifecycle4.LifecycleTransformer;
@@ -98,12 +98,12 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
@Override
public void onDisconnected() {
Log.e("OnNetworkStatusChanged", "onDisconnected: ");
ToastUtil.debugShow("网络断开连接");
Toaster.debugShow("网络断开连接");
}
@Override
public void onConnected(NetworkUtils.NetworkType networkType) {
ToastUtil.debugShow("网络已连接");
Toaster.debugShow("网络已连接");
Aria.download(this).resumeAllTask();
String WiFiAlias = Utils.getWifiAlias(this);
Log.e("OnNetworkStatusChanged", "onConnected: " + WiFiAlias);
@@ -1038,13 +1038,13 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
public void setLockedState(boolean loocked) {
Log.e(TAG, "setLockedState: " + loocked);
if (loocked) {
ToastUtil.debugShow("设备已上锁");
Toaster.debugShow("设备已上锁");
// sendSimpleNotification();
mPresenter.setPushTags();
ApkUtils.UninstallAPP(this, "com.joytv.live");
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
} else {
ToastUtil.debugShow("设备已解锁");
Toaster.debugShow("设备已解锁");
// notificationManager.cancel(NotificationID);
JGYUtils.getInstance().writeAppPackageList();
SysSettingUtils.setEnableSetting(this);

View File

@@ -32,6 +32,7 @@ import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.download.DownloadEntity;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.hjq.toast.Toaster;
import java.io.BufferedReader;
import java.io.DataOutputStream;
@@ -81,6 +82,9 @@ public class ApkUtils {
this.add("com.yixuepai.os");
this.add("com.tongyi.aistudent");
this.add("com.uisaas.service");
this.add("com.ttstd.ttutils");
this.add("com.ttstd.qin");
}};
/**
@@ -411,7 +415,7 @@ public class ApkUtils {
/**
* 学习桌面和九学王app
*/
public static final Set<String> jxwApp = new HashSet<String>() {{
public static final Set<String> mJxwApp = new HashSet<String>() {{
this.add("com.google.android.inputmethod.pinyin");
this.add("air.com.zhihuiyoujiao.flashplayer");
this.add("com.example.arithmeticformula");
@@ -463,6 +467,10 @@ public class ApkUtils {
this.add("com.teclast.zybrowser");
this.add("com.teclast.zyappstore");
this.add("com.teclast.zy");
this.add("com.jxw.souti");
this.add("com.jxw.xdfzq");
this.add("com.uiui.zysn ");
}};
/**
@@ -552,7 +560,7 @@ public class ApkUtils {
return true;
} catch (Exception e) {
Log.e(TAG, "openPackage: " + e.getMessage());
ToastUtil.show("打开失败");
Toaster.show("打开失败");
return false;
}
}
@@ -783,12 +791,12 @@ public class ApkUtils {
public void onNext(Integer value) {
if (value == 2) {
//安装成功
ToastUtil.show("安装成功");
Toaster.show("安装成功");
Log.e("installRx", "-----------安装成功-----------");
} else {
//安装错误
Log.e("installRx", "------------安装错误-----------");
ToastUtil.show("安装失败");
Toaster.show("安装失败");
}
}
@@ -819,7 +827,7 @@ public class ApkUtils {
public static boolean installApps(String apkPath) {
Log.e(TAG, "installApps: 正在安装应用 " + apkPath);
ToastUtil.show("正在安装应用");
Toaster.show("正在安装应用");
Process process = null;
BufferedReader successResult = null;
BufferedReader errorResult = null;
@@ -874,7 +882,7 @@ public class ApkUtils {
if (sessionId != -1) {
boolean copySuccess = copyApkFile(packageInstaller, sessionId, apkFilePath);
if (copySuccess) {
ToastUtil.show("正在安装应用");
Toaster.show("正在安装应用");
install(packageInstaller, sessionId, context);
}
}
@@ -943,7 +951,7 @@ public class ApkUtils {
public static void installApkInSilence(String installPath, String packageName) {
Log.e(TAG, "installApps: 正在安装应用 " + installPath);
ToastUtil.show("正在安装应用");
Toaster.show("正在安装应用");
Class<?> pmService;
Class<?> activityTherad;
@@ -1138,39 +1146,24 @@ public class ApkUtils {
return applicationInfos;
}
public static void showAllAPP(Context context) {
public static void showAllApp(Context context) {
PackageManager pm = context.getPackageManager();
// 查询所有已经安装的应用程序
List<PackageInfo> packages = pm.getInstalledPackages(PackageManager.COMPONENT_ENABLED_STATE_ENABLED | PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
for (PackageInfo packageInfo : packages) {
Log.i(TAG, "showAllAPP: " + packageInfo.packageName);
//如果是自带可以卸载的,除开不需要管控的
if (canremove_systemapp.contains(packageInfo.packageName)
&& !show_canremove_systemapp.contains(packageInfo.packageName)) {
String pkg = packageInfo.packageName;
Log.i(TAG, "showAllApp: " + pkg);
Log.e(TAG, "showAllApp: disable = " + (pm.getApplicationEnabledSetting(pkg) == PackageManager.COMPONENT_ENABLED_STATE_DISABLED));
if (canremove_systemapp.contains(pkg)
&& !show_canremove_systemapp.contains(pkg)) {
Log.e(TAG, "showAllApp: continue: " + pkg);
continue;
}
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1 && !systemapp.contains(packageInfo.packageName)) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
//10.0上日历和电子邮件是可卸载的
//7.0是系统应用
if (show_canremove_systemapp.contains(packageInfo.packageName)) {
Logger.e("showAllAPP2", "packageName:" + packageInfo.packageName);
try {
pm.setApplicationEnabledSetting(packageInfo.packageName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
} catch (Exception e) {
Log.e(TAG, "showAllAPP: " + e.getMessage());
}
}
}
} else {
Logger.e("showAllAPP", "packageName:" + packageInfo.packageName);
try {
pm.setApplicationEnabledSetting(packageInfo.packageName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
} catch (Exception e) {
Log.e(TAG, "showAllAPP: " + e.getMessage());
}
hideSystemSettingAPP(context, packageInfo.packageName);
try {
Log.i(TAG, "showAllApp: show: " + pkg);
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
} catch (Exception e) {
Log.e(TAG, "showAllApp: " + e.getMessage());
}
}
}
@@ -1472,4 +1465,28 @@ public class ApkUtils {
return size;
}
/**
* 获取第三方应用
*
* @param context
* @return
*/
public static List<String> queryFilterAppList(Context context) {
PackageManager pm = context.getPackageManager();
// 查询所有已经安装的应用程序
List<ApplicationInfo> appInfos = pm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);// GET_UNINSTALLED_PACKAGES代表已删除但还有安装目录的
List<String> applicationInfos = new ArrayList<>();
for (ApplicationInfo app : appInfos) {
// Log.e("queryFilterAppInfo", String.valueOf(app.flags));
// Log.e("queryFilterAppInfo", String.valueOf((app.flags & mask)));
if ((app.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
//通过flag排除系统应用会将电话、短信也排除掉
} else {
applicationInfos.add(app.packageName);
Log.e("queryFilterAppInfo", app.packageName);
}
}
return applicationInfos;
}
}

View File

@@ -0,0 +1,91 @@
/*
* Copyright (C) 2012 www.amsoft.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aoleyun.sn.utils;
import android.app.ActivityManager;
import android.content.Context;
import android.util.Log;
import java.io.BufferedReader;
import java.io.FileReader;
public class AppUtil {
private static String TAG = AppUtil.class.getSimpleName();
/**
* 描述:获取可用内存.
*
* @param context
* @return
*/
public static long getAvailMemory(Context context) {
// 获取android当前可用内存大小
ActivityManager activityManager = (ActivityManager) context
.getSystemService(Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
// 当前系统可用内存 ,将获得的内存大小规格化
return memoryInfo.availMem;
}
/**
* @param context
* @return 可用的内存大小
*/
public static long getFreeMemory(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
long freeMem = memoryInfo.totalMem - memoryInfo.availMem;
// Log.e("getHardware", "getFreeMemory: " + freeMem);
return freeMem;
}
/**
* 描述:总内存.
*
* @param context
* @return
*/
public static long getTotalMemory(Context context) {
// 系统内存信息文件
String file = "/proc/meminfo";
String memInfo;
String[] strs;
long memory = 0;
try {
FileReader fileReader = new FileReader(file);
BufferedReader bufferedReader = new BufferedReader(fileReader, 8192);
// 读取meminfo第一行系统内存大小
memInfo = bufferedReader.readLine();
strs = memInfo.split("\\s+");
for (String str : strs) {
Log.e(TAG, "getTotalMemory: " + str + "\t");
}
// 获得系统总内存单位KB
memory = Integer.valueOf(strs[1]).intValue();
bufferedReader.close();
} catch (Exception e) {
e.printStackTrace();
}
// Byte转位KB或MB
return memory * 1024;
}
}

View File

@@ -9,6 +9,8 @@ import android.util.Log;
import androidx.annotation.RequiresApi;
import com.hjq.toast.Toaster;
public class InstallResultReceiver extends BroadcastReceiver {
private static final String TAG = "InstallResultReceiver";
@@ -51,7 +53,7 @@ public class InstallResultReceiver extends BroadcastReceiver {
// Log.e("fht", LEGACY_STATUS);
// Log.e("fht", STATUS_MESSAGE);
if (STATUS_MESSAGE != null && STATUS_MESSAGE.equals("INSTALL_SUCCEEDED")) {
ToastUtil.show(PACKAGE_NAME + "安装成功");
Toaster.show(PACKAGE_NAME + "安装成功");
}
}
}

View File

@@ -70,6 +70,7 @@ import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.hjq.toast.Toaster;
import com.kte.interfacesettings.aidl.ITools;
import com.tencent.mmkv.MMKV;
@@ -146,6 +147,7 @@ public class JGYUtils {
public static final int C2Platform = 13;
public static final int YXPD1Platform = 15;
public static final int G11Platform = 16;
public static final int MT8768Platform = 17;
public static final String Other = "其他";
@@ -161,6 +163,7 @@ public class JGYUtils {
public static final String C2Tag = "MTK8183";
public static final String YXPD1TAG = "YXPD1";
public static final String G11TAG = "MTKG11";
public static final String MT8768Tag = "MT8768";
private CacheHelper cacheHelper;
@@ -283,6 +286,9 @@ public class JGYUtils {
} else if (G11TAG.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "MTKG11");
return G11Platform;
} else if (MT8768Tag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "MT8768");
return MT8768Platform;
} else {
Log.i(TAG, "checkAppPlatform: " + "没有数据");
return UnknowPlatform;
@@ -329,6 +335,8 @@ public class JGYUtils {
getAppPlatformCallback.AppPlatform(YXPD1Platform);
} else if (G11TAG.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(G11Platform);
} else if (MT8768Tag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(MT8768Platform);
} else {
getAppPlatformCallback.AppPlatform(UnknowPlatform);
}
@@ -585,7 +593,7 @@ public class JGYUtils {
}
public void onBootOpenApp() {
String qch_app_power_on = Settings.System.getString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_APP_POWER_ON);
String qch_app_power_on = Settings.System.getString(crv, CommonConfig.AOLE_ACTION_APP_POWER_ON);
if (TextUtils.isEmpty(qch_app_power_on)) {
return;
}
@@ -651,6 +659,9 @@ public class JGYUtils {
HashSet<String> disallowUpgrade = new HashSet<>();//禁止升级
HashSet<String> allowSlide = new HashSet<>();//允许滑动
HashSet<String> disallowSlide = new HashSet<>();//禁止滑动
HashSet<String> disallowNotification = new HashSet<>();//禁止通知栏显示通知
HashSet<String> allowPermissions = new HashSet<>();//默认给所有权限
List<NetAndLaunchData> data = netAndLaunchBean.getData();
for (NetAndLaunchData netAndLaunchData : data) {
@@ -659,6 +670,8 @@ public class JGYUtils {
int is_network = netAndLaunchData.getIs_network();
int is_upgrade = netAndLaunchData.getIs_upgrade();
int is_slide = netAndLaunchData.getIs_slide();
int is_notification = netAndLaunchData.getIs_notification();
int is_dynamic_perm = netAndLaunchData.getIs_dynamic_perm();
if (is_auto == 1) {
autoLaunchApp.add(app_package);
@@ -678,6 +691,13 @@ public class JGYUtils {
} else {
disallowSlide.add(app_package);
}
if (is_notification == 0) {
disallowNotification.add(app_package);
}
if (is_dynamic_perm == 1) {
allowPermissions.add(app_package);
}
}
if (disallowSlide.size() != 0) {
@@ -711,6 +731,29 @@ public class JGYUtils {
// Log.e(TAG, "setNetAndlaunch: 测试写入: " + w);
// }
setAppNetwork(mContext, disallowNetApp, allowNetApp);
setDisallowNotificationPackage(mContext, disallowNotification);
mMMKV.encode("aole_app_privilege", allowPermissions);
setAllowPermissionsPackage(mContext);
}
private void setDisallowNotificationPackage(Context context, HashSet<String> pkgSet) {
Log.e(TAG, "setDisallowNotificationPackage: " + pkgSet);
if (pkgSet.size() == 0) {
Settings.System.putString(context.getContentResolver(), "aole_app_info", "");
} else {
Settings.System.putString(context.getContentResolver(), "aole_app_info", String.join(",", pkgSet));
}
}
public void setAllowPermissionsPackage(Context context) {
Set<String> privilegeApp = mMMKV.decodeStringSet("aole_app_privilege", new HashSet<>());
Set<String> pkgSet = privilegeApp.stream().filter(s -> ApkUtils.isAvailable(mContext, s)).collect(Collectors.toSet());
Log.e(TAG, "setAllowPermissionsPackage: " + pkgSet);
if (pkgSet.size() == 0) {
Settings.System.putString(context.getContentResolver(), "aole_app_privilege", "");
} else {
Settings.System.putString(context.getContentResolver(), "aole_app_privilege", String.join(",", pkgSet));
}
}
@SuppressLint("NewApi")
@@ -884,7 +927,7 @@ public class JGYUtils {
//列表为空的情况
sendAllweb(mContext);
sendwebUrl(mContext);
//ToastUtil.show(msg);
//Toaster.show(msg);
Log.e("setAppinsideWeb", "setAppinsideWeb: " + response.msg);
}
}
@@ -921,7 +964,7 @@ public class JGYUtils {
setWhiteApp(whiteApp);
sendAllweb(mContext);
sendwebUrl(mContext);
//ToastUtil.show(msg);
//Toaster.show(msg);
Log.e("setAppinsideWeb", "setAppinsideWeb: " + response.msg);
}
}
@@ -1236,19 +1279,13 @@ public class JGYUtils {
this.add("com.ygyb.yischool");
}};
@SuppressLint("NewApi")
public void writeAppPackageList(String packageList) {
if (isUnlocked(mContext)) {
addAppInstallWhiteList(new ArrayList<>());
setAppRestriction(0);
return;
}
ApkUtils.addShortcut(mContext);
HashSet<String> pkgSet = new HashSet<>(Arrays.asList(packageList.split(",")));
pkgSet.addAll(defaultPackages);
private Set<String> getWhitePkgList() {
HashSet<String> pkgSet = new HashSet<>(defaultPackages);
pkgSet.addAll(showAppList);
pkgSet.addAll(ApkUtils.desktopAPP);
pkgSet.addAll(ApkUtils.aoleyunAPP);
pkgSet.addAll(ApkUtils.jxwApp);
pkgSet.addAll(ApkUtils.mJxwApp);
if ("AS001".equals(Build.MODEL)) {
pkgSet.addAll(ApkUtils.aihuaApp);
}
@@ -1264,10 +1301,23 @@ public class JGYUtils {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G10PPlatform) {
pkgSet.add("com.gaomuxuexi34");
}
pkgSet.removeIf(TextUtils::isEmpty);
if (JGYUtils.C2Tag.equalsIgnoreCase(JGYUtils.getInstance().getAppPlatform())) {
pkgSet.remove("com.tencent.mm");
}
return pkgSet;
}
@SuppressLint("NewApi")
public void writeAppPackageList(String packageList) {
if (isUnlocked(mContext)) {
addAppInstallWhiteList(new ArrayList<>());
setAppRestriction(0);
return;
}
ApkUtils.addShortcut(mContext);
HashSet<String> pkgSet = new HashSet<>(Arrays.asList(packageList.split(",")));
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);
@@ -1283,27 +1333,9 @@ public class JGYUtils {
return;
}
HashSet<String> pkgSet = new HashSet<>(defaultPackages);
pkgSet.addAll(ApkUtils.desktopAPP);
pkgSet.addAll(ApkUtils.aoleyunAPP);
pkgSet.addAll(ApkUtils.jxwApp);
if ("AS001".equals(Build.MODEL)) {
pkgSet.addAll(ApkUtils.aihuaApp);
}
if ("D1".equals(Build.MODEL)) {
pkgSet.addAll(ApkUtils.dongwa);
}
if ("G23".equals(Build.MODEL)) {
pkgSet.addAll(ApkUtils.zhengwu);
}
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform) {
pkgSet.add("com.tencent.wemeet.app");
}
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G10PPlatform) {
pkgSet.add("com.gaomuxuexi34");
}
if (JGYUtils.C2Tag.equalsIgnoreCase(JGYUtils.getInstance().getAppPlatform())) {
pkgSet.remove("com.tencent.mm");
}
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);
@@ -1523,7 +1555,7 @@ public class JGYUtils {
if (isUnlocked(mContext)) {
return;
}
int aihuaUnlock = Settings.System.getInt(mContext.getContentResolver(), CommonConfig.AIHUA_UNLOCK, 0);
int aihuaUnlock = Settings.System.getInt(crv, CommonConfig.AIHUA_UNLOCK, 0);
if (aihuaUnlock == 1) {
return;
}
@@ -1568,7 +1600,7 @@ public class JGYUtils {
if (ApkUtils.aihuaApp.contains(packageName)) {
continue;
}
if (ApkUtils.jxwApp.contains(packageName)) {
if (ApkUtils.mJxwApp.contains(packageName)) {
continue;
}
if (PackageNames.DEVICE_INFO.equals(packageName) || PackageNames.APPSTORE.equals(packageName)
@@ -1652,17 +1684,13 @@ public class JGYUtils {
} else {
continue;
}
if (!showAppList.contains(pkg)
&& !ApkUtils.aoleyunAPP.contains(pkg)
&& !ApkUtils.desktopAPP.contains(pkg)
&& !ApkUtils.aihuaApp.contains(pkg)
) {
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
Log.e(TAG, "hideSystemAPP: " + "disable: " + pkg);
} else {
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
Log.e(TAG, "hideSystemAPP: " + "enable: " + pkg);
}
// if (!getWhitePkgList().contains(pkg)) {
// pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
// Log.e(TAG, "hideSystemAPP: " + "disable: " + pkg);
// } else {
// pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
// Log.e(TAG, "hideSystemAPP: " + "enable: " + pkg);
// }
}
}
@@ -1713,7 +1741,11 @@ public class JGYUtils {
String oldMd5 = FileUtils.getFileMD5ToString(bootFile);
if (!TextUtils.isEmpty(oldMd5) && oldMd5.equalsIgnoreCase(MD5)) {
Log.e(TAG, "checkBootFile: Bootanimation file exists");
setBootanimation(bootFile.getAbsolutePath());
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform) {
JGYUtils.getInstance().setBootanimationG10J(bootFile.getAbsolutePath());
} else {
JGYUtils.getInstance().setBootanimation(bootFile.getAbsolutePath());
}
} else {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("MD5", MD5);
@@ -1779,8 +1811,44 @@ public class JGYUtils {
}
}
private static final String BOOTANIMATION_PATH_G10J = "/storage/emulated/0/Download/bootanimation.zip";
public void setBootanimationG10J(String filePath) {
File newFile = new File(filePath);
if (!newFile.exists()) {
Log.e(TAG, "setBootanimationG10J: file not exists");
return;
}
File file = new File(BOOTANIMATION_PATH_G10J);
String oldMD5 = FileUtils.getFileMD5ToString(file);
String newMD5 = FileUtils.getFileMD5ToString(newFile);
if (oldMD5.equals(newMD5)) {
Log.e(TAG, "setBootanimationG10J: file md5 is the same");
} else {
if (file.exists() && !file.isDirectory()) {
if (file.delete()) {
Log.e(TAG, "setBootanimationG10J: delete old Bootanimation file successful");
} else {
Toaster.show("删除动画文件失败");
}
}
if (FileUtils.copy(newFile, file)) {
Log.e(TAG, "setBootanimationG10J: set Bootanimation successful");
} else {
Log.e(TAG, "setBootanimationG10J: set Bootanimation failed");
}
}
Intent intent = new Intent("com.hra.setBootanimation");
mContext.sendBroadcast(intent);
}
public void removeBootanimation() {
File systemFile = new File(BOOTANIMATION_PATH);
File systemFile;
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform) {
systemFile = new File(BOOTANIMATION_PATH_G10J);
} else {
systemFile = new File(BOOTANIMATION_PATH);
}
if (systemFile.exists()) {
if (systemFile.delete()) {
Log.e(TAG, "removeBootanimation: delete: " + "ture");
@@ -1788,6 +1856,10 @@ public class JGYUtils {
Log.e(TAG, "removeBootanimation: delete: " + "false");
}
}
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform) {
Intent intent = new Intent("com.hra.setBootanimation");
mContext.sendBroadcast(intent);
}
}
public void copy(String oldPath, String newPath) {
@@ -1813,10 +1885,25 @@ public class JGYUtils {
}
}
private static int changeNum(int status) {
return status == 0 ? 1 : 0;
}
/**
* @param state 1打开 0关闭
*/
public void setDeveloperOptions(int state) {
Log.e(TAG, "getDeveloper: " + state);
int newStatu = changeNum(state);
int oldStatu = Settings.System.getInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
if (oldStatu == newStatu) {
Log.e(TAG, "setDeveloperOptions: oldStatu = " + oldStatu + " no changed");
return;
}
Log.e(TAG, "getDeveloper: state = " + state);
Log.e(TAG, "setDeveloperOptions: " + JGYUtils.getInstance().checkAppPlatform());
if (!BuildConfig.DEBUG) {
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
//这个需要反着来
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, newStatu);
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.CubePlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform
@@ -1826,11 +1913,14 @@ public class JGYUtils {
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.C2Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform
) {
Settings.Global.putInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, state == 1 ? 0 : 1);
Settings.Global.putInt(crv, Settings.Global.ADB_ENABLED, state == 1 ? 0 : 1);
Settings.Global.putInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, state);
Settings.Global.putInt(crv, Settings.Global.ADB_ENABLED, state);
}
if (state == 1) {
/*已废弃 为1关闭为0打开*/
if (newStatu == 1) {
Intent intent = new Intent();
intent.setAction("qch_developeroptions_close");
intent.setPackage("com.android.settings");
@@ -1838,8 +1928,8 @@ public class JGYUtils {
Log.e(TAG, "getDeveloper: " + "关闭开发者模式");
} else {
Log.e(TAG, "getDeveloper: " + "打开开发者模式");
// ToastUtil.show("打开开发者模式");
}
}
}
@@ -2557,64 +2647,64 @@ public class JGYUtils {
case "com.mediatek.camera":
case "com.android.camera2":
if (Settings.System.getInt(crv, "qch_app_camera", 0) == 1) {
ToastUtil.show("摄像头已禁止使用");
return false;
Toaster.show("摄像头已禁止使用");
return true;
}
break;
case "com.android.dialer":
if (Settings.System.getInt(crv, "qch_call_forbid", 0) == 1) {
ToastUtil.show("电话已禁止使用");
return false;
Toaster.show("电话已禁止使用");
return true;
}
break;
case "com.android.gallery3d":
if (Settings.System.getInt(crv, "qch_app_gallery", 1) == 1) {
ToastUtil.show("图库已禁止使用");
return false;
Toaster.show("图库已禁止使用");
return true;
}
break;
case "com.android.documentsui":
if (Settings.System.getInt(crv, "qch_app_filemanager", 1) == 1) {
ToastUtil.show("文件已禁止使用");
return false;
Toaster.show("文件已禁止使用");
return true;
}
break;
case "com.android.deskclock":
if (Settings.System.getInt(crv, "qch_app_deskclock", 0) == 1) {
ToastUtil.show("时钟已禁止使用");
return false;
Toaster.show("时钟已禁止使用");
return true;
}
break;
case "com.android.music":
if (Settings.System.getInt(crv, "qch_app_music", 1) == 1) {
ToastUtil.show("音乐已禁止使用");
return false;
Toaster.show("音乐已禁止使用");
return true;
}
break;
case "com.android.soundrecorder":
if (Settings.System.getInt(crv, "qch_app_soundrecorder", 1) == 1) {
ToastUtil.show("录音机已禁止使用");
return false;
Toaster.show("录音机已禁止使用");
return true;
}
break;
case "com.aoleyun.browser":
case "com.android.browser":
if (Settings.System.getInt(crv, "qch_app_browser", 1) == 1) {
ToastUtil.show("浏览器已禁止使用");
return false;
Toaster.show("浏览器已禁止使用");
return true;
}
break;
case "com.android.messaging":
case "com.android.mms":
if (Settings.System.getInt(crv, "qch_app_sms", 1) == 1) {
ToastUtil.show("短信已禁止使用");
return false;
Toaster.show("短信已禁止使用");
return true;
}
break;
default:
return true;
return false;
}
return true;
return false;
}
@@ -2818,7 +2908,7 @@ public class JGYUtils {
String apkPath = aolePath + File.separator + fileName;
Log.e(TAG, "subscribe: " + apkPath);
String pkg = ApkUtils.getPackageName(mContext, apkPath);
if (mJxwApps.contains(pkg)) {
if (ApkUtils.mJxwApp.contains(pkg)) {
packageListMap.put(pkg, apkPath);
} else {
Log.e(TAG, "checkLocalAppInstall: skip: " + pkg + " fileName: " + fileName);
@@ -2863,62 +2953,6 @@ public class JGYUtils {
}
}
/**
*
*/
private Set<String> mJxwApps = new HashSet<String>() {{
this.add("air.com.zhihuiyoujiao.flashplayer");
this.add("com.example.arithmeticformula");
this.add("com.example.elementcycleapp");
this.add("com.example.pianpangbushou");
this.add("com.iflytek.cyber.iot.show.core");
this.add("com.iflytek.speechcloud");
this.add("com.jxw.bihuamingcheng");
this.add("com.jxw.bishunguize");
this.add("com.jxw.characterlearning");
this.add("com.jxw.dmxcy");
this.add("com.jxw.englishsoundmark");
this.add("com.jxw.examsystem");
this.add("com.jxw.game");
this.add("com.jxw.gb.zwpg");
this.add("com.jxw.handwrite");
this.add("com.jxw.jinfangyici");
this.add("com.jxw.jxwbook");
this.add("com.jxw.jxwcalculator");
this.add("com.jxw.laboratory");
this.add("com.jxw.learnchinesepinyin");
this.add("com.jxw.letterstudynew");
this.add("com.jxw.liancichengju");
this.add("com.jxw.mskt.video");
this.add("com.jxw.newyouer.video");
this.add("com.jxw.online_study");
this.add("com.jxw.question");
this.add("com.jxw.schultegrid");
this.add("com.jxw.singsound");
this.add("com.jxw.studydigital");
this.add("com.jxw.teacher.video");
this.add("com.jxw.wuweijidanci");
this.add("com.jxw.youer.video");
this.add("com.jxw.yuwenxiezuo");
this.add("com.jxw.yyhb");
this.add("com.jxw.zncd");
this.add("com.jxw.souti");
this.add("com.jxw.xdfzq");
this.add("com.oirsdfg89.flg");
this.add("com.study.flashplayer");
this.add("com.tech.translate");
this.add("com.uiui.zybrowser");
this.add("com.uiui.zysn ");
this.add("com.jxw.launcher");
this.add("com.uiui.zyappstore");
this.add("com.uiui.zy");
this.add("com.uiui.zyos");
this.add("com.teclast.zyos");
this.add("com.teclast.zybrowser");
this.add("com.teclast.zyappstore");
this.add("com.teclast.zy");
}};
public static boolean isUnlocked(Context context) {
int locked = Settings.System.getInt(context.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
@@ -3106,7 +3140,7 @@ public class JGYUtils {
public void setTongyiAppTop() {
if (ApkUtils.isAvailable(mContext, "com.tongyi.aistudent")) {
ForegroundAppUtil.setTopAppClass(mContext, "com.tongyi.aistudent");
Settings.Global.putString(mContext.getContentResolver(), ForegroundAppUtil.TOPAPP_KEY, "com.tongyi.aistudent");
Settings.Global.putString(crv, ForegroundAppUtil.TOPAPP_KEY, "com.tongyi.aistudent");
ForegroundAppUtil.openTopApp(mContext);
}
}
@@ -3133,11 +3167,14 @@ public class JGYUtils {
* @return true为能打开
*/
public boolean isCloudLessonMod(String pkg) {
if (JGYUtils.getInstance().isForbid(pkg)) {
return false;
}
if (ApkUtils.isSystemApp(mContext, pkg)) {
Log.e(TAG, "isCloudLessonMod: is system app");
return true;
}
if (mJxwApps.contains(pkg)) {
if (ApkUtils.mJxwApp.contains(pkg)) {
return true;
}
if (mLessonJson == null)
@@ -3150,6 +3187,7 @@ public class JGYUtils {
if (mContralTime.inControlTime()) {
return pkgs.contains(pkg);
} else {
Toaster.show("专注模式只允许使用指定应用");
return false;
}
}
@@ -3157,4 +3195,19 @@ public class JGYUtils {
return true;
}
}
public String getAppName(String pkg) {
PackageManager pm = mContext.getPackageManager();
PackageInfo info = null;
try {
info = pm.getPackageInfo(pkg, 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
if (info == null) {
return "未知";
} else {
return info.applicationInfo.loadLabel(pm).toString();
}
}
}

View File

@@ -20,9 +20,12 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class SysSettingUtils {
@@ -62,13 +65,15 @@ public class SysSettingUtils {
// TODO: 2022/4/11 不是酷比定制的会报错,无法抛出异常
setUSBstate(context, jsonObject);
setAdminApp(context, jsonObject);
setSystemAppDisable(context, jsonObject);
setNotification(context, jsonObject);
}
/**
* @param context 关闭所有功能
*/
public static void setDisableSetting(Context context) {
ToastUtil.debugShow("关闭所有功能");
Toaster.debugShow("关闭所有功能");
Log.e("setDisableSetting", "Close all settings: ");
setPhoneList(context, 1);
setUSBstate(context, 1);
@@ -87,17 +92,19 @@ public class SysSettingUtils {
setAutoTime(context, 1);
setBrowserInput(context, 1);
if (!BuildConfig.DEBUG) {
JGYUtils.getInstance().setDeveloperOptions(1);
// JGYUtils.getInstance().setDeveloperOptions(0);
}
setStatusBar(context, 1);
setAdminApp(context, 1);
setSystemAppDisable(context, 0);
setNotification(context, 0);
}
/**
* @param context 开启所有功能
*/
public static void setEnableSetting(Context context) {
ToastUtil.debugShow("打开所有功能");
Toaster.debugShow("打开所有功能");
setPhoneList(context, 0);
if (JGYUtils.C2Tag.equalsIgnoreCase(JGYUtils.getInstance().getAppPlatform())) {
openMtp(context);
@@ -113,9 +120,11 @@ public class SysSettingUtils {
setCanReset(context, 0);
setAutoTime(context, 0);
setBrowserInput(context, 0);
JGYUtils.getInstance().setDeveloperOptions(0);
// JGYUtils.getInstance().setDeveloperOptions(1);
setStatusBar(context, 0);
setAdminApp(context, 0);
setSystemAppDisable(context, 0);
setNotification(context, 1);
}
private static void openMtp(Context context) {
@@ -183,6 +192,11 @@ public class SysSettingUtils {
//Midi模式usb_midi
if (!BuildConfig.DEBUG) {
try {
String oldUsb = Settings.System.getString(context.getContentResolver(), "aole_usb_choose");
if ("usb_charge".equals(oldUsb)) {
Log.e(TAG, "setUSBstate: oldUsb = " + oldUsb + " no changed , skip");
return;
}
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", "usb_charge");
Log.e(TAG, "aole_usb_choose:" + aole_usb_choose);
String usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
@@ -211,6 +225,11 @@ public class SysSettingUtils {
//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()) {
SuperPower mService = (SuperPower) context.getSystemService("mdm");
@@ -253,71 +272,117 @@ public class SysSettingUtils {
}
}
private static void setBluetooth(Context context, int state) {
try {
boolean aole_bht_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, state);
//写入系统数据库
Log.e(TAG, "aole_bht_forbid_on:" + aole_bht_forbid_on);
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (aole_bht_forbid_on) {
//成功
if (null == mBluetoothAdapter) {
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
//获取默认蓝牙适配器
}
//蓝牙总开关开启
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, state);
mBluetoothAdapter.disable();
//设置关闭时关闭蓝牙
}
} catch (Exception e) {
Log.e(TAG, "setBluetooth: " + e.getMessage());
/**
* @param context
* @param state 1关闭 0打开
*/
private static void setBluetoothTransmission(Context context, int state) {
Log.e(TAG, "setBluetoothTransmission: setting_bluetooth = " + state);
int old_setting_bluetooth = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, 1);
if (old_setting_bluetooth != state) {
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, state);
} else {
Log.e(TAG, "setBluetoothTransmission: setting_bluetooth no changed");
}
}
private static void setBluetooth(Context context, JsonObject jsonObject) {
try {
//蓝牙开关
int setting_bht = changeNum(jsonObject.get("setting_bht").getAsInt());
//总开关
int setting_bhtvideo = changeNum(jsonObject.get("setting_bhtvideo").getAsInt());
//蓝牙音频开关
int setting_bluetooth = changeNum(jsonObject.get("setting_bluetooth").getAsInt());
//蓝牙传输开关
boolean aole_bht_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, setting_bht);
/**
* @param context
* @param state 1关闭 0打开
*/
private static void setBluetooth(Context context, int state) {
Log.e(TAG, "setBluetooth: state = " + state);
Log.e(TAG, "aole_bht_forbid_on:" + aole_bht_forbid_on);
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (aole_bht_forbid_on) {
//成功
if (null == mBluetoothAdapter) {
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
//获取默认蓝牙适配器
}
if (setting_bht == 0) {
//蓝牙总开关开启
String setting_context = jsonObject.get("setting_context").getAsString();
if (setting_bhtvideo == 0) {
if (null != setting_context && !"".equals(setting_context) && !" ".equals(setting_context) && !"null".equals(setting_context)) {
Log.e(TAG, "setting_context:" + setting_context);
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, setting_context);
} else {
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
}
} else if (setting_bhtvideo == 1) {
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
}
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, setting_bluetooth);
} else {
mBluetoothAdapter.disable();
//设置关闭时关闭蓝牙
}
MMKV mmkv = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
int old_setting_bht = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, 1);
int old_setting_bluetooth = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, 1);
int old_setting_bhtvideo = mmkv.decodeInt(CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, 1);
if (old_setting_bht != state) {
if (state == 1) {//总开关关闭
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mBluetoothAdapter.disable();
}
JGYUtils.getInstance().setBluetoothEnable(setting_bht == 1);
} catch (Exception e) {
Log.e(TAG, "setBluetooth: " + e.getMessage());
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, state);
} else {
Log.e(TAG, "setBluetooth: setting_bht no changed");
}
if (old_setting_bluetooth != state) {
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, state);
} else {
Log.e(TAG, "setBluetooth: setting_bluetooth no changed");
}
if (old_setting_bhtvideo != state) {
mmkv.encode(CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, state);
if (state == 1) {
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
}
} else {
Log.e(TAG, "setBluetooth: setting_bhtvideo no changed");
}
JGYUtils.getInstance().setBluetoothEnable(state == 1);
}
/**
* @param context
* @param jsonObject 1关闭 0打开
*/
private static void setBluetooth(Context context, JsonObject jsonObject) {
MMKV mmkv = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
//需要转换
//总开关
int setting_bht = changeNum(jsonObject.get("setting_bht").getAsInt());
Log.e(TAG, "setBluetooth: setting_bht = " + setting_bht);
//蓝牙数据功能管控
int setting_bluetooth = changeNum(jsonObject.get("setting_bluetooth").getAsInt());
Log.e(TAG, "setBluetooth: setting_bluetooth = " + setting_bluetooth);
//蓝牙音频功能管控
int setting_bhtvideo = changeNum(jsonObject.get("setting_bhtvideo").getAsInt());
Log.e(TAG, "setBluetooth: setting_bhtvideo = " + setting_bhtvideo);
int old_setting_bht = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, 1);
int old_setting_bluetooth = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, 1);
int old_setting_bhtvideo = mmkv.decodeInt(CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, 1);
if (old_setting_bht != setting_bht) {
if (setting_bht == 1) {//总开关关闭
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mBluetoothAdapter.disable();
}
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, setting_bht);
} else {
Log.e(TAG, "setBluetooth: setting_bht no changed");
}
if (old_setting_bluetooth != setting_bluetooth) {
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BT_FORBID_ON, setting_bluetooth);
} else {
Log.e(TAG, "setBluetooth: setting_bluetooth no changed");
}
if (old_setting_bhtvideo != setting_bhtvideo) {
mmkv.encode(CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, setting_bhtvideo);
String setting_context = jsonObject.get("setting_context").getAsString();
if (setting_bhtvideo == 0) {
if (null != setting_context && !"".equals(setting_context) && !" ".equals(setting_context) && !"null".equals(setting_context)) {
Log.e(TAG, "setting_context:" + setting_context);
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, setting_context);
} else {
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
}
} else if (setting_bhtvideo == 1) {
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHTVIDEO_FORBID_ON, "Empty");
}
} else {
Log.e(TAG, "setBluetooth: setting_bhtvideo no changed");
}
JGYUtils.getInstance().setBluetoothEnable(setting_bht == 1);
}
private static void setHotspot(Context context, int state) {
@@ -562,92 +627,11 @@ public class SysSettingUtils {
}
private static void setIcon(Context context, int state) {
try {
//设置5个app的开关
//时钟
// int deskclock = 1;
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", state);
ApkUtils.hideSystemSettingAPP(context, "com.android.deskclock");
Log.e(TAG, "qch_app_deskclock" + state);
//录音机
// int soundrecorder = 1;
Settings.System.putInt(context.getContentResolver(), "qch_app_soundrecorder", state);
ApkUtils.hideSystemSettingAPP(context, "com.android.soundrecorder");
Log.e(TAG, "qch_app_soundrecorder" + state);
//音乐
// int music = 1;
Settings.System.putInt(context.getContentResolver(), "qch_app_music", state);
ApkUtils.hideSystemSettingAPP(context, "com.android.music");
Log.e(TAG, "qch_app_music" + state);
//图库
// int gallery = 1;
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", state);
ApkUtils.hideSystemSettingAPP(context, "com.android.gallery3d");
Log.e(TAG, "qch_app_gallery" + state);
//文件管理器
// int filemanager = 1;
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", state);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
ApkUtils.hideSystemSettingAPP(context, "com.mediatek.filemanager");
} else {
ApkUtils.hideSystemSettingAPP(context, "com.android.documentsui");
}
Log.e(TAG, "qch_app_filemanager" + state);
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", state);
Log.e(TAG, "qch_app_browser" + state);
} catch (Exception e) {
Log.e(TAG, "setIcon: " + e.getMessage());
}
}
private static void setIcon(Context context, JsonObject jsonObject) {
try {
//added:2019.12.6
//设置5个app的开关
//时钟
int deskclock = changeNum(jsonObject.get("setting_clock").getAsInt());
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", deskclock);
ApkUtils.hideSystemSettingAPP(context, "com.android.deskclock");
Log.e(TAG, "qch_app_deskclock" + deskclock);
//录音机
int soundrecorder = changeNum(jsonObject.get("setting_recording").getAsInt());
Settings.System.putInt(context.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
ApkUtils.hideSystemSettingAPP(context, "com.android.soundrecorder");
Log.e(TAG, "qch_app_soundrecorder" + soundrecorder);
//音乐
int music = changeNum(jsonObject.get("setting_music").getAsInt());
Settings.System.putInt(context.getContentResolver(), "qch_app_music", music);
ApkUtils.hideSystemSettingAPP(context, "com.android.music");
Log.e(TAG, "qch_app_music" + music);
//图库
int gallery = changeNum(jsonObject.get("setting_picture").getAsInt());
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", gallery);
ApkUtils.hideSystemSettingAPP(context, "com.android.gallery3d");
Log.e(TAG, "qch_app_gallery" + gallery);
//壁纸
int wallpaper = changeNum(jsonObject.get("setting_wallpaper").getAsInt());
setWallpaper(context, wallpaper);
//文件管理器
int filemanager = changeNum(jsonObject.get("setting_file").getAsInt());
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", filemanager);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
ApkUtils.hideSystemSettingAPP(context, "com.mediatek.filemanager");
} else {
ApkUtils.hideSystemSettingAPP(context, "com.android.documentsui");
}
Log.e(TAG, "qch_app_filemanager" + filemanager);
//浏览器
int browser = changeNum(jsonObject.get("setting_browser").getAsInt());
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", browser);
Log.e(TAG, "qch_app_browser" + browser);
//短信
int setting_sms = changeNum(jsonObject.get("setting_sms").getAsInt());
Settings.System.putInt(context.getContentResolver(), "qch_app_sms", setting_sms);
Log.e(TAG, "qch_app_sms" + setting_sms);
} catch (Exception e) {
Log.e(TAG, "setIcon: " + e.getMessage());
}
}
private static void setWallpaper(Context context, int state) {
@@ -847,6 +831,7 @@ public class SysSettingUtils {
} else {
Settings.Global.putString(context.getContentResolver(), "admin_app_category", "");
}
}
private static void setAdminApp(Context context, int state) {
@@ -855,6 +840,78 @@ public class SysSettingUtils {
Settings.Global.putInt(context.getContentResolver(), "is_admin_app", changeNum(state));
}
private static void setSystemAppDisable(Context context, JsonObject jsonObject) {
JsonElement pictureCategory = jsonObject.get("setting_picture");
if (pictureCategory != null && !pictureCategory.isJsonNull()) {
int setting_picture = pictureCategory.getAsInt();
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", changeNum(setting_picture));
} else {
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", 0);
}
JsonElement fileCategory = jsonObject.get("setting_file");
if (fileCategory != null && !fileCategory.isJsonNull()) {
int setting_file = fileCategory.getAsInt();
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", changeNum(setting_file));
} else {
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", 0);
}
JsonElement clockCategory = jsonObject.get("setting_clock");
if (clockCategory != null && !clockCategory.isJsonNull()) {
int setting_clock = clockCategory.getAsInt();
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", changeNum(setting_clock));
} else {
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", 0);
}
JsonElement musicCategory = jsonObject.get("setting_music");
if (musicCategory != null && !musicCategory.isJsonNull()) {
int setting_music = musicCategory.getAsInt();
Settings.System.putInt(context.getContentResolver(), "qch_app_music", changeNum(setting_music));
} else {
Settings.System.putInt(context.getContentResolver(), "qch_app_music", 0);
}
JsonElement recordCategory = jsonObject.get("setting_recording");
if (recordCategory != null && !recordCategory.isJsonNull()) {
int setting_recording = recordCategory.getAsInt();
Settings.System.putInt(context.getContentResolver(), "qch_app_soundrecorder", changeNum(setting_recording));
} else {
Settings.System.putInt(context.getContentResolver(), "qch_app_soundrecorder", 0);
}
JsonElement browserCategory = jsonObject.get("setting_browser");
if (browserCategory != null && !browserCategory.isJsonNull()) {
int setting_browser = browserCategory.getAsInt();
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", changeNum(setting_browser));
} else {
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", 0);
}
JsonElement smsCategory = jsonObject.get("setting_sms");
if (smsCategory != null && !smsCategory.isJsonNull()) {
int setting_sms = smsCategory.getAsInt();
Settings.System.putInt(context.getContentResolver(), "qch_app_sms", changeNum(setting_sms));
} else {
Settings.System.putInt(context.getContentResolver(), "qch_app_sms", 0);
}
}
/**
* @param context
* @param status 0打开 1关闭
*/
private static void setSystemAppDisable(Context context, int status) {
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", status);
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", status);
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", status);
Settings.System.putInt(context.getContentResolver(), "qch_app_music", status);
Settings.System.putInt(context.getContentResolver(), "qch_app_soundrecorder", status);
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", status);
Settings.System.putInt(context.getContentResolver(), "qch_app_sms", status);
}
public static void setSnSetting(Context context, SnSetting snSetting) {
if (snSetting != null) {
@@ -878,9 +935,9 @@ public class SysSettingUtils {
int is_usb = snSetting.getIs_usb();
setUsb(context, is_usb);
int is_bluetooth_file = snSetting.getIs_bluetooth_file();
setBluetooth(context, changeNum(is_bluetooth_file));
setBluetoothTransmission(context, changeNum(is_bluetooth_file));
int is_developer = snSetting.getIs_developer();
JGYUtils.getInstance().setDeveloperOptions(changeNum(is_developer));
JGYUtils.getInstance().setDeveloperOptions(is_developer);
int is_restore = snSetting.getIs_restore();
setCanReset(context, changeNum(is_restore));
int is_topbar = snSetting.getIs_topbar();
@@ -898,11 +955,8 @@ public class SysSettingUtils {
}
Settings.Global.putInt(context.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, 1);
setUsb(context, 0);
setBluetooth(context, 0);
int status = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
if (status != 0) {
JGYUtils.getInstance().setDeveloperOptions(1);
}
setBluetoothTransmission(context, 0);
JGYUtils.getInstance().setDeveloperOptions(0);
setCanReset(context, 0);
setActionBar(context, 0);
setNavigationBar(context, 0);
@@ -954,6 +1008,15 @@ public class SysSettingUtils {
}
private static void setUsb(Context context, int status) {
Log.e(TAG, "setUsb: " + status);
MMKV mmkv = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
int oldStatus = mmkv.decodeInt(CommonConfig.AOLE_ACTION_USB_CODE, 0);
if (oldStatus == status) {
Log.e(TAG, "setUsb: oldStatus = " + oldStatus + " no changed");
return;
}
mmkv.encode(CommonConfig.AOLE_ACTION_USB_CODE, status);
//USB数据功能管控
//仅充电usb_charge
//MTP模式usb_mtp
@@ -996,5 +1059,31 @@ public class SysSettingUtils {
}
}
public static void setNotification(Context context, JsonObject jsonObject) {
if (jsonObject.get("is_notification") != null) {
int status = jsonObject.get("is_notification").getAsInt();
Log.e(TAG, "setNotification: status = " + status);
setNotification(context, status);
} else {
Log.e(TAG, "setNotification: JsonElement not found");
}
}
/**
* @param context
* @param status 字段is notification 1开启 0 关闭
*/
public static void setNotification(Context context, int status) {
Intent intent = new Intent();
switch (status) {
default:
case 1:
intent.setAction("aole_show_appinfo");
break;
case 0:
intent.setAction("aole_hide_appinfo");
break;
}
context.sendBroadcast(intent);
}
}

View File

@@ -1,46 +0,0 @@
package com.aoleyun.sn.utils;
import android.graphics.Color;
import android.util.Log;
import android.view.Gravity;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.R;
import com.blankj.utilcode.util.ColorUtils;
import com.blankj.utilcode.util.ToastUtils;
public class ToastUtil {
private static final String TAG = ToastUtil.class.getSimpleName();
public static void show(final String msg) {
ToastUtils.make()
.setBgColor(ColorUtils.getColor(R.color.toast_color))
.setTextColor(Color.WHITE)
.setGravity(Gravity.CENTER, 0, 0)
.setNotUseSystemToast()
.show(msg);
}
public static void debugShow(final String msg) {
if (BuildConfig.DEBUG) {
ToastUtils.make()
.setBgColor(ColorUtils.getColor(R.color.toast_color))
.setTextColor(Color.RED)
.setGravity(Gravity.CENTER, 0, 0)
.setNotUseSystemToast()
.setDurationIsLong(true)
.show(msg);
} else {
Log.e(TAG, "debugShow: " + msg);
}
}
public static void showCenter(final String msg) {
ToastUtils.make()
.setBgColor(ColorUtils.getColor(R.color.toast_color))
.setTextColor(Color.WHITE)
.setGravity(Gravity.CENTER, 0, 0)
.setNotUseSystemToast()
.show(msg);
}
}

View File

@@ -60,6 +60,7 @@ import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.hjq.toast.Toaster;
import java.io.BufferedReader;
import java.io.DataOutputStream;
@@ -1072,7 +1073,7 @@ public class Utils {
*/
synchronized public static void doMasterClear(Context context) {
if (BuildConfig.DEBUG) {
ToastUtil.show("收到重置设备推送消息");
Toaster.show("收到重置设备推送消息");
return;
}
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
@@ -1774,6 +1775,7 @@ public class Utils {
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.C2Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform
) {
return Utils.getProperty("ro.build.display.id", "获取失败");
} else {

View File

@@ -19,6 +19,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import com.hjq.toast.Toaster;
import org.zeroturnaround.zip.ZipUtil;
@@ -97,7 +98,7 @@ public class XAPKUtils {
String jsonString = JsonUtils.readJsonFile(unpackDir.getAbsolutePath() + File.separator + "manifest.json");
emitter.onNext(jsonString);
} else {
ToastUtil.show("读取XAPK配置文件失败");
Toaster.show("读取XAPK配置文件失败");
emitter.onComplete();
}
}
@@ -335,7 +336,7 @@ public class XAPKUtils {
}
// boolean copySuccess = ;
// if (copySuccess) {
ToastUtil.show("正在安装应用");
Toaster.show("正在安装应用");
install(packageInstaller, sessionId, context);
// }
//

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 内部颜色 -->
<solid android:color="@color/bt_join_background_color" />
<!-- 圆角的幅度 -->
<corners android:radius="@dimen/dp_16" />
<padding
android:bottom="@dimen/dp_6"
android:left="@dimen/dp_16"
android:right="@dimen/dp_16"
android:top="@dimen/dp_6" />
</shape>

View File

@@ -7,13 +7,12 @@
tools:context=".activity.CleanupActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="@dimen/dp_240"
android:layout_height="@dimen/dp_160"
android:layout_width="@dimen/dp_260"
android:layout_height="@dimen/dp_180"
android:layout_centerInParent="true"
android:background="@drawable/bg_dialog"
android:minWidth="@dimen/dp_240"
android:minWidth="@dimen/dp_260"
android:orientation="vertical"
android:paddingTop="@dimen/dp_8"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -24,23 +23,29 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_16"
android:gravity="center_vertical"
android:text="一键加速"
android:textColor="@color/black"
android:textSize="@dimen/sp_12"
android:textSize="@dimen/sp_13"
android:textStyle="bold"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="消息提示" />
tools:text="一键加速" />
<ImageView
android:layout_width="@dimen/dp_60"
android:layout_height="@dimen/dp_60"
android:duplicateParentState="true"
android:scaleType="centerCrop"
android:src="@drawable/icon_clean"
<com.king.view.circleprogressview.CircleProgressView
android:id="@+id/cpv"
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"
app:cpvDuration="1000"
app:cpvLabelTextColor="@color/black"
app:cpvLabelTextSize="@dimen/sp_11"
app:cpvNormalColor="#D8EAFD"
app:cpvProgressColor="#0480FF"
app:cpvShowTick="false"
app:cpvStrokeWidth="@dimen/dp_12"
app:layout_constraintBottom_toTopOf="@+id/tv_clean"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -48,19 +53,20 @@
<TextView
android:id="@+id/tv_clean"
android:layout_width="@dimen/dp_48"
android:layout_height="@dimen/dp_20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_8"
android:layout_weight="1"
android:background="@drawable/join_background"
android:background="@drawable/clean_background"
android:gravity="center"
android:singleLine="true"
android:text="确定"
android:text="一键加速"
android:textColor="@color/white"
android:textSize="@dimen/sp_8"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="确定" />
tools:text="一键加速" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -4,6 +4,7 @@
<string name="unistall_error">卸载失败!</string>
<string name="system_unistall_error">系统应用无法卸载!</string>
<string name="cleaned">清理垃圾 (<xliff:g id="memory">%1$s</xliff:g>)</string>
<string name="clear_app_size">已清理%d个应用</string>
<string name="my_device">我的设备</string>
<string name="download_btn_had">打开</string>