version:1.1.1
fix: update:修复报错,优化推送
This commit is contained in:
@@ -50,8 +50,8 @@ android {
|
|||||||
minSdkVersion 26
|
minSdkVersion 26
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
|
|
||||||
versionCode 9
|
versionCode 12
|
||||||
versionName "1.0.8"
|
versionName "1.1.1"
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
//选择要添加的对应 cpu 类型的 .so 库。
|
//选择要添加的对应 cpu 类型的 .so 库。
|
||||||
|
|||||||
@@ -426,10 +426,10 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
|||||||
setWorkspaceLoading(true);
|
setWorkspaceLoading(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDefaultHome()) {
|
// if (!isDefaultHome()) {
|
||||||
// setDefaultL();
|
// setDefaultL();
|
||||||
setRoleHolderAsUser(this, BuildConfig.APPLICATION_ID);
|
setRoleHolderAsUser(this, BuildConfig.APPLICATION_ID);
|
||||||
}
|
// }
|
||||||
SharedPreferences sharedPref = getPreferences(MODE_PRIVATE);
|
SharedPreferences sharedPref = getPreferences(MODE_PRIVATE);
|
||||||
int i = sharedPref.getInt("SetWallPaper", 0);
|
int i = sharedPref.getInt("SetWallPaper", 0);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
|
|||||||
@@ -538,6 +538,9 @@ public class RunningAppManager {
|
|||||||
}
|
}
|
||||||
boolean havaConfigure = TimeControlManager.getInstance().havaConfigure(pkg);
|
boolean havaConfigure = TimeControlManager.getInstance().havaConfigure(pkg);
|
||||||
TimeManageSn machineControl = TimeControlManager.getInstance().getGlobalMachineControl();
|
TimeManageSn machineControl = TimeControlManager.getInstance().getGlobalMachineControl();
|
||||||
|
if (machineControl == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Log.e(TAG, "inControlTime: globalRemainingTime = " + globalRemainingTime);
|
Log.e(TAG, "inControlTime: globalRemainingTime = " + globalRemainingTime);
|
||||||
if (globalRemainingTime <= 0) {
|
if (globalRemainingTime <= 0) {
|
||||||
@@ -684,6 +687,9 @@ public class RunningAppManager {
|
|||||||
}
|
}
|
||||||
boolean havaConfigure = TimeControlManager.getInstance().havaConfigure(pkg);
|
boolean havaConfigure = TimeControlManager.getInstance().havaConfigure(pkg);
|
||||||
TimeManageSn machineControl = TimeControlManager.getInstance().getGlobalMachineControl();
|
TimeManageSn machineControl = TimeControlManager.getInstance().getGlobalMachineControl();
|
||||||
|
if (machineControl == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (havaConfigure) {
|
if (havaConfigure) {
|
||||||
//有单独设置 不管是分类整机还是其他都是这个设置
|
//有单独设置 不管是分类整机还是其他都是这个设置
|
||||||
|
|||||||
@@ -107,8 +107,13 @@ public class TimeControlManager {
|
|||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
Type Type = new TypeToken<TimeManageSn>() {
|
Type Type = new TypeToken<TimeManageSn>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
|
try {
|
||||||
TimeManageSn machineControl = gson.fromJson(jsonString, Type);
|
TimeManageSn machineControl = gson.fromJson(jsonString, Type);
|
||||||
return machineControl;
|
return machineControl;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "getGlobalMachineControl: " + e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return mGlobalMachineControl;
|
return mGlobalMachineControl;
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import android.content.Context;
|
|||||||
|
|
||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.uiuipad.os.disklrucache.CacheHelper;
|
import com.uiuipad.os.disklrucache.CacheHelper;
|
||||||
import com.uiuipad.os.network.api.CloudLessonAppApi;
|
|
||||||
import com.uiuipad.os.network.api.CloudLessonSettingApi;
|
|
||||||
import com.uiuipad.os.network.api.TimeManageAppApi;
|
import com.uiuipad.os.network.api.TimeManageAppApi;
|
||||||
import com.uiuipad.os.network.api.TimeManageSnApi;
|
import com.uiuipad.os.network.api.TimeManageSnApi;
|
||||||
import com.uiuipad.os.network.api.UploadAppUseLogApi;
|
import com.uiuipad.os.network.api.UploadAppUseLogApi;
|
||||||
@@ -21,8 +19,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.core.Observable;
|
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
import okhttp3.Cache;
|
import okhttp3.Cache;
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
@@ -111,20 +109,6 @@ public class NetInterfaceManager {
|
|||||||
return requestBody;
|
return requestBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observable<BaseResponse> getCloudLessonSettingObservable() {
|
|
||||||
return mRetrofit.create(CloudLessonSettingApi.class)
|
|
||||||
.getCloudLessonSetting(Utils.getSerial(mContext))
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Observable<BaseResponse> getCloudLessonAppObservable() {
|
|
||||||
return mRetrofit.create(CloudLessonAppApi.class)
|
|
||||||
.getCloudLessonApp(Utils.getSerial(mContext))
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Observable<BaseResponse> getUploadAppUseLogObservable(Map<String, RequestBody> params) {
|
public Observable<BaseResponse> getUploadAppUseLogObservable(Map<String, RequestBody> params) {
|
||||||
return mRetrofit.create(UploadAppUseLogApi.class)
|
return mRetrofit.create(UploadAppUseLogApi.class)
|
||||||
.uploadAppUseLog(params)
|
.uploadAppUseLog(params)
|
||||||
|
|||||||
@@ -3,16 +3,9 @@ package com.uiuipad.os.network;
|
|||||||
public class UrlAddress {
|
public class UrlAddress {
|
||||||
public static final String ROOT_URL = "https://kxapi.uiuios.com/android/";
|
public static final String ROOT_URL = "https://kxapi.uiuios.com/android/";
|
||||||
|
|
||||||
|
|
||||||
/*上传应用使用记录*/
|
/*上传应用使用记录*/
|
||||||
public static final String UPLOAD_APP_USE_LOG = "app/app/uploadAppUseLog";
|
public static final String UPLOAD_APP_USE_LOG = "app/app/uploadAppUseLog";
|
||||||
|
|
||||||
/*获取专注模式设置*/
|
|
||||||
@Deprecated
|
|
||||||
public static final String GET_CLOUD_LESSON_SETTING = "equipment/manage/getCloudLessonSetting";
|
|
||||||
/*获取专注模式应用*/
|
|
||||||
@Deprecated
|
|
||||||
public static final String GET_CLOUD_LESSON_APP = "equipment/manage/getCloudLessonApp";
|
|
||||||
/*
|
/*
|
||||||
* 时间管控
|
* 时间管控
|
||||||
* */
|
* */
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.uiuipad.os.network.api;
|
|
||||||
|
|
||||||
import com.uiuipad.os.network.UrlAddress;
|
|
||||||
import com.uiuipad.os.network.bean.BaseResponse;
|
|
||||||
|
|
||||||
import io.reactivex.rxjava3.core.Observable;
|
|
||||||
import retrofit2.http.GET;
|
|
||||||
import retrofit2.http.Query;
|
|
||||||
|
|
||||||
public interface CloudLessonAppApi {
|
|
||||||
@GET(UrlAddress.GET_CLOUD_LESSON_APP)
|
|
||||||
Observable<BaseResponse> getCloudLessonApp(
|
|
||||||
@Query("sn") String sn
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.uiuipad.os.network.api;
|
|
||||||
|
|
||||||
import com.uiuipad.os.network.UrlAddress;
|
|
||||||
import com.uiuipad.os.network.bean.BaseResponse;
|
|
||||||
|
|
||||||
import io.reactivex.rxjava3.core.Observable;
|
|
||||||
import retrofit2.http.GET;
|
|
||||||
import retrofit2.http.Query;
|
|
||||||
|
|
||||||
public interface CloudLessonSettingApi {
|
|
||||||
@GET(UrlAddress.GET_CLOUD_LESSON_SETTING)
|
|
||||||
Observable<BaseResponse> getCloudLessonSetting(
|
|
||||||
@Query("sn") String sn
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,10 @@ package com.uiuipad.os.push;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
import com.uiuipad.os.service.MainService;
|
||||||
|
import com.uiuipad.os.uiuiutils.ToastUtil;
|
||||||
|
|
||||||
public class PushManager {
|
public class PushManager {
|
||||||
private static final String TAG = PushManager.class.getSimpleName();
|
private static final String TAG = PushManager.class.getSimpleName();
|
||||||
@@ -30,12 +34,14 @@ public class PushManager {
|
|||||||
return sInstance;
|
return sInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*删除应用*/
|
/*时间管控*/
|
||||||
private final String UPDATEPASSWD = "39";
|
private static final String TIME_MANAGEMENT = "28";
|
||||||
|
|
||||||
public void setPushContent(String title, String extras) {
|
public void setPushContent(String title, String extras) {
|
||||||
switch (title) {
|
switch (title) {
|
||||||
case UPDATEPASSWD:
|
case TIME_MANAGEMENT:
|
||||||
|
ToastUtil.betaShow("收到管控:时间管控");
|
||||||
|
mContext.sendBroadcast(new Intent(MainService.REFRESH_ACTION));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ public class MainService extends Service implements MainSContact.MainView , Lif
|
|||||||
private String TAG = MainService.class.getSimpleName();
|
private String TAG = MainService.class.getSimpleName();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public MainSPresenter mPresenter;
|
public MainSPresenter mPresenter;
|
||||||
|
|
||||||
|
|
||||||
@@ -73,7 +72,7 @@ public class MainService extends Service implements MainSContact.MainView , Lif
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
Log.e(TAG, "onCreate: ");
|
Log.e(TAG, "onCreate: ");
|
||||||
registerTimeReceiver();
|
registerReceivers();
|
||||||
Aria.download(this).register();
|
Aria.download(this).register();
|
||||||
|
|
||||||
lifecycleSubject.onNext(ActivityEvent.CREATE);
|
lifecycleSubject.onNext(ActivityEvent.CREATE);
|
||||||
@@ -88,6 +87,22 @@ public class MainService extends Service implements MainSContact.MainView , Lif
|
|||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerReceivers() {
|
||||||
|
registerTimeReceiver();
|
||||||
|
registerRefreshReceiver();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unregisterReceivers() {
|
||||||
|
if (mTimeChangedReceiver != null) {
|
||||||
|
unregisterReceiver(mTimeChangedReceiver);
|
||||||
|
}
|
||||||
|
if (mRefreshReceiver != null) {
|
||||||
|
unregisterReceiver(mRefreshReceiver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private TimeChangedReceiver mTimeChangedReceiver;
|
||||||
|
|
||||||
//监听时间和日期变化
|
//监听时间和日期变化
|
||||||
public void registerTimeReceiver() {
|
public void registerTimeReceiver() {
|
||||||
mTimeChangedReceiver = new TimeChangedReceiver();
|
mTimeChangedReceiver = new TimeChangedReceiver();
|
||||||
@@ -100,18 +115,6 @@ public class MainService extends Service implements MainSContact.MainView , Lif
|
|||||||
registerReceiver(mTimeChangedReceiver, filter);
|
registerReceiver(mTimeChangedReceiver, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TimeChangedReceiver mTimeChangedReceiver;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getTimeManageSnFinish() {
|
|
||||||
mPresenter.getTimeManageApp();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getTimeManageAppFinish() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TimeChangedReceiver extends BroadcastReceiver {
|
private class TimeChangedReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -130,14 +133,47 @@ public class MainService extends Service implements MainSContact.MainView , Lif
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String REFRESH_ACTION = "uiui.find.os.action.refresh";
|
||||||
|
private RefreshReceiver mRefreshReceiver;
|
||||||
|
|
||||||
|
private void registerRefreshReceiver() {
|
||||||
|
if (null == mRefreshReceiver) {
|
||||||
|
mRefreshReceiver = new RefreshReceiver();
|
||||||
|
}
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||||
|
filter.addAction(REFRESH_ACTION);
|
||||||
|
registerReceiver(mRefreshReceiver, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
class RefreshReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
Log.e("RefreshReceiver", "onReceive: " + action);
|
||||||
|
if (REFRESH_ACTION.equals(action)) {
|
||||||
|
mPresenter.getTimeManageSn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getTimeManageSnFinish() {
|
||||||
|
mPresenter.getTimeManageApp();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getTimeManageAppFinish() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
lifecycleSubject.onNext(ActivityEvent.DESTROY);
|
lifecycleSubject.onNext(ActivityEvent.DESTROY);
|
||||||
mPresenter.detachView();
|
mPresenter.detachView();
|
||||||
if (mTimeChangedReceiver != null) {
|
unregisterReceivers();
|
||||||
unregisterReceiver(mTimeChangedReceiver);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Download.onTaskRunning
|
@Download.onTaskRunning
|
||||||
|
|||||||
Reference in New Issue
Block a user