Commit 45dd7ec8 by Baoxy

fix: emui10 隐藏中间件图标

parent 22d3c9a3
......@@ -6,6 +6,7 @@ import android.content.pm.ApplicationInfo
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.content.pm.ResolveInfo
import android.os.Build.VERSION_CODES
import android.util.Log
import com.secspace.lib.common.env.Packages.PkgSecSpace
import com.secspace.lib.common.utils.*
......@@ -22,6 +23,8 @@ object SwitchInMdm {
private val TAG = "SwitchInMdm"
fun init(context: Context) {
this.context = context
MdmUtils.setDefaultLauncher(context)
val mdmFactoryManager = DpmHelper.getInstance(context).getmMdmFactoryManager()
mdmFactoryManager.deviceApplicationManager.addDisabledDeactivateMdmPackages(getPersistentList(context))
mdmFactoryManager.deviceApplicationManager.addDisallowedUninstallPackages(getPersistentList(context))
......@@ -37,7 +40,13 @@ object SwitchInMdm {
clearTasks(context)
killBackgroundApplication()
isCoverInstall()
MdmUtils.setDefaultLauncher(context)
hiddenPkgIcon(context)
}
private fun hiddenPkgIcon(context: Context){
if (android.os.Build.VERSION.SDK_INT >= VERSION_CODES.P)
Settings.hiddenPkgIcon(context)
}
private fun clearTasks(context: Context) {
......
package com.secspace.lib.common.utils
import android.content.Context
import android.provider.Settings
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
object Settings {
fun hiddenPkgIcon(ctx: Context?) {
GlobalScope.launch(Dispatchers.IO) {
Settings.Global.putInt(ctx?.contentResolver, "show_hidden_icon_apps_enabled", 0)
}
}
}
\ No newline at end of file
......@@ -220,7 +220,7 @@ public class SettingsUtil {
public static void screenOn(Context context) {
PowerManager mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
if (mPowerManager != null) {
PowerManager.WakeLock mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK
@SuppressLint("InvalidWakeLockTag") PowerManager.WakeLock mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK
| PowerManager.ACQUIRE_CAUSES_WAKEUP, "tag");
mWakeLock.acquire(10 * 60 * 1000L /*10 minutes*/);
mWakeLock.release();
......
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