summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Xie <mattx@google.com>2014-11-17 09:50:54 -0800
committerBrint E. Kriebel <bekit@cyngn.com>2015-04-10 16:10:22 -0700
commit998a0bc32f1e5c4054a02963ecf6f07a7cc7662e (patch)
tree9c2ffa02cb6177e9eeb59ea1ba0eb6df011cfbb9
parent0454165bc6bb2546a0cd64ebd60bb5a317f310f6 (diff)
downloadandroid_packages_apps_Bluetooth-998a0bc32f1e5c4054a02963ecf6f07a7cc7662e.tar.gz
android_packages_apps_Bluetooth-998a0bc32f1e5c4054a02963ecf6f07a7cc7662e.tar.bz2
android_packages_apps_Bluetooth-998a0bc32f1e5c4054a02963ecf6f07a7cc7662e.zip
Check previous user confirmation before auto-confirm put request
Also correct a confirm status change check in updateShare. Bug: 17770561, 18343032 Change-Id: I8e7d10e73604c0bf1c88801a1caef7d579fbd1eb
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppObexServerSession.java2
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppService.java18
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppTransfer.java8
3 files changed, 13 insertions, 15 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppObexServerSession.java b/src/com/android/bluetooth/opp/BluetoothOppObexServerSession.java
index 0303eb676..dfbc707be 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppObexServerSession.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppObexServerSession.java
@@ -364,7 +364,7 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen
boolean needConfirm = true;
/** It's not first put if !serverBlocking, so we auto accept it */
- if (!mServerBlocking) {
+ if (!mServerBlocking && mAccepted == BluetoothShare.USER_CONFIRMATION_CONFIRMED) {
values.put(BluetoothShare.USER_CONFIRMATION,
BluetoothShare.USER_CONFIRMATION_AUTO_CONFIRMED);
needConfirm = false;
diff --git a/src/com/android/bluetooth/opp/BluetoothOppService.java b/src/com/android/bluetooth/opp/BluetoothOppService.java
index 2cffb48a0..b5d95a29a 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppService.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppService.java
@@ -793,7 +793,7 @@ public class BluetoothOppService extends Service {
info.mDestination = stringFromCursor(info.mDestination, cursor, BluetoothShare.DESTINATION);
int newVisibility = cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.VISIBILITY));
- boolean confirmed = false;
+ boolean confirmUpdated = false;
int newConfirm = cursor.getInt(cursor
.getColumnIndexOrThrow(BluetoothShare.USER_CONFIRMATION));
@@ -806,10 +806,8 @@ public class BluetoothOppService extends Service {
info.mVisibility = newVisibility;
if (info.mConfirm == BluetoothShare.USER_CONFIRMATION_PENDING
- && (newConfirm == BluetoothShare.USER_CONFIRMATION_CONFIRMED ||
- newConfirm == BluetoothShare.USER_CONFIRMATION_AUTO_CONFIRMED ||
- newConfirm == BluetoothShare.USER_CONFIRMATION_HANDOVER_CONFIRMED)) {
- confirmed = true;
+ && newConfirm != BluetoothShare.USER_CONFIRMATION_PENDING) {
+ confirmUpdated = true;
}
info.mConfirm = newConfirm;
int newStatus = cursor.getInt(statusColumn);
@@ -826,14 +824,14 @@ public class BluetoothOppService extends Service {
info.mTimestamp = cursor.getLong(cursor.getColumnIndexOrThrow(BluetoothShare.TIMESTAMP));
info.mMediaScanned = (cursor.getInt(cursor.getColumnIndexOrThrow(Constants.MEDIA_SCANNED)) != Constants.MEDIA_SCANNED_NOT_SCANNED);
- if (confirmed) {
- if (V) Log.v(TAG, "Service handle info " + info.mId + " confirmed");
- /* Inbounds transfer get user confirmation, so we start it */
+ if (confirmUpdated) {
+ if (V) Log.v(TAG, "Service handle info " + info.mId + " confirmation updated");
+ /* Inbounds transfer user confirmation status changed, update the session server */
int i = findBatchWithTimeStamp(info.mTimestamp);
if (i != -1) {
BluetoothOppBatch batch = mBatchs.get(i);
if (mServerTransfer != null && batch.mId == mServerTransfer.getBatchId()) {
- mServerTransfer.setConfirmed();
+ mServerTransfer.confirmStatusChanged();
} //TODO need to think about else
}
}
@@ -1066,7 +1064,7 @@ public class BluetoothOppService extends Service {
mServerTransfer.start();
if (nextBatch.getPendingShare().mConfirm ==
BluetoothShare.USER_CONFIRMATION_CONFIRMED) {
- mServerTransfer.setConfirmed();
+ mServerTransfer.confirmStatusChanged();
}
return;
}
diff --git a/src/com/android/bluetooth/opp/BluetoothOppTransfer.java b/src/com/android/bluetooth/opp/BluetoothOppTransfer.java
index 9ec562387..a43287fca 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppTransfer.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppTransfer.java
@@ -552,7 +552,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
if (V) Log.v(TAG, "processCurrentShare" + mCurrentShare.mId);
mSession.addShare(mCurrentShare);
if (mCurrentShare.mConfirm == BluetoothShare.USER_CONFIRMATION_HANDOVER_CONFIRMED) {
- setConfirmed();
+ confirmStatusChanged();
}
}
@@ -560,7 +560,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
* Set transfer confirmed status. It should only be called for inbound
* transfer
*/
- public void setConfirmed() {
+ public void confirmStatusChanged() {
/* unblock server session */
final Thread notifyThread = new Thread("Server Unblock thread") {
public void run() {
@@ -570,7 +570,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
}
}
};
- if (V) Log.v(TAG, "setConfirmed to unblock mSession" + mSession.toString());
+ if (V) Log.v(TAG, "confirmStatusChanged to unblock mSession" + mSession.toString());
notifyThread.start();
}
@@ -801,7 +801,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
if (V) Log.v(TAG, "Transfer continue session for info " + mCurrentShare.mId +
" from batch " + mBatch.mId);
processCurrentShare();
- setConfirmed();
+ confirmStatusChanged();
}
}
}