diff options
Diffstat (limited to 'src/com/android/settings/applications/InstalledAppDetails.java')
-rw-r--r-- | src/com/android/settings/applications/InstalledAppDetails.java | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java index 778ef44..4091b13 100644 --- a/src/com/android/settings/applications/InstalledAppDetails.java +++ b/src/com/android/settings/applications/InstalledAppDetails.java @@ -401,10 +401,19 @@ public class InstalledAppDetails extends Fragment } private void initPrivacyGuardButton() { - // TODO: We probably want to disable this optional for the built-in apps - boolean enabled = mPm.getPrivacyGuardSetting(mAppEntry.info.packageName); - mPrivacyGuardSwitch.setChecked(enabled); - mPrivacyGuardSwitch.setOnCheckedChangeListener(this); + if (mPrivacyGuardSwitch == null) { + return; + } + + mPrivacyGuardSwitch.setChecked(mPm.getPrivacyGuardSetting(mAppEntry.info.packageName)); + + // disable privacy guard switch if the app is signed with the platform certificate + // to avoid the user shooting himself in the foot + if (isThisASystemPackage()) { + mPrivacyGuardSwitch.setEnabled(false); + } else { + mPrivacyGuardSwitch.setOnCheckedChangeListener(this); + } } /** Called when the activity is first created. */ @@ -1201,10 +1210,17 @@ public class InstalledAppDetails extends Fragment .setNegativeButton(R.string.dlg_cancel, null) .create(); case DLG_PRIVACY_GUARD: + final int messageResId; + if ((getOwner().mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { + messageResId = R.string.privacy_guard_dlg_system_app_text; + } else { + messageResId = R.string.privacy_guard_dlg_text; + } + return new AlertDialog.Builder(getActivity()) - .setTitle(getActivity().getText(R.string.privacy_guard_dlg_title)) + .setTitle(R.string.privacy_guard_dlg_title) .setIconAttribute(android.R.attr.alertDialogIcon) - .setMessage(getActivity().getText(R.string.privacy_guard_dlg_text)) + .setMessage(messageResId) .setPositiveButton(R.string.dlg_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { |