使Settings中的app设置为Disabled
程序员文章站
2022-06-06 16:43:01
...
1、文件路径:alps/packages/apps/Settings/src/com/android/settings/applications/InstalledAppDetailsalps/packages/apps/Settings/src/com/android/settings/applications/InstalledAppDetails.java
2、方法handleDisableable(Button button);:
private boolean handleDisableable(Button button) {
boolean disableable = false;
// Try to prevent the user from bricking their phone
// by not allowing disabling of apps signed with the
// system cert and any launcher app in the system.
if (mHomePackages.contains(mAppEntry.info.packageName)
|| Utils.isSystemPackage(mPm, mPackageInfo)) {
// Disable button for core system applications.
button.setText(R.string.disable_text);
} /// M : update uninstall button base on disableAppList {@
else if (UtilsExt.disableAppList != null
&& UtilsExt.disableAppList.contains(mAppEntry.info.packageName)) {
// set some special app cannot disable
Log.d(TAG, "mDisableAppsList contains :" + mAppEntry.info.packageName);
button.setText(R.string.disable_text);
disableable = false;
} /// @}
//Redmine109402 wuxuhua add for UserManual 2017-10-24 begin
else if("com.sagereal.app.usermanual".equals(mAppEntry.info.packageName)){
button.setText(R.string.disable_text);
disableable = false;
}
//Redmine109402 wuxuhua add for UserManual 2017-10-24 end
else if (mAppEntry.info.enabled && !isDisabledUntilUsed()) {
button.setText(R.string.disable_text);
disableable = true;
} else {
button.setText(R.string.enable_text);
disableable = true;
}
return disableable;
}
3、即可让app Disable按钮永远不可点击
上一篇: 揭秘:刘备三兄弟的*兵器是谁打造出来的?
下一篇: Maven项目设置JDK版本