version:6.4.1

fix:
update:去掉腾讯推送,增加保存电子书包激活码
This commit is contained in:
2023-08-14 10:31:06 +08:00
parent 8c948e62be
commit 03901123da
47 changed files with 565 additions and 1061 deletions

View File

@@ -1,5 +1,4 @@
apply plugin: 'com.android.application'
apply plugin: "com.tencent.android.tpns"
static def appName() {
return "AoleyunDeviceInfo"
@@ -78,35 +77,51 @@ android {
buildConfigField "String", "platform", '"ZhanRui"'
}
AH6016 {
flavorDimensions "default"
versionCode 8
versionName "1.7"
buildConfigField "String", "platform", '"AH6016"'
}
G10Z {
flavorDimensions "default"
versionCode 8
versionName "1.7"
buildConfigField "String", "platform", '"ZR6016"'
}
//酷比魔方
cube {
flavorDimensions "default"
versionCode 80
versionName "6.4.0"
versionCode 81
versionName "6.4.1"
buildConfigField "String", "platform", '"ZhanRuiCube"'
}
//MTK
MTKnewly {
flavorDimensions "default"
versionCode 55
versionName "2.4.5"
versionCode 56
versionName "2.4.6"
buildConfigField "String", "platform", '"MTK"'
}
Huaruian {
flavorDimensions "default"
versionCode 8
versionName "1.0.7"
versionCode 9
versionName "1.0.8"
buildConfigField "String", "platform", '"MTK11"'
}
Teclast {
flavorDimensions "default"
versionCode 8
versionName "1.0.7"
versionCode 13
versionName "1.0.9.3"
buildConfigField "String", "platform", '"P20S"'
}
}
sourceSets {
@@ -135,6 +150,15 @@ android {
v2SigningEnabled false
}
zhanRui12 {
storeFile file("keystore/zhanrui12.jks")
storePassword "123456"
keyAlias "zhanrui12"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled false
}
mtk {
storeFile file("keystore/xueshibaoos.jks")
storePassword "123456"
@@ -162,6 +186,15 @@ android {
v2SigningEnabled true
}
zhanruiG10Z{
storeFile file("keystore/zhanruiG10Z.keystore")
storePassword "123456"
keyAlias "zhanruiG10Z"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
mtk12 {
storeFile file("keystore/mtkAndroid12.keystore")
storePassword "123456"
@@ -241,6 +274,18 @@ android {
signingConfig signingConfigs.G10PUserDebug
}
zhanruiG10ZDebug.initWith(debug)
zhanruiG10ZDebug {
versionNameSuffix "-debug"
debuggable true
signingConfig signingConfigs.zhanruiG10Z
}
zhanruiG10ZRelease.initWith(release)
zhanruiG10ZRelease {
signingConfig signingConfigs.zhanruiG10Z
}
TeclastP20SDebug.initWith(debug)
TeclastP20SDebug {
debuggable true
@@ -279,6 +324,18 @@ android {
signingConfig signingConfigs.zhanRuiUserdebug
}
zhanRui12Debug.initWith(debug)
zhanRui12Debug {
debuggable true
versionNameSuffix "-debug"
signingConfig signingConfigs.zhanRui12
}
zhanRui12Release.initWith(release)
zhanRui12Release {
signingConfig signingConfigs.zhanRui12
}
debug {
debuggable true
versionNameSuffix "-debug"
@@ -290,7 +347,7 @@ android {
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null) {
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${productFlavors[0].name}-${buildType.name}.apk"
output.outputFileName = fileName
}
}
@@ -309,7 +366,7 @@ android {
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null) {
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${productFlavors[0].name}-${buildType.name}.apk"
output.outputFileName = fileName
}
}
@@ -378,14 +435,10 @@ dependencies {
implementation 'com.jakewharton:disklrucache:2.0.2'
//阿里云推送
implementation 'com.aliyun.ams:alicloud-android-push:3.8.0'
// //fastjson
// implementation 'com.alibaba:fastjson:1.2.83'
//百度地图
implementation 'com.baidu.lbsyun:BaiduMapSDK_Location:9.1.8'
//MMKV
implementation 'com.tencent:mmkv-static:1.2.13'
//腾讯移动推送 TPNS
implementation 'com.tencent.tpns:tpns:1.4.0.1-release'
//工具类
implementation 'com.blankj:utilcodex:1.31.0'
//Aria

BIN
app/keystore/zhanrui12.jks Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -25,22 +25,16 @@
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.DELETE_CACHE_FILES" />
<uses-permission android:name="android.permission.DUMP" />
<uses-permission android:name="android.permission.MASTER_CLEAR" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.REBOOT" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.REAL_GET_TASKS" />
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
<uses-permission android:name="android.permission.SHUTDOWN" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission
@@ -100,52 +94,45 @@
<!-- 获取模拟定位信息 -->
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<!-- 【必须】 移动推送 TPNS SDK VIP版本所需权限 -->
<permission
android:name="com.aoleyun.sn.permission.XGPUSH_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.aoleyun.sn.permission.XGPUSH_RECEIVE" />
<!-- 【必须】 移动推送 TPNS SDK 所需权限 -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- <uses-permission android:name="android.permission.INTERNET" />-->
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />-->
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />-->
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<!-- 【常用】 移动推送 TPNS SDK所需权限 -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<!-- <uses-permission android:name="android.permission.WAKE_LOCK" />-->
<!-- <uses-permission android:name="android.permission.VIBRATE" />-->
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<!-- <uses-permission android:name="android.permission.READ_PHONE_STATE" />-->
<!-- <uses-permission android:name="android.permission.GET_TASKS" />-->
<!-- 高德地图 -->
<!-- 用于进行网络定位 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->
<!-- 用于访问GPS定位 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />-->
<!-- 用于获取运营商信息,用于支持提供运营商信息相关的接口 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />-->
<!-- 用于访问wifi网络信息wifi信息会用于进行网络定位 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />-->
<!-- 用于获取wifi的获取权限wifi信息会用来进行网络定位 -->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<!-- <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />-->
<!-- 用于访问网络,网络定位需要上网 -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- <uses-permission android:name="android.permission.INTERNET" />-->
<!-- 用于读取手机当前的状态 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- <uses-permission android:name="android.permission.READ_PHONE_STATE" />-->
<!-- 用于写入缓存数据到扩展存储卡 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />-->
<!-- 用于申请调用A-GPS模块 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<!-- 如果设置了target >= 28 如果需要启动后台定位则必须声明这个权限 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />-->
<!-- 如果您的应用需要后台定位权限且有可能运行在Android Q设备上,并且设置了target>28必须增加这个权限声明 -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<application
android:name=".base.BaseApplication"
android:name="com.aoleyun.sn.base.BaseApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@@ -153,7 +140,7 @@
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".activity.SplashActivity">
<activity android:name="com.aoleyun.sn.activity.SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -161,7 +148,7 @@
</intent-filter>
</activity>
<activity
android:name=".activity.checknet.CheckNetActivity"
android:name="com.aoleyun.sn.activity.checknet.CheckNetActivity"
android:theme="@style/activity_styles">
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
@@ -170,18 +157,18 @@
<!-- </intent-filter>-->
</activity>
<activity
android:name=".activity.main.MainActivity"
android:name="com.aoleyun.sn.activity.main.MainActivity"
android:excludeFromRecents="true"
android:launchMode="singleTop"
android:screenOrientation="userPortrait" />
<activity android:name=".activity.TopActivity" />
<activity android:name=".activity.MainActivity1" />
<activity android:name="com.aoleyun.sn.activity.TopActivity" />
<activity android:name="com.aoleyun.sn.activity.MainActivity1" />
<activity
android:name=".activity.requestlog.RequestLogActivity"
android:name="com.aoleyun.sn.activity.requestlog.RequestLogActivity"
android:launchMode="singleTask" />
<service
android:name=".service.main.MainService"
android:name="com.aoleyun.sn.service.main.MainService"
android:enabled="true"
android:exported="true">
<intent-filter android:priority="1000">
@@ -193,16 +180,16 @@
</intent-filter>
</service>
<service
android:name=".service.RemoteService"
android:name="com.aoleyun.sn.service.RemoteService"
android:enabled="true"
android:exported="true"
android:process=":remote" />
<service
android:name=".service.LogcatService"
android:name="com.aoleyun.sn.service.LogcatService"
android:enabled="true"
android:exported="true" />
<service
android:name=".service.GuardService"
android:name="com.aoleyun.sn.service.GuardService"
android:exported="true">
<intent-filter android:priority="1000">
<action android:name="android.intent.action.USER_PRESENT" />
@@ -220,7 +207,7 @@
</intent-filter>
</service>
<service
android:name=".service.StepService"
android:name="com.aoleyun.sn.service.StepService"
android:exported="true">
<intent-filter android:priority="1000">
<action android:name="android.intent.action.SCREEN_OFF" />
@@ -237,7 +224,7 @@
</service>
<receiver
android:name=".receiver.NewAppReceiver"
android:name="com.aoleyun.sn.receiver.NewAppReceiver"
android:enabled="true"
android:exported="true"
android:permission="com.example.broadcast.permission">
@@ -250,11 +237,11 @@
</intent-filter>
</receiver>
<receiver
android:name=".utils.InstallResultReceiver"
android:name="com.aoleyun.sn.utils.InstallResultReceiver"
android:enabled="true"
android:exported="true" />
<receiver
android:name=".receiver.BootReceiver"
android:name="com.aoleyun.sn.receiver.BootReceiver"
android:enabled="true"
android:exported="true">
<intent-filter android:priority="1000">
@@ -309,21 +296,9 @@
android:name="org.apache.http.legacy"
android:required="false" />
<!-- 【可选】APP实现的Receiver用于接收消息透传和操作结果的回调请根据需要添加 -->
<!-- YOUR_PACKAGE_PATH.CustomPushReceiver需要改为自己的Receiver -->
<receiver android:name="com.aoleyun.sn.push.tpush.MessageReceiver">
<intent-filter>
<!-- 接收消息透传 -->
<action android:name="com.tencent.android.xg.vip.action.PUSH_MESSAGE" />
<!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 -->
<action android:name="com.tencent.android.xg.vip.action.FEEDBACK" />
</intent-filter>
</receiver>
<!-- 消息接收监听器 (用户可自主扩展) -->
<receiver
android:name=".push.alipush.AliyunMessageReceiver"
android:name="com.aoleyun.sn.push.alipush.AliyunMessageReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.alibaba.push2.action.NOTIFICATION_OPENED" />
@@ -336,28 +311,20 @@
</intent-filter>
</receiver>
<service
android:name=".push.alipush.AliMessageIntentService"
android:exported="false">
<intent-filter>
<action android:name="com.alibaba.push2.action.NOTIFICATION_OPENED" />
</intent-filter>
<intent-filter>
<action android:name="com.alibaba.push2.action.NOTIFICATION_REMOVED" />
</intent-filter>
<intent-filter>
<action android:name="com.alibaba.sdk.android.push.RECEIVE" />
</intent-filter>
</service>
<!-- <service-->
<!-- android:name=".push.alipush.AliMessageIntentService"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="com.alibaba.push2.action.NOTIFICATION_OPENED" />-->
<!-- </intent-filter>-->
<!-- <intent-filter>-->
<!-- <action android:name="com.alibaba.push2.action.NOTIFICATION_REMOVED" />-->
<!-- </intent-filter>-->
<!-- <intent-filter>-->
<!-- <action android:name="com.alibaba.sdk.android.push.RECEIVE" />-->
<!-- </intent-filter>-->
<!-- </service>-->
<!-- 【必须】 请修改为 APP 的 AccessId“15”开头的10位数字中间没空格 -->
<meta-data
android:name="XG_V2_ACCESS_ID"
android:value="1500026372" />
<!-- 【必须】 请修改为APP的AccessKey“A”开头的12位字符串中间没空格 -->
<meta-data
android:name="XG_V2_ACCESS_KEY"
android:value="AR7A1L5M0LPH" />
<meta-data
android:name="com.aoleyun.sn.base.CustomGlideModule"
android:value="AppGlideModule" />

View File

@@ -1,14 +1,12 @@
package com.aoleyun.sn.activity;
import android.annotation.SuppressLint;
import android.app.AlarmManager;
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.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
@@ -27,24 +25,19 @@ import androidx.core.content.ContextCompat;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.R;
import com.aoleyun.sn.activity.checknet.CheckNetActivity;
import com.aoleyun.sn.activity.main.MainActivity;
import com.aoleyun.sn.base.BaseApplication;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.service.LogcatService;
import com.aoleyun.sn.utils.ApkUtils;
import com.aoleyun.sn.utils.CmdUtil;
import com.aoleyun.sn.utils.FlowInfo;
import com.aoleyun.sn.utils.ForegroundAppUtil;
import com.aoleyun.sn.utils.GetFlowUtil;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.NetworkUtils;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.ServiceAliveUtils;
import com.aoleyun.sn.utils.TimeUtils;
import com.aoleyun.sn.utils.Utils;
import com.blankj.utilcode.util.PathUtils;
import com.google.gson.Gson;
@@ -53,23 +46,11 @@ import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.ObservableEmitter;
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.Consumer;
import io.reactivex.rxjava3.schedulers.Schedulers;
import okhttp3.internal.Util;
public class SplashActivity extends AppCompatActivity {
private static String TAG = SplashActivity.class.getSimpleName();

View File

@@ -274,7 +274,7 @@ public class CheckNetPresenter implements CheckNetContact.Presenter {
@Override
public void getDesktopIcon() {
mNetInterfaceManager.getDesktopIcon(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
mNetInterfaceManager.getDesktopIcon(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
JGYUtils.getInstance().hideSystemAPP();

View File

@@ -12,7 +12,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.aoleyun.sn.R;
import com.aoleyun.sn.rlog.LogBean;
import com.aoleyun.sn.utils.TimeUtils;
import com.aoleyun.sn.utils.Utils;
import java.util.List;

View File

@@ -1,10 +1,7 @@
package com.aoleyun.sn.base;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
@@ -14,50 +11,20 @@ import com.alibaba.sdk.android.push.CloudPushService;
import com.alibaba.sdk.android.push.CommonCallback;
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.bean.BaseResponse;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.manager.MapManager;
import com.aoleyun.sn.manager.ConnectManager;
import com.aoleyun.sn.manager.FileManager;
import com.aoleyun.sn.manager.MapManager;
import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.network.UrlAddress;
import com.aoleyun.sn.push.PushManager;
import com.aoleyun.sn.rlog.LogDBManager;
import com.aoleyun.sn.statistics.AppInformation;
import com.aoleyun.sn.statistics.StatisticsInfo;
import com.aoleyun.sn.utils.ApkUtils;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SystemUtils;
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.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushConfig;
import com.tencent.android.tpush.XGPushManager;
import com.tencent.mmkv.MMKV;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.ObservableEmitter;
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.schedulers.Schedulers;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class BaseApplication extends MultiDexApplication {
private static final String TAG = BaseApplication.class.getSimpleName();
@@ -79,8 +46,8 @@ public class BaseApplication extends MultiDexApplication {
Log.e(TAG, "mmkv root: " + rootDir);
PushManager.init(this);
tPushInit();
aliyunPushInit();
ToastUtil.init(this);
NetInterfaceManager.init(this);
JGYUtils.init(this);
@@ -124,42 +91,6 @@ public class BaseApplication extends MultiDexApplication {
});
}
private void tPushInit() {
XGPushConfig.enableDebug(this, true);
XGPushManager.registerPush(this, new XGIOperateCallback() {
@Override
public void onSuccess(Object data, int flag) {
//token在设备卸载重装的时候有可能会变
Log.e("TPush", "注册成功设备token为" + data);
MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE).encode("XGPushtoken", data.toString());
List<XGPushManager.AccountInfo> accountInfoList = new ArrayList<>();
String sn = Utils.getSerial(getApplicationContext());
Log.e("TPush", "onSuccess: " + sn);
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), sn));
if (Utils.NOSN.equalsIgnoreCase(sn)) {
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getIMEI(getApplicationContext(), 0)));
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getIMEI(getApplicationContext(), 1)));
}
XGPushManager.upsertAccounts(getApplicationContext(), accountInfoList, new XGIOperateCallback() {
@Override
public void onSuccess(Object data, int flag) {
Log.e("TPush upsertAccounts", "onSuccess, data:" + data + ", flag:" + flag);
}
@Override
public void onFail(Object data, int errCode, String msg) {
Log.e("TPush upsertAccounts", "onFail, data:" + data + ", code:" + errCode + ", msg:" + msg);
}
});
}
@Override
public void onFail(Object data, int errCode, String msg) {
Log.e("TPush", "注册失败,错误码:" + errCode + ",错误信息:" + msg);
}
});
}
private void aliyunPushInit() {
PushServiceFactory.init(this);
final CloudPushService pushService = PushServiceFactory.getCloudPushService();
@@ -169,6 +100,25 @@ public class BaseApplication extends MultiDexApplication {
public void onSuccess(String response) {
Log.e("AliyunPush", "init cloudchannel success");
Log.e("AliyunPush", "init cloudchannel success " + pushService.getDeviceId());
setAlias();
}
@Override
public void onFailed(String errorCode, String errorMessage) {
Log.e("AliyunPush", "init cloudchannel failed -- errorcode:" + errorCode + " -- errorMessage:" + errorMessage);
Handler.getMain().postDelayed(new Runnable() {
@Override
public void run() {
Log.e("AliyunPush", "retry register");
aliyunPushInit();
}
}, 30000);
}
});
}
private void setAlias() {
final CloudPushService pushService = PushServiceFactory.getCloudPushService();
String sn = Utils.getSerial(BaseApplication.this);
if (TextUtils.isEmpty(sn)) {
return;
@@ -183,6 +133,13 @@ public class BaseApplication extends MultiDexApplication {
public void onFailed(String errorCode, String errorMsg) {
Log.e("AliyunPush", "bind account " + sn + " failed." +
"errorCode: " + errorCode + ", errorMsg:" + errorMsg);
Handler.getMain().postDelayed(new Runnable() {
@Override
public void run() {
Log.e("AliyunPush", "retry bindAccount");
setAlias();
}
}, 30000);
}
});
pushService.addAlias(sn, new CommonCallback() {
@@ -195,13 +152,13 @@ public class BaseApplication extends MultiDexApplication {
public void onFailed(String errorCode, String errorMsg) {
Log.e("AliyunPush", "add alias " + sn + " failed." +
"errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
}
});
}
Handler.getMain().postDelayed(new Runnable() {
@Override
public void onFailed(String errorCode, String errorMessage) {
Log.e("AliyunPush", "init cloudchannel failed -- errorcode:" + errorCode + " -- errorMessage:" + errorMessage);
public void run() {
Log.e("AliyunPush", "retry addAlias");
setAlias();
}
}, 30000);
}
});
}

View File

@@ -4,7 +4,6 @@ import androidx.annotation.NonNull;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.io.Serializable;

View File

@@ -8,12 +8,12 @@ import java.io.Serializable;
public class ForceDownloadData implements Serializable {
private static final long serialVersionUID = 2965901905485481437L;
private String app_name;
private String app_package;
private String app_url;
private String app_id;
private String app_md5;
private long app_version_code;
String app_name;
String app_package;
String app_url;
String app_id;
String app_md5;
long app_version_code;
public String getApp_package() {
return app_package;

View File

@@ -31,6 +31,8 @@ public class CommonConfig {
*/
public final static String DEVICES_FRIST_START = "DEVICES_FRIST_START";
/*保存激活码*/
public static final String ACTIVATIONBEAN_CODE_KEY = "UIUI_ACTIVATIONBEAN_CODE";
/*保存的应用版本号*/
public final static String SN_VERSIONCODE = "SN_VERSIONCODE";
/*重启标识*/

View File

@@ -5,7 +5,6 @@ import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;

View File

@@ -5,7 +5,6 @@ import android.content.Context;
import android.util.Log;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.utils.TimeUtils;
import com.tencent.mmkv.MMKV;
public class ConnectManager {

View File

@@ -4,7 +4,6 @@ import android.content.Context;
import android.util.Log;
import com.aoleyun.sn.utils.JGYUtils;
import com.blankj.utilcode.util.PathUtils;
import java.io.File;

View File

@@ -42,7 +42,9 @@ public class MapManager {
}
public void initMap() {
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 1);
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+gps");
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+network");
mLocationClient = new LocationClient(mContext);
mLocationClient.setLocOption(getDefaultLocationClientOption());
mLocationClient.registerLocationListener(mListener);
@@ -51,7 +53,9 @@ public class MapManager {
}
public LocationClient getLocationClient() {
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 1);
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+gps");
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+network");
if (mLocationClient == null) {
initMap();
}
@@ -126,9 +130,11 @@ public class MapManager {
}
Log.e(TAG, "MapAddress: " + (String) SPUtils.get(mContext, "MapAddress", "-"));
Log.e(TAG, "MapError: " + (String) SPUtils.get(mContext, "MapError", "-"));
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "-network");
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "-gps");
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 0);
// Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "-network");
// Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "-gps");
// Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "");
// Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 0);
mLocationClient.stop();
}
@Override

View File

@@ -122,8 +122,6 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushManager;
import com.tencent.mmkv.MMKV;
import com.trello.rxlifecycle4.RxLifecycle;
import com.trello.rxlifecycle4.android.ActivityEvent;
@@ -151,7 +149,6 @@ import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.BiFunction;
import io.reactivex.rxjava3.functions.Function5;
import io.reactivex.rxjava3.functions.Function6;
import io.reactivex.rxjava3.schedulers.Schedulers;
import io.reactivex.rxjava3.subjects.BehaviorSubject;
import okhttp3.Cache;
@@ -899,9 +896,9 @@ public class NetInterfaceManager {
}
public void getForceDownload(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
if (refresh) {
connectMode = ConnectMode.ONE_MINUTE;
connectMode = ConnectMode.DEFAULT;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_FORCE_INSTALL_LIST, connectMode)) {
getForceDownload(lifecycle, callback);
@@ -1002,10 +999,12 @@ public class NetInterfaceManager {
if (jsonString == null) {
getDefaultDesktop(lifecycle, callback);
} else {
if (!TextUtils.isEmpty(jsonString)) {
JsonObject data = GsonUtils.getJsonObject(jsonString);
if (data != null) {
JGYUtils.getInstance().installDesktop(data);
}
}
callback.onComplete();
}
}
@@ -1047,27 +1046,23 @@ public class NetInterfaceManager {
} else {
Log.e("getDefaultDesktop", "onNext: " + "删除定制桌面");
cacheHelper.put(UrlAddress.GET_DESKTOP, "");
String whiteList = Settings.System.getString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST);
Log.e("getDefaultDesktop", "onNext: " + whiteList);
// String whiteList = Settings.System.getString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST);
for (String s : ApkUtils.desktopAPP) {
ApkUtils.UninstallAPP(mContext, s);
Log.e("getDefaultDesktop", "UninstallAPP: " + s);
}
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform) {
PackageManager pm = mContext.getPackageManager();
try {
pm.setApplicationEnabledSetting("com.aoleyunos.dop3", PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
} catch (Exception e) {
Log.e("getDefaultDesktop", "onNext: " + e.getMessage());
}
setDefaultDesktop("com.aoleyunos.dop3");
}
}
if (!TextUtils.isEmpty(whiteList)) {
if (!whiteList.contains(ApkUtils.desktopAPP.get(0))) {
if (!BuildConfig.DEBUG) {
ApkUtils.UninstallAPP(mContext, ApkUtils.desktopAPP.get(0));
}
Log.e("getDefaultDesktop", "skip: " + ApkUtils.desktopAPP.get(0));
}
if (!whiteList.contains(ApkUtils.desktopAPP.get(1))) {
if (!BuildConfig.DEBUG) {
ApkUtils.UninstallAPP(mContext, ApkUtils.desktopAPP.get(1));
}
Log.e("getDefaultDesktop", "skip: " + ApkUtils.desktopAPP.get(1));
}
} else {
ApkUtils.UninstallAPP(mContext, ApkUtils.desktopAPP.get(0));
ApkUtils.UninstallAPP(mContext, ApkUtils.desktopAPP.get(1));
}
}
}
@Override
@@ -1718,6 +1713,7 @@ public class NetInterfaceManager {
Log.e("getEBagCode", "onNext: " + baseResponse);
if (baseResponse.code == OK) {
EBagCode eBagCode = baseResponse.data;
Settings.System.putString(mContext.getContentResolver(), CommonConfig.ACTIVATIONBEAN_CODE_KEY, eBagCode.getEbagCode());
cacheHelper.put(UrlAddress.GET_EBAG_CODE, GsonUtils.toJSONString(eBagCode));
String ebagCode = eBagCode.getEbagCode();
SPUtils.put(mContext, "ebagCode", ebagCode);
@@ -1817,7 +1813,13 @@ public class NetInterfaceManager {
} else {
Log.e(TAG, "setDefaultApp: default_IME is empty");
}
String default_launcher = defaultApp.getDefault_launcher();
if (!TextUtils.isEmpty(default_launcher)) {
JGYUtils.getInstance().setDefaultDesktop(default_launcher);
} else {
JGYUtils.getInstance().setDefaultDesktop("com.aoleyun.os");
Log.e(TAG, "setDefaultApp: default_launcher is empty");
}
}
private String getInputMethodId(String pkg) {
@@ -1833,23 +1835,19 @@ public class NetInterfaceManager {
}
private void setDefaultDesktop(String defaultApp) {
// int aihuaUnlock = Settings.System.getInt(mContext.getContentResolver(), CommonConfig.AIHUA_UNLOCK, 0);
// if (aihuaUnlock == 1) {
// JGYUtils.getInstance().setDefaultDesktop(PackageNames.DESKTOP);
// } else {
// if (!TextUtils.isEmpty(defaultApp)) {
// JGYUtils.getInstance().setDefaultDesktop(defaultApp);
// SPUtils.put(mContext, "default_launcher", defaultApp);
// } else {
// String default_launcher = (String) SPUtils.get(mContext, "default_launcher", "");
// Log.e("getDefaultApp", "onNext: " + default_launcher);
// if (TextUtils.isEmpty(default_launcher)) {
// JGYUtils.getInstance().setDefaultDesktop();
// } else {
// JGYUtils.getInstance().setDefaultDesktop(default_launcher);
// }
// }
// }
if (!TextUtils.isEmpty(defaultApp)) {
JGYUtils.getInstance().setDefaultDesktop(defaultApp);
SPUtils.put(mContext, "default_launcher", defaultApp);
} else {
String default_launcher = (String) SPUtils.get(mContext, "default_launcher", "");
Log.e("getDefaultApp", "onNext: " + default_launcher);
if (TextUtils.isEmpty(default_launcher)) {
JGYUtils.getInstance().setDefaultDesktop();
} else {
JGYUtils.getInstance().setDefaultDesktop(default_launcher);
}
}
}
public interface StudesInfoListener {
@@ -1967,8 +1965,10 @@ public class NetInterfaceManager {
JGYUtils.getInstance().setYxpDefaultDesktop();
}
Settings.System.putInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
Settings.System.putInt(mContext.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, 0);
} else if (locked == JGYActions.NET_CODE_UNLOCKED) {
// SysSettingUtils.setEnableSetting(mContext);
JGYUtils.getInstance().writeAppPackageList();
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.TeclastP20sPlatform) {
JGYUtils.getInstance().hideApp(PackageNames.YIXUEPAI_DESKTOP);
JGYUtils.getInstance().setDefaultDesktop();
@@ -1976,6 +1976,8 @@ public class NetInterfaceManager {
mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);
}
Settings.System.putInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_UNLOCKED);
Settings.System.putInt(mContext.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, 1);
}
} else if (response.code == NOTFOUND) {
Settings.System.putInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
@@ -2073,9 +2075,9 @@ public class NetInterfaceManager {
}
public void setPushTags(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, PushTagCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_DAY;
ConnectMode connectMode = ConnectMode.DEFAULT;
if (refresh) {
connectMode = ConnectMode.SIX_HOUR;
connectMode = ConnectMode.DEFAULT;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_DEVICES_TAGS, connectMode)) {
setPushTags(lifecycle, callback);
@@ -2119,6 +2121,7 @@ public class NetInterfaceManager {
@Override
public void onNext(@NonNull BaseResponse<Batch> response) {
Set<String> tags = new HashSet<>();
if (response.code == OK) {
cacheHelper.put(UrlAddress.GET_DEVICES_TAGS, GsonUtils.toJSONString(response.data));
String batch = response.data.getBatch();
@@ -2131,6 +2134,7 @@ public class NetInterfaceManager {
if (callback != null)
callback.setPushTag(batch);
mMMKV.encode(CommonConfig.DEVICES_TAG, batch);
tags.add(batch);
}
} else {
cacheHelper.put(UrlAddress.GET_DEVICES_TAGS, "");
@@ -2138,6 +2142,7 @@ public class NetInterfaceManager {
callback.setPushTag("");
Log.e("setPushTags", "onNext: " + response.toString());
}
clearAndAppendTags(tags);
}
@Override
@@ -2145,6 +2150,11 @@ public class NetInterfaceManager {
Log.e("setPushTags", "onError: " + e.getMessage());
String batch = mMMKV.decodeString(CommonConfig.DEVICES_TAG, "");
Log.e("setPushTags", "tagSets: " + batch);
Set<String> tags = new HashSet<>();
if (!TextUtils.isEmpty(batch)) {
tags.add(batch);
}
clearAndAppendTags(tags);
if (callback != null)
callback.setPushTag(batch);
onComplete();
@@ -2158,28 +2168,35 @@ public class NetInterfaceManager {
}
public void clearAndAppendTags(Set<String> tagSets) {
XGPushManager.clearAndAppendTags(mContext, "clearAndAppendTags :" + System.currentTimeMillis(), tagSets, new XGIOperateCallback() {
@Override
public void onSuccess(Object o, int i) {
Log.e("setPushTags", "onSuccess: " + o);
}
@Override
public void onFail(Object o, int i, String s) {
Log.e("setPushTags", "onFail: " + o);
JGYUtils.getInstance().getAppPlatform(platform -> {
if (platform == JGYUtils.MTKPlatform) {
tagSets.add(JGYUtils.MTKTag);
} else if (platform == JGYUtils.CubePlatform) {
tagSets.add(JGYUtils.ZhanruiTag);
} else if (platform == JGYUtils.ZhanruiPlatform) {
tagSets.add(JGYUtils.ZhanruiTag);
} else if (platform == JGYUtils.MTK11Platform) {
tagSets.add(JGYUtils.MTK11Tag);
} else if (platform == JGYUtils.TeclastP20sPlatform) {
tagSets.add(JGYUtils.TeclastP20sTag);
} else if (platform == JGYUtils.AH6016Platform) {
tagSets.add(JGYUtils.AH6016Tag);
} else if (platform == JGYUtils.ZR6016Platform) {
tagSets.add(JGYUtils.ZR6016Tag);
}
});
Log.e(TAG, "clearAndAppendTags: " + tagSets);
String[] tag = new ArrayList<>(tagSets).toArray(new String[tagSets.size()]);
CloudPushService pushService = PushServiceFactory.getCloudPushService();
pushService.bindTag(CloudPushService.DEVICE_TARGET, tag, null, new CommonCallback() {
@Override
public void onSuccess(String s) {
Log.e("bindTag", "bind tag " + Arrays.toString(tag) + " success\n");
Log.e("clearAndAppendTags", "bind tag " + Arrays.toString(tag) + " success\n");
}
@Override
public void onFailed(String errorCode, String errorMsg) {
Log.e("bindTag", "bind tag " + Arrays.toString(tag) + " failed." +
Log.e("clearAndAppendTags", "bind tag " + Arrays.toString(tag) + " failed." +
"errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
}
});
@@ -2770,11 +2787,11 @@ public class NetInterfaceManager {
cacheHelper.put(UrlAddress.SET_WHITE_PACKAGE_LIST, GsonUtils.toJSONString(appLimit));
String result = appLimit.getResult();
//开机图标 只记录后台传的包名
boolean write = Settings.System.putString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST, result);
Log.e(TAG, "onNext: only_jgy_shortcut_list: " + write);
Log.e(TAG, "onNext: only_jgy_shortcut_list: " + Settings.System.putString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST, result));
JGYUtils.getInstance().writeAppPackageList(mContext, result);
JGYUtils.getInstance().deleteOtherApp();
} else {
Settings.System.putString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST, "");
JGYUtils.getInstance().writeAppPackageList();
cacheHelper.put(UrlAddress.SET_WHITE_PACKAGE_LIST, "");
Log.e("getAppLimit", "onNext: " + baseResponse);

View File

@@ -4,7 +4,6 @@ import com.aoleyun.sn.bean.WhoisBean;
import com.aoleyun.sn.network.UrlAddress;
import io.reactivex.rxjava3.core.Observable;
import okhttp3.ResponseBody;
import retrofit2.http.GET;
import retrofit2.http.Query;

View File

@@ -5,7 +5,6 @@ import com.aoleyun.sn.bean.ForceDownloadData;
import com.aoleyun.sn.network.UrlAddress;
import io.reactivex.rxjava3.core.Observable;
import okhttp3.ResponseBody;
import retrofit2.http.GET;
import retrofit2.http.Query;

View File

@@ -8,10 +8,7 @@ import com.aoleyun.sn.network.UrlAddress;
import java.util.List;
import io.reactivex.rxjava3.core.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
/**

View File

@@ -5,7 +5,6 @@ import com.aoleyun.sn.bean.BaseResponse;
import com.aoleyun.sn.network.UrlAddress;
import io.reactivex.rxjava3.core.Observable;
import okhttp3.ResponseBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

View File

@@ -3,8 +3,6 @@ package com.aoleyun.sn.network.api.post;
import com.aoleyun.sn.bean.BaseResponse;
import com.aoleyun.sn.network.UrlAddress;
import java.io.File;
import io.reactivex.rxjava3.core.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;

View File

@@ -3,8 +3,6 @@ package com.aoleyun.sn.network.api.post;
import com.aoleyun.sn.bean.BaseResponse;
import com.aoleyun.sn.network.UrlAddress;
import java.util.List;
import io.reactivex.rxjava3.core.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;

View File

@@ -7,7 +7,6 @@ import java.util.Map;
import io.reactivex.rxjava3.core.Observable;
import okhttp3.MultipartBody;
import retrofit2.http.Field;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;

View File

@@ -2,7 +2,6 @@ package com.aoleyun.sn.network.interceptor;
import android.text.TextUtils;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.disklrucache.DiskLruCacheHelper;
import com.aoleyun.sn.utils.JGYUtils;
import com.blankj.utilcode.util.LogUtils;

View File

@@ -57,9 +57,11 @@ import com.tencent.mmkv.MMKV;
import java.io.File;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
@@ -207,20 +209,7 @@ public class PushManager {
switch (title) {
case MSG_DELETE:
ToastUtil.betaShow("收到管控:应用删除");
if (!TextUtils.isEmpty(extras)) {
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
String pkg = jsonObject.get("package_name").getAsString();
if (TextUtils.isEmpty(pkg)) return;
ApkUtils.UninstallAPP(mContext, pkg);
}
Handler.getMain().postDelayed(new Runnable() {
@Override
public void run() {
NetInterfaceManager.getInstance().getDesktopIcon();
NetInterfaceManager.getInstance().getDefaultDesktop();
NetInterfaceManager.getInstance().getNetAndLaunchSetting();
}
}, 1234);
deleteApp(extras);
break;
case MSG_SETTING:
ToastUtil.betaShow("收到管控:系统设置");
@@ -395,6 +384,7 @@ public class PushManager {
}
Log.e(TAG, "MapAddress: " + SPUtils.get(mContext, "MapAddress", "-"));
Log.e(TAG, "MapError: " + SPUtils.get(mContext, "MapError", "-"));
locationClient.stop();
}
@Override
@@ -543,12 +533,39 @@ public class PushManager {
getBatteryInfo(mContext);
break;
case UPDATE_DESKTOP:
NetInterfaceManager.getInstance().getDefaultDesktop();
break;
default:
}
}
private void deleteApp(String extras) {
if (!TextUtils.isEmpty(extras)) {
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
String pkg = jsonObject.get("package_name").getAsString();
if (TextUtils.isEmpty(pkg)) return;
String forceApp = Settings.System.getString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP);
if (!TextUtils.isEmpty(forceApp)) {
List<String> forceAppList = new ArrayList<>(Arrays.asList(forceApp.split(",")));
forceAppList.remove(pkg);
if (forceAppList.size() != 0) {
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceAppList));
} else {
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "");
}
}
ApkUtils.UninstallAPP(mContext, pkg);
}
Handler.getMain().postDelayed(new Runnable() {
@Override
public void run() {
NetInterfaceManager.getInstance().getDesktopIcon();
NetInterfaceManager.getInstance().getDefaultDesktop();
NetInterfaceManager.getInstance().getNetAndLaunchSetting();
}
}, 1234);
}
private int changeNum(int paramInt) {
return paramInt == 0 ? 1 : 0;
}

View File

@@ -1,17 +0,0 @@
package com.aoleyun.sn.push.tpush;
/**
* Created by chacewang on 2019/7/5.
*/
public class Constants {
public static final int TEST_LOCAL_NOTIFICATION = 1;
public static final int TEST_NOTIFICATION = 2;
public static final int TEST_SET_TAG = 3;
public static final int TEST_DEL_TAG = 4;
public static final int TEST_SET_ACCOUNT = 5;
public static final int TEST_DEL_ACCOUNT = 6;
public static final String LOCAL_NOTIFICATION_TITLE = "localtest";
public static final String TEST_TAG_NAME = "DiagnosisTag";
}

View File

@@ -1,307 +0,0 @@
package com.aoleyun.sn.push.tpush;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import com.aoleyun.sn.disklrucache.CacheHelper;
import com.aoleyun.sn.push.PushManager;
import com.aoleyun.sn.push.tpush.common.NotificationService;
import com.aoleyun.sn.push.tpush.po.XGNotification;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.tencent.android.tpush.NotificationAction;
import com.tencent.android.tpush.XGPushBaseReceiver;
import com.tencent.android.tpush.XGPushClickedResult;
import com.tencent.android.tpush.XGPushRegisterResult;
import com.tencent.android.tpush.XGPushShowedResult;
import com.tencent.android.tpush.XGPushTextMessage;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class MessageReceiver extends XGPushBaseReceiver {
private static final String TAG = MessageReceiver.class.getSimpleName();
public static final String UPDATE_LISTVIEW_ACTION = "com.qq.xgdemo.activity.UPDATE_LISTVIEW";
public static final String TEST_ACTION = "com.qq.xgdemo.activity.TEST_ACTION";
public static final String LogTag = "xg.test";
private Context mContext;
private ContentResolver mResolver;
private PackageManager mPackageManager;
private CacheHelper cacheHelper;
/**
* 消息透传处理
*
* @param context
* @param message 解析自定义的 JSON
*/
@Override
public void onTextMessage(Context context, XGPushTextMessage message) {
this.mContext = context;
this.mResolver = context.getContentResolver();
this.mPackageManager = context.getPackageManager();
this.cacheHelper = new CacheHelper(context);
String text = "收到消息:" + message.toString();
// 获取自定义key-value
String customContent = message.getCustomContent();
if (customContent != null && customContent.length() != 0) {
JsonObject obj = JsonParser.parseString(customContent).getAsJsonObject();
// key1为前台配置的key
if (!TextUtils.isEmpty(obj.get("key").getAsString())) {
String value = obj.get("key").getAsString();
Log.d(LogTag, "get custom value:" + value);
}
// ...
}
// APP自主处理消息的过程...
Log.e(LogTag, text);
show(context, text);
processCustomMessage(context, message);
}
/**
* 通知展示
*
* @param context
* @param notifiShowedRlt 包含通知的内容
*/
@Override
public void onNotificationShowedResult(Context context, XGPushShowedResult notifiShowedRlt) {
if (context == null || notifiShowedRlt == null) {
return;
}
XGNotification notific = new XGNotification();
notific.setMsg_id(notifiShowedRlt.getMsgId());
notific.setTitle(notifiShowedRlt.getTitle());
notific.setContent(notifiShowedRlt.getContent());
// notificationActionType==1为Activity2为url3为intent
notific.setNotificationActionType(notifiShowedRlt
.getNotificationActionType());
// Activity,url,intent都可以通过getActivity()获得
notific.setActivity(notifiShowedRlt.getActivity());
notific.setUpdate_time(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.format(Calendar.getInstance().getTime()));
NotificationService.getInstance(context).save(notific);
Intent testIntent = new Intent(TEST_ACTION);
if (notifiShowedRlt.getTitle().equals(Constants.LOCAL_NOTIFICATION_TITLE)) {
testIntent.putExtra("step", Constants.TEST_LOCAL_NOTIFICATION);
} else {
testIntent.putExtra("step", Constants.TEST_NOTIFICATION);
}
context.sendBroadcast(testIntent);
Intent viewIntent = new Intent(UPDATE_LISTVIEW_ACTION);
context.sendBroadcast(viewIntent);
show(context, "您有1条新消息, " + "通知被展示 " + notifiShowedRlt.toString());
Log.d(LogTag, "您有1条新消息, " + "通知被展示 " + notifiShowedRlt.toString() + ", PushChannel:" + notifiShowedRlt.getPushChannel());
}
/**
* 注册回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
*/
@Override
public void onRegisterResult(Context context, int errorCode, XGPushRegisterResult message) {
if (context == null || message == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
// 在这里拿token
String token = message.getToken();
text = "注册成功1. token" + token;
} else {
text = message + "注册失败,错误码:" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
}
/**
* 反注册回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
*/
@Override
public void onUnregisterResult(Context context, int errorCode) {
if (context == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = "反注册成功";
} else {
text = "反注册失败" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
}
/**
* 设置标签回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
* @param tagName 设置的 TAG
*/
@Override
public void onSetTagResult(Context context, int errorCode, String tagName) {
if (context == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = "\"" + tagName + "\"设置成功";
} else {
text = "\"" + tagName + "\"设置失败,错误码:" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
Intent testIntent = new Intent(TEST_ACTION);
testIntent.putExtra("step", Constants.TEST_SET_TAG);
context.sendBroadcast(testIntent);
}
/**
* 删除标签的回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
* @param tagName 设置的 TAG
*/
@Override
public void onDeleteTagResult(Context context, int errorCode, String tagName) {
if (context == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = "\"" + tagName + "\"删除成功";
} else {
text = "\"" + tagName + "\"删除失败,错误码:" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
Intent testIntent = new Intent(TEST_ACTION);
testIntent.putExtra("step", Constants.TEST_DEL_TAG);
context.sendBroadcast(testIntent);
}
/**
* 设置账号回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
* @param account 设置的账号
*/
@Override
public void onSetAccountResult(Context context, int errorCode, String account) {
Intent testIntent = new Intent(TEST_ACTION);
testIntent.putExtra("step", Constants.TEST_SET_ACCOUNT);
context.sendBroadcast(testIntent);
}
/**
* 删除账号回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
* @param account 设置的账号
*/
@Override
public void onDeleteAccountResult(Context context, int errorCode, String account) {
Intent testIntent = new Intent(TEST_ACTION);
testIntent.putExtra("step", Constants.TEST_DEL_ACCOUNT);
context.sendBroadcast(testIntent);
}
@Override
public void onSetAttributeResult(Context context, int i, String s) {
}
@Override
public void onDeleteAttributeResult(Context context, int i, String s) {
}
@Override
public void onQueryTagsResult(Context context, int errorCode, String data, String operateName) {
Log.i(LogTag, "action - onQueryTagsResult, errorCode:" + errorCode + ", operateName:" + operateName + ", data: " + data);
}
/**
* 通知点击回调 actionType=1为该消息被清除actionType=0为该消息被点击
*
* @param context
* @param message 包含被点击通知的内容
*/
@Override
public void onNotificationClickedResult(Context context, XGPushClickedResult message) {
if (context == null || message == null) {
return;
}
String text = "";
if (message.getActionType() == NotificationAction.clicked.getType()) {
// 通知在通知栏被点击啦。。。。。
// APP自己处理点击的相关动作
// 这个动作可以在activity的onResume也能监听请看第3点相关内容
text = "通知被打开 :" + message;
} else if (message.getActionType() == NotificationAction.delete.getType()) {
// 通知被清除啦。。。。
// APP自己处理通知被清除后的相关动作
text = "通知被清除 :" + message;
}
Toast.makeText(context, "广播接收到通知被点击:" + message.toString(),
Toast.LENGTH_SHORT).show();
// 获取自定义key-value
String customContent = message.getCustomContent();
if (customContent != null && customContent.length() != 0) {
JsonObject obj = JsonParser.parseString(customContent).getAsJsonObject();
// key1为前台配置的key
if (!TextUtils.isEmpty(obj.get("key").getAsString())) {
String value = obj.get("key").getAsString();
Log.d(LogTag, "get custom value:" + value);
}
// ...
}
// APP自主处理的过程。。。
Log.d(LogTag, text);
show(context, text);
}
private void show(Context context, String text) {
// Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}
private void processCustomMessage(Context context, XGPushTextMessage message) {
if (context == null || message == null) {
return;
}
String title = message.getTitle();
String content = message.getContent();
JsonObject extrasJson = JsonParser.parseString(content).getAsJsonObject();
String extras = "";
if (extrasJson.get("extras") != null) {
extras = extrasJson.get("extras").toString();
}
PushManager.getInstance().setPushContent(title, extras);
}
}

View File

@@ -1,23 +0,0 @@
package com.aoleyun.sn.push.tpush.common;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DBOpenHelper extends SQLiteOpenHelper {
public DBOpenHelper(Context context) {
super(context, "XGExample.db", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE notification (id integer primary key autoincrement,msg_id varchar(64),title varchar(128),activity varchar(256),notificationActionType varchar(512),content text,update_time varchar(16))");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}

View File

@@ -1,134 +0,0 @@
package com.aoleyun.sn.push.tpush.common;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.aoleyun.sn.push.tpush.po.XGNotification;
import java.util.ArrayList;
import java.util.List;
public class NotificationService {
private DBOpenHelper dbOpenHelper;
private static NotificationService instance = null;
public NotificationService(Context context) {
this.dbOpenHelper = new DBOpenHelper(context);
}
public synchronized static NotificationService getInstance(Context ctx) {
if (null == instance) {
instance = new NotificationService(ctx);
}
return instance;
}
public void save(XGNotification notification) {
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
ContentValues values = new ContentValues();
values.put("msg_id", notification.getMsg_id());
values.put("title", notification.getTitle());
values.put("content", notification.getContent());
values.put("activity", notification.getActivity());
values.put("notificationActionType", notification.getNotificationActionType());
values.put("update_time", notification.getUpdate_time());
db.insert("notification", null, values);
}
public void delete(Integer id) {
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
db.delete("notification", "id=?", new String[] { id.toString() });
}
public void deleteAll() {
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
db.delete("notification", "", null);
}
public void update(XGNotification notification) {
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
ContentValues values = new ContentValues();
values.put("msg_id", notification.getMsg_id());
values.put("title", notification.getTitle());
values.put("content", notification.getContent());
values.put("activity", notification.getActivity());
values.put("notificationActionType", notification.getNotificationActionType());
values.put("update_time", notification.getUpdate_time());
db.update("notification", values, "id=?", new String[] { notification
.getId().toString() });
}
public XGNotification find(Integer id) {
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
Cursor cursor = db
.query("notification",
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
"id=?", new String[] { id.toString() }, null, null,
null, "1");
try {
if (cursor.moveToFirst()) {
return new XGNotification(cursor.getInt(cursor
.getColumnIndex("id")), cursor.getLong(cursor
.getColumnIndex("msg_id")), cursor.getString(cursor
.getColumnIndex("title")), cursor.getString(cursor
.getColumnIndex("content")), cursor.getString(cursor
.getColumnIndex("activity")), cursor.getInt(cursor
.getColumnIndex("notificationActionType")), cursor.getString(cursor
.getColumnIndex("update_time")));
}
return null;
} finally {
cursor.close();
}
}
public List<XGNotification> getScrollData(int currentPage, int lineSize,
String msg_id) {
String firstResult = String.valueOf((currentPage - 1) * lineSize);
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
Cursor cursor = null;
try {
if (msg_id == null || "".equals(msg_id)) {
cursor = db
.query("notification",
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
null, null, null, null, "update_time DESC",
firstResult + "," + lineSize);
} else {
cursor = db
.query("notification",
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
"msg_id like ?", new String[] { msg_id + "%" },
null, null, "update_time DESC", firstResult
+ "," + lineSize);
}
List<XGNotification> notifications = new ArrayList<XGNotification>();
while (cursor.moveToNext()) {
notifications.add(new XGNotification(cursor.getInt(cursor
.getColumnIndex("id")), cursor.getLong(cursor
.getColumnIndex("msg_id")), cursor.getString(cursor
.getColumnIndex("title")), cursor.getString(cursor
.getColumnIndex("content")), cursor.getString(cursor
.getColumnIndex("activity")), cursor.getInt(cursor
.getColumnIndex("notificationActionType")), cursor.getString(cursor
.getColumnIndex("update_time"))));
}
return notifications;
} finally {
cursor.close();
}
}
public int getCount() {
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
Cursor cursor = db.rawQuery("select count(*) from notification", null);
try {
cursor.moveToFirst();
return cursor.getInt(0);
} finally {
cursor.close();
}
}
}

View File

@@ -1,83 +0,0 @@
package com.aoleyun.sn.push.tpush.po;
public class XGNotification {
private Integer id;
private Long msg_id;
private String title;
private String content;
private String activity;
private int notificationActionType;
private String update_time;
public XGNotification() {
}
public XGNotification(Integer id, Long msg_id, String title,
String content, String activity, int notificationActionType, String update_time) {
super();
this.id = id;
this.msg_id = msg_id;
this.title = title;
this.content = content;
this.activity = activity;
this.notificationActionType = notificationActionType;
this.update_time = update_time;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Long getMsg_id() {
return msg_id;
}
public void setMsg_id(Long msg_id) {
this.msg_id = msg_id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getUpdate_time() {
return update_time;
}
public void setUpdate_time(String update_time) {
this.update_time = update_time;
}
public String getActivity() {
return activity;
}
public void setActivity(String activity) {
this.activity = activity;
}
public int getNotificationActionType() {
return notificationActionType;
}
public void setNotificationActionType(int notificationActionType) {
this.notificationActionType = notificationActionType;
}
}

View File

@@ -5,11 +5,9 @@ import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.aoleyun.sn.activity.checknet.CheckNetActivity;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.manager.ConnectManager;
import com.aoleyun.sn.rlog.LogDBManager;
import com.aoleyun.sn.service.main.MainService;
import com.aoleyun.sn.utils.BootManager;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SPUtils;

View File

@@ -2,14 +2,12 @@ package com.aoleyun.sn.receiver;
import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import com.aoleyun.sn.bean.BaseResponse;
import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.utils.ApkUtils;

View File

@@ -1,7 +1,6 @@
package com.aoleyun.sn.rlog;
import com.aoleyun.sn.utils.TimeUtils;
import com.aoleyun.sn.utils.Utils;
import java.io.Serializable;

View File

@@ -10,12 +10,8 @@ import android.util.Log;
import androidx.core.content.ContextCompat;
import com.aoleyun.sn.database.DBSqlBuilder;
import com.aoleyun.sn.utils.Utils;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

View File

@@ -823,6 +823,7 @@ public class GuardService extends Service {
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
} else {
switch (setting_usb) {
default:
case "usb_charge":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
break;
@@ -832,11 +833,12 @@ public class GuardService extends Service {
case "usb_midi":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MIDI;
break;
default:
break;
}
}
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
Intent usbIntent = new Intent(usbStatus);
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.TeclastP20sPlatform) {
usbIntent.setPackage("com.android.settings");
}
sendBroadcast(usbIntent);
}
@@ -862,7 +864,6 @@ public class GuardService extends Service {
JsonObject jsonObject = GsonUtils.getJsonObject(extendField);
String app_name = jsonObject.get("app_name").getAsString();
String app_package = jsonObject.get("app_package").getAsString();
String app_id = jsonObject.get("app_id").getAsString();
ToastUtil.show(app_name + "\t:下载完成");
if (filepath.endsWith(".xapk")) {
XAPKUtils.getInstance().installXAPK(filepath);
@@ -870,60 +871,6 @@ public class GuardService extends Service {
} else if (filepath.endsWith(".apk")) {
new Thread(() -> ApkUtils.installApp(GuardService.this, filepath)).start();
}
NetInterfaceManager.getInstance()
.getSendTimesApi()
.sendDownloadTimes(NetInterfaceManager.HTTP_KEY, Utils.getSerial(this), app_package, app_id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BaseResponse>() {
@Override
public void onSubscribe(Disposable d) {
Log.e("SEND_DOWNLOAD_TIMES", "onSubscribe: ");
}
@Override
public void onNext(BaseResponse baseResponse) {
Log.e("SEND_DOWNLOAD_TIMES", "onNext: " + baseResponse.msg);
}
@Override
public void onError(Throwable e) {
Log.e("SEND_DOWNLOAD_TIMES", "onError: " + e.getMessage());
}
@Override
public void onComplete() {
Log.e("SEND_DOWNLOAD_TIMES", "onComplete: ");
}
});
int userId = (int) SPUtils.get(GuardService.this, CommonConfig.ADMIN_ID, 0);
long appSize = task.getFileSize();
// NetInterfaceManager.getInstance()
// .getSendInfoApi()
// .sendDownloadTimes(NetInterfaceManager.HTTP_KEY, Utils.getSerial(), userId, app_package, appSize)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(new Observer<BaseResponse>() {
// @Override
// public void onSubscribe(Disposable d) {
// Log.e("SEND_DOWNLOAD_FILE_INFO", "onSubscribe: ");
// }
//
// @Override
// public void onNext(BaseResponse baseResponse) {
// Log.e("SEND_DOWNLOAD_FILE_INFO", "onNext: " + baseResponse.msg);
// }
//
// @Override
// public void onError(Throwable e) {
// Log.e("SEND_DOWNLOAD_FILE_INFO", "onError: " + e.getMessage());
// }
//
// @Override
// public void onComplete() {
// Log.e("SEND_DOWNLOAD_FILE_INFO", "onComplete: ");
// }
// });
} else if (filepath.endsWith(".zip")) {
Log.e("taskComplete", "下载完成:" + task.getPercent() + ":" + task.getExtendField());
JGYUtils.getInstance().setBootanimation(task.getFilePath());

View File

@@ -10,7 +10,6 @@ import android.text.TextUtils;
import android.util.Log;
import com.aoleyun.sn.bean.BaseResponse;
import com.aoleyun.sn.bean.SnRunLog;
import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.utils.Utils;

View File

@@ -6,6 +6,9 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import com.alibaba.sdk.android.push.CloudPushService;
import com.alibaba.sdk.android.push.CommonCallback;
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
import com.aoleyun.sn.bean.BaseResponse;
import com.aoleyun.sn.bean.StudentsInfo;
import com.aoleyun.sn.comm.CommonConfig;
@@ -22,7 +25,11 @@ import com.tencent.mmkv.MMKV;
import com.trello.rxlifecycle4.RxLifecycle;
import com.trello.rxlifecycle4.android.ActivityEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.Observer;
@@ -103,12 +110,35 @@ public class MainSPresenter implements MainSContact.Presenter {
@Override
public void setPushTag(String tag) {
mView.setTagsFinish(TextUtils.isEmpty(tag));
}
});
String tagSets = mMMKV.decodeString(CommonConfig.DEVICES_TAG);
Log.e("setPushTags", "onComplete: tagSets =" + tagSets);
String tags = cacheHelper.getAsString(UrlAddress.GET_DEVICES_TAGS);
Log.e("setPushTags", "onComplete: tags = " + tags);
String tagstring = cacheHelper.getAsString(UrlAddress.GET_DEVICES_TAGS);
Log.e("setPushTags", "onComplete: tags = " + tagstring);
Set<String> tags = new HashSet<>();
if (!TextUtils.isEmpty(tagSets)) {
tags.add(tagSets);
}
NetInterfaceManager.getInstance().clearAndAppendTags(tags);
}
private void setpushTag(Set<String> tagSets) {
String[] tag = new ArrayList<>(tagSets).toArray(new String[tagSets.size()]);
CloudPushService pushService = PushServiceFactory.getCloudPushService();
pushService.bindTag(CloudPushService.DEVICE_TARGET, tag, null, new CommonCallback() {
@Override
public void onSuccess(String s) {
Log.e("bindTag", "bind tag " + Arrays.toString(tag) + " success\n");
}
@Override
public void onFailed(String errorCode, String errorMsg) {
Log.e("bindTag", "bind tag " + Arrays.toString(tag) + " failed." +
"errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
}
});
}
/*
@@ -388,7 +418,7 @@ public class MainSPresenter implements MainSContact.Presenter {
@Override
public void getDesktopIcon() {
NetInterfaceManager.getInstance()
.getDesktopIcon(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
.getDesktopIcon( getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
Log.e("getDesktopIcon", "onComplete: ");

View File

@@ -5,9 +5,6 @@ import android.app.AlarmManager;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.app.StatusBarManager;
import android.app.role.OnRoleHoldersChangedListener;
import android.app.role.RoleManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -24,7 +21,6 @@ import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.DisplayMetrics;
@@ -38,6 +34,9 @@ import android.widget.TextView;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.alibaba.sdk.android.push.CloudPushService;
import com.alibaba.sdk.android.push.CommonCallback;
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.R;
import com.aoleyun.sn.activity.main.MainActivity;
@@ -62,9 +61,6 @@ import com.blankj.utilcode.util.NetworkUtils;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushConfig;
import com.tencent.android.tpush.XGPushManager;
import com.tencent.mmkv.MMKV;
import com.trello.rxlifecycle4.LifecycleProvider;
import com.trello.rxlifecycle4.LifecycleTransformer;
@@ -74,13 +70,10 @@ import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import io.reactivex.rxjava3.core.Observable;
@@ -136,66 +129,55 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
Handler.getMain().postDelayed(new Runnable() {
@Override
public void run() {
tPushInit();
// aliyunPushInit();
}
}, 10000);
Log.e(TAG, "getTimeFromNtpServer: " + aLong);
}
}
private void tPushInit() {
XGPushConfig.enableDebug(this, true);
XGPushManager.registerPush(this, new XGIOperateCallback() {
private void aliyunPushInit() {
PushServiceFactory.init(this);
final CloudPushService pushService = PushServiceFactory.getCloudPushService();
pushService.setLogLevel(CloudPushService.LOG_DEBUG);
pushService.register(this, new CommonCallback() {
@Override
public void onSuccess(Object data, int flag) {
//token在设备卸载重装的时候有可能会变
Log.e("TPush", "注册成功设备token为" + data);
List<XGPushManager.AccountInfo> accountInfoList = new ArrayList<>();
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getSerial(MainService.this)));
XGPushManager.upsertAccounts(MainService.this, accountInfoList, new XGIOperateCallback() {
public void onSuccess(String response) {
Log.e("AliyunPush", "init cloudchannel success");
Log.e("AliyunPush", "init cloudchannel success " + pushService.getDeviceId());
String sn = Utils.getSerial(MainService.this);
if (TextUtils.isEmpty(sn)) {
return;
}
pushService.bindAccount(sn, new CommonCallback() {
@Override
public void onSuccess(Object data, int flag) {
Log.e("TPush", "onSuccess, data:" + data + ", flag:" + flag);
public void onSuccess(String s) {
Log.e("AliyunPush", "bind account " + sn + " success\n");
}
@Override
public void onFail(Object data, int errCode, String msg) {
Log.e("TPush", "onFail, data:" + data + ", code:" + errCode + ", msg:" + msg);
public void onFailed(String errorCode, String errorMsg) {
Log.e("AliyunPush", "bind account " + sn + " failed." +
"errorCode: " + errorCode + ", errorMsg:" + errorMsg);
}
});
NetInterfaceManager.getInstance().setPushTags(false, lifecycleSubject, new NetInterfaceManager.PushTagCallback() {
pushService.addAlias(sn, new CommonCallback() {
@Override
public void setPushTag(String tag) {
Set<String> tagSets = new HashSet<>();
if (!TextUtils.isEmpty(tag)) {
tagSets.add(tag);
public void onSuccess(String s) {
Log.e("AliyunPush", "add alias " + sn + " success\n");
}
JGYUtils.getInstance().getAppPlatform(new JGYUtils.GetAppPlatformCallback() {
@Override
public void AppPlatform(int platform) {
if (platform == JGYUtils.MTKPlatform) {
tagSets.add(JGYUtils.MTKTag);
} else if (platform == JGYUtils.ZhanruiPlatform) {
tagSets.add(JGYUtils.ZhanruiTag);
} else if (platform == JGYUtils.CubePlatform) {
tagSets.add(JGYUtils.CubeTag);
} else if (platform == JGYUtils.MTK11Platform) {
tagSets.add(JGYUtils.MTK11Tag);
} else if (platform == JGYUtils.TeclastP20sPlatform) {
tagSets.add(JGYUtils.TeclastP20sTag);
}
}
});
Log.e(TAG, "setPushTag: " + tagSets);
NetInterfaceManager.getInstance().clearAndAppendTags(tagSets);
public void onFailed(String errorCode, String errorMsg) {
Log.e("AliyunPush", "add alias " + sn + " failed." +
"errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
}
});
}
@Override
public void onFail(Object data, int errCode, String msg) {
Log.e("TPush", "注册失败,错误码:" + errCode + ",错误信息:" + msg);
public void onFailed(String errorCode, String errorMessage) {
Log.e("AliyunPush", "init cloudchannel failed -- errorcode:" + errorCode + " -- errorMessage:" + errorMessage);
}
});
}
@@ -371,6 +353,27 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
TimeTask task = new TimeTask();
task.execute("ntp.aliyun.com");
mPresenter.getLockedState();
PackageManager pm = getPackageManager();
try {
Log.e(TAG, "initView: " + pm.getApplicationEnabledSetting("com.teclast.update"));
pm.setApplicationEnabledSetting("com.teclast.update", PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
Log.e(TAG, "onCreate: enable com.teclast.update");
} catch (Exception e) {
Log.e(TAG, "onCreate: setApplicationEnabledSetting = " + e.getMessage());
}
if ("V1.01_20230519".equalsIgnoreCase(Build.DISPLAY)) {
Log.e(TAG, "onCreate: enable");
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClassName("com.teclast.update", "com.teclast.update.GoogleOtaClient");
try {
startActivity(intent);
} catch (Exception e) {
Log.e(TAG, "onCreate: startActivity = " + e.getMessage());
}
}
// RoleManager mRm = getSystemService(RoleManager.class);
// mRm.addOnRoleHoldersChangedListenerAsUser(new Executor() {
// @Override
@@ -436,6 +439,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
JGYUtils.getInstance().writeAppPackageList();
// notificationManager = NotificationManagerCompat.from(this);
// createNotificationChannel();
// aliyunPushInit();
}
@Override
@@ -956,8 +960,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
mPresenter.getFirstConnect();
mPresenter.getStudesInfo();
mPresenter.getDeveloper();
mPresenter.sendMacAddress();
}
mPresenter.sendMacAddress();
}
/**
@@ -972,6 +976,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
Log.e(TAG, "setDisableSetting: ");
//设置系统管控
SysSettingUtils.setDisableSetting(this);
JGYUtils.getInstance().writeAppPackageList();
}
mPresenter.getSystemSettingBegin();
}

View File

@@ -731,17 +731,28 @@ public class ApkUtils {
this.add("com.android.email");//电子邮件
this.add("com.android.calendar");//日历
this.add("com.tencent.wework");
this.add("com.tencent.mm");
this.add("cn.wps.moffice_eng");
this.add("com.baidu.BaiduMap");
}};
//桌面app
public static List<String> desktopAPP = new ArrayList<String>() {{
// this.add("com.aoleyunos.dop1");
// this.add("com.aoleyunos.dop2");
this.add("com.uiuios.jgy1");
this.add("com.uiuios.jgy2");
this.add("com.android.uiuios");
this.add("com.shoufei.aole");
this.add("com.aoleyunos.dop1");
this.add("com.aoleyunos.dop2");
this.add("com.aoleyunos.dop3");
this.add("com.aoleyunos.dop4");
this.add("com.aoleyunos.dop5");
this.add("com.aoleyunos.dop6");
this.add("com.aoleyunos.dop7");
this.add("com.aoleyunos.dop8");
this.add("com.aoleyunos.dop9");
this.add("com.aoleyunos.dop10");
// this.add("com.uiuios.jgy1");
// this.add("com.uiuios.jgy2");
// this.add("com.android.uiuios");
// this.add("com.shoufei.aole");
}};
public static List<String> aoleyunAPP = new ArrayList<String>() {{
@@ -939,7 +950,7 @@ public class ApkUtils {
this.add("com.wyt.tongbuyouxue");
this.add("com.qi.wyt.setting");
this.add("air.wyt.modloader");
this.add("com.google.android.inputmethod.pinyin");
// this.add("com.google.android.inputmethod.pinyin");
this.add("com.android.calculator2");
this.add("com.qi.TFSystem");
this.add("com.qi.appstore");
@@ -979,14 +990,73 @@ public class ApkUtils {
this.add("com.shoufei.aole");
this.add("com.ygyb.yischool");
this.add("com.tencent.wework");
this.add("com.tencent.mm");
this.add("cn.wps.moffice_eng");
this.add("com.baidu.BaiduMap");
}};
public static Set<String> jxwApp = 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.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 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)) {
@@ -1197,6 +1267,13 @@ public class ApkUtils {
this.add("com.aoleyunos.dop1");
this.add("com.aoleyunos.dop2");
this.add("com.aoleyunos.dop3");
this.add("com.aoleyunos.dop4");
this.add("com.aoleyunos.dop5");
this.add("com.aoleyunos.dop6");
this.add("com.aoleyunos.dop7");
this.add("com.aoleyunos.dop8");
this.add("com.aoleyunos.dop9");
this.add("com.aoleyunos.dop10");
this.add("com.jiepier.filemanager");
this.add("com.calendar.uiui");
this.add("com.notepad.uiui");
@@ -1205,6 +1282,7 @@ public class ApkUtils {
this.add("com.uiui.speed");
}};
public static String getRunningAppInfo(Context context) {
// ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
// List<ActivityManager.RunningServiceInfo> infoList = activityManager.getRunningServices(Integer.MAX_VALUE);
@@ -1215,8 +1293,8 @@ public class ApkUtils {
Log.e(TAG, "getRunningAppInfo: " + topPkg);
for (PackageInfo packageInfo : packages) {
String packageName = packageInfo.packageName;
//排除桌面app和出厂自带app
if (desktopAPP.contains(packageName) || factoryapp.contains(packageName)) {
//排除出厂自带app
if (factoryapp.contains(packageName)) {
continue;
}
//排除所有系统应用,不显示
@@ -1302,11 +1380,9 @@ public class ApkUtils {
}
public static long getPackageSize(Context context, String filePath) {
long size = new File(filePath).length();
return size;
}
}

View File

@@ -2,11 +2,6 @@ package com.aoleyun.sn.utils;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import com.google.gson.Gson;
import com.google.gson.JsonParser;
import java.io.Serializable;
public class FlowInfo implements Serializable {

View File

@@ -10,8 +10,6 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import com.tencent.mmkv.MMKV;
import java.util.List;
public class ForegroundAppUtil {

View File

@@ -93,6 +93,7 @@ import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
import java.util.function.Predicate;
@@ -116,6 +117,8 @@ public class JGYUtils {
public static final int ZhanruiPlatform = 3;
public static final int MTK11Platform = 5;
public static final int TeclastP20sPlatform = 6;
public static final int AH6016Platform = 9;
public static final int ZR6016Platform = 10;
public static final String Other = "其他";
public static final String MTKTag = "MTK";
@@ -123,6 +126,9 @@ public class JGYUtils {
public static final String ZhanruiTag = "展锐";
public static final String MTK11Tag = "MTK11";
public static final String TeclastP20sTag = "P20S";
public static final String AH6016Tag = "AH6016";
public static final String ZR6016Tag = "ZR6016";
private CacheHelper cacheHelper;
@@ -186,6 +192,12 @@ public class JGYUtils {
} else if (TeclastP20sTag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "P20S");
return TeclastP20sPlatform;
} else if (AH6016Tag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "AH6016");
return AH6016Platform;
} else if (ZR6016Tag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "ZR6016");
return ZR6016Platform;
} else {
Log.i(TAG, "checkAppPlatform: " + "没有数据");
return UnknowPlatform;
@@ -217,6 +229,10 @@ public class JGYUtils {
getAppPlatformCallback.AppPlatform(MTK11Platform);
} else if (TeclastP20sTag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(TeclastP20sPlatform);
} else if (AH6016Tag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(AH6016Platform);
} else if (ZR6016Tag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(ZR6016Platform);
} else {
getAppPlatformCallback.AppPlatform(UnknowPlatform);
}
@@ -228,12 +244,16 @@ public class JGYUtils {
return MTKTag;
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
return ZhanruiTag;
} else if ("ZhanRuiCube".equalsIgnoreCase(platform)) {
} else if (CubeTag.equalsIgnoreCase(platform)) {
return CubeTag;
} else if ("MTK11".equalsIgnoreCase(platform)) {
} else if (MTK11Tag.equalsIgnoreCase(platform)) {
return MTK11Tag;
} else if ("P20S".equalsIgnoreCase(platform)) {
} else if (TeclastP20sTag.equalsIgnoreCase(platform)) {
return TeclastP20sTag;
} else if (AH6016Tag.equalsIgnoreCase(platform)) {
return AH6016Tag;
} else if (ZR6016Tag.equalsIgnoreCase(platform)) {
return ZR6016Tag;
} else {
return Other;
}
@@ -1102,6 +1122,7 @@ public class JGYUtils {
this.add("com.aoleyun.os");
this.add("com.aoleyunos.dop1");
this.add("com.aoleyunos.dop2");
this.add("com.aoleyunos.dop3");
this.add("com.aoleyun.info");
this.add("com.calculator.uiui");
this.add("com.notepad.uiui");
@@ -1119,6 +1140,8 @@ public class JGYUtils {
pkgSet.addAll(ApkUtils.desktopAPP);
pkgSet.addAll(ApkUtils.aoleyunAPP);
pkgSet.addAll(ApkUtils.aihuaApp);
pkgSet.addAll(ApkUtils.jxwApp);
pkgSet.removeIf(TextUtils::isEmpty);
String aole_app_forbid = String.join(",", pkgSet);
Log.e(TAG, "writeAppPackageList: " + aole_app_forbid);
@@ -1127,7 +1150,12 @@ public class JGYUtils {
}
public void writeAppPackageList() {
String aole_app_forbid = String.join(",", defaultPackages);
HashSet<String> pkgSet = new HashSet<>(defaultPackages);
pkgSet.addAll(ApkUtils.desktopAPP);
pkgSet.addAll(ApkUtils.aoleyunAPP);
pkgSet.addAll(ApkUtils.aihuaApp);
pkgSet.addAll(ApkUtils.jxwApp);
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);
}
@@ -1295,10 +1323,10 @@ public class JGYUtils {
String app_url = jsonObject.get("app_url").getAsString();
String app_package = jsonObject.get("app_package").getAsString();
int app_version_code = jsonObject.get("app_version_code").getAsInt();
if (ApkUtils.desktopAPP.get(0).equals(app_package)) {
ApkUtils.UninstallAPP(mContext, ApkUtils.desktopAPP.get(1));
} else {
ApkUtils.UninstallAPP(mContext, ApkUtils.desktopAPP.get(0));
Set<String> desktop = new HashSet<>(ApkUtils.desktopAPP);
desktop.remove(app_package);
for (String s : desktop) {
ApkUtils.UninstallAPP(mContext, s);
}
PackageInfo info = null;
PackageManager packageManager = mContext.getPackageManager();
@@ -1310,6 +1338,7 @@ public class JGYUtils {
Log.e("fht", "installDesktop: " + e.getMessage());
}
if (null != info) {
packageManager.setApplicationEnabledSetting(app_package, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
long versionCode;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
versionCode = info.getLongVersionCode();
@@ -1385,6 +1414,9 @@ public class JGYUtils {
if (ApkUtils.aihuaApp.contains(packageName)) {
continue;
}
if (ApkUtils.jxwApp.contains(packageName)) {
continue;
}
if (PackageNames.DEVICE_INFO.equals(packageName) || PackageNames.APPSTORE.equals(packageName)
) {
continue;
@@ -1426,11 +1458,20 @@ public class JGYUtils {
this.add("com.aoleyun.os");
this.add("com.aoleyunos.dop1");
this.add("com.aoleyunos.dop2");
this.add("com.aoleyunos.dop3");
//aihua
this.add("com.android.mms");
this.add("com.android.fmradio");
this.add("com.mediatek.filemanager");
this.add("com.teclast.update");
this.add("com.google.android.apps.nbu.files");
this.add("com.tencent.wework");
this.add("com.tencent.mm");
this.add("cn.wps.moffice_eng");
this.add("com.baidu.BaiduMap");
}};
/**
@@ -1612,6 +1653,8 @@ public class JGYUtils {
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.CubePlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZR6016Platform
) {
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);
@@ -2149,7 +2192,7 @@ public class JGYUtils {
public void setDefaultDesktop(String pkg, String className) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// setRoleHolderAsUser(mContext, pkg);
setRoleHolderAsUser(mContext, pkg);
Log.e(TAG, "setDefaultDesktop: setRoleHolderAsUser");
} else {
//爱华设置,暂时屏蔽

View File

@@ -7,13 +7,10 @@ import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.os.Build;
import android.telephony.CellInfo;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import java.util.List;
/**
* @author fanhuitong
*/

View File

@@ -17,6 +17,7 @@ import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.gson.GsonUtils;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.util.ArrayList;
import java.util.List;
@@ -51,8 +52,9 @@ public class SysSettingUtils {
setIcon(context, jsonObject);
setCanReset(context, jsonObject);
setAutoTime(context, jsonObject);
JsonObject navJson = jsonObject.get("setting_nav").getAsJsonObject();
SPUtils.put(context, JGYActions.ACTION_STATUSBAR_STATUS, jsonObject.get("setting_nav").toString());
String navJsonString = jsonObject.get("setting_nav").getAsString();
JsonObject navJson = JsonParser.parseString(navJsonString).getAsJsonObject();
SPUtils.put(context, JGYActions.ACTION_STATUSBAR_STATUS, navJsonString);
setStatusBar(context, navJson);
setBrowserInput(context, jsonObject);
// TODO: 2022/4/11 不是酷比定制的会报错,无法抛出异常
@@ -101,6 +103,7 @@ public class SysSettingUtils {
setAutoTime(context, 0);
setBrowserInput(context, 0);
JGYUtils.getInstance().setDeveloperOptions(0);
setStatusBar(context, 0);
}
private static void setPhoneList(Context context, int state) {
@@ -166,7 +169,15 @@ public class SysSettingUtils {
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;
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform) {
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
}
Intent usbIntent = new Intent(usbStatus);
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.TeclastP20sPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform
) {
usbIntent.setPackage("com.android.settings");
}
context.sendBroadcast(usbIntent);
} catch (NoClassDefFoundError | Exception e) {
Log.e(TAG, "setUSBstate: " + e.getMessage());
@@ -195,8 +206,9 @@ public class SysSettingUtils {
} else {
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", setting_usb);
Log.e("setUSBstate", "aole_usb_choose: " + aole_usb_choose);
String usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
String usbStatus;
switch (setting_usb) {
default:
case "usb_charge":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
break;
@@ -206,9 +218,13 @@ public class SysSettingUtils {
case "usb_midi":
usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MIDI;
break;
default:
}
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
Intent usbIntent = new Intent(usbStatus);
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.TeclastP20sPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform
) {
usbIntent.setPackage("com.android.settings");
}
context.sendBroadcast(usbIntent);
}
}

View File

@@ -50,9 +50,7 @@ import androidx.annotation.VisibleForTesting;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.R;
import com.aoleyun.sn.base.BaseApplication;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.network.NetInterfaceManager;
import com.arialyy.aria.core.Aria;
import com.blankj.utilcode.util.FileUtils;
import com.google.gson.JsonObject;
@@ -62,8 +60,6 @@ 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.squareup.moshi.Json;
import com.tencent.mmkv.MMKV;
import java.io.BufferedReader;
import java.io.DataOutputStream;
@@ -75,7 +71,6 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.Reader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.Inet4Address;
import java.net.InetAddress;
@@ -1189,14 +1184,21 @@ public class Utils {
* @param jsonObject
*/
public static void ariaDownload(Context context, String url, JsonObject jsonObject) {
Log.e(TAG, "ariaDownload: " + jsonObject);
String fileName = getFileNamefromURL(url);
String urlMD5 = jsonObject.get("MD5").getAsString();
String urlMD5 = "";
if (jsonObject.get("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();
}
Log.e("ariaDownload", "urlMD5=" + urlMD5);
String p = JGYUtils.getInstance().getDownLoadPath();
File file = new File(JGYUtils.getInstance().getDownLoadPath() + fileName);
if (file.exists() && !file.isDirectory()) {
String filenameMD5 = getMD5fromFileName(url);
String fileMD5 = FileUtils.getFileMD5ToString(file);
Log.e("ariaDownload", "filenameMD5=" + filenameMD5);
Log.e("ariaDownload", "fileMD5=" + fileMD5);
@@ -1210,7 +1212,6 @@ public class Utils {
.ignoreFilePathOccupy()
.setExtendField(jsonObject.toString())
.create(); //启动下载}
// }
}
} else {
Aria.download(context)
@@ -1755,6 +1756,8 @@ public class Utils {
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTKPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTK11Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.TeclastP20sPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZR6016Platform
) {
return Utils.getProperty("ro.build.display.id", "获取失败");
} else {

View File

@@ -1,14 +0,0 @@
{
"tpns": {
"access_id": "1500026372",
"access_key": "AR7A1L5M0LPH"
},
"com.aoleyun.sn": {
"channel": {
"enable": true
}
},
"debug": false,
"version": "1.2.7.1-release",
"upgrade": true
}

View File

@@ -11,7 +11,6 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
classpath "com.tencent.android.tpns:tpnsplugin:1.8.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files