Skip to content

Commit

Permalink
Added Huawei Autostart
Browse files Browse the repository at this point in the history
  • Loading branch information
CedricAle committed Oct 24, 2019
1 parent 2248880 commit c7932ed
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ class AutoStartPermissionHelper private constructor() {
private val PACKAGE_HONOR_MAIN = "com.huawei.systemmanager"
private val PACKAGE_HONOR_COMPONENT = "com.huawei.systemmanager.optimize.process.ProtectActivity"

/***
* Huawei
*/
private val BRAND_HUAWEI = "huawei"
private val PACKAGE_HUAWEI_MAIN = "com.huawei.systemmanager"
private val PACKAGE_HUAWEI_COMPONENT = "com.huawei.systemmanager.optimize.process.ProtectActivity"

/**
* Oppo
*/
Expand Down Expand Up @@ -79,6 +86,8 @@ class AutoStartPermissionHelper private constructor() {

BRAND_HONOR -> autoStartHonor(context)

BRAND_HUAWEI -> autoStartHuawei(context)

BRAND_OPPO -> autoStartOppo(context)

BRAND_VIVO -> autoStartVivo(context)
Expand Down Expand Up @@ -132,6 +141,17 @@ class AutoStartPermissionHelper private constructor() {
}
}

private fun autoStartHuawei(context: Context) {
if (isPackageExists(context, PACKAGE_HUAWEI_MAIN)) {
try {
startIntent(context, PACKAGE_HUAWEI_MAIN, PACKAGE_HUAWEI_COMPONENT)
} catch (e: Exception) {
e.printStackTrace()
}

}
}

private fun autoStartOppo(context: Context) {
if (isPackageExists(context, PACKAGE_OPPO_MAIN) || isPackageExists(context, PACKAGE_OPPO_FALLBACK)) {
try {
Expand Down

0 comments on commit c7932ed

Please sign in to comment.