version:2.7
fix:优化部分接口,对接默认app推送和接口 add:
This commit is contained in:
@@ -8,14 +8,6 @@ import com.uiui.sn.bean.BaseResponse;
|
||||
import com.uiui.sn.bean.SnInfo;
|
||||
|
||||
public class MainAContact {
|
||||
public interface MainView extends BaseView {
|
||||
void setSnInfo(BaseResponse<SnInfo> response);
|
||||
void setAppletQRCode(String url);
|
||||
void setQRCode(Bitmap bitmap);
|
||||
void checkUpdateFinish();
|
||||
void setForceInstall();
|
||||
}
|
||||
|
||||
interface Presenter extends BasePresenter<MainView> {
|
||||
/*获取设备信息*/
|
||||
void getSnInfo();
|
||||
@@ -28,4 +20,12 @@ public class MainAContact {
|
||||
/*获取强制下载*/
|
||||
void getForceInstall();
|
||||
}
|
||||
|
||||
public interface MainView extends BaseView {
|
||||
void setSnInfo(BaseResponse<SnInfo> response);
|
||||
void setAppletQRCode(String url);
|
||||
void setQRCode(Bitmap bitmap);
|
||||
void checkUpdateFinish();
|
||||
void setForceInstall();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,41 +132,11 @@ public class MainAPresenter implements MainAContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getForceInstall() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getForceInstallControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getForceInstall", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
Log.e("getForceInstall", "onNext: " + listBaseResponse);
|
||||
int code = listBaseResponse.code;
|
||||
if (code == 200) {
|
||||
List<AppInfo> appInfos = listBaseResponse.data;
|
||||
if (null != appInfos && appInfos.size() != 0) {
|
||||
NetInterfaceManager.getInstance().getForceInstallState(appInfos);
|
||||
}
|
||||
} else {
|
||||
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "");
|
||||
Log.e("getForceInstall", "aole_force_app: invalid: " + aole_force_app);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getForceInstall", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getForceInstall", "onComplete: ");
|
||||
mView.setForceInstall();
|
||||
}
|
||||
});
|
||||
NetInterfaceManager.getInstance().getForceInstall(false, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getForceInstall", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,15 @@ package com.uiui.sn.activity.main;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.AudioManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.IBinder;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
@@ -163,8 +166,31 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
startService();
|
||||
registerReceiver();
|
||||
timeMillis = System.currentTimeMillis();
|
||||
Intent intent = new Intent(MainActivity.this, MainService.class);
|
||||
bindService(intent, mMainServiceConnection, BIND_AUTO_CREATE);
|
||||
startService(intent);
|
||||
}
|
||||
|
||||
MainService.MainBinder mMainBinder;
|
||||
|
||||
private MainServiceConnection mMainServiceConnection = new MainServiceConnection();
|
||||
|
||||
private class MainServiceConnection implements ServiceConnection {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
||||
Log.e(TAG, "onServiceConnected: ");
|
||||
mMainBinder = (MainService.MainBinder) iBinder;
|
||||
mMainBinder.getService().getLocked();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName componentName) {
|
||||
Log.e(TAG, "onServiceDisconnected: ");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
@@ -30,14 +30,15 @@ public class SystemSettings implements Serializable {
|
||||
int setting_browser;
|
||||
int setting_bhtvideo;
|
||||
String setting_context;
|
||||
|
||||
int setting_bht;
|
||||
int setting_hotspot;
|
||||
int qch_restore;
|
||||
int setting_browserInput;
|
||||
int dev_mode;
|
||||
String setting_sos;
|
||||
int setting_volume;
|
||||
int setting_luminance;
|
||||
String setting_volume;
|
||||
String setting_luminance;
|
||||
String setting_typeface;
|
||||
int setting_admin_app;
|
||||
int projection_screen;
|
||||
@@ -47,6 +48,14 @@ public class SystemSettings implements Serializable {
|
||||
String typewriting_app;
|
||||
int is_control;
|
||||
|
||||
int setting_rotation;
|
||||
int setting_airplane;
|
||||
int setting_disturbance;
|
||||
int setting_location;
|
||||
int setting_charge;
|
||||
int setting_other_appInstaller;
|
||||
|
||||
|
||||
public int getQch_restore() {
|
||||
return qch_restore;
|
||||
}
|
||||
@@ -256,19 +265,19 @@ public class SystemSettings implements Serializable {
|
||||
this.setting_sos = setting_sos;
|
||||
}
|
||||
|
||||
public int getSetting_volume() {
|
||||
public String getSetting_volume() {
|
||||
return setting_volume;
|
||||
}
|
||||
|
||||
public void setSetting_volume(int setting_volume) {
|
||||
public void setSetting_volume(String setting_volume) {
|
||||
this.setting_volume = setting_volume;
|
||||
}
|
||||
|
||||
public int getSetting_luminance() {
|
||||
public String getSetting_luminance() {
|
||||
return setting_luminance;
|
||||
}
|
||||
|
||||
public void setSetting_luminance(int setting_luminance) {
|
||||
public void setSetting_luminance(String setting_luminance) {
|
||||
this.setting_luminance = setting_luminance;
|
||||
}
|
||||
|
||||
@@ -336,6 +345,54 @@ public class SystemSettings implements Serializable {
|
||||
this.is_control = is_control;
|
||||
}
|
||||
|
||||
public int getSetting_rotation() {
|
||||
return setting_rotation;
|
||||
}
|
||||
|
||||
public void setSetting_rotation(int setting_rotation) {
|
||||
this.setting_rotation = setting_rotation;
|
||||
}
|
||||
|
||||
public int getSetting_airplane() {
|
||||
return setting_airplane;
|
||||
}
|
||||
|
||||
public void setSetting_airplane(int setting_airplane) {
|
||||
this.setting_airplane = setting_airplane;
|
||||
}
|
||||
|
||||
public int getSetting_disturbance() {
|
||||
return setting_disturbance;
|
||||
}
|
||||
|
||||
public void setSetting_disturbance(int setting_disturbance) {
|
||||
this.setting_disturbance = setting_disturbance;
|
||||
}
|
||||
|
||||
public int getSetting_location() {
|
||||
return setting_location;
|
||||
}
|
||||
|
||||
public void setSetting_location(int setting_location) {
|
||||
this.setting_location = setting_location;
|
||||
}
|
||||
|
||||
public int getSetting_charge() {
|
||||
return setting_charge;
|
||||
}
|
||||
|
||||
public void setSetting_charge(int setting_charge) {
|
||||
this.setting_charge = setting_charge;
|
||||
}
|
||||
|
||||
public int getSetting_other_appInstaller() {
|
||||
return setting_other_appInstaller;
|
||||
}
|
||||
|
||||
public void setSetting_other_appInstaller(int setting_other_appInstaller) {
|
||||
this.setting_other_appInstaller = setting_other_appInstaller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||
|
||||
@@ -9,6 +9,10 @@ public class CommonConfig {
|
||||
public final static String ONLY_SHORTCUT_LIST = "only_jgy_shortcut_list";
|
||||
/*获取设备的标签*/
|
||||
public final static String DEVICES_TAG = "DEVICES_TAG";
|
||||
/*默认桌面key*/
|
||||
public final static String DESKTOP_APP_KEY = "desktop_app_key";
|
||||
public final static String BROWSER_APP_KEY = "browser_app_key";
|
||||
public final static String TYPEWRITING_APP_KEY = "typewriting_app_key";
|
||||
|
||||
public static String isLogined = "isLogined";
|
||||
public static String AES_KEY = "0123456789ABCDEF";
|
||||
@@ -33,7 +37,7 @@ public class CommonConfig {
|
||||
public final static String AOLE_ACTION_USB_USB_MIDI = "aole_action_usb_usb_midi";
|
||||
|
||||
/*应用安装白名单*/
|
||||
public final static String AOLE_ACTION_APP_FORBID = "aole_app_forbid";
|
||||
public final static String AOLE_ACTION_APP_FORBID = "aole_app_forbid";
|
||||
/*强制安装应用,禁止卸载*/
|
||||
public final static String AOLE_ACTION_FORCE_APP = "aole_force_app";
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.sn.bean.SystemSettings;
|
||||
import com.uiui.sn.config.CommonConfig;
|
||||
import com.uiui.sn.utils.ApkUtils;
|
||||
@@ -36,6 +37,7 @@ public class ControlManager {
|
||||
private static ControlManager sInstance;
|
||||
private Context mContext;
|
||||
private ContentResolver mResolver;
|
||||
private MMKV mMMKV = MMKV.defaultMMKV();
|
||||
|
||||
private ControlManager(Context context) {
|
||||
if (context == null) {
|
||||
@@ -66,25 +68,48 @@ public class ControlManager {
|
||||
if (TextUtils.isEmpty(jsonString)) {
|
||||
return;
|
||||
}
|
||||
SystemSettings settings = GsonUtils.toJavaObject(jsonString, SystemSettings.class);
|
||||
if (null != settings) {
|
||||
setUSBstate(settings);
|
||||
setPhoneList(settings);
|
||||
setBluetooth(settings);
|
||||
setHotspot(settings);
|
||||
setBar(settings);
|
||||
setCamera(settings);
|
||||
setTF(settings);
|
||||
setIcon(settings);
|
||||
setCanReset(settings);
|
||||
setDeveloperOptions(jsonString);
|
||||
setSearchTopic(jsonString);
|
||||
setSOSNumber(settings);
|
||||
setAppstoreAdmin(settings);
|
||||
SystemSettings systemSettings = GsonUtils.toJavaObject(jsonString, SystemSettings.class);
|
||||
if (null != systemSettings) {
|
||||
setUSBstate(systemSettings);
|
||||
setPhoneList(systemSettings);
|
||||
setBluetooth(systemSettings);
|
||||
setHotspot(systemSettings);
|
||||
setBar(systemSettings);
|
||||
setCamera(systemSettings);
|
||||
setTF(systemSettings);
|
||||
setIcon(systemSettings);
|
||||
setCanReset(systemSettings);
|
||||
setDeveloperOptions(systemSettings);
|
||||
// setSearchTopic(systemSettings);
|
||||
setSOSNumber(systemSettings);
|
||||
setAppstoreAdmin(systemSettings);
|
||||
setDefaultApp(systemSettings);
|
||||
JGYUtils.getInstance().updateForbidList();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSystemSetting(SystemSettings systemSettings) {
|
||||
if (systemSettings == null) {
|
||||
Log.e(TAG, "setSystemSetting: SystemSettings is NULL");
|
||||
return;
|
||||
}
|
||||
setUSBstate(systemSettings);
|
||||
setPhoneList(systemSettings);
|
||||
setBluetooth(systemSettings);
|
||||
setHotspot(systemSettings);
|
||||
setBar(systemSettings);
|
||||
setCamera(systemSettings);
|
||||
setTF(systemSettings);
|
||||
setIcon(systemSettings);
|
||||
setCanReset(systemSettings);
|
||||
setDeveloperOptions(systemSettings);
|
||||
// setSearchTopic(systemSettings);
|
||||
setSOSNumber(systemSettings);
|
||||
setAppstoreAdmin(systemSettings);
|
||||
setDefaultApp(systemSettings);
|
||||
JGYUtils.getInstance().updateForbidList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭所有功能
|
||||
*/
|
||||
@@ -103,7 +128,7 @@ public class ControlManager {
|
||||
if (!DeviceManager.isDebugMode()) {
|
||||
setDeveloperOptions(1);
|
||||
}
|
||||
setSearchTopic(0);
|
||||
// setSearchTopic(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -558,11 +583,13 @@ public class ControlManager {
|
||||
} else {
|
||||
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 1);
|
||||
}
|
||||
closeSettingsApp();
|
||||
Log.e(TAG, "aole_restore_forbid_on:" + mode);
|
||||
}
|
||||
|
||||
private void setCanReset(int state) {
|
||||
boolean aole_restore_forbid_on = Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 0);
|
||||
closeSettingsApp();
|
||||
Log.e(TAG, "aole_restore_forbid_on:" + aole_restore_forbid_on);
|
||||
//默认打开
|
||||
}
|
||||
@@ -576,41 +603,87 @@ public class ControlManager {
|
||||
Settings.System.putInt(mResolver, "qch_Browser_input", 0);
|
||||
}
|
||||
|
||||
public void setDeveloperOptions(String jsonString) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(jsonString);
|
||||
int dev_mode = changeNum(jsonObject.get("dev_mode").getAsInt());
|
||||
Log.e(TAG, "getDeveloper: " + dev_mode);
|
||||
public void setDeveloperOptions(SystemSettings systemSettings) {
|
||||
int dev_mode = changeNum(systemSettings.getDev_mode());
|
||||
Log.e(TAG, "setDeveloperOptions: " + dev_mode);
|
||||
if (!DeviceManager.isDebugMode()) {
|
||||
Settings.System.putInt(mResolver, "qch_Developeroptions", dev_mode);
|
||||
int old_dev_enabled = Settings.Global.getInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
|
||||
Log.e(TAG, "setDeveloperOptions: " + old_dev_enabled);
|
||||
int new_state = (dev_mode == 1 ? 0 : 1);
|
||||
if (old_dev_enabled != new_state) {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, new_state);
|
||||
Settings.Global.putInt(mResolver, Settings.Global.ADB_ENABLED, new_state);
|
||||
}
|
||||
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, dev_mode);
|
||||
if (dev_mode == 1) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("qch_developeroptions_close");
|
||||
intent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(intent);
|
||||
Log.e(TAG, "getDeveloper: " + "关闭开发者模式");
|
||||
Log.e(TAG, "setDeveloperOptions: " + "关闭开发者模式");
|
||||
ToastUtil.debugShow("关闭开发者模式");
|
||||
} else {
|
||||
Log.e(TAG, "getDeveloper: " + "打开开发者模式");
|
||||
Log.e(TAG, "setDeveloperOptions: " + "打开开发者模式");
|
||||
ToastUtil.debugShow("打开开发者模式");
|
||||
}
|
||||
}
|
||||
closeSettingsApp();
|
||||
}
|
||||
|
||||
public void setDeveloperOptions(String jsonString) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(jsonString);
|
||||
int dev_mode = changeNum(jsonObject.get("dev_mode").getAsInt());
|
||||
Log.e(TAG, "setDeveloperOptions: " + dev_mode);
|
||||
if (!DeviceManager.isDebugMode()) {
|
||||
Settings.System.putInt(mResolver, "qch_Developeroptions", dev_mode);
|
||||
int old_dev_enabled = Settings.Global.getInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
|
||||
Log.e(TAG, "setDeveloperOptions: " + old_dev_enabled);
|
||||
int new_state = (dev_mode == 1 ? 0 : 1);
|
||||
if (old_dev_enabled != new_state) {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, new_state);
|
||||
Settings.Global.putInt(mResolver, Settings.Global.ADB_ENABLED, new_state);
|
||||
}
|
||||
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, dev_mode);
|
||||
if (dev_mode == 1) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("qch_developeroptions_close");
|
||||
intent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(intent);
|
||||
Log.e(TAG, "setDeveloperOptions: " + "关闭开发者模式");
|
||||
ToastUtil.debugShow("关闭开发者模式");
|
||||
} else {
|
||||
Log.e(TAG, "setDeveloperOptions: " + "打开开发者模式");
|
||||
ToastUtil.debugShow("打开开发者模式");
|
||||
}
|
||||
}
|
||||
closeSettingsApp();
|
||||
}
|
||||
|
||||
public void setDeveloperOptions(int state) {
|
||||
Log.e(TAG, "getDeveloper: " + state);
|
||||
Log.e(TAG, "setDeveloperOptions: " + state);
|
||||
if (!DeviceManager.isDebugMode()) {
|
||||
Settings.System.putInt(mResolver, "qch_Developeroptions", state);
|
||||
int old_dev_enabled = Settings.Global.getInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
|
||||
Log.e(TAG, "setDeveloperOptions: " + old_dev_enabled);
|
||||
int new_state = (state == 1 ? 0 : 1);
|
||||
if (old_dev_enabled != new_state) {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, new_state);
|
||||
Settings.Global.putInt(mResolver, Settings.Global.ADB_ENABLED, new_state);
|
||||
}
|
||||
Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
|
||||
if (state == 1) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("qch_developeroptions_close");
|
||||
intent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(intent);
|
||||
Log.e(TAG, "getDeveloper: " + "关闭开发者模式");
|
||||
Log.e(TAG, "setDeveloperOptions: " + "关闭开发者模式");
|
||||
} else {
|
||||
Log.e(TAG, "getDeveloper: " + "打开开发者模式");
|
||||
Log.e(TAG, "setDeveloperOptions: " + "打开开发者模式");
|
||||
// ToastUtil.show("打开开发者模式");
|
||||
}
|
||||
}
|
||||
closeSettingsApp();
|
||||
}
|
||||
|
||||
public void setSearchTopic(String jsonString) {
|
||||
@@ -618,12 +691,12 @@ public class ControlManager {
|
||||
if (jsonObject.get("search_topic") == null) return;
|
||||
int mode = jsonObject.get("search_topic").getAsInt();
|
||||
SPUtils.put(mContext, "search_topic", mode);
|
||||
Log.e(TAG, "search_topic:" + mode);
|
||||
Log.e(TAG, "setSearchTopic:" + mode);
|
||||
}
|
||||
|
||||
public void setSearchTopic(int state) {
|
||||
SPUtils.put(mContext, "search_topic", state);
|
||||
Log.e(TAG, "search_topic:" + state);
|
||||
Log.e(TAG, "setSearchTopic:" + state);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -676,8 +749,8 @@ public class ControlManager {
|
||||
}
|
||||
|
||||
private void setSetting(SystemSettings settings) {
|
||||
int setting_volume = settings.getSetting_volume();
|
||||
int setting_luminance = settings.getSetting_luminance();
|
||||
String setting_volume = settings.getSetting_volume();
|
||||
String setting_luminance = settings.getSetting_luminance();
|
||||
String setting_typeface = settings.getSetting_typeface();
|
||||
}
|
||||
|
||||
@@ -701,8 +774,50 @@ public class ControlManager {
|
||||
|
||||
private void setDefaultApp(SystemSettings settings) {
|
||||
String desktop_app = settings.getDesktop_app();
|
||||
Log.e(TAG, "setDefaultApp: desktop_app = " + desktop_app);
|
||||
if (!TextUtils.isEmpty(desktop_app)) {
|
||||
mMMKV.encode(CommonConfig.DESKTOP_APP_KEY, desktop_app);
|
||||
JGYUtils.getInstance().setDefaultDesktop(desktop_app);
|
||||
} else {
|
||||
mMMKV.encode(CommonConfig.DESKTOP_APP_KEY, "");
|
||||
}
|
||||
String browser_app = settings.getBrowser_app();
|
||||
Log.e(TAG, "setDefaultApp: browser_app = " + browser_app);
|
||||
if (!TextUtils.isEmpty(browser_app)) {
|
||||
mMMKV.encode(CommonConfig.BROWSER_APP_KEY, browser_app);
|
||||
JGYUtils.getInstance().setDefaultBrowser(browser_app);
|
||||
} else {
|
||||
mMMKV.encode(CommonConfig.BROWSER_APP_KEY, "");
|
||||
}
|
||||
String typewriting_app = settings.getTypewriting_app();
|
||||
Log.e(TAG, "setDefaultApp: typewriting_app = " + typewriting_app);
|
||||
if (!TextUtils.isEmpty(typewriting_app)) {
|
||||
mMMKV.encode(CommonConfig.TYPEWRITING_APP_KEY, typewriting_app);
|
||||
JGYUtils.getInstance().setDefaultInputMethod(typewriting_app);
|
||||
} else {
|
||||
mMMKV.encode(CommonConfig.TYPEWRITING_APP_KEY, "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用安装之后重新设置
|
||||
*/
|
||||
public void setDefaultApp() {
|
||||
String desktop_app = mMMKV.decodeString(CommonConfig.DESKTOP_APP_KEY, "");
|
||||
Log.e(TAG, "setDefaultApp: desktop_app = " + desktop_app);
|
||||
if (!TextUtils.isEmpty(desktop_app)) {
|
||||
JGYUtils.getInstance().setDefaultDesktop(desktop_app);
|
||||
}
|
||||
String browser_app = mMMKV.decodeString(CommonConfig.BROWSER_APP_KEY, "");
|
||||
Log.e(TAG, "setDefaultApp: browser_app = " + browser_app);
|
||||
if (!TextUtils.isEmpty(browser_app)) {
|
||||
JGYUtils.getInstance().setDefaultBrowser(browser_app);
|
||||
}
|
||||
String typewriting_app = mMMKV.decodeString(CommonConfig.TYPEWRITING_APP_KEY, "");
|
||||
Log.e(TAG, "setDefaultApp: typewriting_app = " + typewriting_app);
|
||||
if (!TextUtils.isEmpty(typewriting_app)) {
|
||||
JGYUtils.getInstance().setDefaultInputMethod(typewriting_app);
|
||||
}
|
||||
}
|
||||
|
||||
private void setIsControl(SystemSettings settings) {
|
||||
@@ -714,5 +829,7 @@ public class ControlManager {
|
||||
Settings.System.putInt(mResolver, "is_control", state);
|
||||
}
|
||||
|
||||
|
||||
private void closeSettingsApp() {
|
||||
JGYUtils.getInstance().killBackgroundProcesses("com.android.settings");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.uiui.sn.bean.BatchID;
|
||||
import com.uiui.sn.bean.CloudLessonSetting;
|
||||
import com.uiui.sn.bean.Label;
|
||||
import com.uiui.sn.bean.SnInfo;
|
||||
import com.uiui.sn.bean.SystemSettings;
|
||||
import com.uiui.sn.bean.UserAvatarInfo;
|
||||
import com.uiui.sn.bean.browser.BrowserApiData;
|
||||
import com.uiui.sn.bean.browser.BrowserBean;
|
||||
@@ -276,7 +277,7 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getsettingControl() {
|
||||
public Observable<BaseResponse<SystemSettings>> getsettingControl() {
|
||||
return mRetrofit.create(Setting.class)
|
||||
.getSetting(Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -694,6 +695,7 @@ public class NetInterfaceManager {
|
||||
this.add("com.uiui.aios");
|
||||
this.add("com.uiui.os");
|
||||
this.add("com.uiui.appstore");
|
||||
this.add("com.uiui.info");
|
||||
this.add("com.uiui.sn");
|
||||
this.add("com.uiui.health");
|
||||
this.add("com.uiui.city");
|
||||
@@ -829,7 +831,7 @@ public class NetInterfaceManager {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull List<AppInfo> appInfos) {
|
||||
cacheHelper.put(UrlAddress.GET_NEWESTAPPUPDATE, GsonUtils.toJSONString(appInfos));
|
||||
// cacheHelper.put(UrlAddress.GET_NEWESTAPPUPDATE, GsonUtils.toJSONString(appInfos));
|
||||
getAllAppUpdate(appInfos);
|
||||
Log.e("getElderlyUsersApp", "onNext: " + appInfos);
|
||||
}
|
||||
@@ -917,7 +919,8 @@ public class NetInterfaceManager {
|
||||
getUpdateObservable(JGYUtils.PACKAGE_APPSTORE),
|
||||
getUpdateObservable(JGYUtils.PACKAGE_OS),
|
||||
getUpdateObservable(JGYUtils.PACKAGE_BROWSER),
|
||||
(appInfoBaseResponse, appInfoBaseResponse2, appInfoBaseResponse3, appInfoBaseResponse4) -> {
|
||||
getUpdateObservable(JGYUtils.Notifications),
|
||||
(appInfoBaseResponse, appInfoBaseResponse2, appInfoBaseResponse3, appInfoBaseResponse4, appInfoBaseResponse5) -> {
|
||||
List<AppInfo> appInfoList = new ArrayList<>();
|
||||
if (appInfoBaseResponse.code == 200) {
|
||||
appInfoList.add(appInfoBaseResponse.data);
|
||||
@@ -928,6 +931,12 @@ public class NetInterfaceManager {
|
||||
if (appInfoBaseResponse3.code == 200) {
|
||||
appInfoList.add(appInfoBaseResponse3.data);
|
||||
}
|
||||
if (appInfoBaseResponse4.code == 200) {
|
||||
appInfoList.add(appInfoBaseResponse3.data);
|
||||
}
|
||||
if (appInfoBaseResponse5.code == 200) {
|
||||
appInfoList.add(appInfoBaseResponse3.data);
|
||||
}
|
||||
return appInfoList;
|
||||
})
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
@@ -1735,41 +1744,85 @@ public class NetInterfaceManager {
|
||||
});
|
||||
}
|
||||
|
||||
public void getForceInstall(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||
ConnectMode connectMode = ConnectMode.ONE_DAY;
|
||||
if (refresh) {
|
||||
connectMode = ConnectMode.ONE_HOUR;
|
||||
}
|
||||
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_FORCE_INSTALL, connectMode)) {
|
||||
getForceInstall(lifecycle, callback);
|
||||
} else {
|
||||
String jsonString = cacheHelper.getAsString(UrlAddress.GET_FORCE_INSTALL);
|
||||
//为 "" 是已经请求成功的
|
||||
if (jsonString == null) {
|
||||
getForceInstall(lifecycle, callback);
|
||||
} else {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<AppInfo>>() {
|
||||
}.getType();
|
||||
List<AppInfo> appInfos = gson.fromJson(jsonString, type);
|
||||
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void getForceInstall(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||
getForceInstallControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(getForceInstallObserver(callback));
|
||||
}
|
||||
|
||||
public void getForceInstall(onCompleteCallback callback) {
|
||||
getForceInstallControl()
|
||||
.subscribe(getForceInstallObserver(callback));
|
||||
}
|
||||
|
||||
public void getForceInstall() {
|
||||
getForceInstallControl()
|
||||
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
int code = listBaseResponse.code;
|
||||
if (code == 200) {
|
||||
List<AppInfo> appInfos = listBaseResponse.data;
|
||||
if (null != appInfos && appInfos.size() != 0) {
|
||||
getForceInstallState(appInfos);
|
||||
}
|
||||
// JGYUtils.getInstance().deleteOtherApp();
|
||||
} else {
|
||||
boolean aole_force_app = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_FORCE_APP, "");
|
||||
Log.e(TAG, "aole_force_app:" + aole_force_app + ":" + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getForceInstall", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
.subscribe(getForceInstallObserver(null));
|
||||
}
|
||||
|
||||
private Observer<BaseResponse<List<AppInfo>>> getForceInstallObserver(onCompleteCallback callback) {
|
||||
return new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
int code = listBaseResponse.code;
|
||||
if (code == 200) {
|
||||
List<AppInfo> appInfos = listBaseResponse.data;
|
||||
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL, GsonUtils.toJSONString(appInfos));
|
||||
if (null != appInfos && appInfos.size() != 0) {
|
||||
getForceInstallState(appInfos);
|
||||
}
|
||||
// JGYUtils.getInstance().deleteOtherApp();
|
||||
} else {
|
||||
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL, "");
|
||||
boolean aole_force_app = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_FORCE_APP, "");
|
||||
Log.e(TAG, "aole_force_app:" + aole_force_app + ":" + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getForceInstall", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
if (callback != null) {
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void getForceInstallState(List<AppInfo> list) {
|
||||
if (null != list && list.size() != 0) {
|
||||
@@ -1810,14 +1863,14 @@ public class NetInterfaceManager {
|
||||
|
||||
public void getSystemSettings() {
|
||||
getsettingControl()
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
.subscribe(new Observer<BaseResponse<SystemSettings>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSystemSettings", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse BaseResponse) {
|
||||
public void onNext(@NonNull BaseResponse<SystemSettings> BaseResponse) {
|
||||
int code = BaseResponse.code;
|
||||
if (code == 200) {
|
||||
String data = new Gson().toJson(BaseResponse.data);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.uiui.sn.network.api;
|
||||
|
||||
import com.uiui.sn.bean.BaseResponse;
|
||||
import com.uiui.sn.bean.SystemSettings;
|
||||
import com.uiui.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@@ -9,7 +10,7 @@ import retrofit2.http.Query;
|
||||
|
||||
public interface Setting {
|
||||
@GET(UrlAddress.GET_SETTINGS)
|
||||
Observable<BaseResponse> getSetting(
|
||||
Observable<BaseResponse<SystemSettings>> getSetting(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.uiui.sn.config.CommonConfig;
|
||||
import com.uiui.sn.manager.ControlManager;
|
||||
import com.uiui.sn.network.NetInterfaceManager;
|
||||
import com.uiui.sn.utils.ApkUtils;
|
||||
import com.uiui.sn.utils.CacheUtils;
|
||||
@@ -38,6 +39,7 @@ public class APKinstallReceiver extends BroadcastReceiver {
|
||||
String action = intent.getAction();
|
||||
ApkUtils.addShortcut(context);
|
||||
JGYUtils.getInstance().cleanLauncherCache();
|
||||
ControlManager.getInstance().setDefaultApp();
|
||||
Log.e(TAG, "onReceive: " + "action = " + action);
|
||||
String state;
|
||||
if (TextUtils.isEmpty(action)) {
|
||||
|
||||
@@ -446,7 +446,8 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("sendScreenState", "onError: " + e.getMessage());
|
||||
// TODO: 2022/7/11 接口本身问题
|
||||
// Log.e("sendScreenState", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.uiui.sn.bean.AppInfo;
|
||||
import com.uiui.sn.bean.AppStart;
|
||||
import com.uiui.sn.bean.BaseResponse;
|
||||
import com.uiui.sn.bean.Label;
|
||||
import com.uiui.sn.bean.SystemSettings;
|
||||
import com.uiui.sn.bean.browser.BrowserApiData;
|
||||
import com.uiui.sn.bean.browser.BrowserBean;
|
||||
import com.uiui.sn.config.CommonConfig;
|
||||
@@ -213,42 +214,14 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getForceInstall() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getForceInstallControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getForceInstall", "onSubscribe: ");
|
||||
}
|
||||
NetInterfaceManager.getInstance().getForceInstall(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.setForceInstall();
|
||||
Log.e("getForceInstall", "onComplete: ");
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
Log.e("getForceInstall", "onNext: " + listBaseResponse);
|
||||
int code = listBaseResponse.code;
|
||||
if (code == 200) {
|
||||
List<AppInfo> appInfos = listBaseResponse.data;
|
||||
if (null != appInfos && appInfos.size() != 0) {
|
||||
NetInterfaceManager.getInstance().getForceInstallState(appInfos);
|
||||
}
|
||||
} else {
|
||||
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "");
|
||||
Log.e("getForceInstall", "aole_force_app: invalid: " + aole_force_app);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getForceInstall", "onError: ");
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getForceInstall", "onComplete: ");
|
||||
mView.setForceInstall();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -256,14 +229,14 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getsettingControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
.subscribe(new Observer<BaseResponse<SystemSettings>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getSystemSettings", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse systemSettingsBaseResponse) {
|
||||
public void onNext(BaseResponse<SystemSettings> systemSettingsBaseResponse) {
|
||||
Log.e("getSystemSettings", "onNext: " + systemSettingsBaseResponse);
|
||||
SPUtils.put(mContext, "is_first_connection", 0);
|
||||
int code = systemSettingsBaseResponse.code;
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
@@ -118,7 +119,19 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
return mMainBinder;
|
||||
}
|
||||
|
||||
public MainBinder mMainBinder = new MainBinder();
|
||||
|
||||
public class MainBinder extends Binder {
|
||||
public MainService getService() {
|
||||
return MainService.this;
|
||||
}
|
||||
}
|
||||
|
||||
public void getLocked() {
|
||||
mPresenter.getLocked();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -382,6 +395,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void setLocked(int lockedStatus) {
|
||||
Log.e(TAG, "setLocked: ");
|
||||
switch (lockedStatus) {
|
||||
case 0:
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
|
||||
@@ -619,6 +619,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
JsonObject killJSONObject = GsonUtils.getJsonObject(extras);
|
||||
String packages = killJSONObject.get("app_package").getAsString();
|
||||
JGYUtils.getInstance().killBackgroundProcesses(packages);
|
||||
JGYUtils.getInstance().gotoLauncher();
|
||||
Log.e(TAG, extras);
|
||||
break;
|
||||
case JIGUANG_LOCK_SCREEN:
|
||||
|
||||
@@ -855,17 +855,18 @@ public class ApkUtils {
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public static void writeAppPackageList(Context context, String result) {
|
||||
Log.e(TAG, "writeAppPackageList: " + result);
|
||||
addShortcut(context);//开机之后添加图标到桌面
|
||||
HashSet<String> factoryAppList = JGYUtils.getInstance().getOwnApp();
|
||||
if (!TextUtils.isEmpty(result)) {
|
||||
HashSet<String> writeAppSet = new HashSet<>(Arrays.asList(result.split(",")));
|
||||
writeAppSet.addAll(factoryAppList);
|
||||
String pkgString = String.join(",", writeAppSet);
|
||||
Log.e("fht", "aole_app_forbid: " + pkgString);
|
||||
Log.e("writeAppPackageList", "aole_app_forbid: " + pkgString);
|
||||
boolean aole_app_forbid = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, pkgString);
|
||||
} else {
|
||||
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, String.join(",", factoryAppList));
|
||||
Log.e("fht", "writeAppPackageList is null:");
|
||||
Log.e("writeAppPackageList", "writeAppPackageList is null:");
|
||||
}
|
||||
Utils.writeDisableUpdateList(context);
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@ public class JGYUtils {
|
||||
this.add("com.jiaoguanyi.appstore");
|
||||
this.add("com.jiaoguanyi.store");
|
||||
this.add("com.uiui.appstore");
|
||||
this.add("com.uiui.info");
|
||||
this.add("com.uiui.browser");
|
||||
this.add("com.uiui.health");
|
||||
this.add("com.uiui.videoplayer");
|
||||
@@ -494,7 +495,7 @@ public class JGYUtils {
|
||||
}
|
||||
|
||||
public void killBackgroundProcesses(String processName) {
|
||||
gotoLauncher();
|
||||
// gotoLauncher();
|
||||
// mIsScanning = true;
|
||||
removeTask(processName);
|
||||
ActivityManager activityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
@@ -558,7 +559,7 @@ public class JGYUtils {
|
||||
/**
|
||||
* 如果界面正在最近任务列表,有些app可能不会被清理
|
||||
*/
|
||||
private void gotoLauncher() {
|
||||
public void gotoLauncher() {
|
||||
Intent i = new Intent(Intent.ACTION_MAIN);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //android123提示如果是服务里调用,必须加入new task标识
|
||||
i.addCategory(Intent.CATEGORY_HOME);
|
||||
@@ -732,7 +733,7 @@ public class JGYUtils {
|
||||
|
||||
private void openLauncher3() {
|
||||
setDefaultDesktop(Launcher3, Launcher3Class);
|
||||
ApkUtils.openPackage(mContext, Launcher3);
|
||||
// ApkUtils.openPackage(mContext, Launcher3);
|
||||
}
|
||||
|
||||
public String getStartClassName(String pkg) {
|
||||
@@ -1162,6 +1163,8 @@ public class JGYUtils {
|
||||
public static final String AIHealth = "com.uiui.health";
|
||||
/*老人桌面*/
|
||||
public static final String ElderlyDesktop = "com.uiui.aios";
|
||||
/*消息通知*/
|
||||
public static final String Notifications = "com.uiui.info";
|
||||
|
||||
|
||||
public static final String PACKAGE_BROWSER = "com.uiui.browser";
|
||||
|
||||
@@ -1311,9 +1311,10 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static List<String> runningAppWhitelist = new ArrayList<String>() {{
|
||||
this.add("com.android.launcher3");
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
this.add("com.android.launcher3");
|
||||
this.add("com.uiui.appstore");
|
||||
this.add("com.uiui.info");
|
||||
this.add("com.uiui.os");
|
||||
this.add("com.uiui.aios");
|
||||
this.add("com.uiui.browser");
|
||||
|
||||
Reference in New Issue
Block a user