diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f9308ba9..2f0080dfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index 52385a042..de0afbf37 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/res/menu/settings.xml b/res/menu/settings.xml index 1ec268e87..a74676f4e 100644 --- a/res/menu/settings.xml +++ b/res/menu/settings.xml @@ -4,12 +4,12 @@ \ No newline at end of file diff --git a/src/biz/bokhorst/xprivacy/ActivityApp.java b/src/biz/bokhorst/xprivacy/ActivityApp.java index 2cc59b982..9173d88b2 100644 --- a/src/biz/bokhorst/xprivacy/ActivityApp.java +++ b/src/biz/bokhorst/xprivacy/ActivityApp.java @@ -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); } diff --git a/src/biz/bokhorst/xprivacy/ActivitySettings.java b/src/biz/bokhorst/xprivacy/ActivitySettings.java index 2a04a7a15..51ae3097e 100644 --- a/src/biz/bokhorst/xprivacy/ActivitySettings.java +++ b/src/biz/bokhorst/xprivacy/ActivitySettings.java @@ -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; @@ -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); @@ -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, ""); @@ -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); @@ -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(); } @@ -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 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 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, @@ -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));