summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/applications
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/applications')
-rw-r--r--src/com/android/settings/applications/InstalledAppDetails.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index be515df..36adae2 100644
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -140,6 +140,7 @@ public class InstalledAppDetails extends Fragment
private Button mClearDataButton;
private Button mMoveAppButton;
private CompoundButton mNotificationSwitch;
+ private CompoundButton mPrivacyGuardSwitch;
private PackageMoveObserver mPackageMoveObserver;
@@ -179,6 +180,7 @@ public class InstalledAppDetails extends Fragment
private static final int DLG_DISABLE = DLG_BASE + 7;
private static final int DLG_DISABLE_NOTIFICATIONS = DLG_BASE + 8;
private static final int DLG_SPECIAL_DISABLE = DLG_BASE + 9;
+ private static final int DLG_PRIVACY_GUARD = DLG_BASE + 10;
// Menu identifiers
public static final int UNINSTALL_ALL_USERS_MENU = 1;
@@ -398,6 +400,13 @@ 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);
+ }
+
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
@@ -475,6 +484,8 @@ public class InstalledAppDetails extends Fragment
mNotificationSwitch = (CompoundButton) view.findViewById(R.id.notification_switch);
+ mPrivacyGuardSwitch = (CompoundButton) view.findViewById(R.id.privacy_guard_switch);
+
return view;
}
@@ -981,6 +992,7 @@ public class InstalledAppDetails extends Fragment
initDataButtons();
initMoveButton();
initNotificationButton();
+ initPrivacyGuardButton();
} else {
mMoveAppButton.setText(R.string.moving);
mMoveAppButton.setEnabled(false);
@@ -1184,6 +1196,25 @@ public class InstalledAppDetails extends Fragment
})
.setNegativeButton(R.string.dlg_cancel, null)
.create();
+ case DLG_PRIVACY_GUARD:
+ return new AlertDialog.Builder(getActivity())
+ .setTitle(getActivity().getText(R.string.privacy_guard_dlg_title))
+ .setIconAttribute(android.R.attr.alertDialogIcon)
+ .setMessage(getActivity().getText(R.string.privacy_guard_dlg_text))
+ .setPositiveButton(R.string.dlg_ok,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ getOwner().setPrivacyGuard(true);
+ }
+ })
+ .setNegativeButton(R.string.dlg_cancel,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ // Re-enable the checkbox
+ getOwner().mPrivacyGuardSwitch.setChecked(false);
+ }
+ })
+ .create();
}
throw new IllegalArgumentException("unknown id " + id);
}
@@ -1273,6 +1304,11 @@ public class InstalledAppDetails extends Fragment
}
}
+ private void setPrivacyGuard(boolean enabled) {
+ String packageName = mAppEntry.info.packageName;
+ mPm.setPrivacyGuardSetting(packageName, enabled);
+ }
+
private int getPremiumSmsPermission(String packageName) {
try {
if (mSmsManager != null) {
@@ -1370,6 +1406,12 @@ public class InstalledAppDetails extends Fragment
} else {
setNotificationsEnabled(true);
}
+ } else if (buttonView == mPrivacyGuardSwitch) {
+ if (isChecked) {
+ showDialogInner(DLG_PRIVACY_GUARD, 0);
+ } else {
+ setPrivacyGuard(false);
+ }
}
}
}