Last active
July 13, 2020 10:28
-
-
Save ru-huawei-android/7296148b24e0079c40073efc34f628a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//版权声明:本文为CSDN博主「屈佳俊」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 | |
//原文链接:https://blog.csdn.net/weixin_44021615/java/article/details/104716170 | |
private fun openEmuiPowerSettings() { | |
val sdkVersion = Build.VERSION.SDK_INT | |
val componentName = when { | |
sdkVersion >= 28 -> ComponentName.unflattenFromString("com.huawei.systemmanager/.startupmgr.ui.StartupNormalAppListActivity") | |
sdkVersion >= 26 -> ComponentName.unflattenFromString("com.huawei.systemmanager/.appcontrol.activity.StartupAppControlActivity") | |
sdkVersion >= 23 -> ComponentName.unflattenFromString("com.huawei.systemmanager/.startupmgr.ui.StartupNormalAppListActivity") | |
sdkVersion >= 21 -> ComponentName.unflattenFromString("com.huawei.systemmanager/com.huawei.permissionmanager.ui.MainActivity") | |
else -> null | |
} | |
componentName?.let { | |
try { | |
startActivity(Intent().apply { | |
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | |
component = it | |
}) | |
} catch (ex: ActivityNotFoundException) { } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment