1.4.0117 YX-T01不显示小程序二维码
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user