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

Commit

Permalink
Added quirk 'nousage'
Browse files Browse the repository at this point in the history
Refs #2085
  • Loading branch information
M66B committed Dec 15, 2014
1 parent 5532b74 commit 1e569e8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Changelog
* Check external storage directory for *open* restriction ([issue](/../../issues/1757))
* Added restriction *getInstalledProvidersForProfile* ([issue](/../../issues/1757))
* Allow white listing / show parameter of *getExternalStorageState* ([issue](/../../issues/1757))
* Added quirk *nousage* to disable usage data for specific applications ([issue](/../../issues/2085))

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

Expand Down
5 changes: 5 additions & 0 deletions src/biz/bokhorst/xprivacy/ActivitySettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ protected void onCreate(Bundle savedInstanceState) {
boolean updates = PrivacyManager.getSettingBool(-uid, PrivacyManager.cSettingUpdates, false);
boolean odsystem = PrivacyManager.getSettingBool(-uid, PrivacyManager.cSettingOnDemandSystem, false);
boolean wnomod = PrivacyManager.getSettingBool(-uid, PrivacyManager.cSettingWhitelistNoModify, false);
boolean nousage = PrivacyManager.getSettingBool(-uid, PrivacyManager.cSettingNoUsageData, false);
List<String> listQuirks = new ArrayList<String>();
if (freeze)
listQuirks.add("freeze");
Expand All @@ -237,6 +238,8 @@ protected void onCreate(Bundle savedInstanceState) {
listQuirks.add("odsystem");
if (wnomod)
listQuirks.add("wnomod");
if (nousage)
listQuirks.add("nousage");
Collections.sort(listQuirks);
String quirks = TextUtils.join(",", listQuirks.toArray());

Expand Down Expand Up @@ -667,6 +670,8 @@ private void optionSave() {
Boolean.toString(listQuirks.contains("odsystem")));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingWhitelistNoModify,
Boolean.toString(listQuirks.contains("wnomod")));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingNoUsageData,
Boolean.toString(listQuirks.contains("nousage")));

// Notifications
PrivacyManager.setSetting(uid, PrivacyManager.cSettingNotify, Boolean.toString(cbNotify.isChecked()));
Expand Down
1 change: 1 addition & 0 deletions src/biz/bokhorst/xprivacy/PrivacyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public class PrivacyManager {
public final static String cSettingUpdates = "Updates";
public final static String cSettingMethodExpert = "MethodExpert";
public final static String cSettingWhitelistNoModify = "WhitelistNoModify";
public final static String cSettingNoUsageData = "NoUsageData";

public final static String cSettingODExpert = "ODExpert";
public final static String cSettingODCategory = "ODCategory";
Expand Down
3 changes: 2 additions & 1 deletion src/biz/bokhorst/xprivacy/PrivacyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,8 @@ private void storeUsageData(final PRestriction restriction, String secret, final
throws RemoteException {
// Check if enabled
final int userId = Util.getUserId(restriction.uid);
if (getSettingBool(userId, PrivacyManager.cSettingUsage, true)) {
if (getSettingBool(userId, PrivacyManager.cSettingUsage, true)
&& !getSettingBool(restriction.uid, PrivacyManager.cSettingNoUsageData, false)) {
// Check secret
boolean allowed = true;
if (Util.getAppId(Binder.getCallingUid()) != getXUid()) {
Expand Down

0 comments on commit 1e569e8

Please sign in to comment.