version:1.1.1
fix: update:修复报错,优化推送
This commit is contained in:
@@ -50,8 +50,8 @@ android {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 28
|
||||
|
||||
versionCode 9
|
||||
versionName "1.0.8"
|
||||
versionCode 12
|
||||
versionName "1.1.1"
|
||||
|
||||
ndk {
|
||||
//选择要添加的对应 cpu 类型的 .so 库。
|
||||
|
||||
@@ -426,10 +426,10 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
setWorkspaceLoading(true);
|
||||
}
|
||||
|
||||
if (!isDefaultHome()) {
|
||||
// if (!isDefaultHome()) {
|
||||
// setDefaultL();
|
||||
setRoleHolderAsUser(this, BuildConfig.APPLICATION_ID);
|
||||
}
|
||||
// }
|
||||
SharedPreferences sharedPref = getPreferences(MODE_PRIVATE);
|
||||
int i = sharedPref.getInt("SetWallPaper", 0);
|
||||
if (i == 0) {
|
||||
|
||||
@@ -538,6 +538,9 @@ public class RunningAppManager {
|
||||
}
|
||||
boolean havaConfigure = TimeControlManager.getInstance().havaConfigure(pkg);
|
||||
TimeManageSn machineControl = TimeControlManager.getInstance().getGlobalMachineControl();
|
||||
if (machineControl == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log.e(TAG, "inControlTime: globalRemainingTime = " + globalRemainingTime);
|
||||
if (globalRemainingTime <= 0) {
|
||||
@@ -684,6 +687,9 @@ public class RunningAppManager {
|
||||
}
|
||||
boolean havaConfigure = TimeControlManager.getInstance().havaConfigure(pkg);
|
||||
TimeManageSn machineControl = TimeControlManager.getInstance().getGlobalMachineControl();
|
||||
if (machineControl == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (havaConfigure) {
|
||||
//有单独设置 不管是分类整机还是其他都是这个设置
|
||||
@@ -708,8 +714,8 @@ public class RunningAppManager {
|
||||
// return false;
|
||||
// }
|
||||
// } else {
|
||||
ToastUtil.show("今日可使用时间已用完");
|
||||
return true;
|
||||
ToastUtil.show("今日可使用时间已用完");
|
||||
return true;
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -931,18 +937,18 @@ public class RunningAppManager {
|
||||
remainTime.setTotalTime(machineControl.getRest_time());
|
||||
}
|
||||
// if (machineControl.is_quota == 1) {
|
||||
if (haveUseTime(machineControl.getWork_time(), machineControl.getRest_time(), machineControl.getToday_time())) {
|
||||
return "";
|
||||
if (haveUseTime(machineControl.getWork_time(), machineControl.getRest_time(), machineControl.getToday_time())) {
|
||||
return "";
|
||||
} else {
|
||||
boolean inControlTime = inControlTime(machineControl);
|
||||
if (inControlTime) {
|
||||
remainTime.setDisableType(3);
|
||||
remainTime.setContent("该应用" + partTime2String(machineControl));
|
||||
return remainTime.getContent();
|
||||
} else {
|
||||
boolean inControlTime = inControlTime(machineControl);
|
||||
if (inControlTime) {
|
||||
remainTime.setDisableType(3);
|
||||
remainTime.setContent("该应用" + partTime2String(machineControl));
|
||||
return remainTime.getContent();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// } else {
|
||||
// //关闭整机额度开关 始终可用
|
||||
// return "";
|
||||
|
||||
@@ -107,8 +107,13 @@ public class TimeControlManager {
|
||||
Gson gson = new Gson();
|
||||
Type Type = new TypeToken<TimeManageSn>() {
|
||||
}.getType();
|
||||
TimeManageSn machineControl = gson.fromJson(jsonString, Type);
|
||||
return machineControl;
|
||||
try {
|
||||
TimeManageSn machineControl = gson.fromJson(jsonString, Type);
|
||||
return machineControl;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "getGlobalMachineControl: " + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return mGlobalMachineControl;
|
||||
|
||||
@@ -5,8 +5,6 @@ import android.content.Context;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
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.TimeManageSnApi;
|
||||
import com.uiuipad.os.network.api.UploadAppUseLogApi;
|
||||
@@ -21,8 +19,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.MediaType;
|
||||
@@ -111,20 +109,6 @@ public class NetInterfaceManager {
|
||||
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) {
|
||||
return mRetrofit.create(UploadAppUseLogApi.class)
|
||||
.uploadAppUseLog(params)
|
||||
|
||||
@@ -3,16 +3,9 @@ package com.uiuipad.os.network;
|
||||
public class UrlAddress {
|
||||
public static final String ROOT_URL = "https://kxapi.uiuios.com/android/";
|
||||
|
||||
|
||||
/*上传应用使用记录*/
|
||||
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.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.uiuipad.os.service.MainService;
|
||||
import com.uiuipad.os.uiuiutils.ToastUtil;
|
||||
|
||||
public class PushManager {
|
||||
private static final String TAG = PushManager.class.getSimpleName();
|
||||
@@ -30,12 +34,14 @@ public class PushManager {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/*删除应用*/
|
||||
private final String UPDATEPASSWD = "39";
|
||||
/*时间管控*/
|
||||
private static final String TIME_MANAGEMENT = "28";
|
||||
|
||||
public void setPushContent(String title, String extras) {
|
||||
switch (title) {
|
||||
case UPDATEPASSWD:
|
||||
case TIME_MANAGEMENT:
|
||||
ToastUtil.betaShow("收到管控:时间管控");
|
||||
mContext.sendBroadcast(new Intent(MainService.REFRESH_ACTION));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
@@ -25,18 +25,17 @@ import org.jetbrains.annotations.NotNull;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
public class MainService extends Service implements MainSContact.MainView , LifecycleProvider<ActivityEvent> {
|
||||
public class MainService extends Service implements MainSContact.MainView, LifecycleProvider<ActivityEvent> {
|
||||
private String TAG = MainService.class.getSimpleName();
|
||||
|
||||
|
||||
|
||||
public MainSPresenter mPresenter;
|
||||
|
||||
|
||||
public MainService() {
|
||||
}
|
||||
|
||||
private BehaviorSubject<ActivityEvent> lifecycleSubject = BehaviorSubject.create();
|
||||
private BehaviorSubject<ActivityEvent> lifecycleSubject = BehaviorSubject.create();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -73,7 +72,7 @@ public class MainService extends Service implements MainSContact.MainView , Lif
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.e(TAG, "onCreate: ");
|
||||
registerTimeReceiver();
|
||||
registerReceivers();
|
||||
Aria.download(this).register();
|
||||
|
||||
lifecycleSubject.onNext(ActivityEvent.CREATE);
|
||||
@@ -88,6 +87,22 @@ public class MainService extends Service implements MainSContact.MainView , Lif
|
||||
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() {
|
||||
mTimeChangedReceiver = new TimeChangedReceiver();
|
||||
@@ -100,18 +115,6 @@ public class MainService extends Service implements MainSContact.MainView , Lif
|
||||
registerReceiver(mTimeChangedReceiver, filter);
|
||||
}
|
||||
|
||||
private TimeChangedReceiver mTimeChangedReceiver;
|
||||
|
||||
@Override
|
||||
public void getTimeManageSnFinish() {
|
||||
mPresenter.getTimeManageApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTimeManageAppFinish() {
|
||||
|
||||
}
|
||||
|
||||
private class TimeChangedReceiver extends BroadcastReceiver {
|
||||
|
||||
@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
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
lifecycleSubject.onNext(ActivityEvent.DESTROY);
|
||||
mPresenter.detachView();
|
||||
if (mTimeChangedReceiver != null) {
|
||||
unregisterReceiver(mTimeChangedReceiver);
|
||||
}
|
||||
unregisterReceivers();
|
||||
}
|
||||
|
||||
@Download.onTaskRunning
|
||||
|
||||
Reference in New Issue
Block a user