1.4.0117 YX-T01不显示小程序二维码

This commit is contained in:
2024-01-18 19:40:51 +08:00
parent 913270821c
commit 6d8e4509f0
17 changed files with 275 additions and 175 deletions

View File

@@ -197,7 +197,7 @@ public class CheckNetPresenter implements CheckNetContact.Presenter {
//重置设备
JGYUtils.getInstance().resetDevice();
mView.getSystemSettingbegin();
ToastUtil.betaShow("开始获取管控");
ToastUtil.debugShow("开始获取管控");
}
@Override

View File

@@ -18,13 +18,11 @@ import android.os.IBinder;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
@@ -40,7 +38,6 @@ import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.dialog.UpdateDialog;
import com.aoleyun.sn.service.main.MainService;
import com.aoleyun.sn.utils.ApkUtils;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.SysSettingUtils;
@@ -112,8 +109,14 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
TextView tv_bind_statu;
@BindView(R.id.tv_bind_status)
TextView tv_bind_status;
@BindView(R.id.cl_bind)
ConstraintLayout cl_bind;
@BindView(R.id.cl_qrcode)
ConstraintLayout cl_qrcode;
@BindView(R.id.iv_qrcode)
ImageView iv_qrcode;
@BindView(R.id.iv_qrcode2)
ImageView iv_qrcode2;
@BindView(R.id.tv_bind_time)
TextView tv_bind_time;
@@ -168,9 +171,18 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
@Override
public void initView() {
ButterKnife.bind(this);
mMainAPresenter = new MainAPresenter(this);
mMainAPresenter.attachView(this);
mMainAPresenter.setLifecycle(lifecycleSubject);
Log.e(TAG, "initView: " + Build.MODEL);
if ("YX-T01".equalsIgnoreCase(Build.MODEL)) {
cl_bind.setVisibility(View.GONE);
cl_qrcode.setVisibility(View.VISIBLE);
} else {
cl_bind.setVisibility(View.VISIBLE);
cl_qrcode.setVisibility(View.GONE);
}
JGYUtils.startServices(MainActivity.this);
getDevicesInfo();
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform) {
@@ -362,6 +374,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
@Override
public void setQrCode(Bitmap qrcode) {
iv_qrcode.setImageBitmap(qrcode);
iv_qrcode2.setImageBitmap(qrcode);
}
@Override

View File

@@ -9,6 +9,7 @@ import androidx.multidex.MultiDexApplication;
import com.alibaba.sdk.android.push.CloudPushService;
import com.alibaba.sdk.android.push.CommonCallback;
import com.alibaba.sdk.android.push.noonesdk.PushInitConfig;
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.manager.ConnectManager;
@@ -56,6 +57,7 @@ public class BaseApplication extends MultiDexApplication {
CrashReport.initCrashReport(getApplicationContext(), "b16b3c7f1a", false);
CrashReport.setDeviceId(this, Utils.getSerial(this));
xcrash.XCrash.init(this);
PushManager.init(this);
initRegisterObservable();
@@ -63,7 +65,6 @@ public class BaseApplication extends MultiDexApplication {
initTagObservable();
aliyunPushInit();
ToastUtil.init(this);
NetInterfaceManager.init(this);
JGYUtils.init(this);
WiFiUtils.init(this);
@@ -135,7 +136,7 @@ public class BaseApplication extends MultiDexApplication {
@Override
public void onNext(String code) {
Log.e("initRegisterObservable", "onNext: " + code);
switch (code){
switch (code) {
case "PUSH_20110":
break;
default:
@@ -158,8 +159,14 @@ public class BaseApplication extends MultiDexApplication {
private void aliyunPushInit() {
PushServiceFactory.init(this);
final CloudPushService pushService = PushServiceFactory.getCloudPushService();
// 特殊场景 需要定时拉起channel
PushInitConfig config = new PushInitConfig.Builder()
.application(this)
.loopStartChannel(true)
.loopInterval(60 * 10 * 1000)
.build();
PushServiceFactory.init(config);
CloudPushService pushService = PushServiceFactory.getCloudPushService();
pushService.setLogLevel(CloudPushService.LOG_DEBUG);
pushService.register(this, new CommonCallback() {
@Override
@@ -206,7 +213,7 @@ public class BaseApplication extends MultiDexApplication {
@Override
public void onNext(String code) {
Log.e("initAliasObservable", "onNext: " + code);
switch (code){
switch (code) {
case "PUSH_20101":
aliyunPushInit();
break;

View File

@@ -1277,7 +1277,7 @@ public class NetInterfaceManager {
JGYUtils.getInstance().installDesktop(data);
setDefaultDesktop(desktopInfo.getApp_package());
} else {
Log.e("getDefaultDesktop", "onNext: " + "删除定制桌面");
Log.e("getDefaultDesktop", "onNext: " + "删除定制桌面");
cacheHelper.put(UrlAddress.GET_DESKTOP, "");
// String whiteList = Settings.System.getString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST);
for (String s : ApkUtils.desktopAPP) {
@@ -3505,9 +3505,13 @@ public class NetInterfaceManager {
Settings.Global.putString(mContext.getContentResolver(), ForegroundAppUtil.TOPAPP_KEY, app_package);
ForegroundAppUtil.openTopApp(mContext);
} else {
cacheHelper.put(UrlAddress.GET_TOP_APP_CONTROL, "");
ForegroundAppUtil.setTopAppClass(mContext, "");
Settings.Global.putString(mContext.getContentResolver(), ForegroundAppUtil.TOPAPP_KEY, "");
if ("YX-T01".equalsIgnoreCase(Build.MODEL)) {
JGYUtils.getInstance().setTongyiAppTop();
}else {
cacheHelper.put(UrlAddress.GET_TOP_APP_CONTROL, "");
ForegroundAppUtil.setTopAppClass(mContext, "");
Settings.Global.putString(mContext.getContentResolver(), ForegroundAppUtil.TOPAPP_KEY, "");
}
}
}
@@ -3522,7 +3526,7 @@ public class NetInterfaceManager {
Log.e("getTopApp", "onComplete: ");
callback.onComplete();
Log.e("getTopApp", "onComplete: " + Settings.Global.getString(mContext.getContentResolver(), ForegroundAppUtil.TOPAPP_KEY));
ToastUtil.betaShow("获取app霸屏管控结束");
ToastUtil.debugShow("获取app霸屏管控结束");
}
});
}

View File

@@ -93,6 +93,7 @@ public class PushManager {
private static final String TAG = PushManager.class.getSimpleName();
public static final String ACTION_REFRESH_BINDING_STATUS = "RefreshBindingStatus";
public static final String AOLEYUN_REFRESH_DESKTOP = "aoleyun_refresh_desktop_action";
@SuppressLint("StaticFieldLeak")
@@ -250,34 +251,34 @@ public class PushManager {
public void setPushContent(String title, String extras) {
switch (title) {
case MSG_DELETE:
ToastUtil.betaShow("收到管控:应用删除");
ToastUtil.debugShow("收到管控:应用删除");
deleteApp(extras);
break;
case MSG_SETTING:
ToastUtil.betaShow("收到管控:系统设置");
ToastUtil.debugShow("收到管控:系统设置");
if (!TextUtils.isEmpty(extras)) {
JGYUtils.getInstance().SettingSysData(extras);
JGYUtils.getInstance().removeAllTask();
}
break;
case MSG_BROWSER:
ToastUtil.betaShow("收到管控:浏览器网址管控");
ToastUtil.debugShow("收到管控:浏览器网址管控");
getDeselectBrowerID();
break;
case MSG_APPID:
ToastUtil.betaShow("收到管控APP ID管控");
ToastUtil.debugShow("收到管控APP ID管控");
getDeselectID();
break;
case MSG_NET_CONTROL:
ToastUtil.betaShow("收到管控:应用联网管控");
ToastUtil.debugShow("收到管控:应用联网管控");
settingNetControl(extras);
break;
case MSG_POWER_ON:
ToastUtil.betaShow("收到管控:应用自启管控");
ToastUtil.debugShow("收到管控:应用自启管控");
settingPowerOn(extras);
break;
case MSG_RESET:
ToastUtil.betaShow("收到管控:设备重置");
ToastUtil.debugShow("收到管控:设备重置");
JGYUtils.getInstance().cleanAoleLauncher3Cache();
Utils.doMasterClear(mContext);
mMMKV.clearAll();
@@ -287,7 +288,7 @@ public class PushManager {
sendRefreshBroadcast(mContext);
break;
case MSG_INSTALL:
ToastUtil.betaShow("收到管控:应用安装");
ToastUtil.debugShow("收到管控:应用安装");
doDownloadAndInstall(extras);
Handler.getMain().postDelayed(new Runnable() {
@Override
@@ -297,28 +298,29 @@ public class PushManager {
NetInterfaceManager.getInstance().getNetAndLaunchSetting();
}
}, 1234);
mContext.sendBroadcast(new Intent(AOLEYUN_REFRESH_DESKTOP));
break;
case MSG_LOCK:
ToastUtil.betaShow("收到管控:设备锁定");
ToastUtil.debugShow("收到管控:设备锁定");
settingLock(extras);
break;
case MSG_CAMERA:
ToastUtil.betaShow("收到管控:相机管控");
ToastUtil.debugShow("收到管控:相机管控");
settingCamera(extras);
break;
case MSG_ONEPACKAGES:
ToastUtil.betaShow("收到管控:");
ToastUtil.debugShow("收到管控:");
settingOneNet(extras);
break;
case GET_APP_USEDTIME:
ToastUtil.betaShow("收到管控:获取应用使用时间");
ToastUtil.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.betaShow("收到管控:应用强制安装");
ToastUtil.debugShow("收到管控:应用强制安装");
File file = new File(JGYUtils.getInstance().getDownLoadPath());
if (!file.exists()) {
file.mkdirs();
@@ -350,21 +352,21 @@ public class PushManager {
Log.e(TAG, "setHomepagtag: " + e.getMessage());
}
setHomepagtag();
ToastUtil.betaShow("收到管控:浏览器主页书签设置");
ToastUtil.debugShow("收到管控:浏览器主页书签设置");
}
}, 2000);
break;
case APP_WEBSITE:
ToastUtil.betaShow("收到管控APP内部网页管控");
ToastUtil.debugShow("收到管控APP内部网页管控");
setAPPinsideWebsite(extras);
break;
case DISABLE_APPUPDATE:
ToastUtil.betaShow("收到管控:应用禁止更新设置");
ToastUtil.debugShow("收到管控:应用禁止更新设置");
setDisableUpdateList(extras);
break;
case HIDE_DESKTOP_ICON:
ToastUtil.betaShow("收到管控:隐藏应用设置");
ToastUtil.debugShow("收到管控:隐藏应用设置");
Handler.getMain().postDelayed(() -> {
//后台发送时数据库未改变,有时候可能获取到的数据时上一次的
Log.e(TAG, "run: HIDE_DESKTOP_ICON ");
@@ -372,23 +374,23 @@ public class PushManager {
}, 2000);
break;
case DISABLE_APP_SLIDE:
ToastUtil.betaShow("收到管控:应用滑动设置");
ToastUtil.debugShow("收到管控:应用滑动设置");
setDisableSlideList(extras);
break;
case UPDATE_INFO:
ToastUtil.betaShow("收到管控:更新白名单");
ToastUtil.debugShow("收到管控:更新白名单");
NetInterfaceManager.getInstance().getAppLimit();
break;
case SN_SCREENSHOT:
ToastUtil.betaShow("收到管控:设备截图");
ToastUtil.debugShow("收到管控:设备截图");
screenshot(extras);
break;
case DEVICES_REBOOT:
ToastUtil.betaShow("收到管控:设备重启");
ToastUtil.debugShow("收到管控:设备重启");
Utils.rebootDevices(mContext);
break;
case GET_DEVICES_INFO:
ToastUtil.betaShow("收到管控:获取设备信息");
ToastUtil.debugShow("收到管控:获取设备信息");
getBatteryInfo(mContext);
sendRefreshBroadcast(mContext);
LocationClient locationClient = MapManager.getInstance().getLocationClient();
@@ -477,65 +479,65 @@ public class PushManager {
});
break;
case LOCK_SCREEN:
ToastUtil.betaShow("收到管控:屏幕锁定");
ToastUtil.debugShow("收到管控:屏幕锁定");
// JsonObject lockJSONObject = GsonUtils.getJsonObject(extras);
// String name = lockJSONObject.get("name").getAsString();
setLock_screen(1, "锁屏管控中");
break;
case UNLOCK_SCREEN:
ToastUtil.betaShow("收到管控:屏幕解锁");
ToastUtil.debugShow("收到管控:屏幕解锁");
setLock_screen(0, "");
break;
case KILL_SERVER:
ToastUtil.betaShow("收到管控:停止应用");
ToastUtil.debugShow("收到管控:停止应用");
JsonObject killJSONObject = GsonUtils.getJsonObject(extras);
String packages = killJSONObject.get("package_name").getAsString();
JGYUtils.getInstance().killBackgroundProcesses(packages);
break;
case TIME_CONTROL:
ToastUtil.betaShow("收到管控:使用时间管控");
ToastUtil.debugShow("收到管控:使用时间管控");
getTimeControl(extras);
break;
case TOP_APP:
ToastUtil.betaShow("收到管控:应用霸屏");
ToastUtil.debugShow("收到管控:应用霸屏");
getTopApp(extras);
break;
case LOGO_IMG:
ToastUtil.betaShow("收到管控:开机动画设置");
ToastUtil.debugShow("收到管控:开机动画设置");
setBootanimation(extras);
Log.e(TAG, "processCustomMessage: " + extras);
break;
case DEFAULTP_APP:
ToastUtil.betaShow("收到管控设置默认APP");
ToastUtil.debugShow("收到管控设置默认APP");
setDefalutApp(extras);
break;
case PLAY_SOUND:
ToastUtil.betaShow("收到管控:查找设备");
ToastUtil.debugShow("收到管控:查找设备");
playSound(extras);
break;
case CLEAN_APP_CACHE:
ToastUtil.betaShow("收到管控:应用缓存清除");
ToastUtil.debugShow("收到管控:应用缓存清除");
cleanCache(extras);
break;
case DEVELOPER_OPTIONS:
ToastUtil.betaShow("收到管控:开发人员选项管控");
ToastUtil.debugShow("收到管控:开发人员选项管控");
setDeveloperoptions(extras);
break;
case GLOBAL_UPDATE:
ToastUtil.betaShow("收到管控:全局更新");
ToastUtil.debugShow("收到管控:全局更新");
GlobalUpdate(extras);
break;
case EBAG_CODE:
ToastUtil.betaShow("收到管控:电子书包激活码");
ToastUtil.debugShow("收到管控:电子书包激活码");
setEbagCode(extras);
JGYUtils.getInstance().killBackgroundProcesses("com.jxw.launcher");
break;
case UPDATE_WHITELIST:
ToastUtil.betaShow("收到管控:更新白名单");
ToastUtil.debugShow("收到管控:更新白名单");
NetInterfaceManager.getInstance().getAppLimit();
break;
case UPDATE_BATCH:
ToastUtil.betaShow("收到管控:更换批次不恢复出厂设置");
ToastUtil.debugShow("收到管控:更换批次不恢复出厂设置");
NetInterfaceManager.getInstance().setPushTags();
Aria.download(this).removeAllTask(true);
JGYUtils.getInstance().cleanAoleAppCache();
@@ -578,7 +580,7 @@ public class PushManager {
NetInterfaceManager.getInstance().getDefaultDesktop();
break;
case TAKE_FRONT_PICTURE:
ToastUtil.betaShow("收到推送消息: 截图");
ToastUtil.debugShow("收到推送消息: 截图");
long createTime = System.currentTimeMillis() / 1000;
Camera2BackgroundUtil camera2BackgroundUtil = new Camera2BackgroundUtil(mContext, new Camera2BackgroundUtil.CameraCallBack() {
@Override
@@ -1084,12 +1086,12 @@ public class PushManager {
} else {
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
JsonElement launcherElement = jsonObject.get("default_launcher");
if (launcherElement.isJsonNull()){
if (launcherElement.isJsonNull()) {
JGYUtils.getInstance().setDefaultDesktop("");
SPUtils.put(mContext, "default_launcher", "");
}else {
} else {
String default_launcher = launcherElement.getAsString();
if ( TextUtils.isEmpty(default_launcher)) {
if (TextUtils.isEmpty(default_launcher)) {
JGYUtils.getInstance().setDefaultDesktop("");
SPUtils.put(mContext, "default_launcher", "");
} else {
@@ -1322,7 +1324,7 @@ public class PushManager {
private CustomDialog dialog;
void bindService(final String jsonString) {
ToastUtil.betaShow("收到绑定设备请求");
ToastUtil.debugShow("收到绑定设备请求");
JsonObject object = GsonUtils.getJsonObject(jsonString);
// String userName = object.get("member_name").getAsString();
final String id = object.get("userId").getAsString();

View File

@@ -328,7 +328,7 @@ public class MainSPresenter implements MainSContact.Presenter {
public void getSystemSettingBegin() {
//重置设备
JGYUtils.getInstance().resetDevice();
ToastUtil.betaShow("开始获取管控");
ToastUtil.debugShow("开始获取管控");
mView.setSystemSetting();
}

View File

@@ -1,14 +1,10 @@
package com.aoleyun.sn.service.main;
import android.annotation.SuppressLint;
import android.app.ActivityManagerNative;
import android.app.AlarmManager;
import android.app.IActivityManager;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.app.job.JobScheduler;
import android.app.job.JobService;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -25,7 +21,6 @@ import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.DisplayMetrics;
@@ -50,7 +45,6 @@ import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.gson.GsonUtils;
import com.aoleyun.sn.hook.AoleyunActivityController;
import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.rlog.LogDBManager;
import com.aoleyun.sn.utils.ApkUtils;
@@ -100,12 +94,12 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
@Override
public void onDisconnected() {
Log.e("OnNetworkStatusChanged", "onDisconnected: ");
ToastUtil.betaShow("网络断开连接");
ToastUtil.debugShow("网络断开连接");
}
@Override
public void onConnected(NetworkUtils.NetworkType networkType) {
ToastUtil.betaShow("网络已连接");
ToastUtil.debugShow("网络已连接");
Aria.download(this).resumeAllTask();
String WiFiAlias = Utils.getWifiAlias(this);
Log.e("OnNetworkStatusChanged", "onConnected: " + WiFiAlias);
@@ -144,7 +138,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
private void aliyunPushInit() {
PushServiceFactory.init(this);
final CloudPushService pushService = PushServiceFactory.getCloudPushService();
CloudPushService pushService = PushServiceFactory.getCloudPushService();
pushService.setLogLevel(CloudPushService.LOG_DEBUG);
pushService.register(this, new CommonCallback() {
@Override
@@ -321,7 +315,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
}
switch (action) {
case Intent.ACTION_SCREEN_ON:
checkAliyunPushStatus();
break;
case Intent.ACTION_SCREEN_OFF:
break;
@@ -331,6 +325,27 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
}
}
private void checkAliyunPushStatus() {
CloudPushService mPushService = PushServiceFactory.getCloudPushService();
mPushService.checkPushChannelStatus(new CommonCallback() {
@Override
public void onSuccess(String response) {
Log.e("checkAliyunPushStatus", "onSuccess: " + response);
if ("on".equals(response)) {
// 当前是打开状态
} else {
// 当前是关闭状态
aliyunPushInit();
}
}
@Override
public void onFailed(String errorCode, String errorMessage) {
Log.e("checkAliyunPushStatus", "onFailed: errorCode = " + errorCode + " errorMessage = " + errorMessage);
}
});
}
public MainService() {
}
@@ -356,6 +371,10 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
mPresenter = new MainSPresenter(this);
mPresenter.attachView(this);
mPresenter.setLifecycle(lifecycleSubject);
if ("YX-T01".equalsIgnoreCase(Build.MODEL)) {
JGYUtils.getInstance().setTongyiAppTop();
}
TimeTask task = new TimeTask();
task.execute("ntp.aliyun.com");
mPresenter.getLockedState();
@@ -998,13 +1017,13 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
public void setLockedState(boolean loocked) {
Log.e(TAG, "setLockedState: " + loocked);
if (loocked) {
ToastUtil.betaShow("设备已上锁");
ToastUtil.debugShow("设备已上锁");
// sendSimpleNotification();
mPresenter.setPushTags();
ApkUtils.UninstallAPP(this, "com.joytv.live");
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
} else {
ToastUtil.betaShow("设备已解锁");
ToastUtil.debugShow("设备已解锁");
// notificationManager.cancel(NotificationID);
JGYUtils.getInstance().writeAppPackageList();
SysSettingUtils.setEnableSetting(this);

View File

@@ -392,7 +392,8 @@ public class ApkUtils {
}
public static boolean installApps(String apkPath) {
ToastUtil.show("正在安装应用...");
Log.e(TAG, "installApps: 正在安装应用 " + apkPath);
ToastUtil.show("正在安装应用");
Process process = null;
BufferedReader successResult = null;
BufferedReader errorResult = null;
@@ -438,6 +439,7 @@ public class ApkUtils {
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public static void installAppatPie(Context context, String apkFilePath) {
File file = new File(apkFilePath);
Log.e(TAG, "installAppatPie: 正在安装应用 " + apkFilePath);
PackageInstaller packageInstaller = context.getPackageManager().getPackageInstaller();
PackageInstaller.SessionParams sessionParams = new PackageInstaller.SessionParams(PackageInstaller
.SessionParams.MODE_FULL_INSTALL);
@@ -514,7 +516,8 @@ public class ApkUtils {
public static void installApkInSilence(String installPath, String packageName) {
ToastUtil.show("正在安装应用...");
Log.e(TAG, "installApps: 正在安装应用 " + installPath);
ToastUtil.show("正在安装应用");
Class<?> pmService;
Class<?> activityTherad;
@@ -794,6 +797,7 @@ public class ApkUtils {
this.add("com.uiuipad.os");
this.add("com.uiuipad.zyinfo");
this.add("com.yixuepai.os");
this.add("com.tongyi.aistudent");
}};
//出厂自带的app

View File

@@ -1560,6 +1560,7 @@ public class JGYUtils {
this.add("com.tencent.mm");
this.add("cn.wps.moffice_eng");
this.add("com.baidu.BaiduMap");
this.add("com.tongyi.aistudent");
}};
/**
@@ -1580,7 +1581,10 @@ public class JGYUtils {
} else {
continue;
}
if (!showAppList.contains(pkg) && !ApkUtils.aihuaApp.contains(pkg)) {
if (!showAppList.contains(pkg)
&& !ApkUtils.aoleyunAPP.contains(pkg)
&& !ApkUtils.aihuaApp.contains(pkg)
) {
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
Log.e(TAG, "hideSystemAPP: " + "disable: " + pkg);
} else {
@@ -1591,6 +1595,7 @@ public class JGYUtils {
}
public void hideApp(String pkg) {
Log.e(TAG, "hideApp: " + pkg);
PackageManager pm = mContext.getPackageManager();
try {
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
@@ -1600,6 +1605,7 @@ public class JGYUtils {
}
public void showApp(String pkg) {
Log.e(TAG, "showApp: " + pkg);
PackageManager pm = mContext.getPackageManager();
try {
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
@@ -2995,4 +3001,12 @@ 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");
ForegroundAppUtil.openTopApp(mContext);
}
}
}

View File

@@ -67,7 +67,7 @@ public class SysSettingUtils {
* @param context 关闭所有功能
*/
public static void setDisableSetting(Context context) {
ToastUtil.betaShow("关闭所有功能");
ToastUtil.debugShow("关闭所有功能");
Log.e("setDisableSetting", "Close all settings: ");
setPhoneList(context, 1);
setUSBstate(context, 1);
@@ -92,7 +92,7 @@ public class SysSettingUtils {
* @param context 开启所有功能
*/
public static void setEnableSetting(Context context) {
ToastUtil.betaShow("打开所有功能");
ToastUtil.debugShow("打开所有功能");
setPhoneList(context, 0);
if (JGYUtils.C2Tag.equalsIgnoreCase(JGYUtils.getInstance().getAppPlatform())) {
openMtp(context);

View File

@@ -1,60 +1,32 @@
package com.aoleyun.sn.utils;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.Gravity;
import android.widget.Toast;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.R;
import com.blankj.utilcode.util.ColorUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.aoleyun.sn.BuildConfig;
/**
* Created by haoge on 2017/3/2.
*/
public class ToastUtil {
private static final String TAG = ToastUtil.class.getSimpleName();
@SuppressLint("StaticFieldLeak")
private static Context mContext;
private static Handler mainHandler = new Handler(Looper.getMainLooper());
private static Toast debugToast;
private static Toast toast;
@SuppressLint("ShowToast")
public static void init(Context context) {
mContext = context;
toast = Toast.makeText(mContext, "", Toast.LENGTH_SHORT);
debugToast = Toast.makeText(mContext, "", Toast.LENGTH_SHORT);
}
private static long time1 = 0L;
private static long time2 = 0L;
public static void show(final String msg) {
ToastUtils.make()
// .setBgColor(ColorUtils.getColor(R.color.toast_color))
.setTextColor(Color.DKGRAY)
// .setGravity(Gravity.CENTER, 0, 0)
.setBgColor(ColorUtils.getColor(R.color.toast_color))
.setTextColor(Color.WHITE)
.setGravity(Gravity.CENTER, 0, 0)
.setNotUseSystemToast()
.show(msg);
}
public static void betaShow(final String msg) {
if (JGYUtils.isBetaVersion() || BuildConfig.DEBUG) {
public static void debugShow(final String msg) {
if (BuildConfig.DEBUG) {
ToastUtils.make()
// .setBgColor(ColorUtils.getColor(R.color.toast_color))
.setBgColor(ColorUtils.getColor(R.color.toast_color))
.setTextColor(Color.RED)
// .setGravity(Gravity.CENTER, 0, 0)
.setGravity(Gravity.CENTER, 0, 0)
.setNotUseSystemToast()
.setDurationIsLong(true)
.show(msg);
@@ -71,35 +43,4 @@ public class ToastUtil {
.setNotUseSystemToast()
.show(msg);
}
private static Toast mToast = null;
//android 8.0以后限制
//https://www.jianshu.com/p/d9813ad03d59
//https://www.jianshu.com/p/050ce052b873
public static void showToast(Context context, String text, int duration) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.P) {
Toast.makeText(context, text, duration).show();
} else {
if (mToast == null) {
mToast = Toast.makeText(context, text, duration);
} else {
mToast.setText(text);
mToast.setDuration(duration);
}
mToast.show();
}
}
// public static void showInCenter(String msg) {
// mainHandler.post(() -> {
// if (toast != null) {
// toast.setGravity(Gravity.CENTER, 0, 0);
// toast.setText(msg);
// toast.show();
// }
// });
// }
}

View File

@@ -1188,11 +1188,15 @@ public class Utils {
String fileName = getFileNamefromURL(url);
String urlMD5 = "";
if (jsonObject.get("MD5") == null) {
if (jsonObject.get("app_md5") != null)
if (jsonObject.get("app_md5") != null) {
urlMD5 = jsonObject.get("app_md5").getAsString();
}
} else {
if (jsonObject.get("MD5") != null)
urlMD5 = jsonObject.get("MD5").getAsString();
if (jsonObject.get("MD5") != null) {
if (!jsonObject.get("MD5").isJsonNull()) {
urlMD5 = jsonObject.get("MD5").getAsString();
}
}
}
Log.e("ariaDownload", "urlMD5=" + urlMD5);
String p = JGYUtils.getInstance().getDownLoadPath();

View File

@@ -322,6 +322,7 @@ public class XAPKUtils {
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public static void installAppatPie(Context context, List<String> apkFilePath) {
Log.e(TAG, "installApps: 正在安装应用 " + apkFilePath);
// File file = new File(apkFilePath);
PackageInstaller packageInstaller = context.getPackageManager().getPackageInstaller();
PackageInstaller.SessionParams sessionParams = new PackageInstaller.SessionParams(PackageInstaller