Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
MobileManager
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Wang Xu
MobileManager
Commits
a74afcdb
Commit
a74afcdb
authored
Apr 15, 2020
by
Baoxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 输错几次密码后(到锁定前),输对一次密码进行系统切换,再次输错密码时,输错次数未被重置
parent
1afa2d8d
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
343 additions
and
83 deletions
+343
-83
BlankActivity.java
...er3/src/com/android/launcher3/settings/BlankActivity.java
+53
-2
gradle.properties
gradle.properties
+1
-1
LoadingDialog.kt
...main/java/com/secspace/lib/common/dialog/LoadingDialog.kt
+1
-1
ApplicationManager.kt
...in/java/com/secspace/lib/common/dpm/ApplicationManager.kt
+120
-36
DpmManager.kt
...n/src/main/java/com/secspace/lib/common/dpm/DpmManager.kt
+9
-2
HwSystemManager.kt
.../main/java/com/secspace/lib/common/dpm/HwSystemManager.kt
+23
-7
RestrictionManager.kt
...in/java/com/secspace/lib/common/dpm/RestrictionManager.kt
+110
-27
SettingsManager.kt
.../main/java/com/secspace/lib/common/dpm/SettingsManager.kt
+13
-3
BuyCodeDialog.kt
...in/java/com/secspace/lib/common/function/BuyCodeDialog.kt
+9
-1
SwitchInMdm.kt
...main/java/com/secspace/lib/common/function/SwitchInMdm.kt
+2
-1
WorkManager.kt
...main/java/com/secspace/lib/common/function/WorkManager.kt
+1
-1
strings.xml
lib_common/src/main/res/values/strings.xml
+1
-1
No files found.
Launcher3/src/com/android/launcher3/settings/BlankActivity.java
View file @
a74afcdb
package
com
.
android
.
launcher3
.
settings
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.provider.Settings
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.RequiresApi
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.WindowManager
;
import
com.android.launcher3.function.pwd.EncryptedActivity
;
import
com.android.launcher3.function.pwd.PwdPinSetPwdActivity
;
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.utils.IntentUtil
;
import
com.secspace.lib.common.utils.Prefs
;
import
com.secspace.lib.common.utils.UtilsKt
;
import
java.lang.reflect.Method
;
public
class
BlankActivity
extends
BaseActivity
{
...
...
@@ -37,11 +45,17 @@ public class BlankActivity extends BaseActivity {
@Override
protected
void
onResume
()
{
super
.
onResume
();
if
(!
Prefs
.
isPrivacyPolicyAccept
(
this
))
{
DialogManager
.
INSTANCE
.
showPrivacyPolicyDialog
(
this
);
return
;
}
if
(!
checkPermissions
()){
if
(!
checkPermissions
())
{
return
;
}
if
(!
commonROMPermissionCheck
()){
requestAlertWindowPermission
();
finish
();
return
;
}
String
pwd
=
Prefs
.
getLoginPwd
(
this
);
...
...
@@ -52,7 +66,7 @@ public class BlankActivity extends BaseActivity {
return
;
}
String
encrypted
=
Prefs
.
getEncrypted
(
this
);
if
(
TextUtils
.
isEmpty
(
encrypted
))
{
if
(
TextUtils
.
isEmpty
(
encrypted
))
{
Intent
intent
=
new
Intent
(
this
,
EncryptedActivity
.
class
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
intent
);
...
...
@@ -70,4 +84,41 @@ public class BlankActivity extends BaseActivity {
public
void
overridePendingTransition
(
int
enterAnim
,
int
exitAnim
)
{
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"
);
}
}
}
}
gradle.properties
View file @
a74afcdb
...
...
@@ -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/
#32位有符号数2147483647(10)
versionIntCode
=
202004150
1
versionIntCode
=
202004150
2
versionNameMajor
=
1
versionNameMinor
=
0
...
...
lib_common/src/main/java/com/secspace/lib/common/dialog/LoadingDialog.kt
View file @
a74afcdb
...
...
@@ -73,7 +73,7 @@ class LoadingDialog private constructor(context: Context) {
}
companion
object
{
private
const
val
TAG
=
"
Switcher
Dialog"
private
const
val
TAG
=
"
Loading
Dialog"
@SuppressLint
(
"StaticFieldLeak"
)
private
var
INST
:
LoadingDialog
?
=
null
...
...
lib_common/src/main/java/com/secspace/lib/common/dpm/ApplicationManager.kt
View file @
a74afcdb
...
...
@@ -17,67 +17,150 @@ class ApplicationManager private constructor() : BaseDeviceManager() {
}
}
fun
addPersistentApp
(
pkgs
:
MutableList
<
String
>)
{
if
(!
checkNull
(
pkgs
))
mDeviceApplicationManager
.
addPersistentApp
(
mComponent
,
pkgs
)
fun
addPersistentApp
(
pkgs
:
MutableList
<
String
>)
=
try
{
when
{
!
checkNull
(
pkgs
)
->
{
mDeviceApplicationManager
.
addPersistentApp
(
mComponent
,
pkgs
)
}
else
->
false
}
}
catch
(
e
:
java
.
lang
.
Exception
)
{
}
fun
removePersistentApp
(
pkgs
:
MutableList
<
String
>)
{
if
(!
checkNull
(
pkgs
))
mDeviceApplicationManager
.
removePersistentApp
(
mComponent
,
pkgs
)
fun
removePersistentApp
(
pkgs
:
MutableList
<
String
>)
=
try
{
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
>)
{
if
(!
checkNull
(
pkgs
))
mDeviceApplicationManager
.
addDisallowedRunningApp
(
mComponent
,
pkgs
)
fun
addDisallowedRunningApp
(
pkgs
:
MutableList
<
String
>)
=
try
{
when
{
!
checkNull
(
pkgs
)
->
{
mDeviceApplicationManager
.
addDisallowedRunningApp
(
mComponent
,
pkgs
)
}
else
->
false
}
}
catch
(
e
:
java
.
lang
.
Exception
)
{
}
fun
removeDisallowedRunningApp
(
pkgs
:
MutableList
<
String
>)
{
if
(!
checkNull
(
pkgs
))
mDeviceApplicationManager
.
removeDisallowedRunningApp
(
mComponent
,
pkgs
)
fun
removeDisallowedRunningApp
(
pkgs
:
MutableList
<
String
>)
=
try
{
when
{
!
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
>)
{
if
(!
checkNull
(
pkgs
))
mDevicePackageManager
.
addDisallowedUninstallPackages
(
mComponent
,
pkgs
)
fun
addDisallowedUninstallPackages
(
pkgs
:
MutableList
<
String
>)
=
try
{
when
{
!
checkNull
(
pkgs
)
->
{
mDevicePackageManager
.
addDisallowedUninstallPackages
(
mComponent
,
pkgs
)
}
else
->
false
}
}
catch
(
e
:
java
.
lang
.
Exception
)
{
}
fun
removeDisallowedUninstallPackages
(
pkgs
:
MutableList
<
String
>){
if
(!
checkNull
(
pkgs
))
mDevicePackageManager
.
removeDisallowedUninstallPackages
(
mComponent
,
pkgs
)
fun
removeDisallowedUninstallPackages
(
pkgs
:
MutableList
<
String
>)
=
try
{
when
{
!
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
>){
if
(!
checkNull
(
pkgs
))
mDevicePackageManager
.
addDisabledDeactivateMdmPackages
(
mComponent
,
pkgs
)
fun
addDisabledDeactivateMdmPackages
(
pkgs
:
MutableList
<
String
>)
=
try
{
when
{
!
checkNull
(
pkgs
)
->
{
mDevicePackageManager
.
addDisabledDeactivateMdmPackages
(
mComponent
,
pkgs
)
}
else
->
false
}
}
catch
(
e
:
java
.
lang
.
Exception
)
{
}
fun
removeDisabledDeactivateMdmPackages
(
pkgs
:
MutableList
<
String
>){
if
(!
checkNull
(
pkgs
))
mDevicePackageManager
.
removeDisabledDeactivateMdmPackages
(
mComponent
,
pkgs
)
fun
removeDisabledDeactivateMdmPackages
(
pkgs
:
MutableList
<
String
>)
=
try
{
when
{
!
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
lib_common/src/main/java/com/secspace/lib/common/dpm/DpmManager.kt
View file @
a74afcdb
...
...
@@ -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
)
...
...
lib_common/src/main/java/com/secspace/lib/common/dpm/HwSystemManager.kt
View file @
a74afcdb
package
com.secspace.lib.common.dpm
import
com.huawei.android.app.admin.DeviceHwSystemManager
import
java.lang.Exception
class
HwSystemManager
private
constructor
()
:
BaseDeviceManager
()
{
private
val
mDeviceHwSystemManager
:
DeviceHwSystemManager
=
DeviceHwSystemManager
()
...
...
@@ -12,15 +13,29 @@ class HwSystemManager private constructor() : BaseDeviceManager() {
}
}
fun
setSuperWhiteListForHwSystemManger
(
pkgs
:
ArrayList
<
String
>)
{
if
(!
checkNull
(
pkgs
))
mDeviceHwSystemManager
.
setSuperWhiteListForHwSystemManger
(
mComponent
,
pkgs
)
fun
setSuperWhiteListForHwSystemManger
(
pkgs
:
ArrayList
<
String
>)
=
try
{
when
{
!
checkNull
(
pkgs
)
->
{
mDeviceHwSystemManager
.
setSuperWhiteListForHwSystemManger
(
mComponent
,
pkgs
)
}
else
->
false
}
}
catch
(
e
:
Exception
)
{
}
fun
removeSuperWhiteListForHwSystemManger
(
pkgs
:
ArrayList
<
String
>)
{
if
(!
checkNull
(
pkgs
))
mDeviceHwSystemManager
.
removeSuperWhiteListForHwSystemManger
(
mComponent
,
pkgs
)
fun
removeSuperWhiteListForHwSystemManger
(
pkgs
:
ArrayList
<
String
>)
=
try
{
when
{
!
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
lib_common/src/main/java/com/secspace/lib/common/dpm/RestrictionManager.kt
View file @
a74afcdb
...
...
@@ -3,6 +3,7 @@ package com.secspace.lib.common.dpm
import
android.content.ComponentName
import
com.huawei.android.app.admin.DeviceControlManager
import
com.huawei.android.app.admin.DeviceRestrictionManager
import
java.lang.Exception
class
RestrictionManager
private
constructor
()
:
BaseDeviceManager
()
{
private
val
mDeviceRestrictionManager
:
DeviceRestrictionManager
=
DeviceRestrictionManager
()
...
...
@@ -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
lib_common/src/main/java/com/secspace/lib/common/dpm/SettingsManager.kt
View file @
a74afcdb
...
...
@@ -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
lib_common/src/main/java/com/secspace/lib/common/function/BuyCodeDialog.kt
View file @
a74afcdb
...
...
@@ -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.active
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
{
private
var
mDialog
:
AlertDialog
?
=
null
...
...
@@ -67,10 +71,14 @@ class BuyCodeDialog private constructor(val mContext: Context) : DialogInterface
R
.
id
.
btn_accept
->
{
dismiss
()
WorkManager
.
getInstance
(
mContext
).
removeForbidden
()
active
(
mContext
,
object
:
ActivationListener
{
override
fun
activationFailed
()
{}
override
fun
activated
()
{
IntentUtil
.
startEduLauncher
(
mContext
)
GlobalScope
.
launch
(
Dispatchers
.
Main
)
{
SwitchInMdm
.
getInstance
(
mContext
).
init
()
IntentUtil
.
startEduLauncher
(
mContext
)
}
}
},
true
)
}
...
...
lib_common/src/main/java/com/secspace/lib/common/function/SwitchInMdm.kt
View file @
a74afcdb
...
...
@@ -19,6 +19,7 @@ import java.util.*
class
SwitchInMdm
constructor
(
var
context
:
Context
)
:
ISwitch
()
{
public
override
suspend
fun
init
()
{
DpmManager
.
instance
.
init
(
context
)
Prefs
.
setInSpace
(
context
,
true
)
setDefaultLauncher
()
DpmManager
.
instance
.
applicationManager
.
let
{
...
...
@@ -118,7 +119,7 @@ class SwitchInMdm constructor(var context: Context) : ISwitch() {
private
fun
setDefaultLauncher
()
{
DpmManager
.
instance
.
applicationManager
.
disableComponent
(
context
,
ComponentNames
.
COMPONENT_HUAWEI_LUANCHER
)
DpmManager
.
instance
.
restrictionManager
.
let
{
it
.
setDefaultLauncher
(
context
.
packageName
,
"com.android.launcher3.settings.BlankAc
it
vity"
)
it
.
setDefaultLauncher
(
context
.
packageName
,
"com.android.launcher3.settings.BlankAc
ti
vity"
)
it
.
setStatusBarExpandPanelDisabled
(
true
)
}
...
...
lib_common/src/main/java/com/secspace/lib/common/function/WorkManager.kt
View file @
a74afcdb
...
...
@@ -76,7 +76,7 @@ class WorkManager private constructor(var context: Context) {
},
false
)
}
fun
exit
()
=
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
suspend
fun
exit
(
)
{
SwitchOutMdm
.
getInstance
(
context
).
init
()
}
...
...
lib_common/src/main/res/values/strings.xml
View file @
a74afcdb
...
...
@@ -45,7 +45,7 @@
<string
name=
"edu_item_first_install_tips"
>
长按桌面可进入家长设置
</string>
<string
name=
"edu_item_first_install_tips_two"
>
<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>
</string>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment