version:6.5.4

fix:
update:增加一百分接口,增加清理界面
This commit is contained in:
2023-11-20 10:38:15 +08:00
parent a7af7cf2a8
commit 1bf394241c
31 changed files with 1161 additions and 835 deletions

View File

@@ -755,14 +755,17 @@ public class ApkUtils {
// this.add("com.shoufei.aole");
}};
public static List<String> aoleyunAPP = new ArrayList<String>() {{
public static Set<String> aoleyunAPP = new HashSet<String>() {{
this.add(BuildConfig.APPLICATION_ID);
this.add("com.aoleyun.appstore");
this.add("com.aoleyun.sn");
this.add("com.aoleyun.info");
this.add("com.aoleyun.os");
this.add("com.aoleyun.browser");
this.add("com.aoleyun.browser");
this.add("com.uiui.filecloud");
this.add("com.gl.dwlauncher");
this.add("com.qunyu.dividedroad");
this.add("com.ygyb.yischool");
}};
//出厂自带的app

View File

@@ -11,6 +11,7 @@ import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@@ -23,6 +24,7 @@ import android.net.Uri;
import android.os.BatteryManager;
import android.os.Build;
import android.os.Environment;
import android.os.IBinder;
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
@@ -67,6 +69,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.kte.interfacesettings.aidl.ITools;
import com.tencent.mmkv.MMKV;
import java.io.File;
@@ -128,6 +131,8 @@ public class JGYUtils {
public static final int AH6016Platform = 9;
public static final int ZR6016Platform = 10;
public static final int HRAD13Platform = 11;
public static final int Teclast8183Platform = 12;
public static final int C2Platform = 13;
public static final String Other = "其他";
@@ -139,6 +144,8 @@ public class JGYUtils {
public static final String AH6016Tag = "AH6016";
public static final String ZR6016Tag = "ZR6016";
public static final String HRAD13Tag = "HRAD13";
public static final String Teclast8183Tag = "teclast8183";
public static final String C2Tag = "MTK8183";
private CacheHelper cacheHelper;
@@ -155,6 +162,28 @@ public class JGYUtils {
this.crv = context.getContentResolver();
this.cacheHelper = new CacheHelper(context);
initConnectedTimeCache();
if (C2Tag.equals(BuildConfig.platform)) {
Log.e(TAG, "JGYUtils: c2");
mServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
Log.e(TAG, "onServiceConnected: " + componentName);
try {
mITools = ITools.Stub.asInterface(iBinder);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onServiceDisconnected(ComponentName componentName) {
Log.e(TAG, "onServiceDisconnected: " + componentName);
mITools = null;
bindEbaifenService();
}
};
bindEbaifenService();
}
}
public static void init(Context context) {
@@ -173,6 +202,20 @@ public class JGYUtils {
public static native String getAuthorization();
private static final String EBAIFEN_PACKAGE = "com.kte.interfacesettings";
private static final String EBAIFEN_CLASS_NAME = "com.kte.interfacesettings.ToolsImplService";
private static final String EBAIFEN_ACTION = "com.kte.interfacesettings.aidl";
private ITools mITools;
private ServiceConnection mServiceConnection;
private void bindEbaifenService() {
Intent intent = new Intent(EBAIFEN_ACTION);
intent.setPackage(EBAIFEN_PACKAGE);
// intent.setComponent(new ComponentName(EBAIFEN_PACKAGE, EBAIFEN_CLASS_NAME));
mContext.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);
}
public int checkSNPlatform(String sn) {
if (TextUtils.isEmpty(sn)) return UnknowPlatform;
String secondChars = sn.substring(1, 2);
@@ -212,10 +255,14 @@ public class JGYUtils {
} else if (HRAD13Tag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "HRAD13");
return HRAD13Platform;
} else if (C2Tag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "C2");
return C2Platform;
} else {
Log.i(TAG, "checkAppPlatform: " + "没有数据");
return UnknowPlatform;
}
}
public boolean isSamePlatform(String platform) {
@@ -249,6 +296,8 @@ public class JGYUtils {
getAppPlatformCallback.AppPlatform(ZR6016Platform);
} else if (HRAD13Tag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(HRAD13Platform);
} else if (C2Tag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(C2Platform);
} else {
getAppPlatformCallback.AppPlatform(UnknowPlatform);
}
@@ -272,7 +321,9 @@ public class JGYUtils {
return ZR6016Tag;
} else if (HRAD13Tag.equalsIgnoreCase(platform)) {
return HRAD13Tag;
} else {
} else if (C2Tag.equalsIgnoreCase(platform)) {
return C2Tag;
}else {
return Other;
}
}
@@ -1164,6 +1215,8 @@ public class JGYUtils {
String aole_app_forbid = String.join(",", pkgSet);
Log.e(TAG, "writeAppPackageList: " + aole_app_forbid);
boolean b = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid);
setAppRestriction(2);
addAppInstallWhiteList(new ArrayList<>(pkgSet));
Log.e("writeAppPackageList: ", "aole_app_forbid: " + b + " " + Settings.System.getString(crv, CommonConfig.AOLE_ACTION_APP_FORBID));
}
@@ -1675,6 +1728,7 @@ public class JGYUtils {
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZR6016Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.HRAD13Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.C2Platform
) {
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);
@@ -2065,6 +2119,9 @@ public class JGYUtils {
private String Launcher3 = "com.android.launcher3";
private String Launcher3Class = "com.android.launcher3.Launcher";
private String AoleyunOs ="com.aoleyun.os";
private String AoleyunOsClass ="com.aoleyun.os.Launcher";
public void setDefaultLauncher(Context context, String defPackageName, String defClassName) {
try {
if (!TextUtils.isEmpty(defPackageName) && !TextUtils.isEmpty(defClassName)) {
@@ -2171,8 +2228,12 @@ public class JGYUtils {
}
private void openLauncher3() {
setDefaultDesktop(Launcher3, Launcher3Class);
// ApkUtils.openPackage(mContext, Launcher3);
if ("C2".equals(Build.MODEL)){
setDefaultDesktop(AoleyunOs, AoleyunOsClass);
}else {
setDefaultDesktop(Launcher3, Launcher3Class);
}
}
public String getStartClassName(String pkg) {
@@ -2242,6 +2303,8 @@ public class JGYUtils {
Log.e(TAG, "setDefaultDesktop: " + pkg + ":" + className);
Log.e(TAG, "setDefaultDesktop: " + "persist.sys.launcher.pkgname = " + SystemProperties.get("persist.sys.launcher.pkgname"));
Log.e(TAG, "setDefaultDesktop: " + "persist.sys.launcher.classname = " + SystemProperties.get("persist.sys.launcher.classname"));
setDefaultLauncher(new ComponentName(pkg, className));
}
public String getMacJson(Context context) {
@@ -2372,6 +2435,72 @@ public class JGYUtils {
}
public boolean isForbid(String pkg) {
switch (pkg) {
case "com.mediatek.camera":
case "com.android.camera2":
if (Settings.System.getInt(crv, "qch_app_camera", 0) == 1) {
ToastUtil.show("摄像头已禁止使用");
return false;
}
break;
case "com.android.dialer":
if (Settings.System.getInt(crv, "qch_call_forbid", 0) == 1) {
ToastUtil.show("电话已禁止使用");
return false;
}
break;
case "com.android.gallery3d":
if (Settings.System.getInt(crv, "qch_app_gallery", 1) == 1) {
ToastUtil.show("图库已禁止使用");
return false;
}
break;
case "com.android.documentsui":
if (Settings.System.getInt(crv, "qch_app_filemanager", 1) == 1) {
ToastUtil.show("文件已禁止使用");
return false;
}
break;
case "com.android.deskclock":
if (Settings.System.getInt(crv, "qch_app_deskclock", 0) == 1) {
ToastUtil.show("时钟已禁止使用");
return false;
}
break;
case "com.android.music":
if (Settings.System.getInt(crv, "qch_app_music", 1) == 1) {
ToastUtil.show("音乐已禁止使用");
return false;
}
break;
case "com.android.soundrecorder":
if (Settings.System.getInt(crv, "qch_app_soundrecorder", 1) == 1) {
ToastUtil.show("录音机已禁止使用");
return false;
}
break;
case "com.aoleyun.browser":
case "com.android.browser":
if (Settings.System.getInt(crv, "qch_app_browser", 1) == 1) {
ToastUtil.show("浏览器已禁止使用");
return false;
}
break;
case "com.android.messaging":
case "com.android.mms":
if (Settings.System.getInt(crv, "qch_app_sms", 1) == 1) {
ToastUtil.show("短信已禁止使用");
return false;
}
break;
default:
return true;
}
return false;
}
public static final String PACKAGE_DEVICEINFO = "com.aoleyun.sn";
public static final String CLASS_DEVICEINFO = "com.aoleyun.sn.receiver.BootReceiver";
@@ -2669,4 +2798,184 @@ public class JGYUtils {
this.add("com.teclast.zyappstore");
this.add("com.teclast.zy");
}};
/**
* 启用/禁用MTP数据传输功能
*
* @param enable
*/
void setMtpEnable(boolean enable) {
if (C2Tag.equals(BuildConfig.platform)) {
Log.e("ITools", "setMtpEnable: " + enable);
try {
mITools.setMtpEnable(enable);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
/**
* 启用/禁用Camera功能
*
* @param enable
*/
void setCameraEnable(boolean enable) {
if (C2Tag.equals(BuildConfig.platform)) {
Log.e("ITools", "setCameraEnable: " + enable);
try {
mITools.setCameraEnable(enable);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
/**
* 启用/禁用蓝牙功能
*
* @param enable
*/
void setBluetoothEnable(boolean enable) {
if (C2Tag.equals(BuildConfig.platform)) {
Log.e("ITools", "setBluetoothEnable: " + enable);
try {
mITools.setBluetoothEnable(enable);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
/**
* No. 7
* 启用/禁用OTG T卡功能
*
* @param enable true 启用 ,false 禁用
**/
void setSDOTGEnable(boolean enable) {
if (C2Tag.equals(BuildConfig.platform)) {
Log.e("ITools", "setSDOTGEnable: " + enable);
try {
mITools.setSDOTGEnable(enable);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
/**
* No. 31
* 设置apk安装黑白名单模式不会清除黑白名单数据
*
* @param pattern 0:普通模式黑白名单都不生效1黑名单模式2白名单模式
**/
void setAppRestriction(int pattern) {
if (C2Tag.equals(BuildConfig.platform)) {
Log.e("ITools", "setAppRestriction: " + pattern);
try {
mITools.setAppRestriction(pattern);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
/**
* No. 32
* 获取apk安装名单模式
* @return
* int 0:普通模式黑白名单都不生效1黑名单模式2白名单模式
**/
// int getAppRestrictionMode(){
//
// }
/**
* No. 33
* 设置apk安装白名单
* 在设置前需要先调用setAppRestriction用来设置apk安装模式
* 当设置了黑白名单模式但对应的黑白名单值为空时等同于设置为0普通模式黑白名单都不生效
*
* @param packageNameList 包名列表
**/
void addAppInstallWhiteList(List<String> packageNameList) {
if (C2Tag.equals(BuildConfig.platform)) {
Log.e("ITools", "addAppInstallWhiteList: " + packageNameList);
try {
mITools.addAppInstallWhiteList(packageNameList);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
/**
* No. 34
* 删除安装白名单列表
*
* @param packageNameList 包名列表
**/
void delAppInstallWhiteList(List<String> packageNameList) {
if (C2Tag.equals(BuildConfig.platform)) {
try {
mITools.delAppInstallWhiteList(packageNameList);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
/**
* No. 35
* 清空安装白名单列表
**/
void clearAppInstallWhiteList() {
if (C2Tag.equals(BuildConfig.platform)) {
try {
mITools.clearAppInstallWhiteList();
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
/**
* No. 54
* 设置默认Launcher
*
* @param packageName apk的包名
* @param className apk的组件类名
**/
void setDefaultLauncher(ComponentName cmpName) {
if (C2Tag.equals(BuildConfig.platform)) {
Log.e("ITools", "setDefaultLauncher: " + cmpName);
try {
mITools.setDefaultLauncher(cmpName);
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* No. 55
* 设置默认浏览器
*
* @param packageName apk的包名
**/
public void setDefaultBrowser(String packageName) {
if (C2Tag.equals(BuildConfig.platform)) {
Log.e("ITools", "setDefaultBrowser: " + packageName);
try {
mITools.setDefaultBrowser(packageName);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
}

View File

@@ -154,6 +154,7 @@ public class SysSettingUtils {
}
//存储卡
int setting_memory = changeNum(jsonObject.get("setting_memory").getAsInt());
JGYUtils.getInstance().setSDOTGEnable(setting_memory == 0);
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, setting_memory);
Log.e(TAG, "aole_sdcard_forbid_on:" + aole_sdcard_forbid_on);
} catch (Exception e) {
@@ -215,12 +216,15 @@ public class SysSettingUtils {
default:
case "usb_charge":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
JGYUtils.getInstance().setMtpEnable(false);
break;
case "usb_mtp":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
JGYUtils.getInstance().setMtpEnable(true);
break;
case "usb_midi":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MIDI;
JGYUtils.getInstance().setMtpEnable(false);
break;
}
Intent usbIntent = new Intent(usbStatus);
@@ -232,6 +236,7 @@ public class SysSettingUtils {
context.sendBroadcast(usbIntent);
}
}
}
private static void setBluetooth(Context context, int state) {
@@ -295,6 +300,7 @@ public class SysSettingUtils {
//设置关闭时关闭蓝牙
}
}
JGYUtils.getInstance().setBluetoothEnable(setting_bht == 1);
} catch (Exception e) {
Log.e(TAG, "setBluetooth: " + e.getMessage());
}
@@ -401,22 +407,22 @@ public class SysSettingUtils {
int setting_statusbar = changeNum(jsonObject.get("setting_statusbar").getAsInt());
// int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
// if (oldNum != setting_statusbar) {
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
boolean aole_hide_statusBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, setting_statusbar);
Log.e(TAG, "aole_hide_statusBar: " + aole_hide_statusBar);
String statusbarStatus = "";
switch (setting_statusbar) {
case 0:
statusbarStatus = CommonConfig.AOLE_ACTION_SHOW_STATUS_BAR;
break;
case 1:
statusbarStatus = CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR;
break;
default:
}
Intent statusIntent = new Intent(statusbarStatus);
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
boolean aole_hide_statusBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, setting_statusbar);
Log.e(TAG, "aole_hide_statusBar: " + aole_hide_statusBar);
String statusbarStatus = "";
switch (setting_statusbar) {
case 0:
statusbarStatus = CommonConfig.AOLE_ACTION_SHOW_STATUS_BAR;
break;
case 1:
statusbarStatus = CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR;
break;
default:
}
Intent statusIntent = new Intent(statusbarStatus);
// Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
context.sendBroadcast(statusIntent);
context.sendBroadcast(statusIntent);
// }
}
@@ -462,6 +468,7 @@ public class SysSettingUtils {
}
Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
context.sendBroadcast(cameraIntent);
JGYUtils.getInstance().setCameraEnable(setting_camera == 1);
} catch (Exception e) {
Log.e(TAG, "setCamera: " + e.getMessage());
}

View File

@@ -96,6 +96,12 @@ public class TimeUtils {
return sdf.format(date);
}
public static String getActivationTime(long second) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date(second * 1000);
return sdf.format(date);
}
private static long getLoopTime(String timestamp) {
//"15:34:39"
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");

View File

@@ -1766,6 +1766,7 @@ public class Utils {
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZR6016Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.HRAD13Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.C2Platform
) {
return Utils.getProperty("ro.build.display.id", "获取失败");
} else {