Replaced confusing filter allowed option with per application apply setting

This commit is contained in:
M66B 2016-02-21 09:04:03 +01:00
parent bd7116eac1
commit cb1235a217
16 changed files with 116 additions and 89 deletions

View File

@ -167,10 +167,8 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
pref_wifi_homes.setEntryValues(listSSID.toArray(new CharSequence[0]));
// Filtering always enabled
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
cat_advanced.removePreference(screen.findPreference("filter"));
cat_advanced.removePreference(screen.findPreference("filter_allowed"));
}
Preference pref_reset_usage = screen.findPreference("reset_usage");
pref_reset_usage.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@ -575,10 +573,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
dialogFilter.show();
}
} else if ("filter_allowed".equals(name))
SinkholeService.reload("changed " + name, this);
else if ("use_hosts".equals(name))
} else if ("use_hosts".equals(name))
SinkholeService.reload("changed " + name, this);
else if ("vpn4".equals(name)) {
@ -1002,6 +997,10 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
xmlExport(getSharedPreferences("screen_other", Context.MODE_PRIVATE), serializer);
serializer.endTag(null, "screen_other");
serializer.startTag(null, "apply");
xmlExport(getSharedPreferences("apply", Context.MODE_PRIVATE), serializer);
serializer.endTag(null, "apply");
serializer.startTag(null, "notify");
xmlExport(getSharedPreferences("notify", Context.MODE_PRIVATE), serializer);
serializer.endTag(null, "notify");
@ -1108,6 +1107,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
xmlImport(handler.screen_wifi, getSharedPreferences("screen_wifi", Context.MODE_PRIVATE));
xmlImport(handler.screen_other, getSharedPreferences("screen_other", Context.MODE_PRIVATE));
xmlImport(handler.roaming, getSharedPreferences("roaming", Context.MODE_PRIVATE));
xmlImport(handler.apply, getSharedPreferences("apply", Context.MODE_PRIVATE));
xmlImport(handler.notify, getSharedPreferences("notify", Context.MODE_PRIVATE));
// Upgrade imported settings
@ -1154,6 +1154,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
public Map<String, Object> screen_wifi = new HashMap<>();
public Map<String, Object> screen_other = new HashMap<>();
public Map<String, Object> roaming = new HashMap<>();
public Map<String, Object> apply = new HashMap<>();
public Map<String, Object> notify = new HashMap<>();
private Map<String, Object> current = null;
private List<Integer> listUid = new ArrayList<>();
@ -1188,6 +1189,9 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
else if (qName.equals("roaming"))
current = roaming;
else if (qName.equals("apply"))
current = apply;
else if (qName.equals("notify"))
current = notify;

View File

@ -35,6 +35,7 @@ import android.os.AsyncTask;
import android.os.Build;
import android.preference.PreferenceManager;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.widget.CompoundButtonCompat;
import android.support.v7.widget.RecyclerView;
@ -74,6 +75,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
private int colorChanged;
private int colorOn;
private int colorOff;
private int colorGrayed;
private int iconSize;
private boolean wifiActive = true;
private boolean otherActive = true;
@ -104,6 +106,8 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
public TextView tvDisabled;
public TextView tvInternet;
public CheckBox cbApply;
public Button btnRelated;
public ImageButton ibSettings;
public ImageButton ibLaunch;
@ -148,6 +152,8 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
tvDisabled = (TextView) itemView.findViewById(R.id.tvDisabled);
tvInternet = (TextView) itemView.findViewById(R.id.tvInternet);
cbApply = (CheckBox) itemView.findViewById(R.id.cbApply);
btnRelated = (Button) itemView.findViewById(R.id.btnRelated);
ibSettings = (ImageButton) itemView.findViewById(R.id.ibSettings);
ibLaunch = (ImageButton) itemView.findViewById(R.id.ibLaunch);
@ -219,6 +225,8 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
context.getTheme().resolveAttribute(R.attr.colorOff, tv, true);
colorOff = tv.data;
colorGrayed = ContextCompat.getColor(context, R.color.colorGrayed);
iconSize = Util.dips2pixels(48, context);
}
@ -321,9 +329,10 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
holder.cbWifi.setAlpha(wifiActive ? 1 : 0.5f);
holder.cbWifi.setOnCheckedChangeListener(null);
holder.cbWifi.setChecked(rule.wifi_blocked);
holder.cbWifi.setEnabled(rule.apply);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Drawable wrap = DrawableCompat.wrap(CompoundButtonCompat.getButtonDrawable(holder.cbWifi));
DrawableCompat.setTint(wrap, rule.wifi_blocked ? colorOff : colorOn);
DrawableCompat.setTint(wrap, rule.apply ? (rule.wifi_blocked ? colorOff : colorOn) : colorGrayed);
}
holder.cbWifi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
@ -333,20 +342,22 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
}
});
holder.ivScreenWifi.setEnabled(rule.apply);
holder.ivScreenWifi.setAlpha(wifiActive ? 1 : 0.5f);
holder.ivScreenWifi.setVisibility(rule.screen_wifi && rule.wifi_blocked ? View.VISIBLE : View.INVISIBLE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Drawable wrap = DrawableCompat.wrap(holder.ivScreenWifi.getDrawable());
DrawableCompat.setTint(wrap, colorOn);
DrawableCompat.setTint(wrap, rule.apply ? colorOn : colorGrayed);
}
// Mobile settings
holder.cbOther.setAlpha(otherActive ? 1 : 0.5f);
holder.cbOther.setOnCheckedChangeListener(null);
holder.cbOther.setChecked(rule.other_blocked);
holder.cbOther.setEnabled(rule.apply);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Drawable wrap = DrawableCompat.wrap(CompoundButtonCompat.getButtonDrawable(holder.cbOther));
DrawableCompat.setTint(wrap, rule.other_blocked ? colorOff : colorOn);
DrawableCompat.setTint(wrap, rule.apply ? (rule.other_blocked ? colorOff : colorOn) : colorGrayed);
}
holder.cbOther.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
@ -356,13 +367,15 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
}
});
holder.ivScreenOther.setEnabled(rule.apply);
holder.ivScreenOther.setAlpha(otherActive ? 1 : 0.5f);
holder.ivScreenOther.setVisibility(rule.screen_other && rule.other_blocked ? View.VISIBLE : View.INVISIBLE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Drawable wrap = DrawableCompat.wrap(holder.ivScreenOther.getDrawable());
DrawableCompat.setTint(wrap, colorOn);
DrawableCompat.setTint(wrap, rule.apply ? colorOn : colorGrayed);
}
holder.tvRoaming.setTextColor(rule.apply ? colorOff : colorGrayed);
holder.tvRoaming.setAlpha(otherActive ? 1 : 0.5f);
holder.tvRoaming.setVisibility(rule.roaming && (!rule.other_blocked || rule.screen_other) ? View.VISIBLE : View.INVISIBLE);
@ -378,6 +391,18 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
holder.tvDisabled.setVisibility(rule.enabled ? View.GONE : View.VISIBLE);
holder.tvInternet.setVisibility(rule.internet ? View.GONE : View.VISIBLE);
// Apply
holder.cbApply.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ? View.GONE : View.VISIBLE);
holder.cbApply.setOnCheckedChangeListener(null);
holder.cbApply.setChecked(rule.apply);
holder.cbApply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
rule.apply = isChecked;
updateRule(rule, true, listAll);
}
});
// Show related
holder.btnRelated.setVisibility(rule.relateduids ? View.VISIBLE : View.GONE);
holder.btnRelated.setOnClickListener(new View.OnClickListener() {
@ -412,7 +437,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
// Show Wi-Fi screen on condition
holder.cbScreenWifi.setOnCheckedChangeListener(null);
holder.cbScreenWifi.setChecked(rule.screen_wifi);
holder.cbScreenWifi.setEnabled(rule.wifi_blocked);
holder.cbScreenWifi.setEnabled(rule.wifi_blocked && rule.apply);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Drawable wrap = DrawableCompat.wrap(holder.ivWifiLegend.getDrawable());
@ -436,7 +461,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
// Show mobile screen on condition
holder.cbScreenOther.setOnCheckedChangeListener(null);
holder.cbScreenOther.setChecked(rule.screen_other);
holder.cbScreenOther.setEnabled(rule.other_blocked);
holder.cbScreenOther.setEnabled(rule.other_blocked && rule.apply);
holder.cbScreenOther.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
@ -449,7 +474,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
// Show roaming condition
holder.cbRoaming.setOnCheckedChangeListener(null);
holder.cbRoaming.setChecked(rule.roaming);
holder.cbRoaming.setEnabled(!rule.other_blocked || rule.screen_other);
holder.cbRoaming.setEnabled((!rule.other_blocked || rule.screen_other) && rule.apply);
holder.cbRoaming.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
@ -563,24 +588,14 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
});
// Show disable access notifications setting
final SharedPreferences nprefs = context.getSharedPreferences("notify", Context.MODE_PRIVATE);
holder.cbNotify.setOnCheckedChangeListener(null);
holder.cbNotify.setEnabled(prefs.getBoolean("notify_access", false));
holder.cbNotify.setChecked(nprefs.getBoolean(rule.info.packageName, true));
holder.cbNotify.setChecked(rule.notify);
holder.cbNotify.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
if (isChecked)
nprefs.edit().remove(rule.info.packageName).apply();
else
nprefs.edit().putBoolean(rule.info.packageName, isChecked).apply();
for (String pkg : rule.related)
if (isChecked)
nprefs.edit().remove(pkg).apply();
else
nprefs.edit().putBoolean(pkg, isChecked).apply();
SinkholeService.reload("notify changed", context);
rule.notify = isChecked;
updateRule(rule, true, listAll);
}
});
@ -609,6 +624,8 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
SharedPreferences screen_wifi = context.getSharedPreferences("screen_wifi", Context.MODE_PRIVATE);
SharedPreferences screen_other = context.getSharedPreferences("screen_other", Context.MODE_PRIVATE);
SharedPreferences roaming = context.getSharedPreferences("roaming", Context.MODE_PRIVATE);
SharedPreferences apply = context.getSharedPreferences("apply", Context.MODE_PRIVATE);
SharedPreferences notify = context.getSharedPreferences("notify", Context.MODE_PRIVATE);
if (rule.wifi_blocked == rule.wifi_default)
wifi.edit().remove(rule.info.packageName).apply();
@ -635,6 +652,16 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
else
roaming.edit().putBoolean(rule.info.packageName, rule.roaming).apply();
if (rule.apply)
apply.edit().remove(rule.info.packageName).apply();
else
apply.edit().putBoolean(rule.info.packageName, rule.apply).apply();
if (rule.notify)
notify.edit().remove(rule.info.packageName).apply();
else
notify.edit().putBoolean(rule.info.packageName, rule.notify).apply();
rule.updateChanged(context);
Log.i(TAG, "Updated " + rule);
@ -647,6 +674,8 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
related.screen_wifi = rule.screen_wifi;
related.screen_other = rule.screen_other;
related.roaming = rule.roaming;
related.apply = rule.apply;
related.notify = rule.notify;
listModified.add(related);
}
}

View File

@ -224,17 +224,12 @@ public class Receiver extends BroadcastReceiver {
Log.i(TAG, "Initializing sdk=" + Build.VERSION.SDK_INT);
editor.putBoolean("whitelist_wifi", false);
editor.putBoolean("whitelist_other", false);
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP)
editor.putBoolean("filter", true); // Optional
editor.putBoolean("filter_allowed", true); // Optional
}
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Log.i(TAG, "Forcing filter mode sdk=" + Build.VERSION.SDK_INT);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
editor.putBoolean("filter", true); // Mandatory
editor.putBoolean("filter_allowed", true); // Mandatory
}
editor.putInt("version", newVersion);
editor.apply();

View File

@ -67,6 +67,9 @@ public class Rule {
public boolean screen_other = false;
public boolean roaming = false;
public boolean apply = true;
public boolean notify = true;
public boolean relateduids = false;
public String[] related = null;
@ -128,6 +131,8 @@ public class Rule {
SharedPreferences screen_wifi = context.getSharedPreferences("screen_wifi", Context.MODE_PRIVATE);
SharedPreferences screen_other = context.getSharedPreferences("screen_other", Context.MODE_PRIVATE);
SharedPreferences roaming = context.getSharedPreferences("roaming", Context.MODE_PRIVATE);
SharedPreferences apply = context.getSharedPreferences("apply", Context.MODE_PRIVATE);
SharedPreferences notify = context.getSharedPreferences("notify", Context.MODE_PRIVATE);
// Get settings
boolean default_wifi = prefs.getBoolean("whitelist_wifi", true);
@ -246,6 +251,9 @@ public class Rule {
rule.screen_other = screen_other.getBoolean(info.packageName, rule.screen_other_default);
rule.roaming = roaming.getBoolean(info.packageName, rule.roaming_default);
rule.apply = apply.getBoolean(info.packageName, true);
rule.notify = notify.getBoolean(info.packageName, true);
// Related packages
List<String> listPkg = new ArrayList<>();
if (pre_related.containsKey(info.packageName))

View File

@ -365,7 +365,7 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
List<Rule> listRule = Rule.getRules(true, SinkholeService.this);
List<Rule> listAllowed = getAllowedRules(listRule);
vpn = startVPN(listAllowed);
vpn = startVPN(listAllowed, listRule);
if (vpn == null)
throw new IllegalStateException("VPN start failed");
@ -377,13 +377,6 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
}
private void reload() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this);
boolean tethering = prefs.getBoolean("tethering", false);
boolean filter = prefs.getBoolean("filter", false);
String vpn4 = prefs.getString("vpn4", "10.1.10.1");
String vpn6 = prefs.getString("vpn6", "fd00:1:fd00:1:fd00:1:fd00:1");
InetAddress dns = getDns(SinkholeService.this);
if (state != State.enforcing) {
if (state != State.none) {
Log.d(TAG, "Stop foreground state=" + state.toString());
@ -407,12 +400,12 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
} catch (InterruptedException ignored) {
}
}
vpn = startVPN(listAllowed);
vpn = startVPN(listAllowed, listRule);
} else {
// Attempt seamless handover
ParcelFileDescriptor prev = vpn;
vpn = startVPN(listAllowed);
vpn = startVPN(listAllowed, listRule);
if (prev != null && vpn == null) {
Log.w(TAG, "Handover failed");
@ -423,7 +416,7 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
Thread.sleep(3000);
} catch (InterruptedException ignored) {
}
vpn = startVPN(listAllowed);
vpn = startVPN(listAllowed, listRule);
if (vpn == null)
throw new IllegalStateException("Handover failed");
}
@ -554,14 +547,14 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
private void resolved(ResourceRecord rr) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this);
if (prefs.getBoolean("filter_allowed", false) && prefs.getBoolean("resolved", true))
if (prefs.getBoolean("filter", false) && prefs.getBoolean("resolved", true))
DatabaseHelper.getInstance(SinkholeService.this).insertDns(rr);
}
private void usage(Usage usage) {
if (usage.Uid >= 0) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this);
if (prefs.getBoolean("filter_allowed", false) && prefs.getBoolean("track_usage", false)) {
if (prefs.getBoolean("filter", false) && prefs.getBoolean("track_usage", false)) {
DatabaseHelper dh = DatabaseHelper.getInstance(SinkholeService.this);
String dname = dh.getQName(usage.DAddr);
Log.i(TAG, "Usage account " + usage + " dname=" + dname);
@ -867,11 +860,10 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private ParcelFileDescriptor startVPN(List<Rule> listAllowed) {
private ParcelFileDescriptor startVPN(List<Rule> listAllowed, List<Rule> listRule) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean tethering = prefs.getBoolean("tethering", false);
boolean filter = prefs.getBoolean("filter", false);
boolean filter_allowed = prefs.getBoolean("filter_allowed", false);
// Build VPN service
final Builder builder = new Builder();
@ -921,20 +913,15 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
} catch (PackageManager.NameNotFoundException ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
}
else if (filter && !filter_allowed && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
DatabaseHelper dh = DatabaseHelper.getInstance(this);
for (Rule rule : listAllowed) {
long count = dh.getBlockedRuleCount(rule.info.applicationInfo.uid);
if (count == 0) {
else if (filter)
for (Rule rule : listRule)
if (!rule.apply)
try {
Log.i(TAG, "Not routing " + rule.info.packageName);
builder.addDisallowedApplication(rule.info.packageName);
} catch (PackageManager.NameNotFoundException ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
}
} else
Log.i(TAG, "Routing allowed " + rule + " filter rules=" + count);
}
}
// Build configure intent
Intent configure = new Intent(this, ActivityMain.class);
@ -1009,7 +996,7 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
private void prepareHostsBlocked() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this);
boolean use_hosts = prefs.getBoolean("filter_allowed", false) && prefs.getBoolean("use_hosts", false);
boolean use_hosts = prefs.getBoolean("filter", false) && prefs.getBoolean("use_hosts", false);
File hosts = new File(getFilesDir(), "hosts.txt");
if (!use_hosts || !hosts.exists() || !hosts.canRead()) {
Log.i(TAG, "Hosts file use=" + use_hosts + " exists=" + hosts.exists());
@ -1129,7 +1116,7 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
mapForward.clear();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (prefs.getBoolean("filter_allowed", false)) {
if (prefs.getBoolean("filter", false)) {
Cursor cursor = DatabaseHelper.getInstance(SinkholeService.this).getForwarding();
int colProtocol = cursor.getColumnIndex("protocol");
int colDPort = cursor.getColumnIndex("dport");
@ -1152,7 +1139,6 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
private void prepareNotify(List<Rule> listRule) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences nprefs = getSharedPreferences("notify", Context.MODE_PRIVATE);
boolean notify = prefs.getBoolean("notify_access", false);
boolean system = prefs.getBoolean("manage_system", false);
@ -1160,7 +1146,7 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
if (notify)
for (Rule rule : listRule)
if (nprefs.getBoolean(rule.info.packageName, true) && (system || !rule.system))
if (rule.notify && (system || !rule.system))
mapNoNotify.put(rule.info.applicationInfo.uid, true);
}

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_signal_cellular_off_white_24dp"
android:tint="@android:color/darker_gray" />
android:tint="@color/colorGrayed" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_network_cell_white_24dp"
android:tint="@android:color/darker_gray" />
android:tint="@color/colorGrayed" />

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/screen_on" android:state_enabled="true" />
<item android:drawable="@drawable/screen_on_disabled" android:state_enabled="false" />
</selector>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_perm_identity_white_24dp"
android:tint="@color/colorGrayed" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_signal_wifi_off_white_24dp"
android:tint="@android:color/darker_gray" />
android:tint="@color/colorGrayed" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_network_wifi_white_24dp"
android:tint="@android:color/darker_gray" />
android:tint="@color/colorGrayed" />

View File

@ -87,7 +87,7 @@
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/screen_on" />
android:src="@drawable/screen" />
<View
android:layout_width="16dp"
@ -127,7 +127,7 @@
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/screen_on" />
android:src="@drawable/screen" />
<TextView
android:id="@+id/tvRoaming"
@ -201,6 +201,13 @@
android:layout_gravity="center_vertical"
android:layout_marginTop="4dp" />
<CheckBox
android:id="@+id/cbApply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/title_apply" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -40,4 +40,6 @@
<color name="colorSend">#FF0000</color>
<color name="colorReceive">#0000FF</color>
<color name="colorGrayed">#AAAAAA</color>
</resources>

View File

@ -73,7 +73,6 @@ however it is impossible to guarantee NetGuard will work correctly on every devi
<string name="setting_log_app">Log internet access</string>
<string name="setting_access">Notify on internet access</string>
<string name="setting_filter">Filter traffic</string>
<string name="setting_filter_allowed">Filter allowed traffic</string>
<string name="setting_resolved">Store resolved domain names</string>
<string name="setting_track_usage">Track network usage</string>
<string name="setting_reset_usage">Reset network usage</string>
@ -120,7 +119,6 @@ however it is impossible to guarantee NetGuard will work correctly on every devi
<string name="summary_log_app">Log attempts to access the internet for applications. This might result in extra battery usage.</string>
<string name="summary_access">Show a status bar notification when an application attempts to access a new internet address</string>
<string name="summary_filter">Filter IP packets going out of the VPN tunnel. This might result in extra battery usage.</string>
<string name="summary_filter_allowed">Route allowed traffic into the VPN tunnel to monitor allowed traffic. This might result in extra battery usage.</string>
<string name="summary_resolved">Store domain names/IP addresses into a database. This makes the traffic log more useful, but might result in extra battery usage.</string>
<string name="summary_track_usage">Track the number of bytes sent and received for each application and address. This might result in extra battery usage.</string>
<string name="summary_block_domains">Respond with \'name error\' (NXDOMAIN) for blocked domain names. This switch is disabled when no hosts file is available.</string>
@ -177,9 +175,11 @@ Your internet traffic is not being sent to a remote VPN server.</string>
<string name="title_roaming_blocked">Block when roaming</string>
<string name="title_metered">By default a Wi-Fi connection is considered to be unmetered and a mobile connection to be metered</string>
<string name="title_apply">Apply rules and conditions</string>
<string name="title_conditions">Conditions</string>
<string name="title_screen_wifi">Allow Wi-Fi when screen is on</string>
<string name="title_screen_other">Allow mobile when screen is on</string>
<string name="title_roaming_symbol">R</string>
<string name="title_roaming">Block when roaming</string>
<string name="title_disabled">is disabled</string>
<string name="title_internet">has no internet permission</string>
@ -193,7 +193,6 @@ Your internet traffic is not being sent to a remote VPN server.</string>
<string name="title_root">root</string>
<string name="title_mediaserver">mediaserver</string>
<string name="title_nobody">nobody</string>
<string name="title_roaming_symbol">R</string>
<string name="title_notify">Notify internet access attempts</string>
<string name="title_log_whois">Whois %1$s</string>

View File

@ -115,12 +115,6 @@
<CheckBoxPreference
android:defaultValue="false"
android:dependency="filter"
android:key="filter_allowed"
android:summary="@string/summary_filter_allowed"
android:title="@string/setting_filter_allowed" />
<CheckBoxPreference
android:defaultValue="false"
android:dependency="filter_allowed"
android:key="track_usage"
android:summary="@string/summary_track_usage"
android:title="@string/setting_track_usage" />
@ -129,18 +123,18 @@
android:title="@string/setting_reset_usage" />
<CheckBoxPreference
android:defaultValue="true"
android:dependency="filter_allowed"
android:dependency="filter"
android:key="use_hosts"
android:summary="@string/summary_block_domains"
android:title="@string/setting_block_domains" />
<CheckBoxPreference
android:defaultValue="true"
android:dependency="filter_allowed"
android:dependency="filter"
android:key="resolved"
android:summary="@string/summary_resolved"
android:title="@string/setting_resolved" />
<Preference
android:dependency="filter_allowed"
android:dependency="filter"
android:key="forwarding"
android:title="@string/setting_forwarding" />
<EditTextPreference

View File

@ -115,12 +115,6 @@
<eu.faircode.netguard.SwitchPreference
android:defaultValue="false"
android:dependency="filter"
android:key="filter_allowed"
android:summary="@string/summary_filter_allowed"
android:title="@string/setting_filter_allowed" />
<eu.faircode.netguard.SwitchPreference
android:defaultValue="false"
android:dependency="filter_allowed"
android:key="track_usage"
android:summary="@string/summary_track_usage"
android:title="@string/setting_track_usage" />
@ -129,18 +123,18 @@
android:title="@string/setting_reset_usage" />
<eu.faircode.netguard.SwitchPreference
android:defaultValue="true"
android:dependency="filter_allowed"
android:dependency="filter"
android:key="use_hosts"
android:summary="@string/summary_block_domains"
android:title="@string/setting_block_domains" />
<eu.faircode.netguard.SwitchPreference
android:defaultValue="true"
android:dependency="filter_allowed"
android:dependency="filter"
android:key="resolved"
android:summary="@string/summary_resolved"
android:title="@string/setting_resolved" />
<Preference
android:dependency="filter_allowed"
android:dependency="filter"
android:key="forwarding"
android:title="@string/setting_forwarding" />
<EditTextPreference