version:1.0.9
fix: update:优化推送,优化激活逻辑
This commit is contained in:
@@ -17,8 +17,8 @@ android {
|
|||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
|
|
||||||
versionCode 7
|
versionCode 10
|
||||||
versionName "1.0.6"
|
versionName "1.0.9"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import com.xwad.os.base.BaseDataBindingActivity;
|
|||||||
import com.xwad.os.config.CommonConfig;
|
import com.xwad.os.config.CommonConfig;
|
||||||
import com.xwad.os.databinding.ActivityExitBinding;
|
import com.xwad.os.databinding.ActivityExitBinding;
|
||||||
import com.xwad.os.mdm.AdminManager;
|
import com.xwad.os.mdm.AdminManager;
|
||||||
import com.xwad.os.utils.Utils;
|
import com.xwad.os.utils.ApkUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -179,15 +179,18 @@ public class ExitActivity extends BaseDataBindingActivity {
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// startActivity(new Intent(Settings.ACTION_HOME_SETTINGS));
|
// startActivity(new Intent(Settings.ACTION_HOME_SETTINGS));
|
||||||
|
AdminManager.getInstance().removeDisallowedRunningApp("com.hihonor.android.launcher");
|
||||||
|
|
||||||
|
AdminManager.getInstance().clearDefaultLauncher();
|
||||||
AdminManager.getInstance().setDefaultLauncher("com.hihonor.android.launcher", "com.hihonor.android.launcher.unihome.UniHomeLauncher");
|
AdminManager.getInstance().setDefaultLauncher("com.hihonor.android.launcher", "com.hihonor.android.launcher.unihome.UniHomeLauncher");
|
||||||
|
ApkUtils.openPackage(this, "com.hihonor.android.launcher", "com.hihonor.android.launcher.unihome.UniHomeLauncher");
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
finishAndRemoveTask();
|
finishAndRemoveTask();
|
||||||
} else {
|
} else {
|
||||||
finishAffinity();
|
finishAffinity();
|
||||||
}
|
}
|
||||||
|
AdminManager.getInstance().killApplicationProcess(BuildConfig.APPLICATION_ID);
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import android.content.res.Resources;
|
|||||||
import android.os.BatteryManager;
|
import android.os.BatteryManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -44,12 +43,12 @@ import com.xwad.os.activity.permission.PermissionActivity;
|
|||||||
import com.xwad.os.activity.update.UpdateActivity;
|
import com.xwad.os.activity.update.UpdateActivity;
|
||||||
import com.xwad.os.base.mvvm.BaseMvvmActivity;
|
import com.xwad.os.base.mvvm.BaseMvvmActivity;
|
||||||
import com.xwad.os.bean.AppInfo;
|
import com.xwad.os.bean.AppInfo;
|
||||||
import com.xwad.os.bean.AppUpdateInfo;
|
|
||||||
import com.xwad.os.bean.PhraseContent;
|
import com.xwad.os.bean.PhraseContent;
|
||||||
import com.xwad.os.bean.UserInfo;
|
import com.xwad.os.bean.UserInfo;
|
||||||
import com.xwad.os.bean.jxw.TabBean;
|
import com.xwad.os.bean.jxw.TabBean;
|
||||||
import com.xwad.os.config.CommonConfig;
|
import com.xwad.os.config.CommonConfig;
|
||||||
import com.xwad.os.databinding.ActivityHomeBinding;
|
import com.xwad.os.databinding.ActivityHomeBinding;
|
||||||
|
import com.xwad.os.dialog.DeactivateDialog;
|
||||||
import com.xwad.os.dialog.PermissionsDialog;
|
import com.xwad.os.dialog.PermissionsDialog;
|
||||||
import com.xwad.os.dialog.PrivacyPolicyDialog;
|
import com.xwad.os.dialog.PrivacyPolicyDialog;
|
||||||
import com.xwad.os.eula.EulaDialog;
|
import com.xwad.os.eula.EulaDialog;
|
||||||
@@ -70,11 +69,9 @@ import com.xwad.os.jxw.event.UpdateColorEvent;
|
|||||||
import com.xwad.os.jxw.event.UpdateGradeEvent;
|
import com.xwad.os.jxw.event.UpdateGradeEvent;
|
||||||
import com.xwad.os.jxw.fragment.SztzFragment;
|
import com.xwad.os.jxw.fragment.SztzFragment;
|
||||||
import com.xwad.os.jxw.util.Util;
|
import com.xwad.os.jxw.util.Util;
|
||||||
import com.xwad.os.manager.DeviceSNManager;
|
|
||||||
import com.xwad.os.mdm.AdminManager;
|
import com.xwad.os.mdm.AdminManager;
|
||||||
import com.xwad.os.permission.PermissionUtils;
|
import com.xwad.os.permission.PermissionUtils;
|
||||||
import com.xwad.os.receiver.AoleDeviceAdminReceiver;
|
import com.xwad.os.receiver.AoleDeviceAdminReceiver;
|
||||||
import com.xwad.os.service.main.MainService;
|
|
||||||
import com.xwad.os.utils.ActivationUtil;
|
import com.xwad.os.utils.ActivationUtil;
|
||||||
import com.xwad.os.utils.ApkUtils;
|
import com.xwad.os.utils.ApkUtils;
|
||||||
import com.xwad.os.utils.DataUtil;
|
import com.xwad.os.utils.DataUtil;
|
||||||
@@ -110,7 +107,7 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
|||||||
this.add(BuildConfig.APPLICATION_ID);
|
this.add(BuildConfig.APPLICATION_ID);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private ArrayList<String> mPersistentApp=new ArrayList<String>(){{
|
private ArrayList<String> mPersistentApp = new ArrayList<String>() {{
|
||||||
this.add(BuildConfig.APPLICATION_ID);
|
this.add(BuildConfig.APPLICATION_ID);
|
||||||
this.add("com.jxw.launcher");
|
this.add("com.jxw.launcher");
|
||||||
this.add("com.jxw.zncd");
|
this.add("com.jxw.zncd");
|
||||||
@@ -270,7 +267,7 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initViews() {
|
private void initViews() {
|
||||||
Log.e(TAG, "initViews: " );
|
Log.e(TAG, "initViews: ");
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
|
|
||||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
||||||
@@ -366,7 +363,6 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
|||||||
Log.e(TAG, "checkActiveAdmin: userActiveAdmin0");
|
Log.e(TAG, "checkActiveAdmin: userActiveAdmin0");
|
||||||
} else {
|
} else {
|
||||||
userActiveAdmin();
|
userActiveAdmin();
|
||||||
setDefault();
|
|
||||||
Log.e(TAG, "checkActiveAdmin: setDefault0");
|
Log.e(TAG, "checkActiveAdmin: setDefault0");
|
||||||
}
|
}
|
||||||
} else if (controlMode == 1) {
|
} else if (controlMode == 1) {
|
||||||
@@ -375,7 +371,7 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
|||||||
forceActiveAdmin();
|
forceActiveAdmin();
|
||||||
Log.e(TAG, "checkActiveAdmin: forceActiveAdmin1");
|
Log.e(TAG, "checkActiveAdmin: forceActiveAdmin1");
|
||||||
} else {
|
} else {
|
||||||
setDefault();
|
setDeviceOwnerApp();
|
||||||
Log.e(TAG, "checkActiveAdmin: setDefault1");
|
Log.e(TAG, "checkActiveAdmin: setDefault1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -438,6 +434,7 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "userActiveAdmin: setForcedActiveDeviceAdmin: " + e.getMessage());
|
Log.e(TAG, "userActiveAdmin: setForcedActiveDeviceAdmin: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
setDeviceOwnerApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,12 +451,14 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
|||||||
mDeviceControlManager.setDeviceOwnerApp(mAdminName, getPackageName());
|
mDeviceControlManager.setDeviceOwnerApp(mAdminName, getPackageName());
|
||||||
Log.e(TAG, "setDeviceOwnerApp: " + Utils.getSerial(HomeActivity.this));
|
Log.e(TAG, "setDeviceOwnerApp: " + Utils.getSerial(HomeActivity.this));
|
||||||
Log.e(TAG, "setDeviceOwnerApp: successful1");
|
Log.e(TAG, "setDeviceOwnerApp: successful1");
|
||||||
|
setDefault();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (e.getMessage().contains("accounts")) {
|
|
||||||
Toaster.showLong("设备激活失败,请退出账号");
|
|
||||||
Toaster.debugShow(e.getMessage());
|
|
||||||
}
|
|
||||||
Log.e(TAG, "setDeviceOwnerApp: " + e.getMessage());
|
Log.e(TAG, "setDeviceOwnerApp: " + e.getMessage());
|
||||||
|
if (!TextUtils.isEmpty(e.getMessage()) && e.getMessage().contains("already set")) {
|
||||||
|
setDefault();
|
||||||
|
} else {
|
||||||
|
showDeactivateDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 反射调用setDeviceOwnerApp,激活Device Owner,MagicOS 7.0以上可以直接调用SDK里的对应方法
|
// 反射调用setDeviceOwnerApp,激活Device Owner,MagicOS 7.0以上可以直接调用SDK里的对应方法
|
||||||
@@ -471,19 +470,58 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
|||||||
Log.e(TAG, "setDeviceOwnerApp successful2");
|
Log.e(TAG, "setDeviceOwnerApp successful2");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "setDeviceOwnerApp error:" + e.toString());
|
||||||
|
if (!TextUtils.isEmpty(e.getMessage()) && e.getMessage().contains("already set")) {
|
||||||
Toaster.show("设备激活失败,请退出账号");
|
Toaster.show("设备激活失败,请退出账号");
|
||||||
Log.e(TAG, "setDeviceOwnerApp error: " + e.toString());
|
setDefault();
|
||||||
e.printStackTrace();
|
} else {
|
||||||
|
showDeactivateDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showDeactivateDialog() {
|
||||||
|
DeactivateDialog deactivateDialog = new DeactivateDialog(HomeActivity.this);
|
||||||
|
deactivateDialog.setTitle("激活失败");
|
||||||
|
deactivateDialog.setMessage("设置app为设备管理者失败,请退出设置里面登录的账号,重新运行app或者重启设备后重试。如遇到解锁失败的情况请进入设置-安全-设备管理器手动解锁");
|
||||||
|
deactivateDialog.setOnClickBottomListener(new DeactivateDialog.OnClickBottomListener() {
|
||||||
|
@Override
|
||||||
|
public void onPositiveClick() {
|
||||||
|
try {
|
||||||
|
startActivity(new Intent("android.app.action.DEVICE_POLICY_MANAGER_SETTINGS"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
startActivity(new Intent(Settings.ACTION_SECURITY_SETTINGS));
|
||||||
|
}
|
||||||
|
deactivateDialog.dismiss();
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNegtiveClick() {
|
||||||
|
deactivateDialog.dismiss();
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDeactivateClick() {
|
||||||
|
try {
|
||||||
|
mDeviceControlManager.removeActiveDeviceAdmin(mAdminName);
|
||||||
|
mDeviceControlManager.clearDeviceOwnerApp();
|
||||||
|
Toaster.showLong("设备已解锁");
|
||||||
|
} catch (Exception e) {
|
||||||
|
Toaster.showLong("设备解锁失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
deactivateDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
private void setDefault() {
|
private void setDefault() {
|
||||||
Log.e(TAG, "setDefault: ");
|
Log.e(TAG, "setDefault: ");
|
||||||
AdminManager.init(this);
|
AdminManager.init(this);
|
||||||
getPermission();
|
getPermission();
|
||||||
debugTest();
|
debugTest();
|
||||||
setDeviceOwnerApp();
|
|
||||||
setDisallowUninstall();
|
setDisallowUninstall();
|
||||||
JgyUtils.getInstance().startServices();
|
JgyUtils.getInstance().startServices();
|
||||||
|
|
||||||
@@ -503,9 +541,11 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
|||||||
AdminManager.getInstance().addAlertWindowApps(forceAppList);
|
AdminManager.getInstance().addAlertWindowApps(forceAppList);
|
||||||
|
|
||||||
// AdminManager.getInstance().setRestoreFactoryDisabled(true);
|
// AdminManager.getInstance().setRestoreFactoryDisabled(true);
|
||||||
AdminManager.getInstance().setDefaultLauncher("com.xwad.os");
|
AdminManager.getInstance().setDefaultLauncher("com.xwad.os", "com.xwad.os.activity.home.HomeActivity");
|
||||||
AdminManager.getInstance().addIgnoreFrequentRelaunchAppList("com.xwad.os");
|
AdminManager.getInstance().addIgnoreFrequentRelaunchAppList("com.xwad.os");
|
||||||
AdminManager.getInstance().addDisallowedRunningApp("com.hihonor.servicecenter");
|
AdminManager.getInstance().addDisallowedRunningApp("com.hihonor.servicecenter");
|
||||||
|
AdminManager.getInstance().addDisallowedRunningApp("com.hihonor.parentcontrol");
|
||||||
|
AdminManager.getInstance().addDisallowedRunningApp("com.hihonor.android.launcher");
|
||||||
// AdminManager.getInstance().setStatusBarExpandPanelDisabled(true);
|
// AdminManager.getInstance().setStatusBarExpandPanelDisabled(true);
|
||||||
AdminManager.getInstance().setQuickToolsDisabled(true);
|
AdminManager.getInstance().setQuickToolsDisabled(true);
|
||||||
|
|
||||||
@@ -520,6 +560,8 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
|||||||
this.add("backup_settings");
|
this.add("backup_settings");
|
||||||
this.add("apps_honor_tips");
|
this.add("apps_honor_tips");
|
||||||
this.add("pengine_settings");
|
this.add("pengine_settings");
|
||||||
|
this.add("screen_wallpaper");
|
||||||
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private void getPermission() {
|
private void getPermission() {
|
||||||
@@ -641,6 +683,14 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
|||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void exit() {
|
||||||
|
finish();
|
||||||
|
//调用系统API结束进程
|
||||||
|
android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
|
|
||||||
|
//结束整个虚拟机进程,注意如果在manifest里用android:process给app指定了不止一个进程,则只会结束当前进程
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onGkNoticeEvent(UpdateGradeEvent updateGradeEvent) {
|
public void onGkNoticeEvent(UpdateGradeEvent updateGradeEvent) {
|
||||||
@@ -746,11 +796,12 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
|||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
|
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
return false;
|
return false;
|
||||||
} else if (KeyEvent.KEYCODE_HOME == keyCode) {
|
|
||||||
Log.e(TAG, "onKeyDown: keyCode = " + keyCode);
|
|
||||||
//写要执行的动作或者任务
|
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
|
||||||
}
|
}
|
||||||
|
// else if (KeyEvent.KEYCODE_HOME == keyCode) {
|
||||||
|
// Log.e(TAG, "onKeyDown: keyCode = " + keyCode);
|
||||||
|
// //写要执行的动作或者任务
|
||||||
|
// android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
|
// }
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -963,8 +1014,8 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unregisterRefreshReceiver(){
|
private void unregisterRefreshReceiver() {
|
||||||
if (mRefreshReceiver!=null){
|
if (mRefreshReceiver != null) {
|
||||||
unregisterReceiver(mRefreshReceiver);
|
unregisterReceiver(mRefreshReceiver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import androidx.multidex.MultiDex;
|
|||||||
|
|
||||||
import com.alibaba.sdk.android.push.CloudPushService;
|
import com.alibaba.sdk.android.push.CloudPushService;
|
||||||
import com.alibaba.sdk.android.push.CommonCallback;
|
import com.alibaba.sdk.android.push.CommonCallback;
|
||||||
|
import com.alibaba.sdk.android.push.noonesdk.PushInitConfig;
|
||||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
||||||
import com.arialyy.aria.core.Aria;
|
import com.arialyy.aria.core.Aria;
|
||||||
import com.hjq.toast.Toaster;
|
import com.hjq.toast.Toaster;
|
||||||
@@ -87,6 +88,7 @@ public class BaseApplication extends Application {
|
|||||||
JgyUtils.init(this);
|
JgyUtils.init(this);
|
||||||
AdminManager.init(this);
|
AdminManager.init(this);
|
||||||
|
|
||||||
|
|
||||||
CrashReport.initCrashReport(getApplicationContext(), "4efcaad4c9", false);
|
CrashReport.initCrashReport(getApplicationContext(), "4efcaad4c9", false);
|
||||||
CrashReport.setDeviceId(BaseApplication.this, AdminManager.getInstance().getSerial());
|
CrashReport.setDeviceId(BaseApplication.this, AdminManager.getInstance().getSerial());
|
||||||
|
|
||||||
@@ -115,7 +117,17 @@ public class BaseApplication extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void aliyunPushInit() {
|
public void aliyunPushInit() {
|
||||||
PushServiceFactory.init(this);
|
// 特殊场景 需要定时拉起channel
|
||||||
|
PushInitConfig config = new PushInitConfig.Builder()
|
||||||
|
.application(this)
|
||||||
|
.loopStartChannel(true)
|
||||||
|
.loopInterval(60 * 10 * 1000)
|
||||||
|
// 开启channel进程
|
||||||
|
.disableChannelProcess(false)
|
||||||
|
// 开启channel进程心跳
|
||||||
|
.disableChannelProcessheartbeat(false)
|
||||||
|
.build();
|
||||||
|
PushServiceFactory.init(config);
|
||||||
final CloudPushService pushService = PushServiceFactory.getCloudPushService();
|
final CloudPushService pushService = PushServiceFactory.getCloudPushService();
|
||||||
pushService.setLogLevel(CloudPushService.LOG_OFF);
|
pushService.setLogLevel(CloudPushService.LOG_OFF);
|
||||||
pushService.register(this, new CommonCallback() {
|
pushService.register(this, new CommonCallback() {
|
||||||
@@ -124,6 +136,36 @@ public class BaseApplication extends Application {
|
|||||||
Log.e("AliyunPush", "init cloudchannel success");
|
Log.e("AliyunPush", "init cloudchannel success");
|
||||||
Log.e("AliyunPush", "init cloudchannel success " + pushService.getDeviceId());
|
Log.e("AliyunPush", "init cloudchannel success " + pushService.getDeviceId());
|
||||||
MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE).encode(CommonConfig.ALIYUN_PUSH_ID, pushService.getDeviceId());
|
MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE).encode(CommonConfig.ALIYUN_PUSH_ID, pushService.getDeviceId());
|
||||||
|
|
||||||
|
if (AdminManager.getInstance().isActiveMe()) {
|
||||||
|
String sn = AdminManager.getInstance().getSerial();
|
||||||
|
pushService.bindAccount(sn, new CommonCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String s) {
|
||||||
|
Log.e("AliyunPush", "bind account " + sn + " success\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailed(String errorCode, String errorMsg) {
|
||||||
|
Log.e("AliyunPush", "bind account " + sn + " failed." +
|
||||||
|
"errorCode: " + errorCode + ", errorMsg:" + errorMsg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
pushService.addAlias(sn, new CommonCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String s) {
|
||||||
|
Log.e("AliyunPush", "add alias " + sn + " success\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailed(String errorCode, String errorMsg) {
|
||||||
|
Log.e("AliyunPush", "add alias " + sn + " failed." +
|
||||||
|
"errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "onSuccess: admin not Activation");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.xwad.os.bean;
|
package com.xwad.os.bean;
|
||||||
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
@@ -70,32 +69,13 @@ public class SystemSettings implements Serializable {
|
|||||||
int is_top_notify;
|
int is_top_notify;
|
||||||
int is_bottom_bar;
|
int is_bottom_bar;
|
||||||
int is_notify_bar_show;
|
int is_notify_bar_show;
|
||||||
|
int browser_down;
|
||||||
int voice_assistant;
|
int voice_assistant;
|
||||||
|
int is_browser_network;
|
||||||
public int getQch_restore() {
|
int photo_answer_display;
|
||||||
return qch_restore;
|
int ai_teacher;
|
||||||
}
|
int photo_search_questions;
|
||||||
|
int ai_question_test;
|
||||||
public void setQch_restore(int qch_restore) {
|
|
||||||
this.qch_restore = qch_restore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSetting_browserInput() {
|
|
||||||
return setting_browserInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSetting_browserInput(int setting_browserInput) {
|
|
||||||
this.setting_browserInput = setting_browserInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDev_mode() {
|
|
||||||
return dev_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDev_mode(int dev_mode) {
|
|
||||||
this.dev_mode = dev_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int getSetting_call() {
|
public int getSetting_call() {
|
||||||
return setting_call;
|
return setting_call;
|
||||||
@@ -273,6 +253,30 @@ public class SystemSettings implements Serializable {
|
|||||||
this.setting_hotspot = setting_hotspot;
|
this.setting_hotspot = setting_hotspot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getQch_restore() {
|
||||||
|
return qch_restore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQch_restore(int qch_restore) {
|
||||||
|
this.qch_restore = qch_restore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSetting_browserInput() {
|
||||||
|
return setting_browserInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSetting_browserInput(int setting_browserInput) {
|
||||||
|
this.setting_browserInput = setting_browserInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDev_mode() {
|
||||||
|
return dev_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDev_mode(int dev_mode) {
|
||||||
|
this.dev_mode = dev_mode;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSetting_sos() {
|
public String getSetting_sos() {
|
||||||
return setting_sos;
|
return setting_sos;
|
||||||
}
|
}
|
||||||
@@ -513,6 +517,14 @@ public class SystemSettings implements Serializable {
|
|||||||
this.is_notify_bar_show = is_notify_bar_show;
|
this.is_notify_bar_show = is_notify_bar_show;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBrowser_down() {
|
||||||
|
return browser_down;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBrowser_down(int browser_down) {
|
||||||
|
this.browser_down = browser_down;
|
||||||
|
}
|
||||||
|
|
||||||
public int getVoice_assistant() {
|
public int getVoice_assistant() {
|
||||||
return voice_assistant;
|
return voice_assistant;
|
||||||
}
|
}
|
||||||
@@ -521,6 +533,46 @@ public class SystemSettings implements Serializable {
|
|||||||
this.voice_assistant = voice_assistant;
|
this.voice_assistant = voice_assistant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getIs_browser_network() {
|
||||||
|
return is_browser_network;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIs_browser_network(int is_browser_network) {
|
||||||
|
this.is_browser_network = is_browser_network;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPhoto_answer_display() {
|
||||||
|
return photo_answer_display;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoto_answer_display(int photo_answer_display) {
|
||||||
|
this.photo_answer_display = photo_answer_display;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAi_teacher() {
|
||||||
|
return ai_teacher;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAi_teacher(int ai_teacher) {
|
||||||
|
this.ai_teacher = ai_teacher;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPhoto_search_questions() {
|
||||||
|
return photo_search_questions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoto_search_questions(int photo_search_questions) {
|
||||||
|
this.photo_search_questions = photo_search_questions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAi_question_test() {
|
||||||
|
return ai_question_test;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAi_question_test(int ai_question_test) {
|
||||||
|
this.ai_question_test = ai_question_test;
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ public class CommonConfig {
|
|||||||
public static final String MMKV_ID = "InterProcessKV";
|
public static final String MMKV_ID = "InterProcessKV";
|
||||||
|
|
||||||
public static final String CLOUD_LESSON_SETTINGS_KEY = "cloud_lesson_settings_key";
|
public static final String CLOUD_LESSON_SETTINGS_KEY = "cloud_lesson_settings_key";
|
||||||
|
public static final String DISALLOWED_RUNNING_APP_KEY = "disallowed_running_app";
|
||||||
|
|
||||||
public static final String ALIYUN_PUSH_ID = "aliyun_push_id_key";
|
public static final String ALIYUN_PUSH_ID = "aliyun_push_id_key";
|
||||||
|
|
||||||
|
|||||||
239
app/src/main/java/com/xwad/os/dialog/DeactivateDialog.java
Normal file
239
app/src/main/java/com/xwad/os/dialog/DeactivateDialog.java
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
package com.xwad.os.dialog;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
|
import com.xwad.os.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* description:自定义dialog
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DeactivateDialog extends AlertDialog {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示的标题
|
||||||
|
*/
|
||||||
|
private TextView titleTv;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示的消息
|
||||||
|
*/
|
||||||
|
private TextView messageTv;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认和取消按钮
|
||||||
|
*/
|
||||||
|
private TextView negtiveBn, positiveBn, tvDeactivate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按钮之间的分割线
|
||||||
|
*/
|
||||||
|
// private View columnLineView;
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
public DeactivateDialog(Context context) {
|
||||||
|
super(context, R.style.CustomDialog);
|
||||||
|
this.mContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 都是内容数据
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
private String title;
|
||||||
|
private String positive, negtive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 底部是否只有一个按钮
|
||||||
|
*/
|
||||||
|
private boolean isSingle = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.dialog_deactivate);
|
||||||
|
//按空白处不能取消动画
|
||||||
|
setCanceledOnTouchOutside(false);
|
||||||
|
//初始化界面控件
|
||||||
|
initView();
|
||||||
|
//初始化界面数据
|
||||||
|
refreshView();
|
||||||
|
//初始化界面控件的事件
|
||||||
|
initEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化界面的确定和取消监听器
|
||||||
|
*/
|
||||||
|
private void initEvent() {
|
||||||
|
//设置确定按钮被点击后,向外界提供监听
|
||||||
|
positiveBn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (onClickBottomListener != null) {
|
||||||
|
onClickBottomListener.onPositiveClick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//设置取消按钮被点击后,向外界提供监听
|
||||||
|
negtiveBn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (onClickBottomListener != null) {
|
||||||
|
onClickBottomListener.onNegtiveClick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tvDeactivate.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (onClickBottomListener != null) {
|
||||||
|
onClickBottomListener.onDeactivateClick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化界面控件的显示数据
|
||||||
|
*/
|
||||||
|
private void refreshView() {
|
||||||
|
//如果用户自定了title和message
|
||||||
|
if (!TextUtils.isEmpty(title)) {
|
||||||
|
titleTv.setText(title);
|
||||||
|
titleTv.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
titleTv.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(message)) {
|
||||||
|
messageTv.setText(message);
|
||||||
|
}
|
||||||
|
//如果设置按钮的文字
|
||||||
|
if (!TextUtils.isEmpty(positive)) {
|
||||||
|
positiveBn.setText(positive);
|
||||||
|
} else {
|
||||||
|
positiveBn.setText("确定");
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(negtive)) {
|
||||||
|
negtiveBn.setText(negtive);
|
||||||
|
} else {
|
||||||
|
negtiveBn.setText("取消");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 只显示一个按钮的时候隐藏取消按钮,回掉只执行确定的事件
|
||||||
|
*/
|
||||||
|
if (isSingle) {
|
||||||
|
// columnLineView.setVisibility(View.GONE);
|
||||||
|
negtiveBn.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
negtiveBn.setVisibility(View.VISIBLE);
|
||||||
|
// columnLineView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
super.show();
|
||||||
|
refreshView();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化界面控件
|
||||||
|
*/
|
||||||
|
private void initView() {
|
||||||
|
negtiveBn = findViewById(R.id.negtive);
|
||||||
|
positiveBn = findViewById(R.id.positive);
|
||||||
|
tvDeactivate = findViewById(R.id.tv_deactivate);
|
||||||
|
titleTv = findViewById(R.id.title);
|
||||||
|
messageTv = findViewById(R.id.message);
|
||||||
|
// columnLineView = findViewById(R.id.column_line);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置确定取消按钮的回调
|
||||||
|
*/
|
||||||
|
private OnClickBottomListener onClickBottomListener;
|
||||||
|
|
||||||
|
public void setOnClickBottomListener(OnClickBottomListener onClickBottomListener) {
|
||||||
|
this.onClickBottomListener = onClickBottomListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnClickBottomListener {
|
||||||
|
/**
|
||||||
|
* 点击确定按钮事件
|
||||||
|
*/
|
||||||
|
void onPositiveClick();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击取消按钮事件
|
||||||
|
*/
|
||||||
|
void onNegtiveClick();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击取消激活按钮事件
|
||||||
|
*/
|
||||||
|
void onDeactivateClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeactivateDialog setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeactivateDialog setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPositive() {
|
||||||
|
return positive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeactivateDialog setPositive(String positive) {
|
||||||
|
this.positive = positive;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNegtive() {
|
||||||
|
return negtive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeactivateDialog setNegtive(String negtive) {
|
||||||
|
this.negtive = negtive;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeactivateDialog setNegtiveText(String negtive) {
|
||||||
|
negtiveBn.setText(negtive);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSingle() {
|
||||||
|
return isSingle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeactivateDialog setSingle(boolean single) {
|
||||||
|
isSingle = single;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dismiss() {
|
||||||
|
super.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -233,11 +233,11 @@ public class AppViewModel extends BaseViewModel<FragmentAppBinding, FragmentEven
|
|||||||
// exitIcon.setIcon(BaseApplication.getInstance().getDrawable(R.drawable.exit_icon));
|
// exitIcon.setIcon(BaseApplication.getInstance().getDrawable(R.drawable.exit_icon));
|
||||||
// desktopIcons.add(desktopIcons.size(), exitIcon);
|
// desktopIcons.add(desktopIcons.size(), exitIcon);
|
||||||
|
|
||||||
DesktopIcon homeworkDesktopIcon = new DesktopIcon();
|
// DesktopIcon homeworkDesktopIcon = new DesktopIcon();
|
||||||
homeworkDesktopIcon.setIcon(BaseApplication.getInstance().getDrawable(R.drawable.icon_homework));
|
// homeworkDesktopIcon.setIcon(BaseApplication.getInstance().getDrawable(R.drawable.icon_homework));
|
||||||
homeworkDesktopIcon.setLable("作业");
|
// homeworkDesktopIcon.setLable("作业");
|
||||||
homeworkDesktopIcon.setPackageName(AppManager.APP_HOMEWORK);
|
// homeworkDesktopIcon.setPackageName(AppManager.APP_HOMEWORK);
|
||||||
desktopIcons.add(homeworkDesktopIcon);
|
// desktopIcons.add(homeworkDesktopIcon);
|
||||||
|
|
||||||
DesktopIcon clockIcon = new DesktopIcon();
|
DesktopIcon clockIcon = new DesktopIcon();
|
||||||
clockIcon.setLable("时钟");
|
clockIcon.setLable("时钟");
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import com.xwad.os.bean.SystemSettings;
|
|||||||
import com.xwad.os.config.CommonConfig;
|
import com.xwad.os.config.CommonConfig;
|
||||||
import com.xwad.os.gson.GsonUtils;
|
import com.xwad.os.gson.GsonUtils;
|
||||||
import com.xwad.os.mdm.AdminManager;
|
import com.xwad.os.mdm.AdminManager;
|
||||||
import com.xwad.os.utils.ApkUtils;
|
|
||||||
import com.xwad.os.utils.JgyUtils;
|
import com.xwad.os.utils.JgyUtils;
|
||||||
import com.xwad.os.utils.TimeUtils;
|
import com.xwad.os.utils.TimeUtils;
|
||||||
|
|
||||||
@@ -97,6 +96,7 @@ public class ControlManager {
|
|||||||
setBrowserInput(systemSettings);
|
setBrowserInput(systemSettings);
|
||||||
|
|
||||||
setZhuangyuanSetting(systemSettings);
|
setZhuangyuanSetting(systemSettings);
|
||||||
|
setDisallowedRunningApp(systemSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +120,7 @@ public class ControlManager {
|
|||||||
}
|
}
|
||||||
// setSearchTopic(0);
|
// setSearchTopic(0);
|
||||||
setTimeControlClose();
|
setTimeControlClose();
|
||||||
|
setDisallowedRunningApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -828,5 +829,31 @@ public class ControlManager {
|
|||||||
AdminManager.getInstance().setNavigationBarDisabled(status);
|
AdminManager.getInstance().setNavigationBarDisabled(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDisallowedRunningApp(SystemSettings setting) {
|
||||||
|
Log.e(TAG, "setDisallowedRunningApp: ");
|
||||||
|
if (setting.getAi_teacher() == 0) {
|
||||||
|
AdminManager.getInstance().addDisallowedRunningApp("com.jxw.aijtjs");
|
||||||
|
} else {
|
||||||
|
AdminManager.getInstance().removeDisallowedRunningApp("com.jxw.aijtjs");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setting.getPhoto_search_questions() == 0) {
|
||||||
|
AdminManager.getInstance().addDisallowedRunningApp("com.jxw.souti");
|
||||||
|
} else {
|
||||||
|
AdminManager.getInstance().removeDisallowedRunningApp("com.jxw.souti");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setting.getAi_question_test() == 0) {
|
||||||
|
AdminManager.getInstance().addDisallowedRunningApp("com.jxw.aizndy");
|
||||||
|
} else {
|
||||||
|
AdminManager.getInstance().removeDisallowedRunningApp("com.jxw.aizndy");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisallowedRunningApp() {
|
||||||
|
AdminManager.getInstance().removeDisallowedRunningApp("com.jxw.aijtjs");
|
||||||
|
AdminManager.getInstance().removeDisallowedRunningApp("com.jxw.souti");
|
||||||
|
AdminManager.getInstance().removeDisallowedRunningApp("com.jxw.aizndy");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,12 +275,20 @@ public class AdminManager {
|
|||||||
return sn;
|
return sn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否激活
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public boolean isActiveMe() {
|
public boolean isActiveMe() {
|
||||||
|
boolean active;
|
||||||
if (mDevicePolicyManager == null) {
|
if (mDevicePolicyManager == null) {
|
||||||
return false;
|
active = false;
|
||||||
} else {
|
} else {
|
||||||
return mDevicePolicyManager.isAdminActive(mAdminName);
|
active = mDevicePolicyManager.isAdminActive(mAdminName);
|
||||||
}
|
}
|
||||||
|
Log.e(TAG, "isActiveMe: active = " + active);
|
||||||
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -381,7 +389,9 @@ public class AdminManager {
|
|||||||
* @param pkg 添加后,黑名单中的应用不能打开,正在使用的应用也会被停止运行。
|
* @param pkg 添加后,黑名单中的应用不能打开,正在使用的应用也会被停止运行。
|
||||||
*/
|
*/
|
||||||
public void addDisallowedRunningApp(String pkg) {
|
public void addDisallowedRunningApp(String pkg) {
|
||||||
|
Log.e(TAG, "addDisallowedRunningApp: " + pkg);
|
||||||
List<String> packageList = getDisallowedRunningApp();
|
List<String> packageList = getDisallowedRunningApp();
|
||||||
|
// List<String> packageList = new ArrayList<>();
|
||||||
Log.e(TAG, "addDisallowedRunningApp: packageList = " + packageList);
|
Log.e(TAG, "addDisallowedRunningApp: packageList = " + packageList);
|
||||||
packageList.add(pkg);
|
packageList.add(pkg);
|
||||||
try {
|
try {
|
||||||
@@ -430,7 +440,12 @@ public class AdminManager {
|
|||||||
|
|
||||||
public List<String> getDisallowedRunningApp() {
|
public List<String> getDisallowedRunningApp() {
|
||||||
try {
|
try {
|
||||||
return mDeviceApplicationManager.getDisallowedRunningApp(mAdminName);
|
List<String> strings = mDeviceApplicationManager.getDisallowedRunningApp(mAdminName);
|
||||||
|
Log.e(TAG, "getDisallowedRunningApp: " + strings);
|
||||||
|
if (strings == null) {
|
||||||
|
strings = new ArrayList<>();
|
||||||
|
}
|
||||||
|
return strings;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "getDisallowedRunningApp: " + e.getMessage());
|
Log.e(TAG, "getDisallowedRunningApp: " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -551,6 +566,7 @@ public class AdminManager {
|
|||||||
* 设置可信任应用列表
|
* 设置可信任应用列表
|
||||||
* 3.11.9 ~ 3.11.23 接口为拆分了以上功能的各个接口,该接口和 3.11.9 ~ 3.11.23 接
|
* 3.11.9 ~ 3.11.23 接口为拆分了以上功能的各个接口,该接口和 3.11.9 ~ 3.11.23 接
|
||||||
* 口不可同时使用。
|
* 口不可同时使用。
|
||||||
|
*
|
||||||
* @param packageNames
|
* @param packageNames
|
||||||
*/
|
*/
|
||||||
public void setSuperTrustListForHwSystemManger(ArrayList<String> packageNames) {
|
public void setSuperTrustListForHwSystemManger(ArrayList<String> packageNames) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import com.hjq.toast.Toaster;
|
||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.xwad.os.BuildConfig;
|
import com.xwad.os.BuildConfig;
|
||||||
import com.xwad.os.activity.home.HomeActivity;
|
import com.xwad.os.activity.home.HomeActivity;
|
||||||
@@ -23,7 +24,6 @@ import com.xwad.os.gson.GsonUtils;
|
|||||||
import com.xwad.os.manager.ControlManager;
|
import com.xwad.os.manager.ControlManager;
|
||||||
import com.xwad.os.mdm.AdminManager;
|
import com.xwad.os.mdm.AdminManager;
|
||||||
import com.xwad.os.network.NetInterfaceManager;
|
import com.xwad.os.network.NetInterfaceManager;
|
||||||
import com.hjq.toast.Toaster;
|
|
||||||
import com.xwad.os.network.RetryCallback;
|
import com.xwad.os.network.RetryCallback;
|
||||||
import com.xwad.os.service.ManagerService;
|
import com.xwad.os.service.ManagerService;
|
||||||
import com.xwad.os.service.main.MainService;
|
import com.xwad.os.service.main.MainService;
|
||||||
@@ -34,7 +34,6 @@ import com.xwad.os.utils.ServiceAliveUtils;
|
|||||||
import com.xwad.os.utils.Utils;
|
import com.xwad.os.utils.Utils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -276,6 +275,13 @@ public class PushManager {
|
|||||||
/*爱的鼓励*/
|
/*爱的鼓励*/
|
||||||
private static final String LOVE_ENCOURAGEMENT = "121";
|
private static final String LOVE_ENCOURAGEMENT = "121";
|
||||||
|
|
||||||
|
/*AI家庭教师开关*/
|
||||||
|
private static final String AI_Tutor = "123";
|
||||||
|
/*拍照搜题*/
|
||||||
|
private static final String PHOTO_SEARCH_QUESTIONS = "124";
|
||||||
|
/*AI答疑测试*/
|
||||||
|
private static final String AI_QA_TEST = "125";
|
||||||
|
|
||||||
|
|
||||||
public void setPushContent(String title, String extras) {
|
public void setPushContent(String title, String extras) {
|
||||||
switch (title) {
|
switch (title) {
|
||||||
@@ -357,10 +363,65 @@ public class PushManager {
|
|||||||
case LOVE_ENCOURAGEMENT:
|
case LOVE_ENCOURAGEMENT:
|
||||||
Toaster.debugShow("收到推送消息: 爱的鼓励");
|
Toaster.debugShow("收到推送消息: 爱的鼓励");
|
||||||
sendEncouragement(extras);
|
sendEncouragement(extras);
|
||||||
|
break;
|
||||||
|
case AI_Tutor:
|
||||||
|
setAiTeacher(extras);
|
||||||
|
break;
|
||||||
|
case PHOTO_SEARCH_QUESTIONS:
|
||||||
|
setPhotoSearchQuestions(extras);
|
||||||
|
break;
|
||||||
|
case AI_QA_TEST:
|
||||||
|
setAiQuestionTest(extras);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setAiTeacher(String extras) {
|
||||||
|
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||||
|
JsonElement jsonElement = jsonObject.get("ai_teacher");
|
||||||
|
if (jsonElement == null || jsonElement.isJsonNull()) {
|
||||||
|
Log.e(TAG, "setAiTeacher: jsonElement is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int ai_teacher = jsonElement.getAsInt();
|
||||||
|
if (ai_teacher == 0) {
|
||||||
|
AdminManager.getInstance().addDisallowedRunningApp("com.jxw.aijtjs");
|
||||||
|
} else {
|
||||||
|
AdminManager.getInstance().removeDisallowedRunningApp("com.jxw.aijtjs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setPhotoSearchQuestions(String extras) {
|
||||||
|
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||||
|
JsonElement jsonElement = jsonObject.get("photo_search_questions");
|
||||||
|
if (jsonElement == null || jsonElement.isJsonNull()) {
|
||||||
|
Log.e(TAG, "setPhotoSearchQuestions: jsonElement is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int photo_search_questions = jsonElement.getAsInt();
|
||||||
|
if (photo_search_questions == 0) {
|
||||||
|
AdminManager.getInstance().addDisallowedRunningApp("com.jxw.souti");
|
||||||
|
} else {
|
||||||
|
AdminManager.getInstance().removeDisallowedRunningApp("com.jxw.souti");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setAiQuestionTest(String extras) {
|
||||||
|
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||||
|
JsonElement jsonElement = jsonObject.get("ai_question_test");
|
||||||
|
if (jsonElement == null || jsonElement.isJsonNull()) {
|
||||||
|
Log.e(TAG, "setAiQuestionTest: jsonElement is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int ai_question_test = jsonElement.getAsInt();
|
||||||
|
if (ai_question_test == 0) {
|
||||||
|
AdminManager.getInstance().addDisallowedRunningApp("com.jxw.aizndy");
|
||||||
|
} else {
|
||||||
|
AdminManager.getInstance().removeDisallowedRunningApp("com.jxw.aizndy");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setNotification(String extras) {
|
private void setNotification(String extras) {
|
||||||
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||||
JsonElement jsonElement = jsonObject.get("is_notify_bar_show");
|
JsonElement jsonElement = jsonObject.get("is_notify_bar_show");
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ import com.xwad.os.receiver.ApkInstallReceiver;
|
|||||||
import com.xwad.os.receiver.BootReceiver;
|
import com.xwad.os.receiver.BootReceiver;
|
||||||
import com.xwad.os.service.main.MainService;
|
import com.xwad.os.service.main.MainService;
|
||||||
import com.xwad.os.utils.ActivationUtil;
|
import com.xwad.os.utils.ActivationUtil;
|
||||||
import com.xwad.os.utils.ApkUtils;
|
|
||||||
import com.xwad.os.utils.JgyUtils;
|
import com.xwad.os.utils.JgyUtils;
|
||||||
import com.xwad.os.utils.ServiceAliveUtils;
|
import com.xwad.os.utils.ServiceAliveUtils;
|
||||||
import com.xwad.os.utils.TimeUtils;
|
import com.xwad.os.utils.TimeUtils;
|
||||||
@@ -522,8 +521,8 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
JgyUtils.getInstance().setDefaultDesktop("com.uiui.zyos", "com.uiui.zyos.activity.main.MainActivity");
|
// JgyUtils.getInstance().setDefaultDesktop("com.uiui.zyos", "com.uiui.zyos.activity.main.MainActivity");
|
||||||
ApkUtils.openApp(ManagerService.this, "com.uiui.zyos");
|
// ApkUtils.openApp(ManagerService.this, "com.uiui.zyos");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void add(VerificationCodeView codeView, String text) {
|
private void add(VerificationCodeView codeView, String text) {
|
||||||
|
|||||||
@@ -18,14 +18,12 @@ import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
|||||||
import com.blankj.utilcode.util.NetworkUtils;
|
import com.blankj.utilcode.util.NetworkUtils;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import com.hjq.toast.Toaster;
|
import com.hjq.toast.Toaster;
|
||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.xwad.os.BuildConfig;
|
import com.xwad.os.BuildConfig;
|
||||||
import com.xwad.os.activity.login.LoginActivity;
|
import com.xwad.os.activity.login.LoginActivity;
|
||||||
import com.xwad.os.config.CommonConfig;
|
import com.xwad.os.config.CommonConfig;
|
||||||
import com.xwad.os.gson.GsonUtils;
|
import com.xwad.os.gson.GsonUtils;
|
||||||
import com.xwad.os.manager.DeviceSNManager;
|
|
||||||
import com.xwad.os.mdm.AdminManager;
|
import com.xwad.os.mdm.AdminManager;
|
||||||
import com.xwad.os.network.NetInterfaceManager;
|
import com.xwad.os.network.NetInterfaceManager;
|
||||||
import com.xwad.os.network.UrlAddress;
|
import com.xwad.os.network.UrlAddress;
|
||||||
@@ -156,6 +154,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
|||||||
initSsoSocketClient();
|
initSsoSocketClient();
|
||||||
initPush();
|
initPush();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ public class MainService extends BaseRxService implements MainSContact.MainSView
|
|||||||
mPresenter.getCloudLessonSettings();
|
mPresenter.getCloudLessonSettings();
|
||||||
mPresenter.getScreenLock();
|
mPresenter.getScreenLock();
|
||||||
mPresenter.getAdminApp();
|
mPresenter.getAdminApp();
|
||||||
|
mPresenter.getSystemSettings();
|
||||||
|
|
||||||
registerReceivers();
|
registerReceivers();
|
||||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||||
|
|||||||
@@ -829,13 +829,13 @@ public class JgyUtils {
|
|||||||
if (TextUtils.isEmpty(className)) {
|
if (TextUtils.isEmpty(className)) {
|
||||||
openLauncher3();
|
openLauncher3();
|
||||||
} else {
|
} else {
|
||||||
setDefaultDesktop(pkg, className);
|
AdminManager.getInstance().setDefaultLauncher(pkg, className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openLauncher3() {
|
private void openLauncher3() {
|
||||||
setDefaultDesktop(Launcher3, Launcher3Class);
|
AdminManager.getInstance().setDefaultLauncher(Launcher3, Launcher3Class);
|
||||||
// ApkUtils.openPackage(mContext, Launcher3);
|
// ApkUtils.openPackage(mContext, Launcher3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -887,11 +887,11 @@ public class JgyUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultDesktop(String pkg, String className) {
|
public void setDefaultDesktop(String pkg, String className) {
|
||||||
if (!isDefaultLauncher(pkg, className)) {
|
// if (!isDefaultLauncher(pkg, className)) {
|
||||||
AdminManager.getInstance().setDefaultLauncher(pkg, className);
|
// AdminManager.getInstance().setDefaultLauncher(pkg, className);
|
||||||
} else {
|
// } else {
|
||||||
Log.e(TAG, "setDefaultDesktop: pkg = already set default luancher");
|
// Log.e(TAG, "setDefaultDesktop: pkg = already set default luancher");
|
||||||
}
|
// }
|
||||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
// setRoleHolderAsUser(mContext, pkg);
|
// setRoleHolderAsUser(mContext, pkg);
|
||||||
// Log.e(TAG, "setDefaultDesktop: setRoleHolderAsUser");
|
// Log.e(TAG, "setDefaultDesktop: setRoleHolderAsUser");
|
||||||
|
|||||||
@@ -64,12 +64,15 @@ public class OpenApkUtils {
|
|||||||
private LessonJson mLessonJson;
|
private LessonJson mLessonJson;
|
||||||
private TimeUtils.ContralTime mContralTime;
|
private TimeUtils.ContralTime mContralTime;
|
||||||
|
|
||||||
|
// private Set<String> mDisallowedRunningAppSet;
|
||||||
|
|
||||||
private OpenApkUtils(Context context) {
|
private OpenApkUtils(Context context) {
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
throw new RuntimeException("Context is NULL");
|
throw new RuntimeException("Context is NULL");
|
||||||
}
|
}
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
this.mResolver = context.getContentResolver();
|
this.mResolver = context.getContentResolver();
|
||||||
|
// mDisallowedRunningAppSet = mMMKV.decodeStringSet(CommonConfig.DISALLOWED_RUNNING_APP_KEY, new HashSet<>());
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,6 +89,31 @@ public class OpenApkUtils {
|
|||||||
return sInstance;
|
return sInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public Set<String> getDisallowedRunningAppSet() {
|
||||||
|
// if (mDisallowedRunningAppSet == null) {
|
||||||
|
// mDisallowedRunningAppSet = new HashSet<>();
|
||||||
|
// }
|
||||||
|
// return mDisallowedRunningAppSet;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public void addDisallowedRunningApp(String pkg) {
|
||||||
|
// Log.e(TAG, "addDisallowedRunningApp: " + pkg);
|
||||||
|
// if (mDisallowedRunningAppSet == null) {
|
||||||
|
// mDisallowedRunningAppSet = new HashSet<>();
|
||||||
|
// }
|
||||||
|
// mDisallowedRunningAppSet.add(pkg);
|
||||||
|
// mMMKV.encode(CommonConfig.DISALLOWED_RUNNING_APP_KEY, mDisallowedRunningAppSet);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void removeDisallowedRunningApp(String pkg) {
|
||||||
|
// Log.e(TAG, "removeDisallowedRunningApp: " + pkg);
|
||||||
|
// if (mDisallowedRunningAppSet == null) {
|
||||||
|
// mDisallowedRunningAppSet = new HashSet<>();
|
||||||
|
// }
|
||||||
|
// mDisallowedRunningAppSet.remove(pkg);
|
||||||
|
// mMMKV.encode(CommonConfig.DISALLOWED_RUNNING_APP_KEY, mDisallowedRunningAppSet);
|
||||||
|
// }
|
||||||
|
|
||||||
private boolean checkActivation() {
|
private boolean checkActivation() {
|
||||||
if (!ApkUtils.isAvailable(mContext, "com.uiui.zy")) {
|
if (!ApkUtils.isAvailable(mContext, "com.uiui.zy")) {
|
||||||
return true;
|
return true;
|
||||||
@@ -720,6 +748,8 @@ public class OpenApkUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.e(TAG, "openJxwApp: " + AdminManager.getInstance().getDisallowedRunningApp());
|
||||||
|
|
||||||
if (TextUtils.isEmpty(className)) {
|
if (TextUtils.isEmpty(className)) {
|
||||||
openApp(packageName);
|
openApp(packageName);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.xwad.os.utils;
|
package com.xwad.os.utils;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
@@ -45,10 +44,8 @@ import com.google.zxing.common.BitMatrix;
|
|||||||
import com.google.zxing.qrcode.QRCodeWriter;
|
import com.google.zxing.qrcode.QRCodeWriter;
|
||||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.xwad.os.BuildConfig;
|
|
||||||
import com.xwad.os.R;
|
import com.xwad.os.R;
|
||||||
import com.xwad.os.config.CommonConfig;
|
import com.xwad.os.config.CommonConfig;
|
||||||
import com.xwad.os.mdm.AdminManager;
|
|
||||||
import com.xwad.os.network.NetInterfaceManager;
|
import com.xwad.os.network.NetInterfaceManager;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@@ -540,39 +537,39 @@ public class Utils {
|
|||||||
return powerManager.isInteractive();
|
return powerManager.isInteractive();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void exitDesktop(Activity context) {
|
// public static void exitDesktop(Activity context) {
|
||||||
if ("HONOR".equalsIgnoreCase(Build.BRAND)) {
|
// if ("HONOR".equalsIgnoreCase(Build.BRAND)) {
|
||||||
// AdminManager.getInstance().exitDesktop();
|
//// AdminManager.getInstance().exitDesktop();
|
||||||
// AdminManager.getInstance().setDefaultDesktop("com.hihonor.android.launcher");
|
//// AdminManager.getInstance().setDefaultDesktop("com.hihonor.android.launcher");
|
||||||
} else {
|
// } else {
|
||||||
if ("U807".equals(BuildConfig.platform) && ApkUtils.isAvailable(context, "com.uiuipad.os")) {
|
// if ("U807".equals(BuildConfig.platform) && ApkUtils.isAvailable(context, "com.uiuipad.os")) {
|
||||||
AdminManager.getInstance().setDefaultLauncher("com.uiuipad.os");
|
// AdminManager.getInstance().setDefaultLauncher("com.uiuipad.os");
|
||||||
} else {
|
// } else {
|
||||||
AdminManager.getInstance().setDefaultLauncher(ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME);
|
// AdminManager.getInstance().setDefaultLauncher(ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
|
// if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
|
||||||
if ("U807".equals(BuildConfig.platform) && ApkUtils.isAvailable(context, "com.uiuipad.os")) {
|
// if ("U807".equals(BuildConfig.platform) && ApkUtils.isAvailable(context, "com.uiuipad.os")) {
|
||||||
|
//
|
||||||
if (!ApkUtils.openPackage(context, "com.uiuipad.os", "com.uiuipad.os.Launcher")) {
|
// if (!ApkUtils.openPackage(context, "com.uiuipad.os", "com.uiuipad.os.Launcher")) {
|
||||||
ApkUtils.gotoLauncher(context);
|
// ApkUtils.gotoLauncher(context);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
|
//
|
||||||
if (!ApkUtils.openPackage(context, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_Quickstep_CLASS_NAME)) {
|
// if (!ApkUtils.openPackage(context, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_Quickstep_CLASS_NAME)) {
|
||||||
ApkUtils.gotoLauncher(context);
|
// ApkUtils.gotoLauncher(context);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
|
//
|
||||||
if (!ApkUtils.openPackage(context, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_CLASS_NAME)) {
|
// if (!ApkUtils.openPackage(context, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_CLASS_NAME)) {
|
||||||
ApkUtils.gotoLauncher(context);
|
// ApkUtils.gotoLauncher(context);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
context.finish();
|
// context.finish();
|
||||||
System.exit(0);
|
// System.exit(0);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static void triggerRebirth(Context context) {
|
public static void triggerRebirth(Context context) {
|
||||||
PackageManager packageManager = context.getPackageManager();
|
PackageManager packageManager = context.getPackageManager();
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
android:id="@+id/tv_notification"
|
android:id="@+id/tv_notification"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
|
|||||||
133
app/src/main/res/layout/dialog_deactivate.xml
Normal file
133
app/src/main/res/layout/dialog_deactivate.xml
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="240dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:background="@drawable/bg_dialog"
|
||||||
|
android:minWidth="240dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:visibility="visible"
|
||||||
|
tools:text="消息提示" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/linearLayout3"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/message"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:lineSpacingExtra="3dp"
|
||||||
|
android:lineSpacingMultiplier="1.2"
|
||||||
|
android:minHeight="50dp"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="10sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
tools:text="提示消息提示消息提示消息提示消息提示消息" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_deactivate"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:background="@drawable/join_background"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="取消激活"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="8sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.0" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/linearLayout3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/negtive"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/joined_background"
|
||||||
|
android:gravity="center"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="8sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="取消" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/positive"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/join_background"
|
||||||
|
android:gravity="center"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="8sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.0"
|
||||||
|
tools:text="确定" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user