使Settings中的app設定為Disabled
阿新 • • 發佈:2018-12-27
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按鈕永遠不可點選