Skip to content

Commit

Permalink
Add support for brand Nokia
Browse files Browse the repository at this point in the history
  • Loading branch information
rayworks committed May 27, 2019
1 parent 6e04a73 commit de02239
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -65,6 +73,8 @@ class AutoStartPermissionHelper private constructor() {
BRAND_OPPO -> autoStartOppo(context)

BRAND_VIVO -> autoStartVivo(context)

BRAND_NOKIA -> autoStartNokia(context)
}

}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit de02239

Please sign in to comment.