summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-03-26 23:48:30 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-03-26 23:48:30 -0700
commitc0f7c0e65c3d70730b465c7e8bcd571f01cd2146 (patch)
tree41ab84fbd8f467c10ff68826939deb98d11fcd75
parentcde55b18a9ffd00151e72482a7246772a806a387 (diff)
parenta8b88a3c6dfa1d3555f488f72259f8cf3f766209 (diff)
downloadandroid_packages_apps_Bluetooth-c0f7c0e65c3d70730b465c7e8bcd571f01cd2146.tar.gz
android_packages_apps_Bluetooth-c0f7c0e65c3d70730b465c7e8bcd571f01cd2146.tar.bz2
android_packages_apps_Bluetooth-c0f7c0e65c3d70730b465c7e8bcd571f01cd2146.zip
Merge "Revert "Bluetooth-OPP: Start outbound transfer only after OPPService is up""
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java2
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppManager.java35
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppService.java13
3 files changed, 17 insertions, 33 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java b/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
index 8eb073906..aa2af081d 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
@@ -38,7 +38,7 @@ public class BluetoothOppHandoverReceiver extends BroadcastReceiver {
if (action.equals(Constants.ACTION_HANDOVER_SEND) ||
action.equals(Constants.ACTION_HANDOVER_SEND_MULTIPLE)) {
- if (V) Log.v(TAG, "Transfer initiated from HANDOVER");
+
BluetoothDevice device =
(BluetoothDevice)intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if (device == null) {
diff --git a/src/com/android/bluetooth/opp/BluetoothOppManager.java b/src/com/android/bluetooth/opp/BluetoothOppManager.java
index 7d259e15f..8805818e5 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppManager.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppManager.java
@@ -119,8 +119,6 @@ public class BluetoothOppManager {
// The time for which the whitelist entries remain valid.
private static final int WHITELIST_DURATION_MS = 15000;
- public boolean isOPPServiceUp = false;
-
/**
* Get singleton instance.
*/
@@ -429,28 +427,17 @@ public class BluetoothOppManager {
@Override
public void run() {
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
- while (true) {
- if (mRemoteDevice == null) {
- Log.e(TAG, "Target bt device is null!");
- return;
- }
-
- if (V) Log.v(TAG, "OPPServiceUP = " + isOPPServiceUp);
- if (isOPPServiceUp) {
- if (mIsMultiple) {
- insertMultipleShare();
- } else {
- insertSingleShare();
- }
-
- synchronized (BluetoothOppManager.this) {
- mInsertShareThreadNum--;
- }
- return;
- } else if (!isEnabled()) {
- Log.v(TAG, "BT is OFF");
- return;
- }
+ if (mRemoteDevice == null) {
+ Log.e(TAG, "Target bt device is null!");
+ return;
+ }
+ if (mIsMultiple) {
+ insertMultipleShare();
+ } else {
+ insertSingleShare();
+ }
+ synchronized (BluetoothOppManager.this) {
+ mInsertShareThreadNum--;
}
}
diff --git a/src/com/android/bluetooth/opp/BluetoothOppService.java b/src/com/android/bluetooth/opp/BluetoothOppService.java
index c7c867051..c70d0fe17 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppService.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppService.java
@@ -148,8 +148,6 @@ public class BluetoothOppService extends Service {
*/
private BluetoothOppObexServerSession mServerSession;
- BluetoothOppManager mOppManager = null;
-
@Override
public IBinder onBind(Intent arg0) {
throw new UnsupportedOperationException("Cannot bind to Bluetooth OPP Service");
@@ -170,11 +168,12 @@ public class BluetoothOppService extends Service {
mNotifier.updateNotification();
final ContentResolver contentResolver = getContentResolver();
- synchronized (BluetoothOppService.this) {
- trimDatabase(contentResolver);
- }
+ new Thread("trimDatabase") {
+ public void run() {
+ trimDatabase(contentResolver);
+ }
+ }.start();
- mOppManager = BluetoothOppManager.getInstance(this);
IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
registerReceiver(mBluetoothReceiver, filter);
@@ -184,7 +183,6 @@ public class BluetoothOppService extends Service {
} else {
startListener();
}
- mOppManager.isOPPServiceUp = true;
}
if (V) BluetoothOppPreference.getInstance(this).dump();
updateFromProvider();
@@ -396,7 +394,6 @@ public class BluetoothOppService extends Service {
public void onDestroy() {
if (V) Log.v(TAG, "onDestroy");
super.onDestroy();
- mOppManager.isOPPServiceUp = false;
getContentResolver().unregisterContentObserver(mObserver);
unregisterReceiver(mBluetoothReceiver);
if(mSocketListener != null) {