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

Commit

Permalink
Show application name above usage data
Browse files Browse the repository at this point in the history
Fixes #1949
  • Loading branch information
M66B committed Aug 31, 2014
1 parent eabab99 commit aa94ae5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Version 3.x will be available with a [pro license](http://www.xprivacy.eu/) only

**Next release**

* Show application name above usage data ([issue](/../../issues/1949))

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

**Version 3.0.3 BETA**
Expand Down
35 changes: 19 additions & 16 deletions src/biz/bokhorst/xprivacy/ActivityUsage.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,22 +394,25 @@ public View getView(int position, View convertView, ViewGroup parent) {
// Helpers

private void updateTitle() {
// Get statistics
long count = 0;
long restricted = 0;
double persec = 0;
try {
@SuppressWarnings("rawtypes")
Map statistics = PrivacyService.getClient().getStatistics();
count = (Long) statistics.get("restriction_count");
restricted = (Long) statistics.get("restriction_restricted");
long uptime = (Long) statistics.get("uptime_milliseconds");
persec = (double) count / (uptime / 1000);
} catch (Throwable ex) {
Util.bug(null, ex);
}
if (mUid == 0) {
// Get statistics
long count = 0;
long restricted = 0;
double persec = 0;
try {
@SuppressWarnings("rawtypes")
Map statistics = PrivacyService.getClient().getStatistics();
count = (Long) statistics.get("restriction_count");
restricted = (Long) statistics.get("restriction_restricted");
long uptime = (Long) statistics.get("uptime_milliseconds");
persec = (double) count / (uptime / 1000);
} catch (Throwable ex) {
Util.bug(null, ex);
}

// Set sub title
getActionBar().setSubtitle(String.format("%d/%d %.2f/s", restricted, count, persec));
// Set sub title
getActionBar().setSubtitle(String.format("%d/%d %.2f/s", restricted, count, persec));
} else
getActionBar().setSubtitle(TextUtils.join(", ", new ApplicationInfoEx(this, mUid).getApplicationName()));
}
}

0 comments on commit aa94ae5

Please sign in to comment.