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

Commit

Permalink
Manage white/black lists from usage data
Browse files Browse the repository at this point in the history
Refs #2093
  • Loading branch information
M66B committed Feb 12, 2015
1 parent 2a680ad commit 4ea1402
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 39 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Changelog
**Next release**

* Use application whitelist for *getPackagesForUid* and *Srv_getPackagesForUid* ([issue](/../../issues/2116))
* Manage white/black lists from usage data (long press uid) ([issue](/../../issues/2093))

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

Expand Down
42 changes: 3 additions & 39 deletions src/biz/bokhorst/xprivacy/ActivityUsage.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
import java.util.concurrent.ThreadFactory;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
Expand Down Expand Up @@ -310,49 +308,15 @@ public boolean onLongClick(View view) {
boolean isApp = PrivacyManager.isApplication(usageData.uid);
boolean odSystem = PrivacyManager.getSettingBool(userId,
PrivacyManager.cSettingOnDemandSystem, false);
final boolean wnomod = PrivacyManager.getSettingBool(usageData.uid,
PrivacyManager.cSettingWhitelistNoModify, false);

if ((isApp || odSystem) && hook != null && hook.whitelist() != null
&& usageData.extra != null) {
if (Util.hasProLicense(ActivityUsage.this) == null)
Util.viewUri(ActivityUsage.this, ActivityMain.cProUri);
else {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ActivityUsage.this);
alertDialogBuilder.setTitle(R.string.menu_whitelists);
alertDialogBuilder.setMessage(usageData.restrictionName + "/"
+ usageData.methodName + "(" + usageData.extra + ")");
alertDialogBuilder.setIcon(getThemed(R.attr.icon_launcher));
alertDialogBuilder.setPositiveButton(getString(R.string.title_deny),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Deny
PrivacyManager.setSetting(usageData.uid, hook.whitelist(),
usageData.extra, Boolean.toString(false));
if (!wnomod)
PrivacyManager.updateState(usageData.uid);
}
});
alertDialogBuilder.setNeutralButton(getString(R.string.title_allow),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Allow
PrivacyManager.setSetting(usageData.uid, hook.whitelist(),
usageData.extra, Boolean.toString(true));
if (!wnomod)
PrivacyManager.updateState(usageData.uid);
}
});
alertDialogBuilder.setNegativeButton(getString(android.R.string.cancel),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
WhitelistTask whitelistsTask = new WhitelistTask(usageData.uid, hook.whitelist(),
ActivityUsage.this);
whitelistsTask.executeOnExecutor(mExecutor, (Object) null);
}
return true;
} else
Expand Down

0 comments on commit 4ea1402

Please sign in to comment.