diff --git a/CHANGELOG.md b/CHANGELOG.md index 607c887d1..20fa461a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/biz/bokhorst/xprivacy/ActivitySettings.java b/src/biz/bokhorst/xprivacy/ActivitySettings.java index f5d83b88c..0eff53819 100644 --- a/src/biz/bokhorst/xprivacy/ActivitySettings.java +++ b/src/biz/bokhorst/xprivacy/ActivitySettings.java @@ -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 listQuirks = new ArrayList(); if (freeze) listQuirks.add("freeze"); @@ -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()); @@ -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())); diff --git a/src/biz/bokhorst/xprivacy/PrivacyManager.java b/src/biz/bokhorst/xprivacy/PrivacyManager.java index 8bc0dd4a0..aa62dcbc0 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyManager.java +++ b/src/biz/bokhorst/xprivacy/PrivacyManager.java @@ -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"; diff --git a/src/biz/bokhorst/xprivacy/PrivacyService.java b/src/biz/bokhorst/xprivacy/PrivacyService.java index 763d15cd4..5802e924f 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyService.java +++ b/src/biz/bokhorst/xprivacy/PrivacyService.java @@ -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()) {