Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
briar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julian Dehm
briar
Commits
8e4086a3
Commit
8e4086a3
authored
9 years ago
by
akwizgran
Browse files
Options
Downloads
Plain Diff
Merge branch '226-bluetooth-logic' into 'master'
Don't disable Bluetooth unless we enabled it.
#226
Fixes
#226
See merge request
!71
parents
6bb4d45f
124a4380
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
briar-android/src/org/briarproject/plugins/droidtooth/DroidtoothPlugin.java
+5
-4
5 additions, 4 deletions
...org/briarproject/plugins/droidtooth/DroidtoothPlugin.java
with
5 additions
and
4 deletions
briar-android/src/org/briarproject/plugins/droidtooth/DroidtoothPlugin.java
+
5
−
4
View file @
8e4086a3
...
...
@@ -72,7 +72,7 @@ class DroidtoothPlugin implements DuplexPlugin {
private
final
int
maxLatency
,
pollingInterval
;
private
volatile
boolean
running
=
false
;
private
volatile
boolean
was
Dis
abled
=
false
;
private
volatile
boolean
was
En
abled
ByUs
=
false
;
private
volatile
BluetoothStateReceiver
receiver
=
null
;
private
volatile
BluetoothServerSocket
socket
=
null
;
...
...
@@ -132,12 +132,13 @@ class DroidtoothPlugin implements DuplexPlugin {
filter
.
addAction
(
ACTION_SCAN_MODE_CHANGED
);
receiver
=
new
BluetoothStateReceiver
();
appContext
.
registerReceiver
(
receiver
,
filter
);
// If Bluetooth is enabled, bind a socket
- otherwise enable it
// If Bluetooth is enabled, bind a socket
if
(
adapter
.
isEnabled
())
{
bind
();
}
else
{
wasDisabled
=
true
;
// Enable Bluetooth if settings allow
if
(
callback
.
getSettings
().
getBoolean
(
"enable"
,
false
))
{
wasEnabledByUs
=
true
;
if
(
adapter
.
enable
())
LOG
.
info
(
"Enabling Bluetooth"
);
else
LOG
.
info
(
"Could not enable Bluetooth"
);
}
else
{
...
...
@@ -228,7 +229,7 @@ class DroidtoothPlugin implements DuplexPlugin {
if
(
receiver
!=
null
)
appContext
.
unregisterReceiver
(
receiver
);
tryToClose
(
socket
);
// Disable Bluetooth if we enabled it and it's still enabled
if
(
was
Dis
abled
&&
adapter
.
isEnabled
())
{
if
(
was
En
abled
ByUs
&&
adapter
.
isEnabled
())
{
if
(
adapter
.
disable
())
LOG
.
info
(
"Disabling Bluetooth"
);
else
LOG
.
info
(
"Could not disable Bluetooth"
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment