version:2.0.8

update:
fix:修复文件格式管理失效,展锐平台定位失败问题,增加获取展锐平台系统版本,展锐平台隐藏相机和信息失败
add:
This commit is contained in:
2021-05-24 18:34:07 +08:00
parent d04774bc4c
commit d588fc1c56
21 changed files with 449 additions and 69 deletions

View File

@@ -41,15 +41,16 @@ android {
//新平台正式
newly {
flavorDimensions "default"
versionCode 507
versionCode 508
//versionCode 1037
versionName "2.0.7"
versionName "2.0.8"
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
JPUSH_APPKEY : "20f70bbeb78bad23eddd08d0", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
channel_value: "newly"
channel_value: "newly" ,
AMAP_KEY: "546eb5646a65ac6a5b7d1c7456466e05"
]
/*********************************极光推送end************************************/
buildConfigField "String", "ROOT_URL", '"http://name.jiaoguanyi.cn/api/"'
@@ -66,7 +67,8 @@ android {
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
JPUSH_APPKEY : "52d81643665bb2cadacf0e9e", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
channel_value: "beta"
channel_value: "beta" ,
AMAP_KEY: "5b68c8ee39800ff700a3762b6e028b78"
]
/*********************************极光推送end************************************/
buildConfigField "String", "ROOT_URL", '"http://name.uiuios.com/api/"'
@@ -84,6 +86,7 @@ android {
JPUSH_APPKEY : "20f70bbeb78bad23eddd08d0", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
channel_value: "official",
AMAP_KEY: "5b68c8ee39800ff700a3762b6e028b78"
]
/*********************************极光推送end************************************/
buildConfigField "String", "ROOT_URL", '"http://partner.jiaoguanyi.com/api/"'
@@ -100,7 +103,8 @@ android {
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
JPUSH_APPKEY : "a98c8a210687b4bb43c39c39", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
channel_value: "zhongyou"
channel_value: "zhongyou" ,
AMAP_KEY: "5b68c8ee39800ff700a3762b6e028b78"
]
/*********************************极光推送end************************************/
buildConfigField "String", "ROOT_URL", '"https://jgy.jundunxueyuan.com/api/"'
@@ -170,6 +174,7 @@ android {
zhanRuiDebug.initWith(debug)
zhanRuiDebug {
versionNameSuffix "-debug"
buildConfigField "String", "platform", '"ZhanRui"'
debuggable true
signingConfig signingConfigs.zhanRui

View File

@@ -387,7 +387,7 @@
<!-- 设置key -->
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="5b68c8ee39800ff700a3762b6e028b78" />
android:value="${AMAP_KEY}" />
<!-- 定位需要的服务 适配Android Q需要加上android:foregroundServiceType="location" -->
<service
android:name="com.amap.api.location.APSService"

View File

@@ -228,7 +228,8 @@ public class DiscardActivity extends AppCompatActivity {
synchronized public void sendMACaddress() {
String devices_version = Utils.getProperty("ro.custom.build.version", "获取失败");//获取自定义版本
//获取自定义版本
String devices_version = Utils.getCustomVersion();
String rid = JPushInterface.getRegistrationID(DiscardActivity.this);
OkGo.post(URLAddress.SEND_DEVICES)
.params("sn", Utils.getSerial())
@@ -1030,7 +1031,7 @@ public class DiscardActivity extends AppCompatActivity {
@Override
public void onNext(ResponseBody responseBody) {
try {
String responString = responseBody.string();
String responString = responseBody.string();
Log.e("mjhseng", responString);
JSONObject jsonObject = JSON.parseObject(responString);
int code = jsonObject.getInteger("code");

View File

@@ -120,8 +120,12 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
tv_devmac.setText(macaddr);
}
tv_version.setText(BuildConfig.VERSION_NAME);
String customVersion = Utils.getProperty("ro.custom.build.version", "获取失败");//获取自定义版本
tv_customversion.setText(customVersion);
//获取自定义版本
//Log.e(TAG, "getDevicesInfo: " + Utils.getProperty("ro.build.id", "获取失败"));
//展讯获取自定义版本
Log.e(TAG, "getDevicesInfo: CustomVersion: " + Utils.getCustomVersion());
Log.e(TAG, "getDevicesInfo: RomVersion: " + Utils.getRomVersion());
tv_customversion.setText(Utils.getCustomVersion());
}
private void checkSNError(String sn) {
@@ -132,8 +136,8 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
Log.e(TAG, "checkSNError: " + sn);
}
//检查平台和sn是否对应
if (JGYUtils.getInstance().checkSNPlatform(sn)!=JGYUtils.getInstance().checkAppPlatform()){
showSNErrorDialog("SN数据与平台不符请联系管理员");
if (JGYUtils.getInstance().checkSNPlatform(sn) != JGYUtils.getInstance().checkAppPlatform()) {
showSNErrorDialog("SN数据与平台不符请联系管理员");
}
//设置极光推送标签
JGYUtils.getInstance().getAppPlatform(platform -> mPresenter.setJpushPlatformTags(platform));

View File

@@ -130,6 +130,10 @@ public class MainPresenter implements MainContact.Presenter {
}
SPUtils.put(mContext, "admin_id", studentsInfoBaseResponse.data.getAdmin_id());
} else {
mView.setNumberText("", View.GONE);
mView.setNameText("", View.GONE);
mView.setClassText("", View.GONE);
mView.setBatchText("", View.GONE);
Log.e("getStudesInfo", "onNext: " + studentsInfoBaseResponse.toString());
}
}
@@ -219,7 +223,9 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void onError(@NonNull Throwable e) {
Log.e("getLockedState", "onError: " + e.getMessage());
onComplete();
int locked = Settings.System.getInt(mContext.getContentResolver(), "qch_unlock_ipad", -1);
Log.e("getLockedState", "locked: " + locked);
mView.setLockedState(locked == 0);
}
@Override
@@ -301,13 +307,14 @@ public class MainPresenter implements MainContact.Presenter {
jsonObject.addProperty("longitude", longitude);
jsonObject.addProperty("latitude", latitude);
String add = jsonObject.toString();
UpdateDeviceInfoApi updateDeviceInfo = NetInterfaceManager.getUpdateDeviceInfo();
updateDeviceInfo.updateDeviceInfo(
Utils.getSerial(),
NetInterfaceManager.HTTP_KEY,
Utils.getMachine(context),
Utils.getHardware(context),
add)
Log.e(TAG, "updateDevicesInfo: " + add);
NetInterfaceManager.getUpdateDeviceInfo()
.updateDeviceInfo(
Utils.getSerial(),
NetInterfaceManager.HTTP_KEY,
Utils.getMachine(context),
Utils.getHardware(context),
add)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<ResponseBody>() {
@@ -676,7 +683,9 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void onError(@NonNull Throwable e) {
Log.e("getAppLimit", "onError: " + e.getMessage());
onComplete();
String oldListString = Settings.System.getString(mContext.getContentResolver(), "qch_app_forbid");
Log.e("getAppLimit", "oldListString: " + oldListString);
mView.getAppLimitFinished(oldListString);
}
@Override
@@ -913,7 +922,9 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void onError(@NonNull Throwable e) {
Log.e("SetBrowserList", "onError: " + e.getMessage());
onComplete();
String whiteURLList = Settings.System.getString(mContext.getContentResolver(), "DeselectBrowserArray");
Log.e("SetBrowserList", "whiteURLList: " + whiteURLList);
mView.getBrowserListFinished(whiteURLList);
}
@Override
@@ -1051,6 +1062,14 @@ public class MainPresenter implements MainContact.Presenter {
PackageManager pm = mContext.getPackageManager();
for (String pack : newList) {
try {
// TODO: 2021/5/24 需要后端替换包名,暂时解决方案
if ("com.mediatek.camera".equals(pack)){
pm.setApplicationEnabledSetting("com.android.camera2", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
}
if (" com.android.mms".equals(pack)){
pm.setApplicationEnabledSetting("com.android.messaging", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
}
pm.setApplicationEnabledSetting(pack, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
Log.e("getDesktopIcon", pack);
} catch (Exception e) {
@@ -1192,7 +1211,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void onError(@NonNull Throwable e) {
Log.e("setAppinsideWeb", "onError: ");
Log.e("setAppinsideWeb", "onError: " + e.getMessage());
onComplete();
}
@@ -1247,17 +1266,21 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void onNext(@NonNull ResponseBody responseBody) {
Log.e("setSystemSetting", "onNext: ");
SPUtils.put(mContext, "first_connect", 1);
try {
String bodyString = responseBody.string();
Log.e("setSystemSetting", "onNext: " + bodyString);
JsonObject jsonObject = JsonParser.parseString(bodyString).getAsJsonObject();
int code = jsonObject.get("code").getAsInt();
if (code == 200) {
String data = jsonObject.getAsJsonObject("data").toString();
//结果保存到本地
SPUtils.put(mContext, "SystemSettingData", data);
JGYUtils.getInstance().SettingSysData(data);
} else {
// SysSettingUtils.setDisableSetting(mContext);
//没有就按照默认的管控
//SysSettingUtils.setDisableSetting(mContext);
//获取系统管控先不要关闭开发人员选项
Settings.System.putInt(mContext.getContentResolver(), "qch_Developeroptions", 1);
}
} catch (IOException e) {
@@ -1268,7 +1291,10 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void onError(@NonNull Throwable e) {
Log.e("setSystemSetting", "onError: ");
Log.e("setSystemSetting", "onError: " + e.getMessage());
String oldData = (String) SPUtils.get(mContext, "SystemSettingData", "");
Log.e("setSystemSetting", "oldData: " + oldData);
JGYUtils.getInstance().SettingSysData(oldData);
onComplete();
}
@@ -1306,6 +1332,9 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void onError(Throwable e) {
Log.e("getDeveloper", "onError: " + e.getMessage());
int oldStatus = Settings.System.getInt(mContext.getContentResolver(), "qch_Developeroptions", 1);
Log.e("getDeveloper", "oldStatus: " + oldStatus);
JGYUtils.getInstance().setDeveloperOptions(oldStatus);
onComplete();
}

View File

@@ -88,6 +88,7 @@ public class BaseApplication extends MultiDexApplication {
XAPKUtils.init(this);
FileManager.init(this);
AmapManager.init(this);
AmapManager.getInstance().initAmap();
ToastUtil.init(this);
JGYUtils.getInstance().hookWebView();
@@ -129,7 +130,7 @@ public class BaseApplication extends MultiDexApplication {
onAliasResult.onResult(errorCode);
}
public static void setJpushAlias() {
public static void setJpushAlias() {
Log.e("jiguangInterface", "30s后重新设置alias");
JPushInterface.setAlias(context, TagAliasOperatorHelper.sequence++, Utils.getSerial());
}
@@ -147,24 +148,24 @@ public class BaseApplication extends MultiDexApplication {
HTTPInterface.setJpushTags(context);
}
synchronized public static void clean() {
synchronized public static void clean() {
//alias的绑定的设备超过10个但是alias应该是一个设备对应一个在重置设备后jpush的regid会变动所以需要清除
//https://docs.jiguang.cn/jpush/server/push/rest_api_v3_device/#_5
HTTPInterface.cleanJpushAlias(Utils.getSerial());
}
private static void initAliasObservable() {
Log.e(TAG, "initAliasObservable: " );
Log.e(TAG, "initAliasObservable: ");
Observable.create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> emitter) throws Exception {
onAliasResult = new OnAliasResult() {
@Override
public void onResult(int code) {
Log.e("initAliasObservable", "onResult: " + code);
emitter.onNext(code);
}
};
onAliasResult = new OnAliasResult() {
@Override
public void onResult(int code) {
Log.e("initAliasObservable", "onResult: " + code);
emitter.onNext(code);
}
};
}
}).throttleLast(30, TimeUnit.SECONDS)
.subscribe(new Observer<Integer>() {
@@ -236,7 +237,7 @@ public class BaseApplication extends MultiDexApplication {
}
private static void initTagObservable() {
Log.e(TAG, "initTagObservable: " );
Log.e(TAG, "initTagObservable: ");
Observable.create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> emitter) {

View File

@@ -13,6 +13,7 @@ public class AmapManager {
private static AmapManager sInstance;
private Context mContext;
public static AMapLocationClient locationClient = null;
private String TAG = AmapManager.class.getSimpleName();
private AmapManager(Context context) {
this.mContext = context;
@@ -22,12 +23,14 @@ public class AmapManager {
if (sInstance == null) {
sInstance = new AmapManager(context);
}
}
public static AmapManager getInstance() {
if (sInstance == null) {
throw new IllegalStateException("You must be init AmapManager first");
}
return sInstance;
}
@@ -38,7 +41,7 @@ public class AmapManager {
return locationClient;
}
private void initAmap() {
public void initAmap() {
locationClient = new AMapLocationClient(mContext);
AMapLocationClientOption option = new AMapLocationClientOption();
option.setLocationPurpose(AMapLocationClientOption.AMapLocationPurpose.SignIn);
@@ -55,11 +58,14 @@ public class AmapManager {
//设置定位模式为AMapLocationMode.Hight_Accuracy高精度模式。
//设置定位监听
locationClient.setLocationListener(new AMapLocationListener() {
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
StringBuilder sb = new StringBuilder();
//errCode等于0代表定位成功其他的为定位失败具体的可以参照官网定位错误码说明
if (aMapLocation.getErrorCode() == 0) {
Log.e(TAG, "onLocationChanged: " + "定位成功");
Log.e(TAG, "onLocationChanged: " + aMapLocation.getAddress());
sb.append(aMapLocation.getAddress()).append("\n");
SPUtils.put(mContext, "AmapAddress", aMapLocation.getAddress());
SPUtils.put(mContext, "longitude", aMapLocation.getLongitude());
@@ -67,16 +73,17 @@ public class AmapManager {
} else {
//定位失败
sb.append("定位失败" + "\n");
SPUtils.put(mContext, "AmapError", aMapLocation.getErrorInfo());
SPUtils.put(mContext, "AmapError", String.valueOf(aMapLocation.getErrorCode()));
}
Log.e("AmapAddress", (String) SPUtils.get(mContext, "AmapAddress", "-"));
Log.e("AmapError", (String) SPUtils.get(mContext, "AmapError", "-"));
Log.e("addr", sb.toString());
Log.e(TAG, (String) SPUtils.get(mContext, "AmapAddress", "-"));
Log.e(TAG, (String) SPUtils.get(mContext, "AmapError", "-"));
Log.e(TAG, "amap: " + sb.toString());
}
});
//设置场景模式后最好调用一次stop再调用start以保证场景模式生效
locationClient.stopLocation();
locationClient.startLocation();
Log.e(TAG, "initAmap: " + "startLocation");
}

View File

@@ -156,7 +156,7 @@ public class NetInterfaceManager {
.sendMACaddress(Utils.getSerial(),
Utils.getAndroid7MAC(),
JPushInterface.getRegistrationID(mContext),
Utils.getProperty("ro.custom.build.version", "获取失败"),
Utils.getCustomVersion(),
BuildConfig.VERSION_NAME,
Utils.getAPPVersionName(mContext)
)

View File

@@ -772,6 +772,12 @@ public class HTTPInterface {
PackageManager pm = context.getPackageManager();
for (String pack : newList) {
try {
if ("com.mediatek.camera".equals(pack)){
pm.setApplicationEnabledSetting("com.android.camera2", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
}
if (" com.android.mms".equals(pack)){
pm.setApplicationEnabledSetting("com.android.messaging", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
}
pm.setApplicationEnabledSetting(pack, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
Logger.e("setHideDesktopIcon", pack);
} catch (Exception e) {

View File

@@ -303,18 +303,23 @@ public class MyJPushReceiver extends BroadcastReceiver {
aMapLocationClient.setLocationListener(new AMapLocationListener() {
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
//errCode等于0代表定位成功其他的为定位失败具体的可以参照官网定位错误码说明
if (aMapLocation.getErrorCode() == 0) {
sb.append(aMapLocation.getAddress() + "\n");
SPUtils.put(context, "AmapAddress", aMapLocation.getAddress());
SPUtils.put(context, "longitude", aMapLocation.getLongitude());
SPUtils.put(context, "latitude", aMapLocation.getLatitude());
Log.e(TAG, "onLocationChanged: " + "定位成功");
Log.e(TAG, "onLocationChanged: " + aMapLocation.getAddress());
sb.append(aMapLocation.getAddress()).append("\n");
SPUtils.put(mContext, "AmapAddress", aMapLocation.getAddress());
SPUtils.put(mContext, "longitude", aMapLocation.getLongitude());
SPUtils.put(mContext, "latitude", aMapLocation.getLatitude());
} else {
//定位失败
sb.append("定位失败" + "\n");
SPUtils.put(context, "AmapError", aMapLocation.getErrorInfo());
SPUtils.put(mContext, "AmapError", String.valueOf(aMapLocation.getErrorCode()));
}
Log.e(TAG, (String) SPUtils.get(mContext, "AmapAddress", "-"));
Log.e(TAG, (String) SPUtils.get(mContext, "AmapError", "-"));
Log.e(TAG, "amap: " + sb.toString());
HTTPInterface.updateDeviceInfo(mContext);
}
});

View File

@@ -1117,12 +1117,11 @@ public class DiscardServer extends Service {
synchronized public void sendMACaddress() {
String rid = JPushInterface.getRegistrationID(this);
OkGo.post(URLAddress.SEND_DEVICES)
.params("sn", Utils.getSerial())
.params("mac", com.blankj.utilcode.util.DeviceUtils.getMacAddress())
.params("jpush_id", rid)
.params("devices_version", Utils.getProperty("ro.custom.build.version", "获取失败"))
.params("devices_version", Utils.getCustomVersion())
.params("appstore_version", BuildConfig.VERSION_NAME)//我的设备版本号
.params("store_version", getAPPVersionName())//管教易版本号
.execute(new StringCallback() {

View File

@@ -22,6 +22,7 @@ import android.net.wifi.WifiManager;
import android.os.BatteryManager;
import android.os.Build;
import android.os.IBinder;
import android.provider.Settings;
import android.text.format.Formatter;
import android.util.Log;
@@ -455,12 +456,34 @@ public class GuardService extends Service {
|| Intent.ACTION_BATTERY_LOW.equals(action)
|| Intent.ACTION_BATTERY_OKAY.equals(action)
) {
setDefaultUSBStatus();
Log.e(TAG, action);
startService(new Intent(getBaseContext(), MainService.class));
}
}
}
private void setDefaultUSBStatus() {
String setting_usb = Settings.System.getString(getContentResolver(), "qch_usb_choose");
Log.e("setDefaultUSBStatus", "setting_usb---------" + setting_usb);
String usbStatus = "";
switch (setting_usb) {
case "usb_charge":
usbStatus = "qch_action_usb_usb_charge";
break;
case "usb_mtp":
usbStatus = "qch_action_usb_usb_mtp";
break;
case "usb_midi":
usbStatus = "qch_action_usb_usb_midi";
break;
default:
break;
}
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
sendBroadcast(usbIntent);
}
private void registerNetworkConnectedReceiver() {
if (null == netReceiver) {
netReceiver = new NetworkStateReceiver();

View File

@@ -680,11 +680,13 @@ public class ApkUtils {
this.add("com.android.deskclock");//时钟
this.add("com.android.music");//音乐
this.add("com.mediatek.camera");//相机
this.add("com.android.camera2");//展讯相机
this.add("com.android.documentsui");//文件
this.add("com.mediatek.filemanager");//文件
this.add("com.android.soundrecorder");//录音机
this.add("com.android.browser");//浏览器
this.add("com.android.mms");//信息
this.add("com.android.messaging");//展讯信息
this.add("com.android.fmradio");//FM电台
this.add("com.android.dialer");//电话
this.add("com.android.contacts");//通讯录

View File

@@ -81,6 +81,15 @@ public class JGYUtils {
return "official".equals(channelValue);
}
public static boolean isNewlyVersion() {
String channelValue = JGYUtils.getInstance().getStringMetaData();
return "beta".equals(channelValue);
}
public static boolean isBetaVersion() {
String channelValue = JGYUtils.getInstance().getStringMetaData();
return "beta".equals(channelValue);
}
public void resetDevice() {
boolean isReset = MySQLData.GetBooleanData(mContext, CommonDatas.IS_RESET);
@@ -439,6 +448,10 @@ public class JGYUtils {
}
public void SettingSysData(String data) {
if (TextUtils.isEmpty(data)) {
Log.e(TAG, "SettingSysData: " + "data is empty");
return;
}
SysSettingUtils.setSystemSetting(mContext, data);
}
@@ -939,13 +952,13 @@ public class JGYUtils {
public int checkAppPlatform() {
String platform = BuildConfig.platform;
if ("MTK".equalsIgnoreCase(platform)) {
Log.e(TAG, "checkAppPlatform: " + "MTK平台");
Log.i(TAG, "checkAppPlatform: " + "MTK平台");
return MTKPlatform;
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
Log.e(TAG, "checkAppPlatform: " + "展锐平台");
Log.i(TAG, "checkAppPlatform: " + "展锐平台");
return ZhanruiPlatform;
} else {
Log.e(TAG, "checkAppPlatform: " + "没有数据");
Log.i(TAG, "checkAppPlatform: " + "没有数据");
return UnknowPlatform;
}
}
@@ -954,12 +967,12 @@ public class JGYUtils {
String AppPlatform = BuildConfig.platform;
if ("ZhanRui".equals(AppPlatform)) {
return ZhanruiTag.equals(platform);
}else {
} else {
return AppPlatform.equals(platform);
}
}
public interface GetAppPlatformCallback {
public interface GetAppPlatformCallback {
void AppPlatform(int platform);
}

View File

@@ -19,7 +19,7 @@ import java.util.List;
public class SysSettingUtils {
private static final String TAG = "SysSettingUtils";
private static final String TAG = SysSettingUtils.class.getSimpleName();
public SysSettingUtils() {
@@ -446,7 +446,11 @@ public class SysSettingUtils {
private static void setTF(Context context, JSONObject jsonObject) {
try {
//tfmedia开关
int setting_tfmedia = changeNum(jsonObject.getInteger("setting_tfmedia"));
// TODO: 2021/5/24 正式后台暂时无法修改
int setting_tfmedia = jsonObject.getInteger("setting_tfmedia");
if (JGYUtils.isOfficialVersion()||JGYUtils.isBetaVersion()) {
setting_tfmedia = changeNum(setting_tfmedia);
}
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(),
"qch_tfmedia_forbid", setting_tfmedia);
Log.e("SystemSetting", "setting_tfmedia---------" + qch_tfmedia_forbid);

View File

@@ -11,6 +11,8 @@ import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -30,7 +32,7 @@ import okhttp3.Response;
public class URLUtils {
private static String TAG = URLUtils.class.getSimpleName();
private Context mContext;
private List<String> baseURLList = new ArrayList<>();
private HashSet<String> baseURLList = new HashSet<>();
public URLUtils(Context context) {
this.mContext = context;
@@ -41,22 +43,25 @@ public class URLUtils {
String whiteList = "";
if (isOld) {
whiteList = Settings.System.getString(mContext.getContentResolver(), "DeselectBrowserArray");
Log.e(TAG, "setBrowserList: "+ "DeselectBrowserArray");
Log.e(TAG, "setBrowserList: "+ whiteList);
} else {
whiteList = Settings.System.getString(mContext.getContentResolver(), "BlackBrowserArray");
Log.e(TAG, "setBrowserList: "+ "BlackBrowserArray");
Log.e(TAG, "setBrowserList: "+whiteList );
}
if (TextUtils.isEmpty(whiteList)) {
Log.e(TAG, "getBrowserWhiteList: " + "whiteList is empty");
} else {
List<String> URLList = new ArrayList<>(Arrays.asList(whiteList.split(",")));
HashSet<String> URLList = new HashSet<>(Arrays.asList(whiteList.split(",")));
Observable.create(new ObservableOnSubscribe<String>() {
@Override
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
baseURLList.clear();
baseURLList.addAll(URLList);
for (String url : URLList) {
if (TextUtils.isEmpty(url)){
continue;
}
if (url.startsWith("http://")) {
String noHttp = url.substring(7);
if (!baseURLList.contains(noHttp)) {

View File

@@ -99,6 +99,8 @@ import io.reactivex.schedulers.Schedulers;
public class Utils {
private static String TAG = Utils.class.getSimpleName();
// MD5 设备地址标识
public static String getMAC(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // 如果当前设备系统大于等于6.0 使用下面的方法
@@ -815,7 +817,7 @@ public class Utils {
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class, String.class);
value = (String) (get.invoke(c, key, "unknown"));
value = (String) (get.invoke(c, key, defaultValue));
} catch (Exception e) {
e.printStackTrace();
} finally {
@@ -871,6 +873,7 @@ public class Utils {
/**
* 更新应用白名单禁止升级
*
* @param context
* @param banList
* @param notList
@@ -930,6 +933,7 @@ public class Utils {
/**
* 重启设备
*
* @param context
*/
public static void rebootDevices(Context context) {
@@ -950,6 +954,7 @@ public class Utils {
/**
* 主要的下载
*
* @param context
* @param url
* @param jsonObject
@@ -1157,8 +1162,8 @@ public class Utils {
String device = Build.MODEL;//机型
String imei = getIMEI(context);
String system_version = Build.VERSION.RELEASE;
String firmware_version = getProperty("ro.build.display.id", "获取失败");
String rom = getProperty("ro.custom.build.version", "获取失败");
String firmware_version = getRomVersion();
String rom = Utils.getCustomVersion();
String screen_rate = getAndroiodScreenProperty(context);
JSONObject jsonObject = new JSONObject();
jsonObject.put("device", device);
@@ -1168,6 +1173,7 @@ public class Utils {
jsonObject.put("rom", rom);
jsonObject.put("screen_rate", screen_rate);
String jsonString = jsonObject.toJSONString();
Log.e(TAG, "getMachine: " + jsonString);
return jsonString;
}
@@ -1186,6 +1192,7 @@ public class Utils {
jsonObject.put("storage", storage);
jsonObject.put("CPU", CPU + "");
String jsonString = jsonObject.toJSONString();
Log.e(TAG, "getHardware: " + jsonString);
return jsonString;
}
@@ -1406,6 +1413,21 @@ public class Utils {
return Formatter.formatFileSize(context, availableSize);
}
public static String getCustomVersion() {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform) {
return Utils.getProperty("ro.build.display.id", "获取失败");
} else {
return Utils.getProperty("ro.custom.build.version", "获取失败");
}
}
public static String getRomVersion() {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform) {
return getProperty("ro.build.id", "获取失败");
} else {
return getProperty("ro.build.display.id", "获取失败");
}
}
}

View File

@@ -1,7 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()

172
gradlew vendored Normal file
View File

@@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
gradlew.bat vendored Normal file
View File

@@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -4,6 +4,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue May 11 10:12:21 CST 2021
ndk.dir=F\:\\AndroidSDK\\ndk\\20.0.5594570
sdk.dir=F\:\\AndroidSDK
#Wed May 19 15:52:12 CST 2021
sdk.dir=G\:\\AndroidSDK