增加投屏开关,发送正在运行app,app内部开关
This commit is contained in:
@@ -2,14 +2,11 @@ package com.uiui.sn.activity.main;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.provider.Settings;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.trello.rxlifecycle4.RxLifecycle;
|
|
||||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||||
import com.uiui.sn.bean.AppInfo;
|
|
||||||
import com.uiui.sn.bean.BaseResponse;
|
import com.uiui.sn.bean.BaseResponse;
|
||||||
import com.uiui.sn.bean.SnInfo;
|
import com.uiui.sn.bean.SnInfo;
|
||||||
import com.uiui.sn.config.CommonConfig;
|
import com.uiui.sn.config.CommonConfig;
|
||||||
@@ -20,9 +17,7 @@ import com.uiui.sn.utils.CXAESUtil;
|
|||||||
import com.uiui.sn.utils.Utils;
|
import com.uiui.sn.utils.Utils;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import io.reactivex.rxjava3.core.Observer;
|
|
||||||
import io.reactivex.rxjava3.disposables.Disposable;
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||||
|
|
||||||
@@ -132,7 +127,7 @@ public class MainAPresenter implements MainAContact.Presenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getForceInstall() {
|
public void getForceInstall() {
|
||||||
NetInterfaceManager.getInstance().getForceInstall(false, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
NetInterfaceManager.getInstance().getForceInstall(false, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
Log.e("getForceInstall", "onComplete: ");
|
Log.e("getForceInstall", "onComplete: ");
|
||||||
@@ -143,7 +138,7 @@ public class MainAPresenter implements MainAContact.Presenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getOverallApp() {
|
public void getOverallApp() {
|
||||||
NetInterfaceManager.getInstance().getOverallApp(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
NetInterfaceManager.getInstance().getOverallApp(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
mView.setOverallApp();
|
mView.setOverallApp();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public class MyAppUsageBean implements Serializable {
|
|||||||
|
|
||||||
int id;
|
int id;
|
||||||
String app_name;
|
String app_name;
|
||||||
|
String app_package;
|
||||||
String app_img;
|
String app_img;
|
||||||
String class_name;
|
String class_name;
|
||||||
long use_time;//s
|
long use_time;//s
|
||||||
@@ -32,6 +33,14 @@ public class MyAppUsageBean implements Serializable {
|
|||||||
this.app_name = app_name;
|
this.app_name = app_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getApp_package() {
|
||||||
|
return app_package;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApp_package(String app_package) {
|
||||||
|
this.app_package = app_package;
|
||||||
|
}
|
||||||
|
|
||||||
public String getApp_img() {
|
public String getApp_img() {
|
||||||
return app_img;
|
return app_img;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,10 @@ public class CommonConfig {
|
|||||||
public final static String AOLE_ACTION_USB_USB_MTP = "aole_action_usb_usb_mtp";
|
public final static String AOLE_ACTION_USB_USB_MTP = "aole_action_usb_usb_mtp";
|
||||||
/*USB模式-MIDI*/
|
/*USB模式-MIDI*/
|
||||||
public final static String AOLE_ACTION_USB_USB_MIDI = "aole_action_usb_usb_midi";
|
public final static String AOLE_ACTION_USB_USB_MIDI = "aole_action_usb_usb_midi";
|
||||||
|
/*投屏开关*/
|
||||||
public final static String AOLE_ACTION_SCREEN_SHARE = "aole_app_screen_share";
|
public final static String AOLE_ACTION_SCREEN_SHARE = "aole_app_screen_share";
|
||||||
|
/*内部黑名单*/
|
||||||
|
public final static String AOLE_APP_WEB_WHITE_LIST ="app_web_white_list";
|
||||||
/*应用安装白名单*/
|
/*应用安装白名单*/
|
||||||
public final static String AOLE_ACTION_APP_FORBID = "aole_app_forbid";
|
public final static String AOLE_ACTION_APP_FORBID = "aole_app_forbid";
|
||||||
/*强制安装应用,禁止卸载*/
|
/*强制安装应用,禁止卸载*/
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import com.uiui.sn.disklrucache.CacheHelper;
|
|||||||
import com.uiui.sn.gson.GsonUtils;
|
import com.uiui.sn.gson.GsonUtils;
|
||||||
import com.uiui.sn.network.NetInterfaceManager;
|
import com.uiui.sn.network.NetInterfaceManager;
|
||||||
import com.uiui.sn.network.UrlAddress;
|
import com.uiui.sn.network.UrlAddress;
|
||||||
|
import com.uiui.sn.utils.AppUsedTimeUtils;
|
||||||
import com.uiui.sn.utils.JGYUtils;
|
import com.uiui.sn.utils.JGYUtils;
|
||||||
import com.uiui.sn.utils.ToastUtil;
|
import com.uiui.sn.utils.ToastUtil;
|
||||||
|
|
||||||
@@ -57,8 +58,6 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -187,10 +186,12 @@ public class RunningAppManager {
|
|||||||
Log.i(TAG, "checkForegroundAppName: topPackage = " + topPackage);
|
Log.i(TAG, "checkForegroundAppName: topPackage = " + topPackage);
|
||||||
String appPackageName = getAppPackageName();
|
String appPackageName = getAppPackageName();
|
||||||
Log.d(TAG, "checkForegroundAppName: appPackageName = " + appPackageName);
|
Log.d(TAG, "checkForegroundAppName: appPackageName = " + appPackageName);
|
||||||
if (allowPackage.contains(topPackage)) {
|
if (allowPackage.contains(topPackage)) {//排除在外的包名都写入空值
|
||||||
if (!TextUtils.isEmpty(appPackageName)) {
|
if (!TextUtils.isEmpty(appPackageName)) {
|
||||||
if (!topPackage.equals(appPackageName)) {
|
if (!topPackage.equals(appPackageName)) {
|
||||||
NetInterfaceManager.getInstance().sendCloseApp(appPackageName, new NetInterfaceManager.onCompleteCallback() {
|
//切换出去了
|
||||||
|
Log.i(TAG, "checkForegroundAppName: 切换应用1:" + topPackage);
|
||||||
|
NetInterfaceManager.getInstance().sendCloseApp(appPackageName, new NetInterfaceManager.CompleteCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
Log.i(TAG, "onComplete: ");
|
Log.i(TAG, "onComplete: ");
|
||||||
@@ -198,14 +199,28 @@ public class RunningAppManager {
|
|||||||
NetInterfaceManager.getInstance().getAppTimeControl();
|
NetInterfaceManager.getInstance().getAppTimeControl();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
NetInterfaceManager.getInstance().getMyAppList(new NetInterfaceManager.MyAppListCallback() {
|
||||||
|
@Override
|
||||||
|
public void setMyAppList(List<MyAppUsageBean> myAppList) {
|
||||||
|
syncAllAppUsageTime(myAppList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AppUsedTimeUtils.getInstance().setApp_package(topPackage);
|
||||||
|
AppUsedTimeUtils.getInstance().setStart_time(System.currentTimeMillis() / 1000);
|
||||||
|
NetInterfaceManager.getInstance().sendRunningApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mMMKV.encode(RUNNING_APP_PACKAGENAME, "");
|
mMMKV.encode(RUNNING_APP_PACKAGENAME, "");
|
||||||
Log.d(TAG, "checkForegroundAppName: allow: " + topPackage);
|
Log.d(TAG, "checkForegroundAppName: allow: " + topPackage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//如果appPackageName 为空则topPackage是才打开
|
||||||
if (TextUtils.isEmpty(appPackageName)) {
|
if (TextUtils.isEmpty(appPackageName)) {
|
||||||
|
Log.d(TAG, "checkForegroundAppName: open: " + topPackage);
|
||||||
recordPackageOpenTime(topPackage);
|
recordPackageOpenTime(topPackage);
|
||||||
|
AppUsedTimeUtils.getInstance().setApp_package(topPackage);
|
||||||
|
AppUsedTimeUtils.getInstance().setStart_time(System.currentTimeMillis() / 1000);
|
||||||
|
NetInterfaceManager.getInstance().sendRunningApp();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long onClickTime = getOnClickTime();
|
long onClickTime = getOnClickTime();
|
||||||
@@ -221,17 +236,26 @@ public class RunningAppManager {
|
|||||||
reduceAppRemainingTime(topPackage, 1);
|
reduceAppRemainingTime(topPackage, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.i(TAG, "checkForegroundAppName: 切换应用:" + topPackage);
|
Log.i(TAG, "checkForegroundAppName: 切换应用2:" + topPackage);
|
||||||
NetInterfaceManager.getInstance().sendCloseApp(appPackageName, new NetInterfaceManager.onCompleteCallback() {
|
NetInterfaceManager.getInstance().sendCloseApp(appPackageName, new NetInterfaceManager.CompleteCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
NetInterfaceManager.getInstance().getSnTimeControl();
|
NetInterfaceManager.getInstance().getSnTimeControl();
|
||||||
NetInterfaceManager.getInstance().getAppTimeControl();
|
NetInterfaceManager.getInstance().getAppTimeControl();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
NetInterfaceManager.getInstance().getMyAppList(new NetInterfaceManager.MyAppListCallback() {
|
||||||
|
@Override
|
||||||
|
public void setMyAppList(List<MyAppUsageBean> myAppList) {
|
||||||
|
syncAllAppUsageTime(myAppList);
|
||||||
|
}
|
||||||
|
});
|
||||||
reduceAppRemainingTime(topPackage, 1);
|
reduceAppRemainingTime(topPackage, 1);
|
||||||
appPackageName = topPackage;
|
appPackageName = topPackage;
|
||||||
|
AppUsedTimeUtils.getInstance().setApp_package(appPackageName);
|
||||||
onClickTime = System.currentTimeMillis() / 1000;
|
onClickTime = System.currentTimeMillis() / 1000;
|
||||||
|
NetInterfaceManager.getInstance().sendRunningApp();
|
||||||
|
AppUsedTimeUtils.getInstance().setStart_time(onClickTime);
|
||||||
if (RunningAppManager.getInstance().inControlTime(appPackageName)) {
|
if (RunningAppManager.getInstance().inControlTime(appPackageName)) {
|
||||||
Log.i(TAG, "checkForegroundAppName: 没有剩余时间2");
|
Log.i(TAG, "checkForegroundAppName: 没有剩余时间2");
|
||||||
removeTask(topPackage);
|
removeTask(topPackage);
|
||||||
@@ -289,10 +313,13 @@ public class RunningAppManager {
|
|||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
String finaWayDate = sdf.format(time);
|
String finaWayDate = sdf.format(time);
|
||||||
if ("00:00:00".equals(finaWayDate)) {
|
if ("00:00:00".equals(finaWayDate)) {
|
||||||
|
//清除数据保证及时性
|
||||||
mMMKV.encode(RemainingTimeMap, "");
|
mMMKV.encode(RemainingTimeMap, "");
|
||||||
mMMKV.encode(GlobalUsageTimeMap, "");
|
mMMKV.encode(GlobalUsageTimeMap, "");
|
||||||
|
mMMKV.encode(AllApplUsageTimeMap, "");
|
||||||
mRemainingTimeMap.clear();
|
mRemainingTimeMap.clear();
|
||||||
mGlobalUsageTime.clear();
|
mGlobalUsageTime.clear();
|
||||||
|
mAllAppUsageTime.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -457,16 +484,25 @@ public class RunningAppManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*同步所有应用使用时间*/
|
/*同步所有应用使用时间*/
|
||||||
public void synvAllAppUsageTime(List<MyAppUsageBean> myAppList) {
|
public void syncAllAppUsageTime(List<MyAppUsageBean> myAppList) {
|
||||||
if (myAppList == null || myAppList.size() == 0) {
|
if (myAppList == null || myAppList.size() == 0) {
|
||||||
mAllAppUsageTime.clear();
|
mAllAppUsageTime.clear();
|
||||||
} else {
|
} else {
|
||||||
// mAllAppUsageTime.clear();
|
// mAllAppUsageTime.clear();
|
||||||
for (MyAppUsageBean bean : myAppList) {
|
for (MyAppUsageBean bean : myAppList) {
|
||||||
|
if (TextUtils.isEmpty(bean.getApp_package())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
AppUsageTime appUsageTime = new AppUsageTime();
|
AppUsageTime appUsageTime = new AppUsageTime();
|
||||||
appUsageTime.setPkg(bean.getApp_name());
|
appUsageTime.setPkg(bean.getApp_package());
|
||||||
|
appUsageTime.setAppName(bean.getApp_name());
|
||||||
|
appUsageTime.setUsageTime(bean.getUse_time());
|
||||||
|
mAllAppUsageTime.put(bean.getApp_package(), appUsageTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String singleString = GsonUtils.toJSONString(mAllAppUsageTime);
|
||||||
|
mMMKV.encode(AllApplUsageTimeMap, singleString);
|
||||||
|
Log.e(TAG, "syncAllAppUsageTime: " + mAllAppUsageTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -600,7 +636,7 @@ public class RunningAppManager {
|
|||||||
if (TextUtils.isEmpty(pkg)) {
|
if (TextUtils.isEmpty(pkg)) {
|
||||||
return "未知";
|
return "未知";
|
||||||
}
|
}
|
||||||
String jsonString = mCacheHelper.getAsString(UrlAddress.GET_ALL_PACKAGE);
|
String jsonString = mMMKV.decodeString(UrlAddress.GET_ALL_PACKAGE, "");
|
||||||
if (!TextUtils.isEmpty(jsonString)) {
|
if (!TextUtils.isEmpty(jsonString)) {
|
||||||
Type type = new TypeToken<List<AppInfo>>() {
|
Type type = new TypeToken<List<AppInfo>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
@@ -784,6 +820,12 @@ public class RunningAppManager {
|
|||||||
|
|
||||||
|
|
||||||
public String getDisableContent(String pkg) {
|
public String getDisableContent(String pkg) {
|
||||||
|
NetInterfaceManager.getInstance().getMyAppList(new NetInterfaceManager.MyAppListCallback() {
|
||||||
|
@Override
|
||||||
|
public void setMyAppList(List<MyAppUsageBean> myAppList) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
RemainTime remainTime = new RemainTime();
|
RemainTime remainTime = new RemainTime();
|
||||||
remainTime.setPkg(pkg);
|
remainTime.setPkg(pkg);
|
||||||
// if (allowPackage.contains(pkg)) {
|
// if (allowPackage.contains(pkg)) {
|
||||||
@@ -944,9 +986,12 @@ public class RunningAppManager {
|
|||||||
public int compare(AppUsageTime o1, AppUsageTime o2) {
|
public int compare(AppUsageTime o1, AppUsageTime o2) {
|
||||||
if (o1.getUsageTime() > o2.getUsageTime()) {
|
if (o1.getUsageTime() > o2.getUsageTime()) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else if (o1.getUsageTime() == o2.getUsageTime()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (o1.getUsageTime() < o2.getUsageTime()) {
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (tempTime < allTime) {
|
if (tempTime < allTime) {
|
||||||
@@ -1343,15 +1388,6 @@ public class RunningAppManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkTopAppPackageName() {
|
|
||||||
String topPackage = getTopActivityInfo();
|
|
||||||
Log.i(TAG, "onReceive: " + topPackage);
|
|
||||||
// Log.i(TAG, "onReceive: getWeekDay: " + getWeekDay());
|
|
||||||
// Log.i(TAG, "onReceive: getWeekDayString: " + getWeekDayString());
|
|
||||||
// Log.i(TAG, "onReceive: inWeekDay: " + inWeekDay());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private String getTopActivityInfo() {
|
private String getTopActivityInfo() {
|
||||||
ActivityManager manager = ((ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE));
|
ActivityManager manager = ((ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE));
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ package com.uiui.sn.desktop;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.uiui.sn.disklrucache.CacheHelper;
|
import com.uiui.sn.disklrucache.CacheHelper;
|
||||||
|
import com.uiui.sn.gson.GsonUtils;
|
||||||
import com.uiui.sn.network.UrlAddress;
|
import com.uiui.sn.network.UrlAddress;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
@@ -35,6 +37,14 @@ public class TimeControlManager {
|
|||||||
}
|
}
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
this.mCacheHelper = new CacheHelper(context);
|
this.mCacheHelper = new CacheHelper(context);
|
||||||
|
String appTimeControlJson = mCacheHelper.getAsString(UrlAddress.GET_APP_TIME_CONTROL);
|
||||||
|
if (!TextUtils.isEmpty(appTimeControlJson)) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
Type type = new TypeToken<List<AppTimeControl>>() {
|
||||||
|
}.getType();
|
||||||
|
List<AppTimeControl> appTimeControls = gson.fromJson(appTimeControlJson, type);
|
||||||
|
setAppTimeControlMap(appTimeControls);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init(Context context) {
|
public static void init(Context context) {
|
||||||
@@ -50,7 +60,7 @@ public class TimeControlManager {
|
|||||||
return mTimeControlManager;
|
return mTimeControlManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, AppTimeControl> getAppTimeControlMap(){
|
public HashMap<String, AppTimeControl> getAppTimeControlMap() {
|
||||||
return mAppTimeControlMap;
|
return mAppTimeControlMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +91,6 @@ public class TimeControlManager {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public MachineControl getGlobalMachineControl() {
|
public MachineControl getGlobalMachineControl() {
|
||||||
Log.e(TAG, "getGlobalMachineControl: ");
|
|
||||||
if (mGlobalMachineControl == null) {
|
if (mGlobalMachineControl == null) {
|
||||||
String jsonString = mCacheHelper.getAsString(UrlAddress.GET_SN_TIME_CONTROL);
|
String jsonString = mCacheHelper.getAsString(UrlAddress.GET_SN_TIME_CONTROL);
|
||||||
//为 "" 是已经请求成功的
|
//为 "" 是已经请求成功的
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ public class ControlManager {
|
|||||||
SystemSettings systemSettings = GsonUtils.toJavaObject(jsonString, SystemSettings.class);
|
SystemSettings systemSettings = GsonUtils.toJavaObject(jsonString, SystemSettings.class);
|
||||||
if (null != systemSettings) {
|
if (null != systemSettings) {
|
||||||
setUSBstate(systemSettings);
|
setUSBstate(systemSettings);
|
||||||
|
setScreenShared(systemSettings);
|
||||||
// ControlPanelManager.getInstance().setUsbStatus(systemSettings.getSetting_usb());
|
// ControlPanelManager.getInstance().setUsbStatus(systemSettings.getSetting_usb());
|
||||||
setPhoneList(systemSettings);
|
setPhoneList(systemSettings);
|
||||||
setBluetooth(systemSettings);
|
setBluetooth(systemSettings);
|
||||||
@@ -126,6 +127,7 @@ public class ControlManager {
|
|||||||
public void setDisableSetting() {
|
public void setDisableSetting() {
|
||||||
Log.e("setDisableSetting", "Close all settings: ");
|
Log.e("setDisableSetting", "Close all settings: ");
|
||||||
setUSBstate(1);
|
setUSBstate(1);
|
||||||
|
setScreenShared(1);
|
||||||
setPhoneList(1);
|
setPhoneList(1);
|
||||||
setBluetooth(0);
|
setBluetooth(0);
|
||||||
setHotspot(0);
|
setHotspot(0);
|
||||||
@@ -201,7 +203,7 @@ public class ControlManager {
|
|||||||
}
|
}
|
||||||
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
||||||
// if (!BuildConfig.DEBUG)
|
// if (!BuildConfig.DEBUG)
|
||||||
mContext.sendBroadcast(usbIntent);
|
mContext.sendBroadcast(usbIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -791,16 +793,16 @@ public class ControlManager {
|
|||||||
|
|
||||||
private void setScreenShared(SystemSettings settings) {
|
private void setScreenShared(SystemSettings settings) {
|
||||||
int projection_screen = settings.getProjection_screen();
|
int projection_screen = settings.getProjection_screen();
|
||||||
setScreenShared(projection_screen);
|
setScreenShared(changeNum(projection_screen));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setScreenShared(int state) {
|
public void setScreenShared(int state) {
|
||||||
Settings.System.putInt(mResolver, "projection_screen", state);
|
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SCREEN_SHARE, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setHotPoint(SystemSettings settings) {
|
private void setHotPoint(SystemSettings settings) {
|
||||||
int hot_point = settings.getHot_point();
|
int hot_point = settings.getHot_point();
|
||||||
setScreenShared(hot_point);
|
setHotPoint(hot_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setHotPoint(int state) {
|
private void setHotPoint(int state) {
|
||||||
@@ -873,4 +875,6 @@ public class ControlManager {
|
|||||||
private void closeSettingsApp() {
|
private void closeSettingsApp() {
|
||||||
JGYUtils.getInstance().killBackgroundProcesses("com.android.settings");
|
JGYUtils.getInstance().killBackgroundProcesses("com.android.settings");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import com.trello.rxlifecycle4.RxLifecycle;
|
|||||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||||
import com.uiui.sn.BuildConfig;
|
import com.uiui.sn.BuildConfig;
|
||||||
import com.uiui.sn.bean.AppInfo;
|
import com.uiui.sn.bean.AppInfo;
|
||||||
|
import com.uiui.sn.bean.AppJump;
|
||||||
import com.uiui.sn.bean.AppStart;
|
import com.uiui.sn.bean.AppStart;
|
||||||
import com.uiui.sn.bean.MyAppUsageBean;
|
import com.uiui.sn.bean.MyAppUsageBean;
|
||||||
import com.uiui.sn.bean.OverallAppBean;
|
import com.uiui.sn.bean.OverallAppBean;
|
||||||
@@ -486,6 +487,13 @@ public class NetInterfaceManager {
|
|||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Observable<BaseResponse<List<AppJump>>> getAppJumpObservable() {
|
||||||
|
return getAppJumpControl()
|
||||||
|
.getSNJump(Utils.getSerial())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* execution
|
* execution
|
||||||
@@ -567,7 +575,7 @@ public class NetInterfaceManager {
|
|||||||
void onComplete();
|
void onComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface onCompleteCallback {
|
public interface CompleteCallback {
|
||||||
void onComplete();
|
void onComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -664,7 +672,7 @@ public class NetInterfaceManager {
|
|||||||
* @param lifecycle
|
* @param lifecycle
|
||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
public void setPushTags(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void setPushTags(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
ConnectMode connectMode = ConnectMode.SIX_HOUR;
|
ConnectMode connectMode = ConnectMode.SIX_HOUR;
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
connectMode = ConnectMode.ONE_HOUR;
|
connectMode = ConnectMode.ONE_HOUR;
|
||||||
@@ -685,7 +693,7 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPushTags(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void setPushTags(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
Set set = new HashSet();
|
Set set = new HashSet();
|
||||||
JGYUtils.getInstance().getAppPlatform(platform -> {
|
JGYUtils.getInstance().getAppPlatform(platform -> {
|
||||||
if (platform == JGYUtils.MTKPlatform) {
|
if (platform == JGYUtils.MTKPlatform) {
|
||||||
@@ -951,7 +959,7 @@ public class NetInterfaceManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkAllAppUpdate(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void checkAllAppUpdate(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
ConnectMode connectMode = ConnectMode.SIX_HOUR;
|
ConnectMode connectMode = ConnectMode.SIX_HOUR;
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
connectMode = ConnectMode.ONE_HOUR;
|
connectMode = ConnectMode.ONE_HOUR;
|
||||||
@@ -974,7 +982,7 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkAllAppUpdate(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void checkAllAppUpdate(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
Observable.zip(
|
Observable.zip(
|
||||||
getUpdateObservable(BuildConfig.APPLICATION_ID),
|
getUpdateObservable(BuildConfig.APPLICATION_ID),
|
||||||
getUpdateObservable(JGYUtils.PACKAGE_APPSTORE),
|
getUpdateObservable(JGYUtils.PACKAGE_APPSTORE),
|
||||||
@@ -1030,7 +1038,7 @@ public class NetInterfaceManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkFXYAppUpdate(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void checkFXYAppUpdate(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
ConnectMode connectMode = ConnectMode.SIX_HOUR;
|
ConnectMode connectMode = ConnectMode.SIX_HOUR;
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
connectMode = ConnectMode.ONE_HOUR;
|
connectMode = ConnectMode.ONE_HOUR;
|
||||||
@@ -1053,7 +1061,7 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkFXYAppUpdate(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void checkFXYAppUpdate(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
Observable.zip(
|
Observable.zip(
|
||||||
getUpdateObservable(JGYUtils.gkwxhd),
|
getUpdateObservable(JGYUtils.gkwxhd),
|
||||||
getUpdateObservable(JGYUtils.fuxiaoying),
|
getUpdateObservable(JGYUtils.fuxiaoying),
|
||||||
@@ -1171,7 +1179,7 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getCloudLessonSetting(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
private void getCloudLessonSetting(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
ConnectMode connectMode = ConnectMode.ONE_HOUR;
|
ConnectMode connectMode = ConnectMode.ONE_HOUR;
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
connectMode = ConnectMode.DEFAULT;
|
connectMode = ConnectMode.DEFAULT;
|
||||||
@@ -1193,7 +1201,7 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getCloudLessonSetting(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
private void getCloudLessonSetting(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
getCloudLessonSettingApiControl()
|
getCloudLessonSettingApiControl()
|
||||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||||
.subscribe(new Observer<BaseResponse<CloudLessonSetting>>() {
|
.subscribe(new Observer<BaseResponse<CloudLessonSetting>>() {
|
||||||
@@ -1865,7 +1873,7 @@ public class NetInterfaceManager {
|
|||||||
Log.e("getAllappPackage", "onNext: " + listBaseResponse);
|
Log.e("getAllappPackage", "onNext: " + listBaseResponse);
|
||||||
List<AppInfo> appInfoList = listBaseResponse.data;
|
List<AppInfo> appInfoList = listBaseResponse.data;
|
||||||
if (null != appInfoList && appInfoList.size() != 0) {
|
if (null != appInfoList && appInfoList.size() != 0) {
|
||||||
mCacheHelper.put(UrlAddress.GET_ALL_PACKAGE, appInfoList.toString());
|
mMMKV.encode(UrlAddress.GET_ALL_PACKAGE, GsonUtils.toJSONString(appInfoList));
|
||||||
HashSet<String> allAppPkg = new HashSet<>();
|
HashSet<String> allAppPkg = new HashSet<>();
|
||||||
for (AppInfo appInfo : appInfoList) {
|
for (AppInfo appInfo : appInfoList) {
|
||||||
allAppPkg.add(appInfo.getApp_package());
|
allAppPkg.add(appInfo.getApp_package());
|
||||||
@@ -1875,11 +1883,11 @@ public class NetInterfaceManager {
|
|||||||
ApkUtils.writeAppPackageList(mContext, allPkgSet);
|
ApkUtils.writeAppPackageList(mContext, allPkgSet);
|
||||||
getAppStart(appInfoList);
|
getAppStart(appInfoList);
|
||||||
} else {
|
} else {
|
||||||
mCacheHelper.put(UrlAddress.GET_ALL_PACKAGE, "");
|
mMMKV.encode(UrlAddress.GET_ALL_PACKAGE, "");
|
||||||
ApkUtils.writeAppPackageList(mContext, "");
|
ApkUtils.writeAppPackageList(mContext, "");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mCacheHelper.put(UrlAddress.GET_ALL_PACKAGE, "");
|
mMMKV.encode(UrlAddress.GET_ALL_PACKAGE, "");
|
||||||
ApkUtils.writeAppPackageList(mContext, "");
|
ApkUtils.writeAppPackageList(mContext, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1896,7 +1904,7 @@ public class NetInterfaceManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getForceInstall(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void getForceInstall(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
ConnectMode connectMode = ConnectMode.ONE_DAY;
|
ConnectMode connectMode = ConnectMode.ONE_DAY;
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
connectMode = ConnectMode.ONE_HOUR;
|
connectMode = ConnectMode.ONE_HOUR;
|
||||||
@@ -1919,13 +1927,13 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getForceInstall(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void getForceInstall(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
getForceInstallControl()
|
getForceInstallControl()
|
||||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||||
.subscribe(getForceInstallObserver(callback));
|
.subscribe(getForceInstallObserver(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getForceInstall(onCompleteCallback callback) {
|
public void getForceInstall(CompleteCallback callback) {
|
||||||
getForceInstallControl()
|
getForceInstallControl()
|
||||||
.subscribe(getForceInstallObserver(callback));
|
.subscribe(getForceInstallObserver(callback));
|
||||||
}
|
}
|
||||||
@@ -1935,7 +1943,7 @@ public class NetInterfaceManager {
|
|||||||
.subscribe(getForceInstallObserver(null));
|
.subscribe(getForceInstallObserver(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Observer<BaseResponse<List<AppInfo>>> getForceInstallObserver(onCompleteCallback callback) {
|
private Observer<BaseResponse<List<AppInfo>>> getForceInstallObserver(CompleteCallback callback) {
|
||||||
return new Observer<BaseResponse<List<AppInfo>>>() {
|
return new Observer<BaseResponse<List<AppInfo>>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
@@ -2108,12 +2116,12 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sendRunningApp() {
|
public void sendRunningApp() {
|
||||||
String packageName = AppUsedTimeUtils.getInstance().getAppPackageName();
|
String packageName = AppUsedTimeUtils.getInstance().getApp_package();
|
||||||
long time = AppUsedTimeUtils.getInstance().getStartTime();
|
long time = AppUsedTimeUtils.getInstance().getStart_time();
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("app_package", packageName);
|
jsonObject.addProperty("app_package", packageName);
|
||||||
jsonObject.addProperty("version_name", ApkUtils.getAPPVersionName(mContext, packageName));
|
jsonObject.addProperty("version_name", ApkUtils.getAPPVersionName(mContext, packageName));
|
||||||
jsonObject.addProperty("start_time", time / 1000);
|
jsonObject.addProperty("start_time", time);
|
||||||
String jsonString = jsonObject.toString();
|
String jsonString = jsonObject.toString();
|
||||||
Log.e(TAG, "sendRunningApp: " + jsonString);
|
Log.e(TAG, "sendRunningApp: " + jsonString);
|
||||||
getRunningAppObservable(jsonString)
|
getRunningAppObservable(jsonString)
|
||||||
@@ -2259,7 +2267,7 @@ public class NetInterfaceManager {
|
|||||||
public static final String APP_TIME_CONTROL_UPDATE = "APP_TIME_CONTROL_UPDATE";
|
public static final String APP_TIME_CONTROL_UPDATE = "APP_TIME_CONTROL_UPDATE";
|
||||||
public static final String SN_TIME_CONTROL_UPDATE = "SN_TIME_CONTROL_UPDATE";
|
public static final String SN_TIME_CONTROL_UPDATE = "SN_TIME_CONTROL_UPDATE";
|
||||||
|
|
||||||
public void getAppTimeControl(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void getAppTimeControl(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
|
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
connectMode = ConnectMode.DEFAULT;
|
connectMode = ConnectMode.DEFAULT;
|
||||||
@@ -2275,7 +2283,8 @@ public class NetInterfaceManager {
|
|||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
Type type = new TypeToken<List<AppTimeControl>>() {
|
Type type = new TypeToken<List<AppTimeControl>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
List<AppTimeControl> appInfos = gson.fromJson(jsonString, type);
|
List<AppTimeControl> appTimeControls = gson.fromJson(jsonString, type);
|
||||||
|
TimeControlManager.getInstance().setAppTimeControlMap(appTimeControls);
|
||||||
callback.onComplete();
|
callback.onComplete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2285,13 +2294,13 @@ public class NetInterfaceManager {
|
|||||||
return mCacheHelper.getAsString(UrlAddress.GET_APP_TIME_CONTROL);
|
return mCacheHelper.getAsString(UrlAddress.GET_APP_TIME_CONTROL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAppTimeControl(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void getAppTimeControl(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
getAppTimeControlObservable()
|
getAppTimeControlObservable()
|
||||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||||
.subscribe(getAppTimeControlObserver(callback));
|
.subscribe(getAppTimeControlObserver(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAppTimeControl(onCompleteCallback callback) {
|
public void getAppTimeControl(CompleteCallback callback) {
|
||||||
getAppTimeControlObservable()
|
getAppTimeControlObservable()
|
||||||
.subscribe(getAppTimeControlObserver(callback));
|
.subscribe(getAppTimeControlObserver(callback));
|
||||||
}
|
}
|
||||||
@@ -2301,7 +2310,7 @@ public class NetInterfaceManager {
|
|||||||
.subscribe(getAppTimeControlObserver(null));
|
.subscribe(getAppTimeControlObserver(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Observer<BaseResponse<List<AppTimeControl>>> getAppTimeControlObserver(onCompleteCallback callback) {
|
private Observer<BaseResponse<List<AppTimeControl>>> getAppTimeControlObserver(CompleteCallback callback) {
|
||||||
return new Observer<BaseResponse<List<AppTimeControl>>>() {
|
return new Observer<BaseResponse<List<AppTimeControl>>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
@@ -2345,7 +2354,7 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getSnTimeControl(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void getSnTimeControl(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
|
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
connectMode = ConnectMode.DEFAULT;
|
connectMode = ConnectMode.DEFAULT;
|
||||||
@@ -2371,13 +2380,13 @@ public class NetInterfaceManager {
|
|||||||
return mCacheHelper.getAsString(UrlAddress.GET_SN_TIME_CONTROL);
|
return mCacheHelper.getAsString(UrlAddress.GET_SN_TIME_CONTROL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getSnTimeControl(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void getSnTimeControl(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
getMachineTimeControlObservable()
|
getMachineTimeControlObservable()
|
||||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||||
.subscribe(getSnTimeControlObserver(callback));
|
.subscribe(getSnTimeControlObserver(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getSnTimeControl(onCompleteCallback callback) {
|
public void getSnTimeControl(CompleteCallback callback) {
|
||||||
getMachineTimeControlObservable()
|
getMachineTimeControlObservable()
|
||||||
.subscribe(getSnTimeControlObserver(callback));
|
.subscribe(getSnTimeControlObserver(callback));
|
||||||
}
|
}
|
||||||
@@ -2387,7 +2396,7 @@ public class NetInterfaceManager {
|
|||||||
.subscribe(getSnTimeControlObserver(null));
|
.subscribe(getSnTimeControlObserver(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observer<BaseResponse<MachineControl>> getSnTimeControlObserver(onCompleteCallback callback) {
|
public Observer<BaseResponse<MachineControl>> getSnTimeControlObserver(CompleteCallback callback) {
|
||||||
return new Observer<BaseResponse<MachineControl>>() {
|
return new Observer<BaseResponse<MachineControl>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
@@ -2425,7 +2434,7 @@ public class NetInterfaceManager {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendCloseApp(String packageName, onCompleteCallback completeCallback) {
|
public void sendCloseApp(String packageName, CompleteCallback completeCallback) {
|
||||||
PackageManager pm = mContext.getPackageManager();
|
PackageManager pm = mContext.getPackageManager();
|
||||||
PackageInfo appInfo = null;
|
PackageInfo appInfo = null;
|
||||||
try {
|
try {
|
||||||
@@ -2464,7 +2473,7 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getOverallApp(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void getOverallApp(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
|
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
connectMode = ConnectMode.DEFAULT;
|
connectMode = ConnectMode.DEFAULT;
|
||||||
@@ -2486,13 +2495,13 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getOverallApp(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void getOverallApp(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
getOverallAppObservable()
|
getOverallAppObservable()
|
||||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||||
.subscribe(getOverallAppObserver(callback));
|
.subscribe(getOverallAppObserver(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getOverallApp(onCompleteCallback callback) {
|
public void getOverallApp(CompleteCallback callback) {
|
||||||
getOverallAppObservable()
|
getOverallAppObservable()
|
||||||
.subscribe(getOverallAppObserver(callback));
|
.subscribe(getOverallAppObserver(callback));
|
||||||
}
|
}
|
||||||
@@ -2502,7 +2511,7 @@ public class NetInterfaceManager {
|
|||||||
.subscribe(getOverallAppObserver(null));
|
.subscribe(getOverallAppObserver(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Observer<BaseResponse<List<OverallAppBean>>> getOverallAppObserver(onCompleteCallback callback) {
|
public Observer<BaseResponse<List<OverallAppBean>>> getOverallAppObserver(CompleteCallback callback) {
|
||||||
return new Observer<BaseResponse<List<OverallAppBean>>>() {
|
return new Observer<BaseResponse<List<OverallAppBean>>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
@@ -2580,7 +2589,7 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MyAppListCallback {
|
public interface MyAppListCallback {
|
||||||
void setMyAppList(List<MyAppUsageBean> myAppList);
|
void setMyAppList(List<MyAppUsageBean> myAppList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2611,4 +2620,49 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getAppJump(CompleteCallback completeCallback) {
|
||||||
|
getAppJumpObservable()
|
||||||
|
.subscribe(new Observer<BaseResponse<List<AppJump>>>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
Log.e("getAppJump", "onSubscribe: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseResponse<List<AppJump>> listBaseResponse) {
|
||||||
|
Log.e("getAppJump", "onNext: " + listBaseResponse);
|
||||||
|
if (listBaseResponse.code == 200) {
|
||||||
|
List<AppJump> appJumpList = listBaseResponse.data;
|
||||||
|
if (appJumpList == null || appJumpList.size() == 0) {
|
||||||
|
boolean putString = Settings.System.putString(crv, CommonConfig.AOLE_APP_WEB_WHITE_LIST, "");
|
||||||
|
Log.e(TAG, "getAppJump: " + putString);
|
||||||
|
} else {
|
||||||
|
List<String> urls = appJumpList.stream().map(new java.util.function.Function<AppJump, String>() {
|
||||||
|
@Override
|
||||||
|
public String apply(AppJump appJump) {
|
||||||
|
return appJump.getAddress();
|
||||||
|
}
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
boolean putString = Settings.System.putString(crv, CommonConfig.AOLE_APP_WEB_WHITE_LIST, String.join(",", urls));
|
||||||
|
Log.e(TAG, "getAppJump: " + putString);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
boolean putString = Settings.System.putString(crv, CommonConfig.AOLE_APP_WEB_WHITE_LIST, "");
|
||||||
|
Log.e(TAG, "getAppJump: " + putString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
Log.e("getAppJump", "onError: " + e.getMessage());
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Log.e("getAppJump", "onComplete: ");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import android.util.Log;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.uiui.sn.BuildConfig;
|
import com.uiui.sn.BuildConfig;
|
||||||
import com.uiui.sn.IGetInfoInterface;
|
import com.uiui.sn.IGetInfoInterface;
|
||||||
|
import com.uiui.sn.bean.MyAppUsageBean;
|
||||||
import com.uiui.sn.config.CommonConfig;
|
import com.uiui.sn.config.CommonConfig;
|
||||||
import com.uiui.sn.desktop.RunningAppManager;
|
import com.uiui.sn.desktop.RunningAppManager;
|
||||||
import com.uiui.sn.network.NetInterfaceManager;
|
import com.uiui.sn.network.NetInterfaceManager;
|
||||||
|
|||||||
@@ -19,9 +19,11 @@ public class MainSContact {
|
|||||||
void setSystemSettings();
|
void setSystemSettings();
|
||||||
void setBrowserLabel();
|
void setBrowserLabel();
|
||||||
void setBrowserWhiteList();
|
void setBrowserWhiteList();
|
||||||
|
void setAppJump();
|
||||||
void setAppStart();
|
void setAppStart();
|
||||||
void setAppTimeControl();
|
void setAppTimeControl();
|
||||||
void setSnTimeControl();
|
void setSnTimeControl();
|
||||||
|
void setMyAppList();
|
||||||
void setScreenLock();
|
void setScreenLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,12 +52,16 @@ public class MainSContact {
|
|||||||
void getBrowserLabel();
|
void getBrowserLabel();
|
||||||
//获取浏览器黑白名单
|
//获取浏览器黑白名单
|
||||||
void getBrowserWhiteList();
|
void getBrowserWhiteList();
|
||||||
|
//获取内部网址管控
|
||||||
|
void getAppJump();
|
||||||
//应用自启
|
//应用自启
|
||||||
void getAppStart();
|
void getAppStart();
|
||||||
//获取时间管控
|
//获取时间管控
|
||||||
void getAppTimeControl();
|
void getAppTimeControl();
|
||||||
//获取整机管控
|
//获取整机管控
|
||||||
void getSnTimeControl();
|
void getSnTimeControl();
|
||||||
|
//获取所有应用使用时间
|
||||||
|
void getMyAppList();
|
||||||
//获取锁屏管控
|
//获取锁屏管控
|
||||||
void getScreenLock();
|
void getScreenLock();
|
||||||
|
|
||||||
|
|||||||
@@ -10,17 +10,19 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.trello.rxlifecycle4.RxLifecycle;
|
import com.trello.rxlifecycle4.RxLifecycle;
|
||||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||||
import com.uiui.sn.bean.AppInfo;
|
import com.uiui.sn.bean.AppInfo;
|
||||||
import com.uiui.sn.bean.AppStart;
|
import com.uiui.sn.bean.AppStart;
|
||||||
import com.uiui.sn.bean.BaseResponse;
|
import com.uiui.sn.bean.BaseResponse;
|
||||||
import com.uiui.sn.bean.Label;
|
import com.uiui.sn.bean.Label;
|
||||||
import com.uiui.sn.bean.SystemSettings;
|
import com.uiui.sn.bean.MyAppUsageBean;
|
||||||
import com.uiui.sn.bean.SystemSettingsSet;
|
import com.uiui.sn.bean.SystemSettingsSet;
|
||||||
import com.uiui.sn.bean.browser.BrowserApiData;
|
import com.uiui.sn.bean.browser.BrowserApiData;
|
||||||
import com.uiui.sn.bean.browser.BrowserBean;
|
import com.uiui.sn.bean.browser.BrowserBean;
|
||||||
import com.uiui.sn.config.CommonConfig;
|
import com.uiui.sn.config.CommonConfig;
|
||||||
|
import com.uiui.sn.desktop.RunningAppManager;
|
||||||
import com.uiui.sn.disklrucache.CacheHelper;
|
import com.uiui.sn.disklrucache.CacheHelper;
|
||||||
import com.uiui.sn.manager.ControlManager;
|
import com.uiui.sn.manager.ControlManager;
|
||||||
import com.uiui.sn.network.NetInterfaceManager;
|
import com.uiui.sn.network.NetInterfaceManager;
|
||||||
@@ -31,7 +33,6 @@ import com.uiui.sn.gson.GsonUtils;
|
|||||||
import com.uiui.sn.utils.JGYUtils;
|
import com.uiui.sn.utils.JGYUtils;
|
||||||
import com.uiui.sn.utils.SPUtils;
|
import com.uiui.sn.utils.SPUtils;
|
||||||
import com.uiui.sn.utils.ServiceAliveUtils;
|
import com.uiui.sn.utils.ServiceAliveUtils;
|
||||||
import com.uiui.sn.utils.TimeUtils;
|
|
||||||
import com.uiui.sn.utils.URLUtils;
|
import com.uiui.sn.utils.URLUtils;
|
||||||
import com.uiui.sn.utils.Utils;
|
import com.uiui.sn.utils.Utils;
|
||||||
|
|
||||||
@@ -56,6 +57,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
private MainSContact.MainView mView;
|
private MainSContact.MainView mView;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private CacheHelper mCacheHelper;
|
private CacheHelper mCacheHelper;
|
||||||
|
private MMKV mMMKV = MMKV.defaultMMKV();
|
||||||
|
|
||||||
public MainSPresenter(Context context) {
|
public MainSPresenter(Context context) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
@@ -123,7 +125,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkUpdate() {
|
public void checkUpdate() {
|
||||||
NetInterfaceManager.getInstance().checkAllAppUpdate(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
NetInterfaceManager.getInstance().checkAllAppUpdate(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
mView.checkUpdateFinish();
|
mView.checkUpdateFinish();
|
||||||
@@ -133,7 +135,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkFXYUpdate() {
|
public void checkFXYUpdate() {
|
||||||
NetInterfaceManager.getInstance().checkFXYAppUpdate(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
NetInterfaceManager.getInstance().checkFXYAppUpdate(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
mView.checkFXYUpdateFinish();
|
mView.checkFXYUpdateFinish();
|
||||||
@@ -160,10 +162,10 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
List<AppInfo> appInfoList = listBaseResponse.data;
|
List<AppInfo> appInfoList = listBaseResponse.data;
|
||||||
if (appInfoList == null || appInfoList.size() == 0) {
|
if (appInfoList == null || appInfoList.size() == 0) {
|
||||||
mCacheHelper.put(UrlAddress.GET_ALL_PACKAGE, "");
|
mMMKV.encode(UrlAddress.GET_ALL_PACKAGE, "");
|
||||||
ApkUtils.writeAppPackageList(mContext, "");
|
ApkUtils.writeAppPackageList(mContext, "");
|
||||||
} else {
|
} else {
|
||||||
mCacheHelper.put(UrlAddress.GET_ALL_PACKAGE, appInfoList.toString());
|
mMMKV.encode(UrlAddress.GET_ALL_PACKAGE, GsonUtils.toJSONString(appInfoList));
|
||||||
HashSet allPkgSet = new HashSet<String>();
|
HashSet allPkgSet = new HashSet<String>();
|
||||||
for (AppInfo pkg : appInfoList) {
|
for (AppInfo pkg : appInfoList) {
|
||||||
allPkgSet.add(pkg.getApp_package());
|
allPkgSet.add(pkg.getApp_package());
|
||||||
@@ -176,7 +178,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
}
|
}
|
||||||
JGYUtils.getInstance().deleteOtherApp();
|
JGYUtils.getInstance().deleteOtherApp();
|
||||||
} else {
|
} else {
|
||||||
mCacheHelper.put(UrlAddress.GET_ALL_PACKAGE, "");
|
mMMKV.encode(UrlAddress.GET_ALL_PACKAGE, "");
|
||||||
ApkUtils.writeAppPackageList(mContext, "");
|
ApkUtils.writeAppPackageList(mContext, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,7 +199,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getOverallApp() {
|
public void getOverallApp() {
|
||||||
NetInterfaceManager.getInstance().getOverallApp(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
NetInterfaceManager.getInstance().getOverallApp(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
mView.setOverallApp();
|
mView.setOverallApp();
|
||||||
@@ -248,7 +250,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getForceInstall() {
|
public void getForceInstall() {
|
||||||
NetInterfaceManager.getInstance().getForceInstall(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
NetInterfaceManager.getInstance().getForceInstall(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
mView.setForceInstall();
|
mView.setForceInstall();
|
||||||
@@ -429,6 +431,16 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getAppJump() {
|
||||||
|
NetInterfaceManager.getInstance().getAppJump(new NetInterfaceManager.CompleteCallback() {
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
mView.setAppJump();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getAppStart() {
|
public void getAppStart() {
|
||||||
NetInterfaceManager.getInstance()
|
NetInterfaceManager.getInstance()
|
||||||
@@ -468,7 +480,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getAppTimeControl() {
|
public void getAppTimeControl() {
|
||||||
NetInterfaceManager.getInstance().getAppTimeControl(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
NetInterfaceManager.getInstance().getAppTimeControl(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
mView.setAppTimeControl();
|
mView.setAppTimeControl();
|
||||||
@@ -478,7 +490,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSnTimeControl() {
|
public void getSnTimeControl() {
|
||||||
NetInterfaceManager.getInstance().getSnTimeControl(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
NetInterfaceManager.getInstance().getSnTimeControl(true, getLifecycle(), new NetInterfaceManager.CompleteCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
mView.setSnTimeControl();
|
mView.setSnTimeControl();
|
||||||
@@ -486,6 +498,16 @@ public class MainSPresenter implements MainSContact.Presenter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getMyAppList() {
|
||||||
|
NetInterfaceManager.getInstance().getMyAppList(new NetInterfaceManager.MyAppListCallback() {
|
||||||
|
@Override
|
||||||
|
public void setMyAppList(List<MyAppUsageBean> myAppList) {
|
||||||
|
RunningAppManager.getInstance().syncAllAppUsageTime(myAppList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getScreenLock() {
|
public void getScreenLock() {
|
||||||
NetInterfaceManager.getInstance()
|
NetInterfaceManager.getInstance()
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import android.os.AsyncTask;
|
|||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.blankj.utilcode.util.NetworkUtils;
|
import com.blankj.utilcode.util.NetworkUtils;
|
||||||
@@ -205,6 +206,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
lifecycleSubject.onNext(ActivityEvent.DESTROY);
|
lifecycleSubject.onNext(ActivityEvent.DESTROY);
|
||||||
NetworkUtils.unregisterNetworkStatusChangedListener(this);
|
NetworkUtils.unregisterNetworkStatusChangedListener(this);
|
||||||
mPresenter.detachView();
|
mPresenter.detachView();
|
||||||
|
unregisterReceivers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MainSPresenter getPresenter() {
|
public static MainSPresenter getPresenter() {
|
||||||
@@ -229,7 +231,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||||
am.setTime(aLong);
|
am.setTime(aLong);
|
||||||
tPushInit();
|
tPushInit();
|
||||||
NetInterfaceManager.getInstance().setPushTags(true, lifecycleSubject, new NetInterfaceManager.onCompleteCallback() {
|
NetInterfaceManager.getInstance().setPushTags(true, lifecycleSubject, new NetInterfaceManager.CompleteCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
Log.e("TimeTask", "onComplete: ");
|
Log.e("TimeTask", "onComplete: ");
|
||||||
@@ -268,12 +270,23 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private WifiReceiver mWifiReceiver;
|
|
||||||
|
|
||||||
private void registerReceivers() {
|
private void registerReceivers() {
|
||||||
registerWiFiReceiver();
|
registerWiFiReceiver();
|
||||||
|
registerScreenReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void unregisterReceivers() {
|
||||||
|
if (mWifiReceiver != null) {
|
||||||
|
unregisterReceiver(mWifiReceiver);
|
||||||
|
}
|
||||||
|
if (mScreenReceiver != null) {
|
||||||
|
unregisterReceiver(mScreenReceiver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private WifiReceiver mWifiReceiver;
|
||||||
|
|
||||||
private void registerWiFiReceiver() {
|
private void registerWiFiReceiver() {
|
||||||
if (mWifiReceiver == null) {
|
if (mWifiReceiver == null) {
|
||||||
mWifiReceiver = new WifiReceiver();
|
mWifiReceiver = new WifiReceiver();
|
||||||
@@ -342,6 +355,49 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ScreenReceiver mScreenReceiver;
|
||||||
|
|
||||||
|
private void registerScreenReceiver() {
|
||||||
|
if (mScreenReceiver == null) {
|
||||||
|
mScreenReceiver = new ScreenReceiver();
|
||||||
|
}
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||||
|
filter.addAction(Intent.ACTION_USER_PRESENT);
|
||||||
|
filter.addAction(Intent.ACTION_SCREEN_ON);
|
||||||
|
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||||
|
filter.addAction(Intent.ACTION_USER_UNLOCKED);
|
||||||
|
registerReceiver(mScreenReceiver, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ScreenReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
Log.e(TAG, "onReceive: " + action);
|
||||||
|
if (TextUtils.isEmpty(action)) {
|
||||||
|
Log.e(TAG, "onReceive: action is NULL");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (action) {
|
||||||
|
case Intent.ACTION_USER_PRESENT:
|
||||||
|
mPresenter.getAppTimeControl();
|
||||||
|
break;
|
||||||
|
case Intent.ACTION_SCREEN_ON:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Intent.ACTION_SCREEN_OFF:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Intent.ACTION_USER_UNLOCKED:
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private interface Start {
|
private interface Start {
|
||||||
void onstar(String key);
|
void onstar(String key);
|
||||||
}
|
}
|
||||||
@@ -465,6 +521,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBrowserWhiteList() {
|
public void setBrowserWhiteList() {
|
||||||
|
mPresenter.getAppJump();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAppJump() {
|
||||||
mPresenter.getAppStart();
|
mPresenter.getAppStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,6 +541,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSnTimeControl() {
|
public void setSnTimeControl() {
|
||||||
|
mPresenter.getMyAppList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMyAppList() {
|
||||||
mPresenter.getScreenLock();
|
mPresenter.getScreenLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import com.uiui.sn.config.CommonConfig;
|
|||||||
import com.uiui.sn.dialog.CustomDialog;
|
import com.uiui.sn.dialog.CustomDialog;
|
||||||
import com.uiui.sn.disklrucache.CacheHelper;
|
import com.uiui.sn.disklrucache.CacheHelper;
|
||||||
import com.uiui.sn.manager.ControlManager;
|
import com.uiui.sn.manager.ControlManager;
|
||||||
import com.uiui.sn.manager.ControlPanelManager;
|
|
||||||
import com.uiui.sn.manager.DeviceManager;
|
import com.uiui.sn.manager.DeviceManager;
|
||||||
import com.uiui.sn.network.NetInterfaceManager;
|
import com.uiui.sn.network.NetInterfaceManager;
|
||||||
import com.uiui.sn.receiver.BootReceiver;
|
import com.uiui.sn.receiver.BootReceiver;
|
||||||
@@ -466,7 +465,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
//显示所有的admin应用
|
//显示所有的admin应用
|
||||||
private static final String JIGUANG_ADMIN_APP = "63";
|
private static final String JIGUANG_ADMIN_APP = "63";
|
||||||
/*投屏开关*/
|
/*投屏开关*/
|
||||||
private static final String SCRENN_SHARED = "74";
|
private static final String SCREEN_SHARED = "74";
|
||||||
/*移动热点开关*/
|
/*移动热点开关*/
|
||||||
private static final String HOT_SPOT = "75";
|
private static final String HOT_SPOT = "75";
|
||||||
/*桌面默认应用*/
|
/*桌面默认应用*/
|
||||||
@@ -583,7 +582,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
break;
|
break;
|
||||||
case JIGUANG_APP_WEBSITE:
|
case JIGUANG_APP_WEBSITE:
|
||||||
ToastUtil.debugShow("收到推送消息: app内部网址管控");
|
ToastUtil.debugShow("收到推送消息: app内部网址管控");
|
||||||
// NetInterfaceManager.getInstance().getAppJump(context);
|
setAppInsideNetwork(context, extras);
|
||||||
break;
|
break;
|
||||||
case JIGUANG_REBOOT_DEVICES:
|
case JIGUANG_REBOOT_DEVICES:
|
||||||
ToastUtil.debugShow("收到推送消息: 重启");
|
ToastUtil.debugShow("收到推送消息: 重启");
|
||||||
@@ -765,8 +764,9 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
case JIGUANG_ADMIN_APP:
|
case JIGUANG_ADMIN_APP:
|
||||||
setAdminApp(context, extras);
|
setAdminApp(context, extras);
|
||||||
break;
|
break;
|
||||||
case SCRENN_SHARED:
|
case SCREEN_SHARED:
|
||||||
ToastUtil.debugShow("收到推送消息: 投屏开关");
|
ToastUtil.debugShow("收到推送消息: 投屏开关");
|
||||||
|
setScreenShared(context, extras);
|
||||||
break;
|
break;
|
||||||
case HOT_SPOT:
|
case HOT_SPOT:
|
||||||
ToastUtil.debugShow("收到推送消息: 热点开关");
|
ToastUtil.debugShow("收到推送消息: 热点开关");
|
||||||
@@ -1229,6 +1229,22 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
Log.e("setAppUpdate", Settings.System.getString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID));
|
Log.e("setAppUpdate", Settings.System.getString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setAppInsideNetwork(Context context, String extras) {
|
||||||
|
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||||
|
int is_ground = jsonObject.get("is_ground").getAsInt();
|
||||||
|
if (is_ground == 0) {
|
||||||
|
boolean putString = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, "");
|
||||||
|
Log.e(TAG, "setAppInsideNetwork: " + putString);
|
||||||
|
} else if (is_ground == 1) {
|
||||||
|
NetInterfaceManager.getInstance().getAppJump(new NetInterfaceManager.CompleteCallback() {
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setLock_screen(Context context, String jsonString) {
|
private void setLock_screen(Context context, String jsonString) {
|
||||||
int type = 0;
|
int type = 0;
|
||||||
JsonObject jSONObject = GsonUtils.getJsonObject(jsonString);
|
JsonObject jSONObject = GsonUtils.getJsonObject(jsonString);
|
||||||
@@ -1477,6 +1493,11 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
String app_url = jsonObject.get("app_url").getAsString();
|
String app_url = jsonObject.get("app_url").getAsString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setScreenShared(Context context, String extras) {
|
||||||
|
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||||
|
int projection_screen = jsonObject.get("projection_screen").getAsInt();
|
||||||
|
ControlManager.getInstance().setScreenShared(changeNum(projection_screen));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param context
|
* @param context
|
||||||
@@ -1553,4 +1574,6 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
JGYUtils.getInstance().restorrNetwork();
|
JGYUtils.getInstance().restorrNetwork();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,14 @@ public class AppUsedTimeUtils {
|
|||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
private static AppUsedTimeUtils sInstance;
|
private static AppUsedTimeUtils sInstance;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
private String app_package;
|
||||||
|
private long start_time;
|
||||||
|
|
||||||
private AppTimeinfo appTimeinfo;
|
// private AppTimeinfo appTimeinfo;
|
||||||
|
|
||||||
private AppUsedTimeUtils(Context context) {
|
private AppUsedTimeUtils(Context context) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
appTimeinfo = getAppTimeinfo();
|
// appTimeinfo = getAppTimeinfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init(Context context) {
|
public static void init(Context context) {
|
||||||
@@ -46,75 +48,91 @@ public class AppUsedTimeUtils {
|
|||||||
return sInstance;
|
return sInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class AppTimeinfo implements Serializable {
|
public String getApp_package() {
|
||||||
private static final long serialVersionUID = 5373751133823666192L;
|
return app_package;
|
||||||
|
|
||||||
AppTimeinfo() {
|
|
||||||
this.appPackageName = "";
|
|
||||||
this.endTime = 0;
|
|
||||||
this.startTime = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String appPackageName;
|
|
||||||
private long endTime;
|
|
||||||
private long startTime;
|
|
||||||
|
|
||||||
public String getAppPackageName() {
|
|
||||||
return appPackageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAppPackageName(String appPackageName) {
|
|
||||||
this.appPackageName = appPackageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getEndTime() {
|
|
||||||
return endTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEndTime(long endTime) {
|
|
||||||
this.endTime = endTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getStartTime() {
|
|
||||||
return startTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStartTime(long startTime) {
|
|
||||||
this.startTime = startTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized public String getAppPackageName() {
|
public void setApp_package(String app_package) {
|
||||||
appTimeinfo = getAppTimeinfo();
|
this.app_package = app_package;
|
||||||
return appTimeinfo.getAppPackageName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized public long getStartTime() {
|
public long getStart_time() {
|
||||||
appTimeinfo = getAppTimeinfo();
|
return start_time;
|
||||||
return appTimeinfo.getStartTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized public long getEndTime() {
|
public void setStart_time(long start_time) {
|
||||||
appTimeinfo = getAppTimeinfo();
|
this.start_time = start_time;
|
||||||
return appTimeinfo.getEndTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized private AppTimeinfo getAppTimeinfo() {
|
// static class AppTimeinfo implements Serializable {
|
||||||
String jsonString = Settings.System.getString(mContext.getContentResolver(), "runningAppInfo");
|
// private static final long serialVersionUID = 5373751133823666192L;
|
||||||
if (TextUtils.isEmpty(jsonString)) {
|
//
|
||||||
return new AppTimeinfo();
|
// AppTimeinfo() {
|
||||||
}
|
// this.appPackageName = "";
|
||||||
Log.e(TAG, "getAppTimeinfo: " + jsonString);
|
// this.endTime = 0;
|
||||||
Type type = new TypeToken<AppTimeinfo>() {
|
// this.startTime = 0;
|
||||||
}.getType();
|
// }
|
||||||
Gson gson = new Gson();
|
//
|
||||||
AppTimeinfo appTimeinfo = gson.fromJson(jsonString, type);
|
// private String appPackageName;
|
||||||
return appTimeinfo;
|
// private long endTime;
|
||||||
}
|
// private long startTime;
|
||||||
|
//
|
||||||
|
// public String getAppPackageName() {
|
||||||
|
// return appPackageName;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setAppPackageName(String appPackageName) {
|
||||||
|
// this.appPackageName = appPackageName;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public long getEndTime() {
|
||||||
|
// return endTime;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setEndTime(long endTime) {
|
||||||
|
// this.endTime = endTime;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public long getStartTime() {
|
||||||
|
// return startTime;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setStartTime(long startTime) {
|
||||||
|
// this.startTime = startTime;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @NonNull
|
||||||
|
// @Override
|
||||||
|
// public String toString() {
|
||||||
|
// return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// synchronized public String getAppPackageName() {
|
||||||
|
// appTimeinfo = getAppTimeinfo();
|
||||||
|
// return appTimeinfo.getAppPackageName();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// synchronized public long getStartTime() {
|
||||||
|
// appTimeinfo = getAppTimeinfo();
|
||||||
|
// return appTimeinfo.getStartTime();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// synchronized public long getEndTime() {
|
||||||
|
// appTimeinfo = getAppTimeinfo();
|
||||||
|
// return appTimeinfo.getEndTime();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// synchronized private AppTimeinfo getAppTimeinfo() {
|
||||||
|
// String jsonString = Settings.System.getString(mContext.getContentResolver(), "runningAppInfo");
|
||||||
|
// if (TextUtils.isEmpty(jsonString)) {
|
||||||
|
// return new AppTimeinfo();
|
||||||
|
// }
|
||||||
|
// Log.e(TAG, "getAppTimeinfo: " + jsonString);
|
||||||
|
// Type type = new TypeToken<AppTimeinfo>() {
|
||||||
|
// }.getType();
|
||||||
|
// Gson gson = new Gson();
|
||||||
|
// AppTimeinfo appTimeinfo = gson.fromJson(jsonString, type);
|
||||||
|
// return appTimeinfo;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user