diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a49ed4ab..006184072 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Changelog * Fixed function name overlapping information icon * Clear all data will also clear local caches +* Show parameters in usage data [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) diff --git a/src/biz/bokhorst/xprivacy/ActivityUsage.java b/src/biz/bokhorst/xprivacy/ActivityUsage.java index ccf89d974..d34392deb 100644 --- a/src/biz/bokhorst/xprivacy/ActivityUsage.java +++ b/src/biz/bokhorst/xprivacy/ActivityUsage.java @@ -297,7 +297,11 @@ public View getView(int position, View convertView, ViewGroup parent) { holder.imgIcon.setVisibility(View.INVISIBLE); holder.imgRestricted.setVisibility(usageData.restricted ? View.VISIBLE : View.INVISIBLE); holder.tvApp.setText(Integer.toString(usageData.uid)); - holder.tvRestriction.setText(String.format("%s/%s", usageData.restrictionName, usageData.methodName)); + if (usageData.extra == null) + holder.tvRestriction.setText(String.format("%s/%s", usageData.restrictionName, usageData.methodName)); + else + holder.tvRestriction.setText(String.format("%s/%s(%s)", usageData.restrictionName, + usageData.methodName, usageData.extra)); // Async update new HolderTask(position, holder, usageData).executeOnExecutor(mExecutor, (Object) null); diff --git a/src/biz/bokhorst/xprivacy/PrivacyService.java b/src/biz/bokhorst/xprivacy/PrivacyService.java index d532dcb6b..d533c60c0 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyService.java +++ b/src/biz/bokhorst/xprivacy/PrivacyService.java @@ -589,6 +589,7 @@ public void run() { values.put("method", restriction.methodName); values.put("restricted", mresult.restricted); values.put("time", new Date().getTime()); + values.put("extra", restriction.extra); db.insertWithOnConflict(cTableUsage, null, values, SQLiteDatabase.CONFLICT_REPLACE); @@ -755,10 +756,11 @@ public List getUsageList(int uid) throws RemoteException { Cursor cursor; if (uid == 0) cursor = db.query(cTableUsage, new String[] { "uid", "restriction", "method", "restricted", - "time" }, null, new String[] {}, null, null, "time DESC LIMIT " + cMaxUsageData); + "time", "extra" }, null, new String[] {}, null, null, "time DESC LIMIT " + + cMaxUsageData); else cursor = db.query(cTableUsage, new String[] { "uid", "restriction", "method", "restricted", - "time" }, "uid=?", new String[] { Integer.toString(uid) }, null, null, + "time", "extra" }, "uid=?", new String[] { Integer.toString(uid) }, null, null, "time DESC LIMIT " + cMaxUsageData); if (cursor == null) Util.log(null, Log.WARN, "Database cursor null (usage data)"); @@ -771,6 +773,7 @@ public List getUsageList(int uid) throws RemoteException { data.methodName = cursor.getString(2); data.restricted = (cursor.getInt(3) > 0); data.time = cursor.getLong(4); + data.extra = cursor.getString(5); result.add(data); } } finally { @@ -1722,6 +1725,22 @@ private SQLiteDatabase getDatabase() { } } + if (db.needUpgrade(7)) { + mLock.writeLock().lock(); + db.beginTransaction(); + try { + db.execSQL("ALTER TABLE usage ADD COLUMN extra TEXT"); + db.setVersion(7); + db.setTransactionSuccessful(); + } finally { + try { + db.endTransaction(); + } finally { + mLock.writeLock().unlock(); + } + } + } + Util.log(null, Log.WARN, "Database version=" + db.getVersion()); mDatabase = db; } catch (Throwable ex) {