version:2.0.8
update: fix:修复文件格式管理失效,展锐平台定位失败问题,增加获取展锐平台系统版本,展锐平台隐藏相机和信息失败 add:
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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");//通讯录
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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", "获取失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user