Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Fixed respecting dangerous while applying template
Browse files Browse the repository at this point in the history
Closes #1251
  • Loading branch information
M66B committed Feb 5, 2014
1 parent 9f5541c commit 40ecfed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Test and beta releases will have experimental functions enabled by default.

**Next release**

* Fixed respecting dangerous while applying template (#1251)
* Moved filter to action bar, thanks @[jpeg729](https://github.com/jpeg729)
* Reporting of user interface errors
* Updated traditional Chinese translation
Expand Down
8 changes: 3 additions & 5 deletions src/biz/bokhorst/xprivacy/ActivityApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,24 +451,22 @@ private void optionApply() {
break;
}
}
final boolean restricted = !some;
final boolean restrict = !some;

AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ActivityApp.this);
alertDialogBuilder.setTitle(getString(restricted ? R.string.menu_apply : R.string.menu_clear_all));
alertDialogBuilder.setTitle(getString(restrict ? R.string.menu_apply : R.string.menu_clear_all));
alertDialogBuilder.setMessage(R.string.msg_sure);
alertDialogBuilder.setIcon(Util.getThemed(this, R.attr.icon_launcher));
alertDialogBuilder.setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Do toggle
List<Boolean> oldState = PrivacyManager.getRestartStates(mAppInfo.getUid(), null);
List<PRestriction> listPRestriction = new ArrayList<PRestriction>();
for (String restrictionName : listRestriction) {
String templateName = PrivacyManager.cSettingTemplate + "." + restrictionName;
if (PrivacyManager.getSettingBool(null, 0, templateName, !ondemand, false))
listPRestriction.add(new PRestriction(mAppInfo.getUid(), restrictionName, null, restricted));
PrivacyManager.setRestriction(mAppInfo.getUid(), restrictionName, null, restrict, false);
}
PrivacyManager.setRestrictionList(listPRestriction);
List<Boolean> newState = PrivacyManager.getRestartStates(mAppInfo.getUid(), null);

// Refresh display
Expand Down
7 changes: 1 addition & 6 deletions src/biz/bokhorst/xprivacy/PackageChange.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package biz.bokhorst.xprivacy;

import java.util.ArrayList;
import java.util.List;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
Expand Down Expand Up @@ -53,13 +50,11 @@ public void onReceive(final Context context, Intent intent) {

// Restrict new non-system apps
if (!appInfo.isSystem()) {
List<PRestriction> listPRestriction = new ArrayList<PRestriction>();
for (String restrictionName : PrivacyManager.getRestrictions()) {
String templateName = PrivacyManager.cSettingTemplate + "." + restrictionName;
if (PrivacyManager.getSettingBool(null, 0, templateName, !ondemand, false))
listPRestriction.add(new PRestriction(uid, restrictionName, null, true));
PrivacyManager.setRestriction(uid, restrictionName, null, true, false);
}
PrivacyManager.setRestrictionList(listPRestriction);
}
}

Expand Down

0 comments on commit 40ecfed

Please sign in to comment.