version:
update:2021.03.31 fix:修复推送没有自启,开机动画后台对接 add:
This commit is contained in:
@@ -9,11 +9,11 @@ def releaseTime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 29
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.jiaoguanyi.appstore"
|
applicationId "com.jiaoguanyi.appstore"
|
||||||
minSdkVersion 20
|
minSdkVersion 20
|
||||||
targetSdkVersion 30
|
targetSdkVersion 29
|
||||||
|
|
||||||
// versionCode 105
|
// versionCode 105
|
||||||
// versionName "3.1.0"//测试jiaoguanyi.cn
|
// versionName "3.1.0"//测试jiaoguanyi.cn
|
||||||
@@ -105,8 +105,8 @@ android {
|
|||||||
|
|
||||||
newl {
|
newl {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 167
|
// versionCode 167
|
||||||
// versionCode 1031
|
versionCode 1033
|
||||||
versionName "1.2.7"
|
versionName "1.2.7"
|
||||||
/*********************************极光推送************************************/
|
/*********************************极光推送************************************/
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
|
|||||||
@@ -324,6 +324,11 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSystemSettingFinished() {
|
public void setSystemSettingFinished() {
|
||||||
|
mPresenter.setLogoImg();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLogoImgFinished() {
|
||||||
netWorkIsRunning = false;
|
netWorkIsRunning = false;
|
||||||
Log.e(TAG, "SettingFinished: " + (System.currentTimeMillis() - timeMillis) + " ms");
|
Log.e(TAG, "SettingFinished: " + (System.currentTimeMillis() - timeMillis) + " ms");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ public class MainContact {
|
|||||||
//获取第三方应用内部网页跳转屏蔽结束
|
//获取第三方应用内部网页跳转屏蔽结束
|
||||||
void setSystemSettingFinished();
|
void setSystemSettingFinished();
|
||||||
//获取系统其他管控设置结束
|
//获取系统其他管控设置结束
|
||||||
|
void setLogoImgFinished ();
|
||||||
|
//设置开机动画
|
||||||
/*
|
/*
|
||||||
* MainService
|
* MainService
|
||||||
* */
|
* */
|
||||||
@@ -116,6 +118,8 @@ public class MainContact {
|
|||||||
//获取第三方应用内部网页跳转屏蔽
|
//获取第三方应用内部网页跳转屏蔽
|
||||||
void setSystemSetting();
|
void setSystemSetting();
|
||||||
//获取系统其他管控设置
|
//获取系统其他管控设置
|
||||||
|
void setLogoImg();
|
||||||
|
//设置开机动画
|
||||||
/*
|
/*
|
||||||
* MainService
|
* MainService
|
||||||
* */
|
* */
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ import com.jiaoguanyi.appstore.bean.BaseResponse;
|
|||||||
import com.jiaoguanyi.appstore.bean.Batch;
|
import com.jiaoguanyi.appstore.bean.Batch;
|
||||||
import com.jiaoguanyi.appstore.bean.BrowserBookmarks;
|
import com.jiaoguanyi.appstore.bean.BrowserBookmarks;
|
||||||
import com.jiaoguanyi.appstore.bean.BrowserData;
|
import com.jiaoguanyi.appstore.bean.BrowserData;
|
||||||
|
import com.jiaoguanyi.appstore.bean.Desktop;
|
||||||
import com.jiaoguanyi.appstore.bean.ForceDownloadBean;
|
import com.jiaoguanyi.appstore.bean.ForceDownloadBean;
|
||||||
|
import com.jiaoguanyi.appstore.bean.LogoImg;
|
||||||
import com.jiaoguanyi.appstore.bean.NetAndLaunchBean;
|
import com.jiaoguanyi.appstore.bean.NetAndLaunchBean;
|
||||||
import com.jiaoguanyi.appstore.bean.StudentsInfo;
|
import com.jiaoguanyi.appstore.bean.StudentsInfo;
|
||||||
import com.jiaoguanyi.appstore.jpush.TagAliasOperatorHelper;
|
import com.jiaoguanyi.appstore.jpush.TagAliasOperatorHelper;
|
||||||
@@ -1075,6 +1077,49 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLogoImg() {
|
||||||
|
NetInterfaceManager.getInstance()
|
||||||
|
.getLogoImgObservable()
|
||||||
|
.subscribe(new Observer<BaseResponse<LogoImg>>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
Log.e("setLogoImg", "onSubscribe: ");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseResponse<LogoImg> logoImgBaseResponse) {
|
||||||
|
Log.e("setLogoImg", "onNext: ");
|
||||||
|
if (logoImgBaseResponse.code == 200) {
|
||||||
|
LogoImg logoImg = logoImgBaseResponse.data;
|
||||||
|
String file_url = logoImg.getFile_url();
|
||||||
|
String file_md5 = logoImg.getFile_md5();
|
||||||
|
String batch = logoImg.getBatch();
|
||||||
|
if (TextUtils.isEmpty(file_url)) {
|
||||||
|
Log.e("setLogoImg", "onNext: file_url is empty");
|
||||||
|
} else {
|
||||||
|
JGYUtils.getInstance().checkBootFile(file_url, file_md5);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e("setLogoImg", "onNext: ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
onComplete();
|
||||||
|
Log.e("setLogoImg", "onError: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Log.e("setLogoImg", "onComplete: ");
|
||||||
|
mView.setLogoImgFinished();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getScreenLockState() {
|
public void getScreenLockState() {
|
||||||
String channel_value = JGYUtils.getInstance().getStringMetaData();
|
String channel_value = JGYUtils.getInstance().getStringMetaData();
|
||||||
@@ -1127,21 +1172,27 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
}
|
}
|
||||||
NetInterfaceManager.getInstance()
|
NetInterfaceManager.getInstance()
|
||||||
.getDesktopObservable()
|
.getDesktopObservable()
|
||||||
.subscribe(new Observer<BaseResponse>() {
|
.subscribe(new Observer<ResponseBody>() {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
Log.e("getDefaultDesktop", "onSubscribe: ");
|
Log.e("getDefaultDesktop", "onSubscribe: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NonNull BaseResponse response) {
|
public void onNext(@NonNull ResponseBody responseBody) {
|
||||||
Log.e("getDefaultDesktop", "onNext: ");
|
Log.e("getDefaultDesktop", "onNext: ");
|
||||||
if (response.code == 200) {
|
try {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(response.data.toString());
|
JSONObject jsonObject = JSONObject.parseObject(responseBody.string());
|
||||||
JGYUtils.getInstance().installDesktop(jsonObject);
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
} else {
|
JGYUtils.getInstance().installDesktop(data);
|
||||||
Log.e("getDefaultDesktop", "onNext: " + response);
|
Log.e("getDefaultDesktop", "onNext: " + data.toJSONString());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Log.e("getDefaultDesktop", "onNext: IOException: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.jiaoguanyi.appstore.activity;
|
package com.jiaoguanyi.appstore.activity;
|
||||||
|
|
||||||
|
import android.app.StatusBarManager;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class BaseApplication extends MultiDexApplication{
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
if (SystemUtils.IsMainProcessName(this, Process.myPid())) {
|
if (SystemUtils.isMainProcessName(this, Process.myPid())) {
|
||||||
//非主进程不初始化
|
//非主进程不初始化
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public class BaseResponse<T> implements Serializable {
|
|||||||
public String msg;
|
public String msg;
|
||||||
public T data;
|
public T data;
|
||||||
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|||||||
43
app/src/main/java/com/jiaoguanyi/appstore/bean/Desktop.java
Normal file
43
app/src/main/java/com/jiaoguanyi/appstore/bean/Desktop.java
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package com.jiaoguanyi.appstore.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class Desktop implements Serializable {
|
||||||
|
private static final long serialVersionUID = 8747792657698028628L;
|
||||||
|
private String app_name;
|
||||||
|
private String app_url;
|
||||||
|
private String app_package;
|
||||||
|
private String app_version_code;
|
||||||
|
|
||||||
|
public String getApp_name() {
|
||||||
|
return app_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApp_name(String app_name) {
|
||||||
|
this.app_name = app_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApp_url() {
|
||||||
|
return app_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApp_url(String app_url) {
|
||||||
|
this.app_url = app_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApp_package() {
|
||||||
|
return app_package;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApp_package(String app_package) {
|
||||||
|
this.app_package = app_package;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApp_version_code() {
|
||||||
|
return app_version_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApp_version_code(String app_version_code) {
|
||||||
|
this.app_version_code = app_version_code;
|
||||||
|
}
|
||||||
|
}
|
||||||
34
app/src/main/java/com/jiaoguanyi/appstore/bean/LogoImg.java
Normal file
34
app/src/main/java/com/jiaoguanyi/appstore/bean/LogoImg.java
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package com.jiaoguanyi.appstore.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class LogoImg implements Serializable {
|
||||||
|
private static final long serialVersionUID = -225928093718933004L;
|
||||||
|
private String file_url;
|
||||||
|
private String file_md5;
|
||||||
|
private String batch;
|
||||||
|
|
||||||
|
public String getFile_url() {
|
||||||
|
return file_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFile_url(String file_url) {
|
||||||
|
this.file_url = file_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFile_md5() {
|
||||||
|
return file_md5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFile_md5(String file_md5) {
|
||||||
|
this.file_md5 = file_md5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBatch() {
|
||||||
|
return batch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBatch(String batch) {
|
||||||
|
this.batch = batch;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,9 @@ import com.jiaoguanyi.appstore.bean.Appground;
|
|||||||
import com.jiaoguanyi.appstore.bean.BaseResponse;
|
import com.jiaoguanyi.appstore.bean.BaseResponse;
|
||||||
import com.jiaoguanyi.appstore.bean.BrowserBookmarks;
|
import com.jiaoguanyi.appstore.bean.BrowserBookmarks;
|
||||||
import com.jiaoguanyi.appstore.bean.BrowserData;
|
import com.jiaoguanyi.appstore.bean.BrowserData;
|
||||||
|
import com.jiaoguanyi.appstore.bean.Desktop;
|
||||||
import com.jiaoguanyi.appstore.bean.ForceDownloadBean;
|
import com.jiaoguanyi.appstore.bean.ForceDownloadBean;
|
||||||
|
import com.jiaoguanyi.appstore.bean.LogoImg;
|
||||||
import com.jiaoguanyi.appstore.bean.NetAndLaunchBean;
|
import com.jiaoguanyi.appstore.bean.NetAndLaunchBean;
|
||||||
import com.jiaoguanyi.appstore.bean.StudentsInfo;
|
import com.jiaoguanyi.appstore.bean.StudentsInfo;
|
||||||
import com.jiaoguanyi.appstore.network.api.AppLimitApi;
|
import com.jiaoguanyi.appstore.network.api.AppLimitApi;
|
||||||
@@ -33,6 +35,7 @@ import com.jiaoguanyi.appstore.network.api.newapi.GetBatchApi;
|
|||||||
import com.jiaoguanyi.appstore.network.api.newapi.GetDesktopApi;
|
import com.jiaoguanyi.appstore.network.api.newapi.GetDesktopApi;
|
||||||
import com.jiaoguanyi.appstore.network.api.newapi.GetLockStateApi;
|
import com.jiaoguanyi.appstore.network.api.newapi.GetLockStateApi;
|
||||||
import com.jiaoguanyi.appstore.network.api.newapi.JpushTagsApi;
|
import com.jiaoguanyi.appstore.network.api.newapi.JpushTagsApi;
|
||||||
|
import com.jiaoguanyi.appstore.network.api.newapi.LogoImgApi;
|
||||||
import com.jiaoguanyi.appstore.network.api.newapi.MACAddressApi;
|
import com.jiaoguanyi.appstore.network.api.newapi.MACAddressApi;
|
||||||
import com.jiaoguanyi.appstore.network.api.newapi.ScreenLockStateApi;
|
import com.jiaoguanyi.appstore.network.api.newapi.ScreenLockStateApi;
|
||||||
import com.jiaoguanyi.appstore.network.api.newapi.SnTimeControl;
|
import com.jiaoguanyi.appstore.network.api.newapi.SnTimeControl;
|
||||||
@@ -270,7 +273,7 @@ public class NetInterfaceManager {
|
|||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse> getDesktopObservable() {
|
public Observable<ResponseBody> getDesktopObservable() {
|
||||||
return mRetrofit
|
return mRetrofit
|
||||||
.create(GetDesktopApi.class)
|
.create(GetDesktopApi.class)
|
||||||
.getDesktop(Utils.getSerial())
|
.getDesktop(Utils.getSerial())
|
||||||
@@ -286,6 +289,14 @@ public class NetInterfaceManager {
|
|||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Observable<BaseResponse<LogoImg>> getLogoImgObservable() {
|
||||||
|
return mRetrofit
|
||||||
|
.create(LogoImgApi.class)
|
||||||
|
.getLogoImg(Utils.getSerial())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -52,4 +52,6 @@ public class URLAddress {
|
|||||||
//获取顶部app管控
|
//获取顶部app管控
|
||||||
public final static String GET_SN_APP_TEST = HTTP_TAG_HEAD_NEW + "Sn/getSnAppTest";
|
public final static String GET_SN_APP_TEST = HTTP_TAG_HEAD_NEW + "Sn/getSnAppTest";
|
||||||
//获取测试app
|
//获取测试app
|
||||||
|
public final static String GET_LOGO_IMG = HTTP_TAG_HEAD_NEW + "Sn/getLogoImg";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
package com.jiaoguanyi.appstore.network.api.newapi;
|
package com.jiaoguanyi.appstore.network.api.newapi;
|
||||||
|
|
||||||
import com.jiaoguanyi.appstore.bean.BaseResponse;
|
|
||||||
import com.jiaoguanyi.appstore.network.URLAddress;
|
import com.jiaoguanyi.appstore.network.URLAddress;
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
public interface GetDesktopApi {
|
public interface GetDesktopApi {
|
||||||
@GET(URLAddress.GET_DESKTOP)
|
@GET(URLAddress.GET_DESKTOP)
|
||||||
Observable<BaseResponse> getDesktop(
|
Observable<ResponseBody> getDesktop(
|
||||||
@Query("sn") String sn
|
@Query("sn") String sn
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jiaoguanyi.appstore.network.api.newapi;
|
||||||
|
|
||||||
|
import com.jiaoguanyi.appstore.bean.BaseResponse;
|
||||||
|
import com.jiaoguanyi.appstore.bean.LogoImg;
|
||||||
|
import com.jiaoguanyi.appstore.network.URLAddress;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
public interface LogoImgApi {
|
||||||
|
@GET(URLAddress.GET_LOGO_IMG)
|
||||||
|
Observable<BaseResponse<LogoImg>> getLogoImg(
|
||||||
|
@Query("sn") String sn
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -31,6 +31,7 @@ import com.arialyy.annotations.Download;
|
|||||||
import com.arialyy.aria.core.Aria;
|
import com.arialyy.aria.core.Aria;
|
||||||
import com.arialyy.aria.core.download.DownloadEntity;
|
import com.arialyy.aria.core.download.DownloadEntity;
|
||||||
import com.arialyy.aria.core.task.DownloadTask;
|
import com.arialyy.aria.core.task.DownloadTask;
|
||||||
|
import com.jiaoguanyi.appstore.utils.JGYUtils;
|
||||||
import com.lzy.okgo.OkGo;
|
import com.lzy.okgo.OkGo;
|
||||||
import com.lzy.okgo.callback.StringCallback;
|
import com.lzy.okgo.callback.StringCallback;
|
||||||
import com.jiaoguanyi.appstore.KeepAliveConnection;
|
import com.jiaoguanyi.appstore.KeepAliveConnection;
|
||||||
@@ -284,6 +285,7 @@ public class GuardService extends Service {
|
|||||||
void taskComplete(DownloadTask task) {
|
void taskComplete(DownloadTask task) {
|
||||||
//在这里处理任务完成的状态
|
//在这里处理任务完成的状态
|
||||||
final String filepath = task.getFilePath();
|
final String filepath = task.getFilePath();
|
||||||
|
if (filepath.endsWith("apk")) {
|
||||||
final String packageName = task.getExtendField();
|
final String packageName = task.getExtendField();
|
||||||
Log.e("aria", "downloadPath::" + filepath);
|
Log.e("aria", "downloadPath::" + filepath);
|
||||||
Log.e("aria", "extendField::" + packageName);
|
Log.e("aria", "extendField::" + packageName);
|
||||||
@@ -340,6 +342,9 @@ public class GuardService extends Service {
|
|||||||
BaseApplication.getInstance().setDownloadState(false);
|
BaseApplication.getInstance().setDownloadState(false);
|
||||||
Log.e("aria", "isDownloading=" + BaseApplication.getInstance().isDownloading());
|
Log.e("aria", "isDownloading=" + BaseApplication.getInstance().isDownloading());
|
||||||
}
|
}
|
||||||
|
} else if (filepath.endsWith("zip")) {
|
||||||
|
JGYUtils.getInstance().setBootanimation(task.getFilePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Download.onTaskFail
|
@Download.onTaskFail
|
||||||
|
|||||||
@@ -62,24 +62,26 @@ public class MainService extends Service implements MainContact.MainView {
|
|||||||
mPresenter.detachView();
|
mPresenter.detachView();
|
||||||
}
|
}
|
||||||
|
|
||||||
long timeMillis;
|
long runningTime;
|
||||||
|
//执行所有请求的时间
|
||||||
|
|
||||||
long startCommandTime = 0;
|
long startCommandTime = 0;
|
||||||
|
//MainService上次执行时间
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
if ((SystemClock.elapsedRealtime() - startCommandTime) < 60000) {
|
if (MainActivity.isForeground){
|
||||||
|
Log.e(TAG, "onStartCommand: MainActivity: " + MainActivity.isForeground);
|
||||||
|
}else {
|
||||||
|
if (((SystemClock.elapsedRealtime() - startCommandTime) < 60000) ){
|
||||||
Log.e(TAG, "onStartCommand: " + "启动时间过短");
|
Log.e(TAG, "onStartCommand: " + "启动时间过短");
|
||||||
//一分钟内防止多次调用
|
//一分钟内防止多次调用
|
||||||
} else {
|
}else {
|
||||||
startCommandTime = SystemClock.elapsedRealtime();
|
|
||||||
if (MainActivity.isForeground) {
|
|
||||||
mPresenter.getFirstConnect();
|
mPresenter.getFirstConnect();
|
||||||
timeMillis = System.currentTimeMillis();
|
|
||||||
mPresenter.getLockedState();
|
mPresenter.getLockedState();
|
||||||
Log.e(TAG, "onStartCommand: " + (SystemClock.elapsedRealtime() - startCommandTime));
|
startCommandTime = runningTime = SystemClock.elapsedRealtime();
|
||||||
} else {
|
|
||||||
Log.e(TAG, "onStartCommand: isForeground: " + MainActivity.isForeground);
|
Log.e(TAG, "onStartCommand: isForeground: " + MainActivity.isForeground);
|
||||||
|
Log.e(TAG, "onStartCommand: " + (SystemClock.elapsedRealtime() - startCommandTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
@@ -420,8 +422,13 @@ public class MainService extends Service implements MainContact.MainView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSystemSettingFinished() {
|
public void setSystemSettingFinished() {
|
||||||
|
mPresenter.setLogoImg();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLogoImgFinished() {
|
||||||
netWorkIsRunning = false;
|
netWorkIsRunning = false;
|
||||||
Log.e(TAG, "SettingFinished: " + (System.currentTimeMillis() - timeMillis) + " ms");
|
Log.e(TAG, "SettingFinished: " + (SystemClock.elapsedRealtime() - runningTime) + " ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -10,12 +10,15 @@ import android.content.pm.PackageInfo;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.BatteryManager;
|
import android.os.BatteryManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.os.Environment;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.blankj.utilcode.util.FileUtils;
|
||||||
|
import com.blankj.utilcode.util.PathUtils;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.jiaoguanyi.appstore.BuildConfig;
|
import com.jiaoguanyi.appstore.BuildConfig;
|
||||||
import com.jiaoguanyi.appstore.base.BaseApplication;
|
import com.jiaoguanyi.appstore.base.BaseApplication;
|
||||||
@@ -26,6 +29,14 @@ import com.jiaoguanyi.appstore.bean.NetAndLaunchBean;
|
|||||||
import com.jiaoguanyi.appstore.bean.NetAndLaunchData;
|
import com.jiaoguanyi.appstore.bean.NetAndLaunchData;
|
||||||
import com.jiaoguanyi.appstore.comm.CommonDatas;
|
import com.jiaoguanyi.appstore.comm.CommonDatas;
|
||||||
|
|
||||||
|
import org.w3c.dom.Text;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -570,4 +581,53 @@ public class JGYUtils {
|
|||||||
String value = appInfo.metaData.getString("CHANNEL_VALUE");
|
String value = appInfo.metaData.getString("CHANNEL_VALUE");
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkBootFile(String url, String MD5) {
|
||||||
|
String urlFileName = Utils.getFileNamefromURL(url);
|
||||||
|
File bootFile = new File(PathUtils.getExternalDownloadsPath() + File.separator + "jgy" + File.separator + urlFileName);
|
||||||
|
if (bootFile.exists() && bootFile.isFile()) {
|
||||||
|
String oldMd5 = FileUtils.getFileMD5ToString(bootFile);
|
||||||
|
if (!TextUtils.isEmpty(oldMd5) && oldMd5.equalsIgnoreCase(MD5)) {
|
||||||
|
Log.e(TAG, "checkBootFile: Bootanimation file exists");
|
||||||
|
setBootanimation(bootFile.getAbsolutePath());
|
||||||
|
} else {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("MD5", MD5);
|
||||||
|
Utils.ariaDownload(mContext, url, jsonObject);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("MD5", MD5);
|
||||||
|
Utils.ariaDownload(mContext, url, jsonObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String BOOTANIMATION_PATH = "/data/local/qchmedia/bootanimation.zip";
|
||||||
|
|
||||||
|
public void setBootanimation(String filePath) {
|
||||||
|
File systemFile = new File(BOOTANIMATION_PATH);
|
||||||
|
File newFile = new File(filePath);
|
||||||
|
if (systemFile.exists() && systemFile.isFile()) {
|
||||||
|
String systemMD5 = FileUtils.getFileMD5ToString(systemFile);
|
||||||
|
String newMD5 = FileUtils.getFileMD5ToString(newFile);
|
||||||
|
if (systemMD5.equals(newMD5)) {
|
||||||
|
Log.e(TAG, "setBootanimation: 文件一致");
|
||||||
|
} else {
|
||||||
|
Path path = Paths.get(newFile.getAbsolutePath());
|
||||||
|
try {
|
||||||
|
Files.copy(path, new FileOutputStream(systemFile));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Path path = Paths.get(newFile.getAbsolutePath());
|
||||||
|
try {
|
||||||
|
Files.copy(path, new FileOutputStream(systemFile));
|
||||||
|
Log.e(TAG, "setBootanimation: 设置新开机动画");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class SysSettingUtils {
|
|||||||
|
|
||||||
public static void setEnableSetting(Context mContext) {
|
public static void setEnableSetting(Context mContext) {
|
||||||
setPhoneList(mContext,0);
|
setPhoneList(mContext,0);
|
||||||
setUSBstate(mContext,0);
|
// setUSBstate(mContext,0);
|
||||||
setBluetooth(mContext,0);
|
setBluetooth(mContext,0);
|
||||||
setHotspot(mContext,0);
|
setHotspot(mContext,0);
|
||||||
setBar(mContext,0);
|
setBar(mContext,0);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class SystemUtils {
|
public class SystemUtils {
|
||||||
|
|
||||||
public static boolean IsMainProcessName(Context cxt, int pid) {
|
public static boolean isMainProcessName(Context cxt, int pid) {
|
||||||
String packageName = cxt.getPackageName();
|
String packageName = cxt.getPackageName();
|
||||||
ActivityManager am = (ActivityManager) cxt.getSystemService(Context.ACTIVITY_SERVICE);
|
ActivityManager am = (ActivityManager) cxt.getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
List<ActivityManager.RunningAppProcessInfo> runningApps = am.getRunningAppProcesses();
|
List<ActivityManager.RunningAppProcessInfo> runningApps = am.getRunningAppProcesses();
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ import java.text.ParseException;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Administrator
|
||||||
|
* 时间管控工具类
|
||||||
|
*/
|
||||||
public class TimeUtils {
|
public class TimeUtils {
|
||||||
private static DateFormat df = new SimpleDateFormat("HH:mm");
|
private static DateFormat df = new SimpleDateFormat("HH:mm");
|
||||||
public static final String START_TIME_KEY = "START_TIME";
|
public static final String START_TIME_KEY = "START_TIME";
|
||||||
|
|||||||
@@ -1025,7 +1025,7 @@ public class Utils {
|
|||||||
context.startActivity(iReboot);
|
context.startActivity(iReboot);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getFileNamefromURL(String url) {
|
public static String getFileNamefromURL(String url) {
|
||||||
int position = url.lastIndexOf("/");
|
int position = url.lastIndexOf("/");
|
||||||
return url.substring(position + 1);
|
return url.substring(position + 1);
|
||||||
}
|
}
|
||||||
@@ -1378,7 +1378,7 @@ public class Utils {
|
|||||||
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
|
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
|
||||||
activityManager.getMemoryInfo(memoryInfo);
|
activityManager.getMemoryInfo(memoryInfo);
|
||||||
long freeMem = memoryInfo.totalMem - memoryInfo.availMem;
|
long freeMem = memoryInfo.totalMem - memoryInfo.availMem;
|
||||||
Log.e("getHardware", "getFreeMemory: " + freeMem);
|
// Log.e("getHardware", "getFreeMemory: " + freeMem);
|
||||||
return freeMem;
|
return freeMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1391,7 +1391,7 @@ public class Utils {
|
|||||||
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
|
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
|
||||||
activityManager.getMemoryInfo(memoryInfo);
|
activityManager.getMemoryInfo(memoryInfo);
|
||||||
Log.e("getHardware", "getFreeMemory: " + memoryInfo.totalMem);
|
// Log.e("getHardware", "getFreeMemory: " + memoryInfo.totalMem);
|
||||||
return memoryInfo.totalMem;
|
return memoryInfo.totalMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.jiaoguanyi.appstore.utils;
|
package com.jiaoguanyi.appstore.utils;
|
||||||
|
|
||||||
public class XApkUtils {
|
public class XAPKUtils {
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user