Merge "Revert "OPP: Do not trimDatabase if ContentProvider doesn't exist"" into tm-qpr-dev
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppLauncherActivity.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppLauncherActivity.java
index b5dd0f7..301b39f 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppLauncherActivity.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppLauncherActivity.java
@@ -422,8 +422,7 @@
launchDevicePicker();
finish();
} catch (IllegalArgumentException exception) {
- String message = exception.getMessage();
- showToast(message != null ? message : "IllegalArgumentException");
+ showToast(exception.getMessage());
finish();
}
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java
index d9dbbb1..e16e310 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java
@@ -33,7 +33,6 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.spy;
@@ -188,6 +187,7 @@
assertThat(file.length()).isGreaterThan(shareContent.length());
}
+ @Ignore("b/263754734")
@Test
public void sendFileInfo_finishImmediately() throws Exception {
doReturn(true).when(mMethodProxy).bluetoothAdapterIsEnabled(any());
@@ -195,7 +195,7 @@
mIntent.setAction("unsupported-action");
ActivityScenario<BluetoothOppLauncherActivity> scenario = ActivityScenario.launch(mIntent);
doThrow(new IllegalArgumentException()).when(mBluetoothOppManager).saveSendingFileInfo(
- any(), any(String.class), anyBoolean(), anyBoolean());
+ any(), any(String.class), any(), any());
scenario.onActivity(activity -> {
activity.sendFileInfo("text/plain", "content:///abc.txt", false, false);
});
@@ -208,4 +208,18 @@
Thread.sleep(2_000);
assertThat(activityScenario.getState()).isEqualTo(state);
}
+
+
+ private void enableActivity(boolean enable) {
+ int enabledState = enable ? COMPONENT_ENABLED_STATE_ENABLED
+ : COMPONENT_ENABLED_STATE_DEFAULT;
+
+ mTargetContext.getPackageManager().setApplicationEnabledSetting(
+ mTargetContext.getPackageName(), enabledState, DONT_KILL_APP);
+
+ ComponentName activityName = new ComponentName(mTargetContext,
+ BluetoothOppLauncherActivity.class);
+ mTargetContext.getPackageManager().setComponentEnabledSetting(
+ activityName, enabledState, DONT_KILL_APP);
+ }
}
diff --git a/system/stack/avdt/avdt_scb.cc b/system/stack/avdt/avdt_scb.cc
index f67b396..bcb8a1a 100644
--- a/system/stack/avdt/avdt_scb.cc
+++ b/system/stack/avdt/avdt_scb.cc
@@ -228,7 +228,7 @@
/* TC_DATA_EVT */
{AVDT_SCB_DROP_PKT, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
/* CC_CLOSE_EVT */
- {AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_CLR_VARS, AVDT_SCB_IDLE_ST}};
+ {AVDT_SCB_CLR_VARS, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST}};
/* state table for configured state */
const uint8_t avdt_scb_st_conf[][AVDT_SCB_NUM_COLS] = {
diff --git a/system/stack/gatt/gatt_utils.cc b/system/stack/gatt/gatt_utils.cc
index d65b6d6..745ee3a 100644
--- a/system/stack/gatt/gatt_utils.cc
+++ b/system/stack/gatt/gatt_utils.cc
@@ -1591,6 +1591,13 @@
cb_data.att_value.handle = p_clcb->s_handle;
cb_data.att_value.len = p_clcb->counter;
+ if (cb_data.att_value.len > GATT_MAX_ATTR_LEN) {
+ LOG(WARNING) << __func__
+ << StringPrintf(" Large cb_data.att_value, size=%d",
+ cb_data.att_value.len);
+ cb_data.att_value.len = GATT_MAX_ATTR_LEN;
+ }
+
if (p_data && p_clcb->counter)
memcpy(cb_data.att_value.value, p_data, cb_data.att_value.len);
}