Commit a74afcdb by Baoxy

fix: 输错几次密码后(到锁定前),输对一次密码进行系统切换,再次输错密码时,输错次数未被重置

parent 1afa2d8d
package com.android.launcher3.settings; package com.android.launcher3.settings;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi; import android.support.annotation.RequiresApi;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import android.view.WindowManager; import android.view.WindowManager;
import com.android.launcher3.function.pwd.EncryptedActivity; import com.android.launcher3.function.pwd.EncryptedActivity;
import com.android.launcher3.function.pwd.PwdPinSetPwdActivity; import com.android.launcher3.function.pwd.PwdPinSetPwdActivity;
import com.secspace.lib.common.base.BaseActivity; import com.secspace.lib.common.base.BaseActivity;
import com.secspace.lib.common.dialog.LoadingDialog;
import com.secspace.lib.common.function.DialogManager; import com.secspace.lib.common.function.DialogManager;
import com.secspace.lib.common.utils.IntentUtil; import com.secspace.lib.common.utils.IntentUtil;
import com.secspace.lib.common.utils.Prefs; import com.secspace.lib.common.utils.Prefs;
import com.secspace.lib.common.utils.UtilsKt;
import java.lang.reflect.Method;
public class BlankActivity extends BaseActivity { public class BlankActivity extends BaseActivity {
...@@ -37,11 +45,17 @@ public class BlankActivity extends BaseActivity { ...@@ -37,11 +45,17 @@ public class BlankActivity extends BaseActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
if (!Prefs.isPrivacyPolicyAccept(this)) { if (!Prefs.isPrivacyPolicyAccept(this)) {
DialogManager.INSTANCE.showPrivacyPolicyDialog(this); DialogManager.INSTANCE.showPrivacyPolicyDialog(this);
return; return;
} }
if(!checkPermissions()){ if (!checkPermissions()) {
return;
}
if(!commonROMPermissionCheck()){
requestAlertWindowPermission();
finish();
return; return;
} }
String pwd = Prefs.getLoginPwd(this); String pwd = Prefs.getLoginPwd(this);
...@@ -52,7 +66,7 @@ public class BlankActivity extends BaseActivity { ...@@ -52,7 +66,7 @@ public class BlankActivity extends BaseActivity {
return; return;
} }
String encrypted = Prefs.getEncrypted(this); String encrypted = Prefs.getEncrypted(this);
if(TextUtils.isEmpty(encrypted)){ if (TextUtils.isEmpty(encrypted)) {
Intent intent = new Intent(this, EncryptedActivity.class); Intent intent = new Intent(this, EncryptedActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent); startActivity(intent);
...@@ -70,4 +84,41 @@ public class BlankActivity extends BaseActivity { ...@@ -70,4 +84,41 @@ public class BlankActivity extends BaseActivity {
public void overridePendingTransition(int enterAnim, int exitAnim) { public void overridePendingTransition(int enterAnim, int exitAnim) {
super.overridePendingTransition(0, 0); super.overridePendingTransition(0, 0);
} }
private static final int REQUEST_CODE = 1;
//判断权限
private boolean commonROMPermissionCheck() {
Boolean result = true;
if (Build.VERSION.SDK_INT >= 23) {
try {
Class clazz = Settings.class;
Method canDrawOverlays = clazz.getDeclaredMethod("canDrawOverlays", Context.class);
result = (Boolean) canDrawOverlays.invoke(null, this);
} catch (Exception e) {
Log.e(TAG, Log.getStackTraceString(e));
}
}
return result;
}
//申请权限
@RequiresApi(api = Build.VERSION_CODES.M)
private void requestAlertWindowPermission() {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
intent.setData(Uri.parse("package:" + getPackageName()));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent, REQUEST_CODE);
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE) {
if (Settings.canDrawOverlays(this)) {
Log.i(TAG, "onActivityResult granted");
}
}
}
} }
...@@ -26,7 +26,7 @@ MAVEN_URL=http://192.168.0.170:13000/nexus/content/repositories/releases/ ...@@ -26,7 +26,7 @@ MAVEN_URL=http://192.168.0.170:13000/nexus/content/repositories/releases/
MAVEN_URL_SNAPSHOT=http://192.168.0.170:13000/nexus/content/repositories/releases/ MAVEN_URL_SNAPSHOT=http://192.168.0.170:13000/nexus/content/repositories/releases/
#32位有符号数2147483647(10) #32位有符号数2147483647(10)
versionIntCode=2020041501 versionIntCode=2020041502
versionNameMajor=1 versionNameMajor=1
versionNameMinor=0 versionNameMinor=0
......
...@@ -73,7 +73,7 @@ class LoadingDialog private constructor(context: Context) { ...@@ -73,7 +73,7 @@ class LoadingDialog private constructor(context: Context) {
} }
companion object { companion object {
private const val TAG = "SwitcherDialog" private const val TAG = "LoadingDialog"
@SuppressLint("StaticFieldLeak") @SuppressLint("StaticFieldLeak")
private var INST: LoadingDialog? = null private var INST: LoadingDialog? = null
......
...@@ -17,67 +17,150 @@ class ApplicationManager private constructor() : BaseDeviceManager() { ...@@ -17,67 +17,150 @@ class ApplicationManager private constructor() : BaseDeviceManager() {
} }
} }
fun addPersistentApp(pkgs: MutableList<String>) { fun addPersistentApp(pkgs: MutableList<String>) = try {
if (!checkNull(pkgs)) when {
mDeviceApplicationManager.addPersistentApp(mComponent, pkgs) !checkNull(pkgs) -> {
mDeviceApplicationManager.addPersistentApp(mComponent, pkgs)
}
else -> false
}
} catch (e: java.lang.Exception) {
} }
fun removePersistentApp(pkgs: MutableList<String>) {
if (!checkNull(pkgs)) fun removePersistentApp(pkgs: MutableList<String>) = try {
mDeviceApplicationManager.removePersistentApp(mComponent, pkgs) when {
!checkNull(pkgs) -> {
mDeviceApplicationManager.removePersistentApp(mComponent, pkgs)
}
else -> false
}
} catch (e: Exception) {
} }
fun getPersistentApp(): MutableList<String> = mDeviceApplicationManager.getPersistentApp(mComponent) fun getPersistentApp(): MutableList<String> = try {
mDeviceApplicationManager.getPersistentApp(mComponent)
} catch (e: java.lang.Exception) {
arrayListOf()
}
fun addDisallowedRunningApp(pkgs: MutableList<String>) { fun addDisallowedRunningApp(pkgs: MutableList<String>) = try {
if (!checkNull(pkgs)) when {
mDeviceApplicationManager.addDisallowedRunningApp(mComponent, pkgs) !checkNull(pkgs) -> {
mDeviceApplicationManager.addDisallowedRunningApp(mComponent, pkgs)
}
else -> false
}
} catch (e: java.lang.Exception) {
} }
fun removeDisallowedRunningApp(pkgs: MutableList<String>) { fun removeDisallowedRunningApp(pkgs: MutableList<String>) = try {
if (!checkNull(pkgs)) when {
mDeviceApplicationManager.removeDisallowedRunningApp(mComponent, pkgs) !checkNull(pkgs) -> {
mDeviceApplicationManager.removeDisallowedRunningApp(mComponent, pkgs)
}
else -> false
}
} catch (e: java.lang.Exception) {
} }
fun getDisallowedRunningApp(): MutableList<String> = mDeviceApplicationManager.getDisallowedRunningApp(mComponent) fun getDisallowedRunningApp(): MutableList<String> = try {
mDeviceApplicationManager.getDisallowedRunningApp(mComponent)
} catch (e: java.lang.Exception) {
arrayListOf()
}
fun killApplicationProcess(pkg: String) = try {
mDeviceApplicationManager.killApplicationProcess(mComponent, pkg)
} catch (e: java.lang.Exception) {
}
fun killApplicationProcess(pkg: String) = mDeviceApplicationManager.killApplicationProcess(mComponent, pkg)
fun addDisallowedUninstallPackages(pkgs: MutableList<String>) { fun addDisallowedUninstallPackages(pkgs: MutableList<String>) = try {
if (!checkNull(pkgs)) when {
mDevicePackageManager.addDisallowedUninstallPackages(mComponent, pkgs) !checkNull(pkgs) -> {
mDevicePackageManager.addDisallowedUninstallPackages(mComponent, pkgs)
}
else -> false
}
} catch (e: java.lang.Exception) {
} }
fun removeDisallowedUninstallPackages(pkgs: MutableList<String>){ fun removeDisallowedUninstallPackages(pkgs: MutableList<String>) = try {
if (!checkNull(pkgs)) when {
mDevicePackageManager.removeDisallowedUninstallPackages(mComponent, pkgs) !checkNull(pkgs) -> {
mDevicePackageManager.removeDisallowedUninstallPackages(mComponent, pkgs)
}
else -> false
}
} catch (e: java.lang.Exception) {
} }
fun getDisallowedUninstallPackageList(): MutableList<String> = mDevicePackageManager.getDisallowedUninstallPackageList(mComponent) fun getDisallowedUninstallPackageList(): MutableList<String> = try {
mDevicePackageManager.getDisallowedUninstallPackageList(mComponent)
} catch (e: java.lang.Exception) {
arrayListOf()
}
fun addDisabledDeactivateMdmPackages(pkgs: MutableList<String>){ fun addDisabledDeactivateMdmPackages(pkgs: MutableList<String>) = try {
if (!checkNull(pkgs)) when {
mDevicePackageManager.addDisabledDeactivateMdmPackages(mComponent, pkgs) !checkNull(pkgs) -> {
mDevicePackageManager.addDisabledDeactivateMdmPackages(mComponent, pkgs)
}
else -> false
}
} catch (e: java.lang.Exception) {
} }
fun removeDisabledDeactivateMdmPackages(pkgs: MutableList<String>){ fun removeDisabledDeactivateMdmPackages(pkgs: MutableList<String>) = try {
if (!checkNull(pkgs)) when {
mDevicePackageManager.removeDisabledDeactivateMdmPackages(mComponent, pkgs) !checkNull(pkgs) -> {
mDevicePackageManager.removeDisabledDeactivateMdmPackages(mComponent, pkgs)
}
else -> false
}
} catch (e: java.lang.Exception) {
} }
fun getDisabledDeactivateMdmPackageList(): MutableList<String> = mDevicePackageManager.getDisabledDeactivateMdmPackageList(mComponent) fun getDisabledDeactivateMdmPackageList(): MutableList<String> = try {
mDevicePackageManager.getDisabledDeactivateMdmPackageList(mComponent)
} catch (e: java.lang.Exception) {
arrayListOf()
}
fun addSingleApp(pkg: String) = mDeviceApplicationManager.addSingleApp(mComponent, pkg) fun addSingleApp(pkg: String) = try {
mDeviceApplicationManager.addSingleApp(mComponent, pkg)
} catch (e: java.lang.Exception) {
}
fun clearSingleApp(pkg: String) = mDeviceApplicationManager.clearSingleApp(mComponent, pkg) fun clearSingleApp(pkg: String) = try {
mDeviceApplicationManager.clearSingleApp(mComponent, pkg)
} catch (e: java.lang.Exception) {
}
fun getSingleApp() = mDeviceApplicationManager.getSingleApp(mComponent) fun getSingleApp() = try {
mDeviceApplicationManager.getSingleApp(mComponent)
} catch (e: java.lang.Exception) {
""
}
fun disableComponent(context: Context, componentName: ComponentName) = context.packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP) fun disableComponent(context: Context, componentName: ComponentName) = try {
context.packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP)
} catch (e: java.lang.Exception) {
}
fun enableComponent(context: Context, componentName: ComponentName) = context.packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP) fun enableComponent(context: Context, componentName: ComponentName) = try {
context.packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP)
} catch (e: java.lang.Exception) {
}
fun disableApplication(context: Context, packageName: String) = context.packageManager.setApplicationEnabledSetting(packageName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0) fun disableApplication(context: Context, packageName: String) = try {
context.packageManager.setApplicationEnabledSetting(packageName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0)
} catch (e: java.lang.Exception) {
}
fun enableApplication(context: Context, packageName: String) = context.packageManager.setApplicationEnabledSetting(packageName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0) fun enableApplication(context: Context, packageName: String) = try {
context.packageManager.setApplicationEnabledSetting(packageName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0)
} catch (e: java.lang.Exception) {
}
} }
\ No newline at end of file
...@@ -35,9 +35,16 @@ class DpmManager private constructor() { ...@@ -35,9 +35,16 @@ class DpmManager private constructor() {
} }
} }
fun isActive(): Boolean = mDevicePolicyManager.isAdminActive(mAdminName) fun isActive(): Boolean = try {
mDevicePolicyManager.isAdminActive(mAdminName)
} catch (e: java.lang.Exception) {
false
}
fun removeActive(component: ComponentName = mAdminName) = mDevicePolicyManager.removeActiveAdmin(component) fun removeActive(component: ComponentName = mAdminName) = try {
mDevicePolicyManager.removeActiveAdmin(component)
} catch (e: java.lang.Exception) {
}
fun active(component: ComponentName = mAdminName) = restrictionManager.setSilentActiveAdmin(component) fun active(component: ComponentName = mAdminName) = restrictionManager.setSilentActiveAdmin(component)
......
package com.secspace.lib.common.dpm package com.secspace.lib.common.dpm
import com.huawei.android.app.admin.DeviceHwSystemManager import com.huawei.android.app.admin.DeviceHwSystemManager
import java.lang.Exception
class HwSystemManager private constructor() : BaseDeviceManager() { class HwSystemManager private constructor() : BaseDeviceManager() {
private val mDeviceHwSystemManager: DeviceHwSystemManager = DeviceHwSystemManager() private val mDeviceHwSystemManager: DeviceHwSystemManager = DeviceHwSystemManager()
...@@ -12,15 +13,29 @@ class HwSystemManager private constructor() : BaseDeviceManager() { ...@@ -12,15 +13,29 @@ class HwSystemManager private constructor() : BaseDeviceManager() {
} }
} }
fun setSuperWhiteListForHwSystemManger(pkgs: ArrayList<String>) { fun setSuperWhiteListForHwSystemManger(pkgs: ArrayList<String>) = try {
if (!checkNull(pkgs)) when {
mDeviceHwSystemManager.setSuperWhiteListForHwSystemManger(mComponent, pkgs) !checkNull(pkgs) -> {
mDeviceHwSystemManager.setSuperWhiteListForHwSystemManger(mComponent, pkgs)
}
else -> false
}
} catch (e: Exception) {
} }
fun removeSuperWhiteListForHwSystemManger(pkgs: ArrayList<String>) { fun removeSuperWhiteListForHwSystemManger(pkgs: ArrayList<String>) = try {
if (!checkNull(pkgs)) when {
mDeviceHwSystemManager.removeSuperWhiteListForHwSystemManger(mComponent, pkgs) !checkNull(pkgs) -> {
mDeviceHwSystemManager.removeSuperWhiteListForHwSystemManger(mComponent, pkgs)
}
else -> false
}
} catch (e: Exception) {
} }
fun getSuperWhiteListForHwSystemManger() = mDeviceHwSystemManager.getSuperWhiteListForHwSystemManger(mComponent) fun getSuperWhiteListForHwSystemManger() = try {
mDeviceHwSystemManager.getSuperWhiteListForHwSystemManger(mComponent)
} catch (e: Exception) {
arrayListOf<String>()
}
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.secspace.lib.common.dpm ...@@ -3,6 +3,7 @@ package com.secspace.lib.common.dpm
import android.content.ComponentName import android.content.ComponentName
import com.huawei.android.app.admin.DeviceControlManager import com.huawei.android.app.admin.DeviceControlManager
import com.huawei.android.app.admin.DeviceRestrictionManager import com.huawei.android.app.admin.DeviceRestrictionManager
import java.lang.Exception
class RestrictionManager private constructor() : BaseDeviceManager() { class RestrictionManager private constructor() : BaseDeviceManager() {
private val mDeviceRestrictionManager: DeviceRestrictionManager = DeviceRestrictionManager() private val mDeviceRestrictionManager: DeviceRestrictionManager = DeviceRestrictionManager()
...@@ -15,58 +16,139 @@ class RestrictionManager private constructor() : BaseDeviceManager() { ...@@ -15,58 +16,139 @@ class RestrictionManager private constructor() : BaseDeviceManager() {
} }
} }
fun setStatusBarExpandPanelDisabled(disabled: Boolean) = mDeviceRestrictionManager.setStatusBarExpandPanelDisabled(mComponent, disabled) fun setStatusBarExpandPanelDisabled(disabled: Boolean) = try {
mDeviceRestrictionManager.setStatusBarExpandPanelDisabled(mComponent, disabled)
} catch (e: Exception) {
}
fun isStatusBarExpandPanelDisabled() = mDeviceRestrictionManager.isStatusBarExpandPanelDisabled(mComponent) fun isStatusBarExpandPanelDisabled() = try {
mDeviceRestrictionManager.isStatusBarExpandPanelDisabled(mComponent)
} catch (e: Exception) {
}
fun setBluetoothDisabled(disabled: Boolean) = mDeviceRestrictionManager.setBluetoothDisabled(mComponent, disabled) fun setBluetoothDisabled(disabled: Boolean) = try {
mDeviceRestrictionManager.setBluetoothDisabled(mComponent, disabled)
} catch (e: Exception) {
}
fun isBluetoothDisabled() = mDeviceRestrictionManager.isBluetoothDisabled(mComponent) fun isBluetoothDisabled()= try {
mDeviceRestrictionManager.isBluetoothDisabled(mComponent)
} catch (e: Exception) {
}
fun setGPSDisabled(disabled: Boolean) = mDeviceRestrictionManager.setGPSDisabled(mComponent, disabled) fun setGPSDisabled(disabled: Boolean)= try {
mDeviceRestrictionManager.setGPSDisabled(mComponent, disabled)
} catch (e: Exception) {
}
fun isGPSDisabled() = mDeviceRestrictionManager.isGPSDisabled(mComponent) fun isGPSDisabled() = try {
mDeviceRestrictionManager.isGPSDisabled(mComponent)
} catch (e: Exception) {
}
fun setAdbDisabled(disabled: Boolean) = mDeviceRestrictionManager.setAdbDisabled(mComponent, disabled) fun setAdbDisabled(disabled: Boolean) = try {
mDeviceRestrictionManager.setAdbDisabled(mComponent, disabled)
} catch (e: Exception) {
}
fun isAdbDisabled() = mDeviceRestrictionManager.isAdbDisabled(mComponent) fun isAdbDisabled() = try {
mDeviceRestrictionManager.isAdbDisabled(mComponent)
} catch (e: Exception) {
}
fun setUSBOtgDisabled(disabled: Boolean) = mDeviceRestrictionManager.setUSBOtgDisabled(mComponent, disabled) fun setUSBOtgDisabled(disabled: Boolean)= try {
mDeviceRestrictionManager.setUSBOtgDisabled(mComponent, disabled)
} catch (e: Exception) {
}
fun isUSBOtgDisabled() = mDeviceRestrictionManager.isUSBOtgDisabled(mComponent) fun isUSBOtgDisabled() = try {
mDeviceRestrictionManager.isUSBOtgDisabled(mComponent)
} catch (e: Exception) {
}
fun setSystemUpdateDisabled(disabled: Boolean) = mDeviceRestrictionManager.setSystemUpdateDisabled(mComponent, disabled) fun setSystemUpdateDisabled(disabled: Boolean)= try {
mDeviceRestrictionManager.setSystemUpdateDisabled(mComponent, disabled)
} catch (e: Exception) {
}
fun isSystemUpdateDisabled() = mDeviceRestrictionManager.isSystemUpdateDisabled(mComponent) fun isSystemUpdateDisabled() = try {
mDeviceRestrictionManager.isSystemUpdateDisabled(mComponent)
} catch (e: Exception) {
}
fun setTaskButtonDisabled(disabled: Boolean) = mDeviceRestrictionManager.setTaskButtonDisabled(mComponent, disabled) fun setTaskButtonDisabled(disabled: Boolean) = try {
mDeviceRestrictionManager.setTaskButtonDisabled(mComponent, disabled)
} catch (e: Exception) {
}
fun isTaskButtonDisabled() = mDeviceRestrictionManager.isTaskButtonDisabled(mComponent) fun isTaskButtonDisabled() = try {
mDeviceRestrictionManager.isTaskButtonDisabled(mComponent)
} catch (e: Exception) {
}
fun setHomeButtonDisabled(disabled: Boolean) = mDeviceRestrictionManager.setHomeButtonDisabled(mComponent, disabled) fun setHomeButtonDisabled(disabled: Boolean) = try {
mDeviceRestrictionManager.setHomeButtonDisabled(mComponent, disabled)
} catch (e: Exception) {
}
fun isHomeButtonDisabled() = mDeviceRestrictionManager.isHomeButtonDisabled(mComponent) fun isHomeButtonDisabled() = try {
mDeviceRestrictionManager.isHomeButtonDisabled(mComponent)
} catch (e: Exception) {
}
fun setBackButtonDisabled(disabled: Boolean) = mDeviceRestrictionManager.setBackButtonDisabled(mComponent, disabled) fun setBackButtonDisabled(disabled: Boolean) = try {
mDeviceRestrictionManager.setBackButtonDisabled(mComponent, disabled)
} catch (e: Exception) {
}
fun isBackButtonDisabled() = mDeviceRestrictionManager.isBackButtonDisabled(mComponent) fun isBackButtonDisabled() = try {
mDeviceRestrictionManager.isBackButtonDisabled(mComponent)
} catch (e: Exception) {
}
fun setSysTime(millis: Long) = mDeviceControlManager.setSysTime(mComponent, millis) fun setSysTime(millis: Long) = try {
mDeviceControlManager.setSysTime(mComponent, millis)
} catch (e: Exception) {
}
fun setDefaultLauncher(packageName: String, className: String) = mDeviceControlManager.setDefaultLauncher(mComponent, packageName, className) fun setDefaultLauncher(packageName: String, className: String) = try {
mDeviceControlManager.setDefaultLauncher(mComponent, packageName, className)
} catch (e: Exception) {
}
fun clearDefaultLauncher() = mDeviceControlManager.clearDefaultLauncher(mComponent) fun clearDefaultLauncher() = try {
mDeviceControlManager.clearDefaultLauncher(mComponent)
} catch (e: Exception) {
}
fun captureScreen() = mDeviceControlManager.captureScreen(mComponent) fun captureScreen() = try {
mDeviceControlManager.captureScreen(mComponent)
} catch (e: Exception) {
}
fun setSilentActiveAdmin(component: ComponentName = mComponent) = mDeviceControlManager.setSilentActiveAdmin(component) fun setSilentActiveAdmin(component: ComponentName = mComponent) = try {
mDeviceControlManager.setSilentActiveAdmin(component)
} catch (e: Exception) {
}
fun setUSBDataDisabled(disabled: Boolean) = mDeviceRestrictionManager.setUSBDataDisabled(mComponent, disabled) fun setUSBDataDisabled(disabled: Boolean) = try {
mDeviceRestrictionManager.setUSBDataDisabled(mComponent, disabled)
} catch (e: Exception) {
}
fun isUSBDataDisabled() = mDeviceRestrictionManager.isUSBDataDisabled(mComponent) fun isUSBDataDisabled() = try {
mDeviceRestrictionManager.isUSBDataDisabled(mComponent)
} catch (e: Exception) {
}
fun setExternalStorageDisabled(disabled: Boolean) = mDeviceRestrictionManager.setExternalStorageDisabled(mComponent, disabled) fun setExternalStorageDisabled(disabled: Boolean) = try {
mDeviceRestrictionManager.setExternalStorageDisabled(mComponent, disabled)
} catch (e: Exception) {
}
fun isExternalStorageDisabled() = mDeviceRestrictionManager.isExternalStorageDisabled(mComponent) fun isExternalStorageDisabled() = try {
mDeviceRestrictionManager.isExternalStorageDisabled(mComponent)
} catch (e: Exception) {
}
} }
\ No newline at end of file
...@@ -12,9 +12,18 @@ class SettingsManager private constructor() : BaseDeviceManager() { ...@@ -12,9 +12,18 @@ class SettingsManager private constructor() : BaseDeviceManager() {
} }
} }
fun setFontSize(size: Int) = mDeviceSettingsManager.setFontSize(mComponent, size) fun setFontSize(size: Int) = try {
mDeviceSettingsManager.setFontSize(mComponent, size)
} catch (e: java.lang.Exception) {
}
fun setRestoreFactoryDisabled(disable: Boolean) = mDeviceSettingsManager.setRestoreFactoryDisabled(mComponent, disable) fun setRestoreFactoryDisabled(disable: Boolean) = try {
mDeviceSettingsManager.setRestoreFactoryDisabled(mComponent, disable)
} catch (e: java.lang.Exception) {
}
fun isRestoreFactoryDisabled() = mDeviceSettingsManager.isRestoreFactoryDisabled(mComponent) fun isRestoreFactoryDisabled() = try {
mDeviceSettingsManager.isRestoreFactoryDisabled(mComponent)
} catch (e: java.lang.Exception) {
}
} }
\ No newline at end of file
...@@ -12,6 +12,10 @@ import com.secspace.lib.common.R ...@@ -12,6 +12,10 @@ import com.secspace.lib.common.R
import com.secspace.lib.common.function.ActivationHelper.ActivationListener import com.secspace.lib.common.function.ActivationHelper.ActivationListener
import com.secspace.lib.common.function.ActivationHelper.active import com.secspace.lib.common.function.ActivationHelper.active
import com.secspace.lib.common.utils.IntentUtil import com.secspace.lib.common.utils.IntentUtil
import com.secspace.lib.common.utils.Prefs
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
class BuyCodeDialog private constructor(val mContext: Context) : DialogInterface.OnDismissListener, View.OnClickListener { class BuyCodeDialog private constructor(val mContext: Context) : DialogInterface.OnDismissListener, View.OnClickListener {
private var mDialog: AlertDialog? = null private var mDialog: AlertDialog? = null
...@@ -67,10 +71,14 @@ class BuyCodeDialog private constructor(val mContext: Context) : DialogInterface ...@@ -67,10 +71,14 @@ class BuyCodeDialog private constructor(val mContext: Context) : DialogInterface
R.id.btn_accept -> { R.id.btn_accept -> {
dismiss() dismiss()
WorkManager.getInstance(mContext).removeForbidden() WorkManager.getInstance(mContext).removeForbidden()
active(mContext, object : ActivationListener { active(mContext, object : ActivationListener {
override fun activationFailed() {} override fun activationFailed() {}
override fun activated() { override fun activated() {
IntentUtil.startEduLauncher(mContext) GlobalScope.launch(Dispatchers.Main) {
SwitchInMdm.getInstance(mContext).init()
IntentUtil.startEduLauncher(mContext)
}
} }
}, true) }, true)
} }
......
...@@ -19,6 +19,7 @@ import java.util.* ...@@ -19,6 +19,7 @@ import java.util.*
class SwitchInMdm constructor(var context: Context) : ISwitch() { class SwitchInMdm constructor(var context: Context) : ISwitch() {
public override suspend fun init() { public override suspend fun init() {
DpmManager.instance.init(context)
Prefs.setInSpace(context, true) Prefs.setInSpace(context, true)
setDefaultLauncher() setDefaultLauncher()
DpmManager.instance.applicationManager.let { DpmManager.instance.applicationManager.let {
...@@ -118,7 +119,7 @@ class SwitchInMdm constructor(var context: Context) : ISwitch() { ...@@ -118,7 +119,7 @@ class SwitchInMdm constructor(var context: Context) : ISwitch() {
private fun setDefaultLauncher() { private fun setDefaultLauncher() {
DpmManager.instance.applicationManager.disableComponent(context, ComponentNames.COMPONENT_HUAWEI_LUANCHER) DpmManager.instance.applicationManager.disableComponent(context, ComponentNames.COMPONENT_HUAWEI_LUANCHER)
DpmManager.instance.restrictionManager.let { DpmManager.instance.restrictionManager.let {
it.setDefaultLauncher(context.packageName, "com.android.launcher3.settings.BlankAcitvity") it.setDefaultLauncher(context.packageName, "com.android.launcher3.settings.BlankActivity")
it.setStatusBarExpandPanelDisabled(true) it.setStatusBarExpandPanelDisabled(true)
} }
......
...@@ -76,7 +76,7 @@ class WorkManager private constructor(var context: Context) { ...@@ -76,7 +76,7 @@ class WorkManager private constructor(var context: Context) {
}, false) }, false)
} }
fun exit() = GlobalScope.launch(Dispatchers.IO) { suspend fun exit() {
SwitchOutMdm.getInstance(context).init() SwitchOutMdm.getInstance(context).init()
} }
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<string name="edu_item_first_install_tips">长按桌面可进入家长设置</string> <string name="edu_item_first_install_tips">长按桌面可进入家长设置</string>
<string name="edu_item_first_install_tips_two"> <string name="edu_item_first_install_tips_two">
<Data> <Data>
<![CDATA[<font color="#111111"">首次安装需要设置家长密码及密保问题</font><br><font color="#c2c2c2">家长密码用于切换空间及进入家长设置</font><br><font color="#c2c2c2">密保问题用于忘记密码时进行密码重设</font>]]> <![CDATA[<font color="#111111"">首次安装需要设置家长密码及密保问题</font><br><font color="#c2c2c2">家长密码用于切换空间及进入家长设置<br>密保问题用于忘记密码时进行密码重设</font>]]>
</Data> </Data>
</string> </string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment