summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java17
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java12
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java2
3 files changed, 17 insertions, 14 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java b/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java
index 7abd01a8..6ce8ee61 100644
--- a/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java
+++ b/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java
@@ -130,7 +130,7 @@ public class SetupTetheringTask extends AsyncTask<Void, Boolean, Boolean> {
}
private boolean removeWifiTetheringRules(TetheringState state, StringBuilder log) throws Exception {
- Log.d(TAG, "add Wifi tethering Rules");
+ Log.d(TAG, "remove Wifi tethering Rules");
String[] removeRules = getDeletionRules(state, state.lastSeenWifiAddress, state.lastSeenWifiInterface);
return runBlockingCmd(removeRules, log) == 0;
}
@@ -142,18 +142,21 @@ public class SetupTetheringTask extends AsyncTask<Void, Boolean, Boolean> {
}
private boolean removeUsbTetheringRules(TetheringState state, StringBuilder log) throws Exception {
- Log.d(TAG, "add usb tethering rules");
+ Log.d(TAG, "remove usb tethering rules");
String[] addRules = getDeletionRules(state, state.lastSeenUsbAddress, state.lastSeenUsbInterface);
return runBlockingCmd(addRules, log) == 0;
}
- //TODO: implement the follwing methods -v
- private boolean removeBluetoothTetheringRules(TetheringState state, StringBuilder log) {
- return true;
+ private boolean removeBluetoothTetheringRules(TetheringState state, StringBuilder log) throws Exception {
+ Log.d(TAG, "add bluetooth tethering rules");
+ String[] addRules = getAdditionRules(state.bluetoothAddress, state.bluetoothInterface);
+ return runBlockingCmd(addRules, log) == 0;
}
- private boolean addBluetoothTetheringRules(TetheringState state, StringBuilder log) {
- return true;
+ private boolean addBluetoothTetheringRules(TetheringState state, StringBuilder log) throws Exception {
+ Log.d(TAG, "remove bluetooth tethering rules");
+ String[] addRules = getDeletionRules(state, state.lastSeenBluetoothAddress, state.lastSeenBluetoothInterface);
+ return runBlockingCmd(addRules, log) == 0;
}
private String[] getAdditionRules(String addressRange, String interfaceName) {
diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java
index 1bc90605..900d1885 100644
--- a/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java
+++ b/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java
@@ -152,10 +152,10 @@ public class TetheringDialog extends AppCompatDialogFragment implements Observer
.setPositiveButton(android.R.string.ok, (dialog, id) -> {
PreferenceHelper.allowWifiTethering(getContext(), dataset[0].checked);
PreferenceHelper.allowUsbTethering(getContext(), dataset[1].checked);
-// PreferenceHelper.allowBluetoothTethering(getContext(), dataset[2].checked);
+ PreferenceHelper.allowBluetoothTethering(getContext(), dataset[2].checked);
TetheringObservable.allowVpnWifiTethering(dataset[0].checked);
TetheringObservable.allowVpnUsbTethering(dataset[1].checked);
-// TetheringObservable.allowVpnBluetoothTethering(dataset[2].checked);
+ TetheringObservable.allowVpnBluetoothTethering(dataset[2].checked);
FirewallManager firewallManager = new FirewallManager(getContext().getApplicationContext(), false);
if (VpnStatus.isVPNActive()) {
if (TetheringObservable.getInstance().getTetheringState().hasAnyDeviceTetheringEnabled() &&
@@ -174,7 +174,7 @@ public class TetheringDialog extends AppCompatDialogFragment implements Observer
super.onResume();
dataset[0].enabled = TetheringObservable.getInstance().isWifiTetheringEnabled();
dataset[1].enabled = TetheringObservable.getInstance().isUsbTetheringEnabled();
-// dataset[2].enabled = TetheringObservable.getInstance().isBluetoothTetheringEnabled();
+ dataset[2].enabled = TetheringObservable.getInstance().isBluetoothTetheringEnabled();
adapter.notifyDataSetChanged();
TetheringObservable.getInstance().addObserver(this);
}
@@ -229,10 +229,10 @@ public class TetheringDialog extends AppCompatDialogFragment implements Observer
getContext().getString(R.string.tethering_usb),
PreferenceHelper.isUsbTetheringAllowed(getContext()),
TetheringObservable.getInstance().isUsbTetheringEnabled()),
-/* new DialogListAdapter.ViewModel(getContext().getResources().getDrawable(R.drawable.ic_bluetooth),
+ new DialogListAdapter.ViewModel(getContext().getResources().getDrawable(R.drawable.ic_bluetooth),
getContext().getString(R.string.tethering_bluetooth),
PreferenceHelper.isBluetoothTetheringAllowed(getContext()),
- TetheringObservable.getInstance().isUsbTetheringEnabled())*/
+ TetheringObservable.getInstance().isUsbTetheringEnabled())
};
}
@@ -243,7 +243,7 @@ public class TetheringDialog extends AppCompatDialogFragment implements Observer
Log.d(TAG, "TetheringObservable is updated");
dataset[0].enabled = observable.isWifiTetheringEnabled();
dataset[1].enabled = observable.isUsbTetheringEnabled();
-// dataset[2].enabled = observable.isBluetoothTetheringEnabled();
+ dataset[2].enabled = observable.isBluetoothTetheringEnabled();
adapter.notifyDataSetChanged();
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java b/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java
index dac31e53..1a11945b 100644
--- a/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java
@@ -85,7 +85,7 @@ public class TetheringStateManager {
}
static void updateBluetoothTetheringState() {
- //TetheringObservable.setBluetoothTethering(isBluetoothTetheringEnabled());
+ TetheringObservable.setBluetoothTethering(isBluetoothTetheringEnabled());
}
private static String getWifiAddressRange() {