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

Commit

Permalink
Updated changelog, FAQ
Browse files Browse the repository at this point in the history
Showing action bar items always
Remove passing application name
Formatting

Refs #1938
  • Loading branch information
M66B committed Aug 30, 2014
1 parent 3aad666 commit 67458d0
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 62 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Version 3.x will be available with a [pro license](http://www.xprivacy.eu/) only
**Next release**

* Improved database locking ([pull request](/../../issues/1939))
* Changed settings dialog to settings activity ([pull request](/../../issues/1938))
* Updated simplified Chinese translation

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,14 @@ See [question #5](#FAQ5) for how to start an export and for details on Tasker.

Similarly you can start other activities:

* Application settings
* Settings

```
am start -a biz.bokhorst.xprivacy.action.SETTINGS
am start -a biz.bokhorst.xprivacy.action.SETTINGS --ei Uid 10123
```

* Application details view

```
am start -a biz.bokhorst.xprivacy.action.APPLICATION --ei Uid 10123
Expand Down
4 changes: 2 additions & 2 deletions res/menu/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<item
android:id="@+id/menu_cancel"
android:icon="@android:drawable/ic_menu_close_clear_cancel"
android:showAsAction="ifRoom"
android:showAsAction="always"
android:title="@android:string/cancel"/>
<item
android:id="@+id/menu_save"
android:icon="@android:drawable/ic_menu_save"
android:showAsAction="ifRoom"
android:showAsAction="always"
android:title="@android:string/ok"/>

</menu>
3 changes: 1 addition & 2 deletions src/biz/bokhorst/xprivacy/ActivityApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,7 @@ private void optionFetch() {

private void optionSettings() {
Intent intent = new Intent(ActivityApp.this, ActivitySettings.class);
intent.putExtra(ActivitySettings.cAppUid, mAppInfo.getUid());
intent.putStringArrayListExtra(ActivitySettings.cAppName, mAppInfo.getApplicationName());
intent.putExtra(ActivitySettings.cUid, mAppInfo.getUid());
startActivity(intent);
}

Expand Down
98 changes: 41 additions & 57 deletions src/biz/bokhorst/xprivacy/ActivitySettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,20 @@ public class ActivitySettings extends ActivityBase implements OnCheckedChangeLis
private CheckBox cbSSID;

public static final String ACTION_SETTINGS = "biz.bokhorst.xprivacy.action.SETTINGS";
public static final String cAppUid = "AppUid";
public static final String cAppName = "AppName";
public static final String cUid = "Uid";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.settings);
setTitle(R.string.menu_settings);

final Bundle extras = getIntent().getExtras();
userId = Util.getUserId(Process.myUid());

if (extras != null && extras.containsKey(cAppUid))
uid = extras.getInt(cAppUid);
final Bundle extras = getIntent().getExtras();
if (extras != null && extras.containsKey(cUid))
uid = extras.getInt(cUid);
else
uid = userId;

Expand Down Expand Up @@ -181,16 +181,6 @@ protected void onCreate(Bundle savedInstanceState) {
cbSubscriber.setOnCheckedChangeListener(this);
cbSSID.setOnCheckedChangeListener(this);

// Display app name
if (extras != null) {
String subtitle;
if (extras.containsKey(cAppName))
subtitle = TextUtils.join(", ", extras.getIntegerArrayList(cAppName));
else // Should never happen
subtitle = "-";
getActionBar().setSubtitle(subtitle);
}

// Get current values
boolean usage = PrivacyManager.getSettingBool(-uid, PrivacyManager.cSettingUsage, true);
boolean parameters = PrivacyManager.getSettingBool(-uid, PrivacyManager.cSettingParameters, false);
Expand Down Expand Up @@ -242,7 +232,6 @@ protected void onCreate(Bundle savedInstanceState) {

// Common
boolean random = PrivacyManager.getSettingBool(-uid, PrivacyManager.cSettingRandom, false);

String serial = PrivacyManager.getSetting(-uid, PrivacyManager.cSettingSerial, "");
String lat = PrivacyManager.getSetting(-uid, PrivacyManager.cSettingLatitude, "");
String lon = PrivacyManager.getSetting(-uid, PrivacyManager.cSettingLongitude, "");
Expand Down Expand Up @@ -293,6 +282,10 @@ protected void onCreate(Bundle savedInstanceState) {
btnClearDb.setEnabled(false);
}
} else {
// Display application names
ApplicationInfoEx appInfo = new ApplicationInfoEx(this, uid);
getActionBar().setSubtitle(TextUtils.join(", ", appInfo.getApplicationName()));

// Disable global settings
cbUsage.setVisibility(View.GONE);
cbParameters.setVisibility(View.GONE);
Expand Down Expand Up @@ -516,27 +509,24 @@ private void clearDB() {
alertDialogBuilder.setTitle(R.string.menu_clear_db);
alertDialogBuilder.setMessage(R.string.msg_sure);
alertDialogBuilder.setIcon(getThemed(R.attr.icon_launcher));
alertDialogBuilder.setPositiveButton(getString(android.R.string.ok),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
PrivacyManager.clear();
Toast.makeText(ActivitySettings.this, getString(R.string.msg_reboot), Toast.LENGTH_LONG)
.show();
finish();

// Refresh main UI
Intent intent = new Intent(ActivitySettings.this, ActivityMain.class);
intent.putExtra(ActivityMain.cRefreshUI, true);
startActivity(intent);
}
});
alertDialogBuilder.setNegativeButton(getString(android.R.string.cancel),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
alertDialogBuilder.setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
PrivacyManager.clear();
Toast.makeText(ActivitySettings.this, getString(R.string.msg_reboot), Toast.LENGTH_LONG).show();
finish();

// Refresh main UI
Intent intent = new Intent(ActivitySettings.this, ActivityMain.class);
intent.putExtra(ActivityMain.cRefreshUI, true);
startActivity(intent);
}
});
alertDialogBuilder.setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
Expand Down Expand Up @@ -617,28 +607,24 @@ private void optionSave() {
Boolean.toString(cbParameters.isChecked()));
if (userId == 0)
PrivacyManager.setSetting(uid, PrivacyManager.cSettingLog, Boolean.toString(cbLog.isChecked()));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingSystem,
Boolean.toString(cbSystem.isChecked()));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingSystem, Boolean.toString(cbSystem.isChecked()));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingExperimental,
Boolean.toString(cbExperimental.isChecked()));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingHttps, Boolean.toString(cbHttps.isChecked()));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingAOSPMode,
Boolean.toString(cbAOSP.isChecked()));
PrivacyManager
.setSetting(uid, PrivacyManager.cSettingConfidence, etConfidence.getText().toString());
PrivacyManager.setSetting(uid, PrivacyManager.cSettingAOSPMode, Boolean.toString(cbAOSP.isChecked()));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingConfidence, etConfidence.getText().toString());
}

// Quirks
List<String> listQuirks = Arrays.asList(etQuirks.getText().toString().toLowerCase().replace(" ", "")
.split(","));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingFreeze,
Boolean.toString(listQuirks.contains("freeze")));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingResolve,
Boolean.toString(listQuirks.contains("resolve")));
List<String> listQuirks = Arrays
.asList(etQuirks.getText().toString().toLowerCase().replace(" ", "").split(","));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingFreeze, Boolean.toString(listQuirks.contains("freeze")));
PrivacyManager
.setSetting(uid, PrivacyManager.cSettingResolve, Boolean.toString(listQuirks.contains("resolve")));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingNoResolve,
Boolean.toString(listQuirks.contains("noresolve")));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingPermMan,
Boolean.toString(listQuirks.contains("permman")));
PrivacyManager
.setSetting(uid, PrivacyManager.cSettingPermMan, Boolean.toString(listQuirks.contains("permman")));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingIntentWall,
Boolean.toString(listQuirks.contains("iwall")));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingSafeMode,
Expand All @@ -653,16 +639,14 @@ private void optionSave() {

// On demand restricting
if (uid == userId || (isApp || odSystem))
PrivacyManager.setSetting(uid, PrivacyManager.cSettingOnDemand,
Boolean.toString(cbOnDemand.isChecked()));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingOnDemand, Boolean.toString(cbOnDemand.isChecked()));

if (uid != userId)
PrivacyManager.setSetting(uid, PrivacyManager.cSettingBlacklist,
Boolean.toString(cbBlacklist.isChecked()));
PrivacyManager.setSetting(uid, PrivacyManager.cSettingBlacklist, Boolean.toString(cbBlacklist.isChecked()));

// Random at boot
PrivacyManager.setSetting(uid, PrivacyManager.cSettingRandom,
cbRandom.isChecked() ? Boolean.toString(true) : null);
PrivacyManager.setSetting(uid, PrivacyManager.cSettingRandom, cbRandom.isChecked() ? Boolean.toString(true)
: null);

// Serial#
PrivacyManager.setSetting(uid, PrivacyManager.cSettingSerial, getValue(cbSerial, etSerial));
Expand Down

0 comments on commit 67458d0

Please sign in to comment.