1.4.1126
bugfixes:增加设置壁纸
This commit is contained in:
@@ -29,8 +29,8 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.aoleyun.sn"
|
||||
versionCode 161
|
||||
versionName "1.4.1014"
|
||||
versionCode 168
|
||||
versionName "1.4.1126"
|
||||
|
||||
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
|
||||
minSdkVersion 24
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.SHUTDOWN" />
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
|
||||
|
||||
<uses-permission
|
||||
android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"
|
||||
android:maxSdkVersion="22" />
|
||||
@@ -164,11 +166,11 @@
|
||||
android:label="一键加速"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@style/activity_styles">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.MAIN" />-->
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
||||
<!-- </intent-filter>-->
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.databinding.ActivityMainBinding;
|
||||
import com.aoleyun.sn.gson.GsonUtils;
|
||||
import com.aoleyun.sn.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.network.UrlAddress;
|
||||
import com.aoleyun.sn.utils.AES.CXAESUtil;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
@@ -306,6 +307,12 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
|
||||
int is_control_show = jsonElement.getAsInt();
|
||||
mShowPanel.setValue(is_control_show == 1);
|
||||
}
|
||||
String data = GsonUtils.toJSONString(baseResponse.data);
|
||||
Log.e("setSystemSetting", "onNext: " + data);
|
||||
// cacheHelper.put(UrlAddress.GET_FIRMWARE, data);
|
||||
//结果保存到本地
|
||||
JGYUtils.getInstance().SettingSysData(data);
|
||||
|
||||
} else {
|
||||
if (JGYUtils.G11TAG.equals(JGYUtils.getInstance().getAppPlatform())
|
||||
|| "HT01".equals(Build.MODEL)) {
|
||||
@@ -314,6 +321,9 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
|
||||
||"Ebox201W".equals(Build.MODEL)) {
|
||||
mShowPanel.setValue(false);
|
||||
}
|
||||
|
||||
JGYUtils.getInstance().SettingSysData("");
|
||||
// cacheHelper.put(UrlAddress.GET_FIRMWARE, "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.base.rx.BaseRxActivity;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
public abstract class BaseDataBindingActivity extends BaseRxActivity {
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.base.rx.BaseRxActivity;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
public abstract class BaseTransparentActivity extends BaseRxActivity {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.aoleyun.sn.base;
|
||||
package com.aoleyun.sn.base.rx;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
17
app/src/main/java/com/aoleyun/sn/bean/Wallpaper.java
Normal file
17
app/src/main/java/com/aoleyun/sn/bean/Wallpaper.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.aoleyun.sn.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Wallpaper implements Serializable {
|
||||
private static final long serialVersionUID = -395207605166607229L;
|
||||
|
||||
String file_url;
|
||||
|
||||
public String getFile_url() {
|
||||
return file_url;
|
||||
}
|
||||
|
||||
public void setFile_url(String file_url) {
|
||||
this.file_url = file_url;
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,9 @@ public class CommonConfig {
|
||||
/*存放后台上传的app包名 set*/
|
||||
public static final String ALL_APP_PKG_SET = "all_app_pkg_set_key";
|
||||
|
||||
/*壁纸地址*/
|
||||
public static final String WALLPAPER_URL_KEY = "wallpaper_url";
|
||||
|
||||
/**
|
||||
* 管控系统指令
|
||||
*/
|
||||
@@ -113,7 +116,9 @@ public class CommonConfig {
|
||||
public final static String AOLE_ACTION_APP_POWER_ON = "aole_app_power_on";
|
||||
/*禁止联网应用*/
|
||||
public final static String AOLE_ACTION_NETWORK_DISALLOW = "aole_network_disallow";
|
||||
// TODO: 2024/10/23 华瑞安设备上不管有没有写入settins的包名,WiFi都会显示无网络
|
||||
/*允许联网应用 G10P*/
|
||||
@Deprecated
|
||||
public final static String AOLE_ACTION_NETWORK_ALLOW = "aole_network_allow";
|
||||
/*全局黑名单 G10P*/
|
||||
public static final String AOLE_APP_WEB_BLACK_LIST = "app_web_black_list";
|
||||
@@ -134,6 +139,8 @@ public class CommonConfig {
|
||||
public final static String AOLE_ACTION_HIDE_STATUS_BAR = "aole_hide_statusBar";
|
||||
/*热点*/
|
||||
public final static String AOLE_ACTION_HOTSPOT_FORBID_ON = "aole_hotspot_forbid_on";
|
||||
/*相机*/
|
||||
public final static String AOLE_ACTION_DISALLOW_CAMERA = "aole_disallow_camera";
|
||||
|
||||
/*蓝牙总开关*/
|
||||
public final static String AOLE_ACTION_BHT_FORBID_ON = "aole_bht_forbid_on";
|
||||
@@ -152,7 +159,7 @@ public class CommonConfig {
|
||||
/*计算机*/
|
||||
public final static String AOLE_BT_COMPUTER_KEY = "aole_bt_computer_on";
|
||||
/*鼠标键盘*/
|
||||
public final static String AOLE_BT_KEYBOARD_KEY = "aole_bt_keyboard_on" ;
|
||||
public final static String AOLE_BT_KEYBOARD_KEY = "aole_bt_keyboard_on";
|
||||
|
||||
/*电话白名单开关*/
|
||||
public final static String AOLE_ACTION_WHITE_LIST_ON = "aole_white_list_on";
|
||||
|
||||
@@ -55,6 +55,7 @@ import com.aoleyun.sn.bean.SnSetting;
|
||||
import com.aoleyun.sn.bean.SnTimeControl;
|
||||
import com.aoleyun.sn.bean.StudentsInfo;
|
||||
import com.aoleyun.sn.bean.TopApp;
|
||||
import com.aoleyun.sn.bean.Wallpaper;
|
||||
import com.aoleyun.sn.bean.WhitelistBean;
|
||||
import com.aoleyun.sn.bean.WhoisBean;
|
||||
import com.aoleyun.sn.bean.WiFiAlias;
|
||||
@@ -87,6 +88,7 @@ import com.aoleyun.sn.network.api.get.SnAppAttrApi;
|
||||
import com.aoleyun.sn.network.api.get.SnSettingApi;
|
||||
import com.aoleyun.sn.network.api.get.SnTimeControlApi;
|
||||
import com.aoleyun.sn.network.api.get.TopAppControlApi;
|
||||
import com.aoleyun.sn.network.api.get.WallpaperApi;
|
||||
import com.aoleyun.sn.network.api.get.WhiteListApi;
|
||||
import com.aoleyun.sn.network.api.post.AppLimitApi;
|
||||
import com.aoleyun.sn.network.api.post.AppinsideWebApi;
|
||||
@@ -114,7 +116,6 @@ import com.aoleyun.sn.network.api.post.NewAppinsideWebApi;
|
||||
import com.aoleyun.sn.network.api.post.SendDownloadInfoApi;
|
||||
import com.aoleyun.sn.network.api.post.SendDownloadTimesApi;
|
||||
import com.aoleyun.sn.network.api.post.SendRestoreTimesApi;
|
||||
import com.aoleyun.sn.network.api.post.SendScreenshotApi;
|
||||
import com.aoleyun.sn.network.api.post.SendScreenshotCall;
|
||||
import com.aoleyun.sn.network.api.post.SnConfirmBindApi;
|
||||
import com.aoleyun.sn.network.api.post.StudentsInfoApi;
|
||||
@@ -131,6 +132,7 @@ import com.aoleyun.sn.statistics.StatisticsInfo;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.BitmapUtils;
|
||||
import com.aoleyun.sn.utils.CacheUtils;
|
||||
import com.aoleyun.sn.utils.CmdUtil;
|
||||
import com.aoleyun.sn.utils.ForegroundAppUtil;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.utils.MD5Util;
|
||||
@@ -168,7 +170,6 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
@@ -177,7 +178,6 @@ import io.reactivex.rxjava3.core.Observable;
|
||||
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.functions.Function7;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
@@ -761,6 +761,14 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
||||
public Observable<BaseResponse<Wallpaper>> getWallpaperObservable() {
|
||||
return mRetrofit.create(WallpaperApi.class)
|
||||
.getWallpaper(Utils.getSerial(mContext))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* API
|
||||
@@ -823,10 +831,6 @@ public class NetInterfaceManager {
|
||||
return mRetrofit.create(SendDownloadInfoApi.class);
|
||||
}
|
||||
|
||||
public SendScreenshotApi getScreenshotApi() {
|
||||
return mRetrofit.create(SendScreenshotApi.class);
|
||||
}
|
||||
|
||||
public SendScreenshotCall getScreenshotCall() {
|
||||
return mRetrofit.create(SendScreenshotCall.class);
|
||||
}
|
||||
@@ -1496,31 +1500,6 @@ public class NetInterfaceManager {
|
||||
});
|
||||
}
|
||||
|
||||
public void getDeveloper(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||
ConnectMode connectMode = ConnectMode.ONE_HOUR;
|
||||
if (refresh) {
|
||||
connectMode = ConnectMode.ONE_MINUTE;
|
||||
}
|
||||
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_DEVELOPER, connectMode)) {
|
||||
Log.e(TAG, "getDeveloper: cache2");
|
||||
getDeveloper(lifecycle, callback);
|
||||
} else {
|
||||
String jsonString = cacheHelper.getAsString(UrlAddress.GET_DEVELOPER);
|
||||
//为 "" 是已经请求成功的
|
||||
if (jsonString == null) {
|
||||
Log.e(TAG, "getDeveloper: cache2");
|
||||
getDeveloper(lifecycle, callback);
|
||||
} else {
|
||||
// Gson gson = new Gson();
|
||||
// Type type = new TypeToken<DeveloperBean>() {
|
||||
// }.getType();
|
||||
// DeveloperBean developerBean = gson.fromJson(jsonString, type);
|
||||
// JGYUtils.getInstance().setDeveloperOptions(developerBean.getIs_developer());
|
||||
// callback.onComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void getDeveloper(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||
getDeveloperControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
@@ -2644,7 +2623,7 @@ public class NetInterfaceManager {
|
||||
tagSets.add(JGYUtils.MT8768Tag);
|
||||
} else if (platform == JGYUtils.AUDG104Platform) {
|
||||
tagSets.add(JGYUtils.AUDG104Tag);
|
||||
}else if (platform == JGYUtils.HL500Platform) {
|
||||
} else if (platform == JGYUtils.HL500Platform) {
|
||||
tagSets.add(JGYUtils.HL500Tag);
|
||||
}
|
||||
});
|
||||
@@ -2702,14 +2681,15 @@ public class NetInterfaceManager {
|
||||
}
|
||||
|
||||
private Observable<BaseResponse> getUpdateDeviceInfoObservable() {
|
||||
String add = Utils.getAddressJsonString(mContext);
|
||||
cacheHelper.put(UrlAddress.UPDATE_DEVICEINFO, add);
|
||||
String addressJsonString = Utils.getAddressJsonString(mContext);
|
||||
cacheHelper.put(UrlAddress.UPDATE_DEVICEINFO, addressJsonString);
|
||||
return getUpdateDeviceInfo().updateDeviceInfo(
|
||||
Utils.getSerial(mContext),
|
||||
NetInterfaceManager.HTTP_KEY,
|
||||
Utils.getMachine(mContext),
|
||||
Utils.getHardware(mContext),
|
||||
add
|
||||
addressJsonString,
|
||||
Utils.getOtherInfo()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4396,20 +4376,38 @@ public class NetInterfaceManager {
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<BlacklistBean> blacklistBeanBaseResponse) {
|
||||
Log.e("getBlackList", "onNext: " + blacklistBeanBaseResponse);
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL)) {
|
||||
|
||||
} else {
|
||||
try {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_web_black_list");
|
||||
Log.e(TAG, "getBlackList: " + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (blacklistBeanBaseResponse.code == 200) {
|
||||
BlacklistBean blacklistBean = blacklistBeanBaseResponse.data;
|
||||
if (blacklistBean == null) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, "");
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL))
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
} else {
|
||||
List<String> strings = blacklistBean.getBlacklist();
|
||||
if (strings == null || strings.isEmpty()) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, "");
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL))
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, String.join(",", strings));
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL)) {
|
||||
// TODO: 2024/10/31 需要多写一次保证数据库变化
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, String.join(",", strings));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, "");
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL))
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4454,20 +4452,40 @@ public class NetInterfaceManager {
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<WhitelistBean> blacklistBeanBaseResponse) {
|
||||
Log.e("getWhiteList", "onNext: " + blacklistBeanBaseResponse);
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL)) {
|
||||
|
||||
} else {
|
||||
try {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_web_white_list");
|
||||
Log.e(TAG, "getWhiteList: " + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (blacklistBeanBaseResponse.code == 200) {
|
||||
WhitelistBean whitelistBean = blacklistBeanBaseResponse.data;
|
||||
if (whitelistBean == null) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, "");
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL))
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
} else {
|
||||
List<String> strings = whitelistBean.getWhitelist();
|
||||
if (strings == null || strings.isEmpty()) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, "");
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL))
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, String.join(",", strings));
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL)) {
|
||||
// TODO: 2024/10/31 需要多写一次保证数据库变化
|
||||
strings.add("ttstd.com");
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, String.join(",", strings));
|
||||
strings.remove("ttstd.com");
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, String.join(",", strings));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, "");
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL))
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4487,4 +4505,50 @@ public class NetInterfaceManager {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void getWallpaper() {
|
||||
getWallpaperObservable()
|
||||
.subscribe(getWallpaperObserver(null));
|
||||
}
|
||||
|
||||
public void getWallpaper(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||
getWallpaperObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(getWallpaperObserver(callback));
|
||||
}
|
||||
|
||||
public Observer<BaseResponse<Wallpaper>> getWallpaperObserver(onCompleteCallback callback) {
|
||||
return new Observer<BaseResponse<Wallpaper>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getWallpaper", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<Wallpaper> baseResponse) {
|
||||
Log.e("getWallpaper", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
Wallpaper wallpaper = baseResponse.data;
|
||||
String url = wallpaper.getFile_url();
|
||||
JGYUtils.getInstance().setWallpaper(url);
|
||||
} else {
|
||||
mMMKV.encode(CommonConfig.WALLPAPER_URL_KEY, "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getWallpaper", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getWallpaper", "onComplete: ");
|
||||
if (callback != null) {
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class UrlAddress {
|
||||
public static final String APP_SETTING = "android/sn-control/app-setting";
|
||||
/*获取设备批次全局黑名单*/
|
||||
public static final String BLACK_LIST = "android/common/blacklist";
|
||||
/*获取设备批次全局黑名单*/
|
||||
/*获取设备批次全局白名单*/
|
||||
public static final String WHITE_LIST = "android/common/whitelist";
|
||||
|
||||
/**
|
||||
@@ -132,6 +132,8 @@ public class UrlAddress {
|
||||
public static final String GET_DESKTOPS_DIY_UPDATE = "Sn/getDesktopsDiyUpdate";
|
||||
/*获取系统默认程序*/
|
||||
public static final String GET_DEFAULT_APP = "app/getDefaultApp";
|
||||
/*获取壁纸设置*/
|
||||
public static final String GET_WALLPAPER = "android/sn/wallpaper";
|
||||
|
||||
/**
|
||||
* 开发人员调试
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.aoleyun.sn.network.api.get;
|
||||
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.Wallpaper;
|
||||
import com.aoleyun.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface WallpaperApi {
|
||||
@GET(UrlAddress.GET_WALLPAPER)
|
||||
Observable<BaseResponse<Wallpaper>> getWallpaper(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import retrofit2.http.POST;
|
||||
import retrofit2.http.Part;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
@Deprecated
|
||||
public interface SendScreenshotApi {
|
||||
@Multipart
|
||||
@POST(UrlAddress.SEND_SCREENSHOT)
|
||||
|
||||
@@ -16,6 +16,7 @@ public interface UpdateDeviceInfoApi {
|
||||
@Field("key") String key,
|
||||
@Field("machine") String machine,
|
||||
@Field("hardware") String hardware,
|
||||
@Field("address") String address
|
||||
@Field("address") String address,
|
||||
@Field("other") String other
|
||||
);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RepeatRequestInterceptor implements Interceptor {
|
||||
// Response copy = response.newBuilder().body(responseBody).build();
|
||||
ResponseBody copy = ResponseBody.create(responseBody.contentType(), content);
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (content.length() < 1024) {
|
||||
if (content.length() < 10240) {
|
||||
Log.e(TAG, "请求体返回:| Response: " + request.url() + "\t body: " + content);
|
||||
}else {
|
||||
Log.e(TAG, "请求体返回:| Response: " + request.url() + "\t body: too long" );
|
||||
@@ -87,7 +87,7 @@ public class RepeatRequestInterceptor implements Interceptor {
|
||||
final Request copy = request.newBuilder().build();
|
||||
final Buffer buffer = new Buffer();
|
||||
copy.body().writeTo(buffer);
|
||||
if (buffer.size() > 1024) {
|
||||
if (buffer.size() > 10240) {
|
||||
return "-too long";
|
||||
}
|
||||
return buffer.readUtf8();
|
||||
@@ -100,7 +100,7 @@ public class RepeatRequestInterceptor implements Interceptor {
|
||||
try {
|
||||
final Buffer buffer = new Buffer();
|
||||
body.writeTo(buffer);
|
||||
if (buffer.size() > 1024) {
|
||||
if (buffer.size() > 10240) {
|
||||
return "-too long";
|
||||
}
|
||||
return buffer.readUtf8();
|
||||
|
||||
@@ -258,7 +258,8 @@ public class PushManager {
|
||||
private static final String GLOBAL_WHITE_LIST = "75";
|
||||
/*应用市场应用安装*/
|
||||
private static final String APPSTORE_INSTALL = "76";
|
||||
|
||||
/*设置壁纸*/
|
||||
private static final String wallpaper = "78";
|
||||
|
||||
public void setPushContent(String title, String extras) {
|
||||
switch (title) {
|
||||
@@ -670,11 +671,18 @@ public class PushManager {
|
||||
break;
|
||||
case APPSTORE_INSTALL:
|
||||
|
||||
break;
|
||||
case wallpaper:
|
||||
setWallpaper(extras);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
private void setWallpaper(String extras) {
|
||||
NetInterfaceManager.getInstance().getWallpaper();
|
||||
}
|
||||
|
||||
private void refreshFocusMode() {
|
||||
// Intent intent = new Intent();
|
||||
// ComponentName componentName = new ComponentName("com.aoleyunos.dop6", "com.aoleyunos.dop6.service.main.MainService");
|
||||
|
||||
@@ -54,6 +54,8 @@ public class MainSContact {
|
||||
void getDefaultDesktop();
|
||||
/*设置开机动画*/
|
||||
void setLogoImg();
|
||||
/*获取壁纸*/
|
||||
void getWallpaper();
|
||||
/*获取所有app详细信息*/
|
||||
void getAllAppList();
|
||||
/*获取浏览器书签设置管控*/
|
||||
@@ -138,6 +140,8 @@ public class MainSContact {
|
||||
void getDefaultDesktopFinish();
|
||||
/*设置开机动画*/
|
||||
void setLogoImgFinish();
|
||||
/*获取开机动画结束*/
|
||||
void getWallpaperFinish();
|
||||
/*获取所有app详细信息*/
|
||||
void getAllAppListFinish();
|
||||
/*获取浏览器书签设置管控结束*/
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.alibaba.sdk.android.push.CommonCallback;
|
||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
||||
import com.aoleyun.sn.bean.AdminAppInfo;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.BlacklistBean;
|
||||
import com.aoleyun.sn.bean.StudentsInfo;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
@@ -114,7 +113,6 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
@Override
|
||||
public void setPushTag(String tag) {
|
||||
mView.setTagsFinish(TextUtils.isEmpty(tag));
|
||||
|
||||
}
|
||||
});
|
||||
String tagSets = mMMKV.decodeString(CommonConfig.DEVICES_TAG);
|
||||
@@ -293,8 +291,9 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
*/
|
||||
@Override
|
||||
public void getDeveloper() {
|
||||
Log.e(TAG, "getDeveloper: ");
|
||||
NetInterfaceManager.getInstance()
|
||||
.getDeveloper(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
.getDeveloper(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.getDeveloperFinish();
|
||||
@@ -393,6 +392,16 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWallpaper() {
|
||||
NetInterfaceManager.getInstance().getWallpaper(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.getWallpaperFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAllAppList() {
|
||||
NetInterfaceManager.getInstance()
|
||||
|
||||
@@ -1125,8 +1125,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
} else {
|
||||
mPresenter.getFirstConnect();
|
||||
mPresenter.getStudesInfo();
|
||||
mPresenter.getDeveloper();
|
||||
}
|
||||
mPresenter.getDeveloper();
|
||||
mPresenter.sendMacAddress();
|
||||
}
|
||||
|
||||
@@ -1234,6 +1234,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void setLogoImgFinish() {
|
||||
mPresenter.getWallpaper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWallpaperFinish() {
|
||||
mPresenter.getAllAppList();
|
||||
}
|
||||
|
||||
|
||||
@@ -104,6 +104,7 @@ public class ApkUtils {
|
||||
* 桌面app
|
||||
*/
|
||||
public static final Set<String> desktopAPP = new HashSet<String>() {{
|
||||
this.add("com.aoleyunos.dop");
|
||||
this.add("com.aoleyunos.dop1");
|
||||
this.add("com.aoleyunos.dop2");
|
||||
this.add("com.aoleyunos.dop3");
|
||||
@@ -1410,6 +1411,7 @@ public class ApkUtils {
|
||||
this.add("com.aoleyun.sn");
|
||||
this.add("com.aoleyun.browser");
|
||||
this.add("com.aoleyun.appstore");
|
||||
this.add("com.aoleyunos.dop0");
|
||||
this.add("com.aoleyunos.dop1");
|
||||
this.add("com.aoleyunos.dop2");
|
||||
this.add("com.aoleyunos.dop3");
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.ActivityTaskManager;
|
||||
import android.app.WallpaperManager;
|
||||
import android.app.role.RoleManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
@@ -18,6 +19,8 @@ import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
@@ -38,6 +41,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.bean.AdminAppInfo;
|
||||
import com.aoleyun.sn.bean.AppID;
|
||||
@@ -61,6 +65,9 @@ import com.aoleyun.sn.service.GuardService;
|
||||
import com.aoleyun.sn.service.StepService;
|
||||
import com.aoleyun.sn.service.main.MainService;
|
||||
import com.blankj.utilcode.util.FileUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
@@ -77,6 +84,7 @@ import com.tencent.mmkv.MMKV;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -773,13 +781,47 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static final Set<String> DEFAULT_ALLOW_NETWORK_APP_SET = new HashSet<String>() {{
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
this.add("com.aoleyun.appstore");
|
||||
this.add("com.aoleyun.camera");
|
||||
this.add("com.aoleyun.calculator");
|
||||
this.add("com.aoleyun.gallery3d");
|
||||
this.addAll(ApkUtils.mJxwApp);
|
||||
this.addAll(ApkUtils.desktopAPP);
|
||||
this.add("com.android.settings");
|
||||
this.add("com.aoleyunos.dop");
|
||||
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");
|
||||
}};
|
||||
|
||||
public void setAppNetwork(HashSet<String> blackList, HashSet<String> whiteList) {
|
||||
Log.e(TAG, "setAppNetwork: " + "设置应用联网管控 blackList =" + blackList);
|
||||
Log.e(TAG, "setAppNetwork: " + "设置应用联网管控 whiteList =" + whiteList);
|
||||
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL)) {
|
||||
|
||||
} else {
|
||||
try {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system aole_network_allow");
|
||||
Log.e(TAG, "setAppNetwork: " + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (!MTK11Tag.equals(JGYUtils.getInstance().getAppPlatform())) {
|
||||
if (blackList == null || blackList.size() == 0) {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, null);
|
||||
} else {
|
||||
String net_not = String.join(",", blackList);
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
||||
@@ -796,19 +838,19 @@ public class JGYUtils {
|
||||
} else {
|
||||
pkgs = new HashSet<>(whiteList);
|
||||
}
|
||||
pkgs.add(BuildConfig.APPLICATION_ID);
|
||||
pkgs.add("com.aoleyun.appstore");
|
||||
pkgs.add("com.aoleyun.camera");
|
||||
pkgs.add("com.aoleyun.calculator");
|
||||
pkgs.add("com.aoleyun.gallery3d");
|
||||
pkgs.addAll(ApkUtils.mJxwApp);
|
||||
|
||||
pkgs.addAll(DEFAULT_ALLOW_NETWORK_APP_SET);
|
||||
List<String> filterList = pkgs.stream().filter(s -> ApkUtils.isAvailable(mContext, s)).collect(Collectors.toList());
|
||||
Log.e(TAG, "setAppNetwork: filterList = " + filterList);
|
||||
if (filterList.size() == 0) {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
} else {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL)) {
|
||||
if (filterList.size() == 0) {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, null);
|
||||
} else {
|
||||
// TODO: 2024/10/31 需要多写一次保证数据库变化
|
||||
filterList.add("com.ttstd.utils");
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
filterList.remove("com.ttstd.utils");
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,6 +858,44 @@ public class JGYUtils {
|
||||
* 应用安装之后添加到白名单
|
||||
*/
|
||||
public void updateNetworkWhiteList() {
|
||||
Log.e(TAG, "updateNetworkWhiteList: ");
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL)) {
|
||||
|
||||
} else {
|
||||
try {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system aole_network_allow");
|
||||
Log.e(TAG, "updateNetworkWhiteList: " + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL)) {
|
||||
|
||||
} else {
|
||||
try {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_BLACK_LIST, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_web_black_list");
|
||||
Log.e(TAG, "updateNetworkWhiteList: " + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL)) {
|
||||
|
||||
} else {
|
||||
try {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, null);
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_web_white_list");
|
||||
Log.e(TAG, "getWhiteList: " + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Set<String> pkgs;
|
||||
int is_app_install = Settings.System.getInt(crv, CommonConfig.AOLE_APP_ALLOW_INSTALL, 0);
|
||||
if (is_app_install == 1) {
|
||||
@@ -824,24 +904,23 @@ public class JGYUtils {
|
||||
} else {
|
||||
pkgs = mMMKV.decodeStringSet(CommonConfig.AOLE_ACTION_NETWORK_ALLOW, new HashSet<>());
|
||||
}
|
||||
|
||||
pkgs.add(BuildConfig.APPLICATION_ID);
|
||||
pkgs.add("com.aoleyun.appstore");
|
||||
pkgs.add("com.aoleyun.camera");
|
||||
pkgs.add("com.aoleyun.calculator");
|
||||
pkgs.add("com.aoleyun.gallery3d");
|
||||
pkgs.addAll(ApkUtils.mJxwApp);
|
||||
|
||||
pkgs.addAll(DEFAULT_ALLOW_NETWORK_APP_SET);
|
||||
List<String> whiteList = new ArrayList<>(pkgs);
|
||||
|
||||
List<String> filterList = whiteList.stream().filter(s -> ApkUtils.isAvailable(mContext, s)).collect(Collectors.toList());
|
||||
Log.e(TAG, "updateNetworkWhiteList: filterList = " + filterList);
|
||||
|
||||
if (filterList.size() == 0) {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
} else {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
if ("Ebox201W".equals(Build.MODEL) || "Ebox201".equals(Build.MODEL)) {
|
||||
if (filterList.size() == 0) {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, null);
|
||||
} else {
|
||||
// TODO: 2024/10/31 需要多写一次保证数据库变化
|
||||
filterList.add("com.ttstd.utils");
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
filterList.remove("com.ttstd.utils");
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
}
|
||||
}
|
||||
|
||||
Log.e(TAG, "updateNetworkWhiteList: " + filterList);
|
||||
}
|
||||
|
||||
@@ -873,7 +952,7 @@ public class JGYUtils {
|
||||
public void writeDeselectIDtoSystem(List<AppID> appIDList) {
|
||||
if (appIDList == null || appIDList.isEmpty()) {
|
||||
try {
|
||||
Settings.System.putString(crv, CommonConfig.APP_VIEW_CLICK_DISABLED, "");
|
||||
Settings.System.putString(crv, CommonConfig.APP_VIEW_CLICK_DISABLED, null);
|
||||
// TODO: 2024/9/11 修复1.4.0907版本数据为空系统报错
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_view_click_disabled");
|
||||
Log.e(TAG, "writeDeselectIDtoSystem: " + result);
|
||||
@@ -1279,9 +1358,17 @@ public class JGYUtils {
|
||||
this.add("com.android.uiuios");
|
||||
this.add("com.aoleyun.os");
|
||||
this.add("com.aoleyun.audos");
|
||||
this.add("com.aoleyunos.dop");
|
||||
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.aoleyun.info");
|
||||
this.add("com.calculator.uiui");
|
||||
this.add("com.notepad.uiui");
|
||||
@@ -1673,9 +1760,18 @@ public class JGYUtils {
|
||||
this.add("com.aoleyun.sn");
|
||||
this.add("com.aoleyun.browser");
|
||||
this.add("com.aoleyun.os");
|
||||
this.add("com.aoleyunos.dop");
|
||||
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");
|
||||
|
||||
}};
|
||||
|
||||
HashSet<String> aihuaAppList = new HashSet<String>() {{
|
||||
@@ -2653,7 +2749,7 @@ public class JGYUtils {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("sn", Utils.getSerial(context));
|
||||
jsonObject.addProperty("mac", Utils.getAndroid10MAC(mContext));
|
||||
jsonObject.addProperty("jpush_id", "0000");
|
||||
jsonObject.addProperty("jpush_id", PushServiceFactory.getCloudPushService().getDeviceId());
|
||||
jsonObject.addProperty("devices_version", Utils.getCustomVersion());
|
||||
jsonObject.addProperty("appstore_version", BuildConfig.VERSION_NAME);
|
||||
jsonObject.addProperty("store_version", Utils.getAPPVersionName(PackageNames.APPSTORE, mContext));
|
||||
@@ -3360,4 +3456,40 @@ public class JGYUtils {
|
||||
return pkgs.contains(pkg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setWallpaper(String url) {
|
||||
String oldUrl = mMMKV.decodeString(CommonConfig.WALLPAPER_URL_KEY, "");
|
||||
if (oldUrl.equals(url)){
|
||||
Log.e(TAG, "setWallpaper: Already set" );
|
||||
return;
|
||||
}
|
||||
|
||||
// Bitmap bitmap = BitmapFactory.decodeFile(path);
|
||||
//利用WallpaparManager,添加权限set_wallpaper
|
||||
WallpaperManager wallpaperManager = WallpaperManager.getInstance(mContext);
|
||||
|
||||
// // 获取当前壁纸(非缩略图)
|
||||
// Drawable drawable = wallpaperManager.getDrawable();
|
||||
// // 获取当前壁纸的缩略图
|
||||
// Bitmap bitmap = wallpaperManager.getBitmap();
|
||||
// // 获取当前壁纸的尺寸
|
||||
// int width = wallpaperManager.getDesiredMinimumWidth();
|
||||
// int height = wallpaperManager.getDesiredMinimumHeight();
|
||||
Glide.with(mContext).asBitmap().load(url).into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@androidx.annotation.NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
try {
|
||||
wallpaperManager.setBitmap(resource);
|
||||
mMMKV.encode(CommonConfig.WALLPAPER_URL_KEY, url);
|
||||
Log.e("setWallpaper", "onResourceReady: set wallpaper Successful");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("setWallpaper", "onResourceReady: " + e.getMessage());
|
||||
Log.e("setWallpaper", "onResourceReady: set wallpaper failed");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ public class SysSettingUtils {
|
||||
setSystemAppDisable(context, jsonObject);
|
||||
setNotification(context, jsonObject);
|
||||
setPanelShow(context, jsonObject);
|
||||
setDisAllowCamera(context, jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -535,6 +536,8 @@ public class SysSettingUtils {
|
||||
|
||||
//状态栏显示开关
|
||||
int setting_statusbar = changeNum(jsonObject.get("setting_statusbar").getAsInt());
|
||||
Log.e(TAG, "setting_statusbar: " + setting_statusbar);
|
||||
|
||||
// int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
|
||||
// if (oldNum != setting_statusbar) {
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
@@ -1004,19 +1007,19 @@ public class SysSettingUtils {
|
||||
setTF(context, changeNum(is_memory_card));
|
||||
|
||||
} else {
|
||||
TimeUtils.setEmpty(context);
|
||||
TimeUtils.ContralTime c = TimeUtils.getDefaltContralTime(context);
|
||||
if (null != c) {
|
||||
Log.e("getTimeControl", c.toString());
|
||||
}
|
||||
Settings.Global.putInt(context.getContentResolver(), CommonConfig.AOLEYUN_APPSTORE_INSTALL, 1);
|
||||
setUsb(context, 0);
|
||||
setBluetoothTransmission(context, 0);
|
||||
// JGYUtils.getInstance().setDeveloperOptions(0);
|
||||
setCanReset(context, 0);
|
||||
setActionBar(context, 0);
|
||||
setNavigationBar(context, 0);
|
||||
setTF(context, 0);
|
||||
// TimeUtils.setEmpty(context);
|
||||
// TimeUtils.ContralTime c = TimeUtils.getDefaltContralTime(context);
|
||||
// if (null != c) {
|
||||
// Log.e("getTimeControl", c.toString());
|
||||
// }
|
||||
// Settings.Global.putInt(context.getContentResolver(), CommonConfig.AOLEYUN_APPSTORE_INSTALL, 1);
|
||||
// setUsb(context, 0);
|
||||
// setBluetoothTransmission(context, 0);
|
||||
//// JGYUtils.getInstance().setDeveloperOptions(0);
|
||||
// setCanReset(context, 0);
|
||||
// setActionBar(context, 0);
|
||||
// setNavigationBar(context, 0);
|
||||
// setTF(context, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1160,4 +1163,14 @@ public class SysSettingUtils {
|
||||
context.sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setDisAllowCamera(Context context, JsonObject jsonObject) {
|
||||
JsonElement jsonElement = jsonObject.get("camera_ctrl");
|
||||
if (jsonElement != null && !jsonElement.isJsonNull()) {
|
||||
int camera_ctrl = jsonElement.getAsInt();
|
||||
Log.e("setDisAllowCamera", "setDisAllowCamera: " + camera_ctrl);
|
||||
Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_DISALLOW_CAMERA, changeNum(camera_ctrl));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import android.widget.Toast;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
@@ -109,7 +110,7 @@ import static android.content.Context.WIFI_SERVICE;
|
||||
|
||||
|
||||
public class Utils {
|
||||
private static String TAG = "Utils";
|
||||
private static final String TAG = "Utils";
|
||||
|
||||
// MD5 设备地址标识
|
||||
public static String getMAC(Context context) {
|
||||
@@ -795,7 +796,7 @@ public class Utils {
|
||||
* @return
|
||||
*/
|
||||
public static String getSerial(Context context) {
|
||||
if ("HL500".equals(Build.MODEL)){
|
||||
if ("HL500".equals(Build.MODEL)) {
|
||||
return getIMEI(context);
|
||||
}
|
||||
if (TECLAST_BRAND.equalsIgnoreCase(Build.BRAND)) {
|
||||
@@ -1470,8 +1471,8 @@ public class Utils {
|
||||
jsonObject.addProperty("screen_rate", screen_rate);
|
||||
jsonObject.addProperty("working_time", SystemClock.elapsedRealtime() / 1000);
|
||||
jsonObject.addProperty("restart_count", (int) SPUtils.get(context, "restart_count", 0));
|
||||
jsonObject.addProperty("storage_usable", getRemnantSize(context));
|
||||
jsonObject.addProperty("storage_total", getDataTotalSize(context));
|
||||
jsonObject.addProperty("storage_usable", getDataTotalSizeGb(context));
|
||||
jsonObject.addProperty("storage_total", getDataTotalSizeGb(context));
|
||||
String jsonString = jsonObject.toString();
|
||||
Log.e(TAG, "getMachine: " + jsonString);
|
||||
return jsonString;
|
||||
@@ -1486,9 +1487,12 @@ public class Utils {
|
||||
String storage = getRemnantSize(context) + "/" + getDataTotalSize(context);
|
||||
int CPU = getNumCores();
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
|
||||
jsonObject.addProperty("electric", electric);
|
||||
jsonObject.addProperty("charging", charging);
|
||||
jsonObject.addProperty("memory", memory);
|
||||
jsonObject.addProperty("memory_used", Utils.getSizeGb(getFreeMemory(context)));
|
||||
jsonObject.addProperty("memory_total", Utils.getSizeGb(getTotalMemory(context)));
|
||||
jsonObject.addProperty("storage", storage);
|
||||
jsonObject.addProperty("battery_capacity", Utils.getBatterymAh(context));
|
||||
jsonObject.addProperty("CPU", CPU + "核");
|
||||
@@ -1509,6 +1513,15 @@ public class Utils {
|
||||
jsonObject.addProperty("longitude", longitude);
|
||||
jsonObject.addProperty("latitude", latitude);
|
||||
String jsonString = jsonObject.toString();
|
||||
Log.e(TAG, "getAddressJsonString: " + jsonString);
|
||||
return jsonString;
|
||||
}
|
||||
|
||||
public static String getOtherInfo() {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("push_id", PushServiceFactory.getCloudPushService().getDeviceId());
|
||||
String jsonString = jsonObject.toString();
|
||||
Log.e(TAG, "getOtherInfo: push_id = " + jsonString);
|
||||
return jsonString;
|
||||
}
|
||||
|
||||
@@ -1751,6 +1764,23 @@ public class Utils {
|
||||
return String.format(Locale.getDefault(), " %.2f %s", size, units[index]);
|
||||
}
|
||||
|
||||
public static String getSizeGb(long size) {
|
||||
DecimalFormat df = new DecimalFormat("#.00");
|
||||
return df.format((double) size / 1073741824);
|
||||
}
|
||||
|
||||
public static String getDataTotalSizeGb(Context context) {
|
||||
StatFs sf = new StatFs(context.getCacheDir().getAbsolutePath());
|
||||
long blockSize = sf.getBlockSize();
|
||||
long totalBlocks = sf.getBlockCount();
|
||||
return getSizeGb(blockSize * totalBlocks);
|
||||
}
|
||||
|
||||
public static String getRemnantSizeGb(Context context) {
|
||||
StatFs sf = new StatFs(context.getCacheDir().getAbsolutePath());
|
||||
long availableSize = sf.getAvailableBytes();
|
||||
return getSizeGb(availableSize);
|
||||
}
|
||||
|
||||
public static String getDataTotalSize(Context context) {
|
||||
StatFs sf = new StatFs(context.getCacheDir().getAbsolutePath());
|
||||
|
||||
Reference in New Issue
Block a user