version:
update:2020.12.23 fix:更换主页图标 add:
This commit is contained in:
@@ -225,6 +225,8 @@ public class MyApplication extends MultiDexApplication {
|
||||
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());
|
||||
} else {
|
||||
//定位失败
|
||||
sb.append("定位失败" + "\n");
|
||||
|
||||
@@ -194,7 +194,23 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
// Utils.queryStorage();
|
||||
// Utils.shotScreen(this);
|
||||
HTTPInterface.updateDeviceInfo(this);
|
||||
testFilepath();
|
||||
}
|
||||
|
||||
private void testFilepath() {
|
||||
File file = new File("/system/media/bootanimation.zip");
|
||||
if (file.exists()) {
|
||||
Log.e("testFilepath", "exists");
|
||||
} else {
|
||||
Log.e("testFilepath", "not exists");
|
||||
}
|
||||
File file2 = new File("/system/media/bootanimation1.zip");
|
||||
try {
|
||||
file2.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("testFilepath", "createNewFile:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1115,8 +1131,10 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
private void writeAppPackageList(String result) {
|
||||
String appstore = "com.jiaoguanyi.appstore";
|
||||
String store = "com.jiaoguanyi.store";
|
||||
String iflytek = "iflytek.eface2sdk";
|
||||
// String iflytek = "iflytek.eface2sdk";
|
||||
// String iflytek = "com.estrongs.android.pop";
|
||||
String jgy1 = "com.uiuios.jgy1";
|
||||
String jgy2 = "com.uiuios.jgy2";
|
||||
if (!TextUtils.isEmpty(result)) {
|
||||
LogUtils.e(result);
|
||||
if (!result.contains(appstore)) {
|
||||
@@ -1125,9 +1143,15 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
if (!result.contains(store)) {
|
||||
result = result + "," + store;
|
||||
}
|
||||
if (!result.contains(iflytek)) {
|
||||
result = result + "," + iflytek;
|
||||
if (!result.contains(jgy1)) {
|
||||
result = result + "," + jgy1;
|
||||
}
|
||||
if (!result.contains(jgy2)) {
|
||||
result = result + "," + jgy2;
|
||||
}
|
||||
// if (!result.contains(iflytek)) {
|
||||
// result = result + "," + iflytek;
|
||||
// }
|
||||
//人脸识别
|
||||
boolean b = Settings.System.putString(getContentResolver(), "qch_app_forbid", result);
|
||||
Log.e("mjsheng", "qch_app_forbid is :" + b + Settings.System.getString(getContentResolver(), "qch_app_forbid"));
|
||||
@@ -1914,6 +1938,9 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
sb.append("位置: " + aMapLocation.getAddress() + "\n");
|
||||
// sb.append("经 度 : " + location.getLongitude() + "\n");
|
||||
// sb.append("纬 度 : " + location.getLatitude() + "\n");
|
||||
SPUtils.put(this, "longitude", aMapLocation.getLongitude());
|
||||
SPUtils.put(this, "latitude", aMapLocation.getLatitude());
|
||||
|
||||
// sb.append("精 度 : " + location.getAccuracy() + "米" + "\n");
|
||||
// sb.append("提供者 : " + location.getProvider() + "\n");
|
||||
//
|
||||
|
||||
@@ -546,7 +546,6 @@ public class HTTPInterface {
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
Log.e("fht", "setBrowserList" + e.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -754,13 +753,21 @@ public class HTTPInterface {
|
||||
|
||||
|
||||
public static void updateDeviceInfo(Context context) {
|
||||
String address = String.valueOf(SPUtils.get(context, "AmapAddress", "-"));
|
||||
String longitude = String.valueOf(SPUtils.get(context, "longitude", "0"));
|
||||
String latitude = String.valueOf(SPUtils.get(context, "latitude", "0"));
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("address", address);
|
||||
jsonObject.put("longitude", longitude);
|
||||
jsonObject.put("latitude", latitude);
|
||||
UpdateDeviceInfo updateDeviceInfo = Network.getUpdateDeviceInfo();
|
||||
updateDeviceInfo.updateDeviceInfo(
|
||||
Utils.getSerial(),
|
||||
Configure.HTTP_KEY,
|
||||
Utils.getMachine(context),
|
||||
Utils.getHardware(context),
|
||||
String.valueOf(SPUtils.get(context, "AmapAddress", "-")))
|
||||
jsonObject.toJSONString()
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
HTTPInterface.updateDeviceInfo(context);
|
||||
startService(context);
|
||||
} else if (
|
||||
intent.getAction().equals("android.intent.action.BATTERY_CHANGED")
|
||||
intent.getAction().equals("android.intent.action.BroadcastReceiver")
|
||||
|| intent.getAction().equals("android.intent.action.BATTERY_CHANGED")
|
||||
|| intent.getAction().equals("android.intent.action.BATTERY_LOW")
|
||||
|| intent.getAction().equals("android.intent.action.BATTERY_OKAY")
|
||||
|
||||
@@ -20,6 +20,9 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
import com.amap.api.location.AMapLocationListener;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.blankj.utilcode.util.AppUtils;
|
||||
import com.blankj.utilcode.util.EncryptUtils;
|
||||
@@ -41,6 +44,7 @@ import com.mjsheng.myappstore.utils.ApkUtils;
|
||||
import com.mjsheng.myappstore.utils.CmdUtil;
|
||||
import com.mjsheng.myappstore.utils.Configure;
|
||||
import com.mjsheng.myappstore.utils.MySQLData;
|
||||
import com.mjsheng.myappstore.utils.SPUtils;
|
||||
import com.mjsheng.myappstore.utils.SaveListUtils;
|
||||
import com.mjsheng.myappstore.utils.ServiceAliveUtils;
|
||||
import com.mjsheng.myappstore.utils.SysSettingUtils;
|
||||
@@ -299,19 +303,39 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
Utils.rebootDevices(mContext);
|
||||
break;
|
||||
case GET_DEVICES_INFO:
|
||||
HTTPInterface.updateDeviceInfo(mContext);
|
||||
AMapLocationClient aMapLocationClient = MyApplication.getLocationClient();
|
||||
aMapLocationClient.stopLocation();
|
||||
aMapLocationClient.startLocation();
|
||||
aMapLocationClient.setLocationListener(new AMapLocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(AMapLocation aMapLocation) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
//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());
|
||||
} else {
|
||||
//定位失败
|
||||
sb.append("定位失败" + "\n");
|
||||
SPUtils.put(context, "AmapError", aMapLocation.getErrorInfo());
|
||||
}
|
||||
HTTPInterface.updateDeviceInfo(mContext);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case LOCK_SCREEN:
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(extras);
|
||||
String name = jSONObject.getString("name");
|
||||
setLock_screen(1,context,name);
|
||||
setLock_screen(1, context, name);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case UNLOCK_SCREEN:
|
||||
setLock_screen(0,context,"");
|
||||
setLock_screen(0, context, "");
|
||||
break;
|
||||
case KILL_SERVER:
|
||||
try {
|
||||
@@ -368,7 +392,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
private BluetoothAdapter mBluetoothAdapter;
|
||||
|
||||
private void SettingSysData(String extras) {
|
||||
SysSettingUtils.setSystemSetting(mContext,extras);
|
||||
SysSettingUtils.setSystemSetting(mContext, extras);
|
||||
// try {
|
||||
// JSONObject data = new JSONObject(extras);
|
||||
// int setting_call = changeNum(data.optInt("setting_call"));
|
||||
@@ -1084,6 +1108,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
private void writeAppPackageList(String result) {
|
||||
String appstore = "com.jiaoguanyi.appstore";
|
||||
String store = "com.jiaoguanyi.store";
|
||||
String jgy1 = "com.uiuios.jgy1";
|
||||
String jgy2 = "com.uiuios.jgy2";
|
||||
if (!TextUtils.isEmpty(result)) {
|
||||
LogUtils.e(result);
|
||||
if (!result.contains(appstore)) {
|
||||
@@ -1092,6 +1118,12 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
if (!result.contains(store)) {
|
||||
result = result + "," + store;
|
||||
}
|
||||
if (!result.contains(jgy1)) {
|
||||
result = result + "," + jgy1;
|
||||
}
|
||||
if (!result.contains(jgy2)) {
|
||||
result = result + "," + jgy2;
|
||||
}
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_app_forbid", result);
|
||||
Log.e("mjsheng", "qch_app_forbid " + result);
|
||||
|
||||
|
||||
@@ -317,11 +317,78 @@ public class InitJpushServer extends Service {
|
||||
@Override
|
||||
public void call(Long aLong) {
|
||||
checkUpdate();
|
||||
getDefaultDesktop();
|
||||
getLockedState();//
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getDefaultDesktop() {
|
||||
OkGo.get(Configure.GET_DESKTOP)
|
||||
.params("sn", Utils.getSerial())
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, Response response) {
|
||||
Log.e("getDefaultDesktop", "onSuccess: "+s );
|
||||
try {
|
||||
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(s);
|
||||
int code = jsonObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
com.alibaba.fastjson.JSONObject data = jsonObject.getJSONObject("data");
|
||||
installDesktop(data);
|
||||
} else {
|
||||
Log.e("getDefaultDesktop", "onSuccess: " + "没有部署桌面");
|
||||
}
|
||||
}catch (Exception e){
|
||||
Log.e("Exception", "onSuccess: "+e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Call call, Response response, Exception e) {
|
||||
super.onError(call, response, e);
|
||||
Log.e("fht", "onError: " + e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void installDesktop(com.alibaba.fastjson.JSONObject jsonObject) {
|
||||
String app_name = jsonObject.getString("app_name");
|
||||
String app_url = jsonObject.getString("app_url");
|
||||
String app_package = jsonObject.getString("app_package");
|
||||
int app_version_code = jsonObject.getInteger("app_version_code");
|
||||
PackageInfo info = null;
|
||||
PackageManager packageManager = getPackageManager();
|
||||
if (null != packageManager) {
|
||||
try {
|
||||
info = packageManager.getPackageInfo(app_package, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("fht", "installDesktop: " + e.getMessage());
|
||||
}
|
||||
if (null != info) {
|
||||
long versionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
versionCode = info.getLongVersionCode();
|
||||
} else {
|
||||
versionCode = info.versionCode;
|
||||
}
|
||||
if (app_version_code > versionCode) {
|
||||
if (!SaveListUtils.isDownLoading(app_url)) {
|
||||
Utils.ariaDownload(InitJpushServer.this, app_url, jsonObject);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!SaveListUtils.isDownLoading(app_url)) {
|
||||
Utils.ariaDownload(InitJpushServer.this, app_url, jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void getDeselectID() {
|
||||
DeselectIDApi deselectIDApi = Network.getDeselectIDApi();
|
||||
@@ -467,6 +534,8 @@ public class InitJpushServer extends Service {
|
||||
ApkUtils.addShortcut(this, result);//开机之后添加图标到桌面
|
||||
String appstore = "com.jiaoguanyi.appstore";
|
||||
String store = "com.jiaoguanyi.store";
|
||||
String jgy1 = "com.uiuios.jgy1";
|
||||
String jgy2 = "com.uiuios.jgy2";
|
||||
if (!TextUtils.isEmpty(result)) {
|
||||
LogUtils.e(result);
|
||||
if (!result.contains(appstore)) {
|
||||
@@ -475,6 +544,12 @@ public class InitJpushServer extends Service {
|
||||
if (!result.contains(store)) {
|
||||
result = result + "," + store;
|
||||
}
|
||||
if (!result.contains(jgy1)) {
|
||||
result = result + "," + jgy1;
|
||||
}
|
||||
if (!result.contains(jgy2)) {
|
||||
result = result + "," + jgy2;
|
||||
}
|
||||
Settings.System.putString(getContentResolver(), "qch_app_forbid", result);
|
||||
Log.e("mjsheng", "qch_app_forbid :" + result);
|
||||
} else {
|
||||
@@ -1076,7 +1151,7 @@ public class InitJpushServer extends Service {
|
||||
|
||||
private void SettingSysData(JSONObject data) {
|
||||
SPUtils.put(InitJpushServer.this, "first_connect", 1);
|
||||
SysSettingUtils.setSystemSetting(InitJpushServer.this,data.toString());
|
||||
SysSettingUtils.setSystemSetting(InitJpushServer.this, data.toString());
|
||||
|
||||
// try {
|
||||
// int setting_call = changeNum(data.optInt("setting_call"));
|
||||
|
||||
@@ -213,4 +213,7 @@ public class Configure {
|
||||
//上传我的设备
|
||||
public final static String GET_LOCK_SCREEN_STATE = HTTP_TAG_HEAD_NEW + "Sn/getSnScreen";
|
||||
//获取霸屏状态
|
||||
public final static String GET_DESKTOP = HTTP_TAG_HEAD_NEW + "Sn/getSnDesktop";
|
||||
//获取默认桌面升级
|
||||
|
||||
}
|
||||
|
||||
@@ -94,20 +94,20 @@ public class SysSettingUtils {
|
||||
//设置电话功能,电话白名单
|
||||
int setting_call = changeNum(jsonObject.getInteger("setting_call"));
|
||||
boolean qch_call_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_call_forbid", setting_call);
|
||||
Log.e("SystemSetting", "qch_call_forbid---------" + qch_call_forbid);
|
||||
Log.e("SystemSetting", "qch_call_forbid:" + qch_call_forbid);
|
||||
|
||||
int setting_phone = changeNum(jsonObject.getInteger("setting_phone"));
|
||||
boolean qch_white_list_on = Settings.System.putInt(mContext.getContentResolver(), "qch_white_list_on", setting_phone);
|
||||
Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
|
||||
Log.e("SystemSetting", "qch_white_list_on:" + qch_white_list_on);
|
||||
|
||||
String setting_phones = jsonObject.getString("setting_phones");
|
||||
boolean qch_white_list_Array = Settings.System.putString(mContext.getContentResolver(), "qch_white_list_Array", setting_phones);
|
||||
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
|
||||
Log.e("SystemSetting", "qch_white_list_Array---------" + qch_white_list_Array + "---" + setting_phones);
|
||||
Log.e("SystemSetting", "qch_white_list_Array:" + qch_white_list_Array + "---" + setting_phones);
|
||||
|
||||
int setting_memory = changeNum(jsonObject.getInteger("setting_memory"));
|
||||
boolean qch_sdcard_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
|
||||
Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
|
||||
Log.e("SystemSetting", "qch_sdcard_forbid_on:" + qch_sdcard_forbid_on);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setPhoneList: " + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -943,7 +943,6 @@ public class Utils {
|
||||
MySQLData.SetBooleanData(context, CommonDatas.IS_RESET, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
synchronized private static int getBatteryLevel(Context mContext) {
|
||||
@@ -1018,9 +1017,7 @@ public class Utils {
|
||||
|
||||
private static String getMD5fromFileName(String fileName) {
|
||||
int position = fileName.lastIndexOf("/");
|
||||
|
||||
return fileName.substring(position + 9, fileName.length() - 4);
|
||||
|
||||
}
|
||||
|
||||
public static void ariaDownload(Context context, String url, JSONObject jsonObject) {
|
||||
@@ -1170,13 +1167,12 @@ public class Utils {
|
||||
int screenWidth = (int) (width / density); // 屏幕宽度(dp)
|
||||
int screenHeight = (int) (height / density);// 屏幕高度(dp)
|
||||
|
||||
|
||||
Log.e("h_bl", "屏幕宽度(像素):" + width);
|
||||
Log.e("h_bl", "屏幕高度(像素):" + height);
|
||||
Log.e("h_bl", "屏幕密度(0.75 / 1.0 / 1.5):" + density);
|
||||
Log.e("h_bl", "屏幕密度dpi(120 / 160 / 240):" + densityDpi);
|
||||
Log.e("h_bl", "屏幕宽度(dp):" + screenWidth);
|
||||
Log.e("h_bl", "屏幕高度(dp):" + screenHeight);
|
||||
// Log.e("h_bl", "屏幕宽度(像素):" + width);
|
||||
// Log.e("h_bl", "屏幕高度(像素):" + height);
|
||||
// Log.e("h_bl", "屏幕密度(0.75 / 1.0 / 1.5):" + density);
|
||||
// Log.e("h_bl", "屏幕密度dpi(120 / 160 / 240):" + densityDpi);
|
||||
// Log.e("h_bl", "屏幕宽度(dp):" + screenWidth);
|
||||
// Log.e("h_bl", "屏幕高度(dp):" + screenHeight);
|
||||
return width + "×" + height;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user