From de022390348493b81808ef4e81d716cd7dc51b6e Mon Sep 17 00:00:00 2001 From: rayworks Date: Mon, 27 May 2019 11:32:56 +0800 Subject: [PATCH] Add support for brand Nokia --- .../autostarter/AutoStartPermissionHelper.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/autostarter/src/main/java/com/judemanutd/autostarter/AutoStartPermissionHelper.kt b/autostarter/src/main/java/com/judemanutd/autostarter/AutoStartPermissionHelper.kt index 6fa972b..8d85f8e 100644 --- a/autostarter/src/main/java/com/judemanutd/autostarter/AutoStartPermissionHelper.kt +++ b/autostarter/src/main/java/com/judemanutd/autostarter/AutoStartPermissionHelper.kt @@ -50,6 +50,14 @@ class AutoStartPermissionHelper private constructor() { private val PACKAGE_VIVO_COMPONENT_FALLBACK = "com.vivo.permissionmanager.activity.BgStartUpManagerActivity" private val PACKAGE_VIVO_COMPONENT_FALLBACK_A = "com.iqoo.secure.ui.phoneoptimize.BgStartUpManager" + /** + * Nokia + */ + + private val BRAND_NOKIA = "nokia" + private val PACKAGE_NOKIA_MAIN = "com.evenwell.powersaving.g3" + private val PACKAGE_NOKIA_COMPONENT = "com.evenwell.powersaving.g3.exception.PowerSaverExceptionActivity" + fun getAutoStartPermission(context: Context) { val build_info = Build.BRAND.toLowerCase() @@ -65,6 +73,8 @@ class AutoStartPermissionHelper private constructor() { BRAND_OPPO -> autoStartOppo(context) BRAND_VIVO -> autoStartVivo(context) + + BRAND_NOKIA -> autoStartNokia(context) } } @@ -148,6 +158,16 @@ class AutoStartPermissionHelper private constructor() { } } + private fun autoStartNokia(context: Context) { + if (isPackageExists(context, PACKAGE_NOKIA_MAIN)) { + try { + startIntent(context, PACKAGE_NOKIA_MAIN, PACKAGE_NOKIA_COMPONENT) + } catch (e: Exception) { + e.printStackTrace() + } + } + } + @Throws(Exception::class) private fun startIntent(context: Context, packageName: String, componentName: String) { try {