update:2020.12.23
fix:更换主页图标
add:
This commit is contained in:
2020-12-23 16:16:58 +08:00
parent ad3d6745b1
commit 63cc954eb9
16 changed files with 198 additions and 51 deletions

View File

@@ -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");

View File

@@ -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");
//

View File

@@ -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>() {

View File

@@ -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")

View File

@@ -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);

View File

@@ -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"));

View File

@@ -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";
//获取默认桌面升级
}

View File

@@ -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());
}

View File

@@ -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", "屏幕密度dpi120 / 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", "屏幕密度dpi120 / 160 / 240" + densityDpi);
// Log.e("h_bl", "屏幕宽度dp" + screenWidth);
// Log.e("h_bl", "屏幕dp" + screenHeight);
return width + "×" + height;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -18,39 +18,41 @@
<TextView
android:id="@+id/textView3"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="我的设备"
android:textColor="#000000"
android:textColor="@color/title_textcolor"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/back"
android:layout_width="@dimen/dp_16"
android:layout_height="@dimen/dp_16"
android:layout_marginStart="@dimen/dp_8"
android:layout_marginLeft="4dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/textView3"
app:layout_constraintTop_toTopOf="@+id/textView3" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/locked"
android:layout_width="@dimen/dp_16"
android:layout_height="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_8"
android:layout_marginLeft="10dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/locked"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/textView3"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="@+id/textView3"
app:layout_constraintStart_toEndOf="@+id/textView3"
app:layout_constraintTop_toTopOf="@+id/textView3" />
</android.support.constraint.ConstraintLayout>

View File

@@ -19,39 +19,41 @@
<TextView
android:id="@+id/textView3"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="我的设备"
android:textColor="#000000"
android:textColor="@color/title_textcolor"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/back"
android:layout_width="@dimen/dp_16"
android:layout_height="@dimen/dp_16"
android:layout_marginStart="@dimen/dp_8"
android:adjustViewBounds="true"
android:layout_marginLeft="4dp"
android:scaleType="centerCrop"
android:src="@drawable/back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/textView3"
app:layout_constraintTop_toTopOf="@+id/textView3" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/locked"
android:layout_width="@dimen/dp_16"
android:layout_height="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_8"
android:layout_marginLeft="10dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/locked"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/textView3"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="@+id/textView3"
app:layout_constraintStart_toEndOf="@+id/textView3"
app:layout_constraintTop_toTopOf="@+id/textView3" />
</android.support.constraint.ConstraintLayout>

View File

@@ -45,7 +45,8 @@
<color name="main_text_color">#ff797979</color>
<color name="main_green_color">#55b68a</color>
<color name="appstore_selecte_color">#8f82bc</color>
<color name="check_update_color">#f93191</color>
<color name="check_update_color">#4880ff</color>
<color name="check_update_color_pressed">#FF47A0</color>
<color name="title_textcolor">#494949</color>
</resources>