MIUI 10。
对于当前应用程序:
try {
Intent intent = new Intent();
intent.setClassName("com.miui.powerkeeper",
"com.miui.powerkeeper.ui.HiddenAppsConfigActivity");
intent.putExtra("package_name", getPackageName());
intent.putExtra("package_label", getText(R.string.app_name));
startActivity(intent);
} catch (ActivityNotFoundException anfe) {
}
Intent
可以打开这个 Activity
。ActivityManager
在某个时刻处理,因此您可以进行过滤。获取这些信息后,您只需创建一个适当的I/ActivityManager: START u0 {cmp=com.miui.powerkeeper/.ui.PowerHideModeActivity} from uid 1000 on display 0
Intent
即可启动相同的 Activity
:try {
Intent intent = new Intent();
intent.setClassName("com.miui.powerkeeper",
"com.miui.powerkeeper.ui.PowerHideModeActivity");
startActivity(intent);
} catch (ActivityNotFoundException anfe) {
// this is not an MIUI device, or the component got moved/renamed
}
顺便说一句,你不应该以这种显式的方式打开操作系统组件。每当他们更改此组件的类名或包名时,您的代码将会出错。
您可以在小米手机(MIUI)上使用跳转到应用详情活动。
Intent intent = new Intent();
intent.setClassName("com.miui.securitycenter", "com.miui.appmanager.ApplicationsDetailsActivity");
intent.putExtra("package_name", packageName);
intent.putExtra("package_label", "Dev Tools");
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);