Merge changes from topic "cherrypick-BT-result-storage-descriptor"
* changes: Bluetooth: deprecate TruncatedFilter and ResultStorageDescriptor Get rid of ResultStorageDescriptor in startScan
This commit is contained in:
@@ -1752,17 +1752,17 @@ package android.bluetooth.le {
|
|||||||
public final class BluetoothLeScanner {
|
public final class BluetoothLeScanner {
|
||||||
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_ADMIN, android.Manifest.permission.UPDATE_DEVICE_STATS}) public void startScanFromSource(android.os.WorkSource, android.bluetooth.le.ScanCallback);
|
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_ADMIN, android.Manifest.permission.UPDATE_DEVICE_STATS}) public void startScanFromSource(android.os.WorkSource, android.bluetooth.le.ScanCallback);
|
||||||
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_ADMIN, android.Manifest.permission.UPDATE_DEVICE_STATS}) public void startScanFromSource(java.util.List<android.bluetooth.le.ScanFilter>, android.bluetooth.le.ScanSettings, android.os.WorkSource, android.bluetooth.le.ScanCallback);
|
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_ADMIN, android.Manifest.permission.UPDATE_DEVICE_STATS}) public void startScanFromSource(java.util.List<android.bluetooth.le.ScanFilter>, android.bluetooth.le.ScanSettings, android.os.WorkSource, android.bluetooth.le.ScanCallback);
|
||||||
method public void startTruncatedScan(java.util.List<android.bluetooth.le.TruncatedFilter>, android.bluetooth.le.ScanSettings, android.bluetooth.le.ScanCallback);
|
method @Deprecated public void startTruncatedScan(java.util.List<android.bluetooth.le.TruncatedFilter>, android.bluetooth.le.ScanSettings, android.bluetooth.le.ScanCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class ResultStorageDescriptor implements android.os.Parcelable {
|
@Deprecated public final class ResultStorageDescriptor implements android.os.Parcelable {
|
||||||
ctor public ResultStorageDescriptor(int, int, int);
|
ctor @Deprecated public ResultStorageDescriptor(int, int, int);
|
||||||
method public int describeContents();
|
method @Deprecated public int describeContents();
|
||||||
method public int getLength();
|
method @Deprecated public int getLength();
|
||||||
method public int getOffset();
|
method @Deprecated public int getOffset();
|
||||||
method public int getType();
|
method @Deprecated public int getType();
|
||||||
method public void writeToParcel(android.os.Parcel, int);
|
method @Deprecated public void writeToParcel(android.os.Parcel, int);
|
||||||
field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.ResultStorageDescriptor> CREATOR;
|
field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.ResultStorageDescriptor> CREATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class ScanFilter implements android.os.Parcelable {
|
public final class ScanFilter implements android.os.Parcelable {
|
||||||
@@ -1786,10 +1786,10 @@ package android.bluetooth.le {
|
|||||||
method public android.bluetooth.le.ScanSettings.Builder setScanResultType(int);
|
method public android.bluetooth.le.ScanSettings.Builder setScanResultType(int);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class TruncatedFilter {
|
@Deprecated public final class TruncatedFilter {
|
||||||
ctor public TruncatedFilter(android.bluetooth.le.ScanFilter, java.util.List<android.bluetooth.le.ResultStorageDescriptor>);
|
ctor @Deprecated public TruncatedFilter(android.bluetooth.le.ScanFilter, java.util.List<android.bluetooth.le.ResultStorageDescriptor>);
|
||||||
method public android.bluetooth.le.ScanFilter getFilter();
|
method @Deprecated public android.bluetooth.le.ScanFilter getFilter();
|
||||||
method public java.util.List<android.bluetooth.le.ResultStorageDescriptor> getStorageDescriptors();
|
method @Deprecated public java.util.List<android.bluetooth.le.ResultStorageDescriptor> getStorageDescriptors();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ public final class BluetoothLeScanner {
|
|||||||
@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
|
@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
|
||||||
public void startScan(List<ScanFilter> filters, ScanSettings settings,
|
public void startScan(List<ScanFilter> filters, ScanSettings settings,
|
||||||
final ScanCallback callback) {
|
final ScanCallback callback) {
|
||||||
startScan(filters, settings, null, callback, /*callbackIntent=*/ null, null);
|
startScan(filters, settings, null, callback, /*callbackIntent=*/ null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -175,7 +175,7 @@ public final class BluetoothLeScanner {
|
|||||||
@NonNull PendingIntent callbackIntent) {
|
@NonNull PendingIntent callbackIntent) {
|
||||||
return startScan(filters,
|
return startScan(filters,
|
||||||
settings != null ? settings : new ScanSettings.Builder().build(),
|
settings != null ? settings : new ScanSettings.Builder().build(),
|
||||||
null, null, callbackIntent, null);
|
null, null, callbackIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -210,13 +210,12 @@ public final class BluetoothLeScanner {
|
|||||||
Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.UPDATE_DEVICE_STATS})
|
Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.UPDATE_DEVICE_STATS})
|
||||||
public void startScanFromSource(List<ScanFilter> filters, ScanSettings settings,
|
public void startScanFromSource(List<ScanFilter> filters, ScanSettings settings,
|
||||||
final WorkSource workSource, final ScanCallback callback) {
|
final WorkSource workSource, final ScanCallback callback) {
|
||||||
startScan(filters, settings, workSource, callback, null, null);
|
startScan(filters, settings, workSource, callback, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int startScan(List<ScanFilter> filters, ScanSettings settings,
|
private int startScan(List<ScanFilter> filters, ScanSettings settings,
|
||||||
final WorkSource workSource, final ScanCallback callback,
|
final WorkSource workSource, final ScanCallback callback,
|
||||||
final PendingIntent callbackIntent,
|
final PendingIntent callbackIntent) {
|
||||||
List<List<ResultStorageDescriptor>> resultStorages) {
|
|
||||||
BluetoothLeUtils.checkAdapterStateOn(mBluetoothAdapter);
|
BluetoothLeUtils.checkAdapterStateOn(mBluetoothAdapter);
|
||||||
if (callback == null && callbackIntent == null) {
|
if (callback == null && callbackIntent == null) {
|
||||||
throw new IllegalArgumentException("callback is null");
|
throw new IllegalArgumentException("callback is null");
|
||||||
@@ -252,7 +251,7 @@ public final class BluetoothLeScanner {
|
|||||||
}
|
}
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
BleScanCallbackWrapper wrapper = new BleScanCallbackWrapper(gatt, filters,
|
BleScanCallbackWrapper wrapper = new BleScanCallbackWrapper(gatt, filters,
|
||||||
settings, workSource, callback, resultStorages);
|
settings, workSource, callback);
|
||||||
wrapper.startRegistration();
|
wrapper.startRegistration();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@@ -328,20 +327,20 @@ public final class BluetoothLeScanner {
|
|||||||
/**
|
/**
|
||||||
* Start truncated scan.
|
* Start truncated scan.
|
||||||
*
|
*
|
||||||
|
* @deprecated this is not used anywhere
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@SystemApi
|
@SystemApi
|
||||||
public void startTruncatedScan(List<TruncatedFilter> truncatedFilters, ScanSettings settings,
|
public void startTruncatedScan(List<TruncatedFilter> truncatedFilters, ScanSettings settings,
|
||||||
final ScanCallback callback) {
|
final ScanCallback callback) {
|
||||||
int filterSize = truncatedFilters.size();
|
int filterSize = truncatedFilters.size();
|
||||||
List<ScanFilter> scanFilters = new ArrayList<ScanFilter>(filterSize);
|
List<ScanFilter> scanFilters = new ArrayList<ScanFilter>(filterSize);
|
||||||
List<List<ResultStorageDescriptor>> scanStorages =
|
|
||||||
new ArrayList<List<ResultStorageDescriptor>>(filterSize);
|
|
||||||
for (TruncatedFilter filter : truncatedFilters) {
|
for (TruncatedFilter filter : truncatedFilters) {
|
||||||
scanFilters.add(filter.getFilter());
|
scanFilters.add(filter.getFilter());
|
||||||
scanStorages.add(filter.getStorageDescriptors());
|
|
||||||
}
|
}
|
||||||
startScan(scanFilters, settings, null, callback, null, scanStorages);
|
startScan(scanFilters, settings, null, callback, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -364,7 +363,6 @@ public final class BluetoothLeScanner {
|
|||||||
private final WorkSource mWorkSource;
|
private final WorkSource mWorkSource;
|
||||||
private ScanSettings mSettings;
|
private ScanSettings mSettings;
|
||||||
private IBluetoothGatt mBluetoothGatt;
|
private IBluetoothGatt mBluetoothGatt;
|
||||||
private List<List<ResultStorageDescriptor>> mResultStorages;
|
|
||||||
|
|
||||||
// mLeHandle 0: not registered
|
// mLeHandle 0: not registered
|
||||||
// -2: registration failed because app is scanning to frequently
|
// -2: registration failed because app is scanning to frequently
|
||||||
@@ -374,15 +372,13 @@ public final class BluetoothLeScanner {
|
|||||||
|
|
||||||
public BleScanCallbackWrapper(IBluetoothGatt bluetoothGatt,
|
public BleScanCallbackWrapper(IBluetoothGatt bluetoothGatt,
|
||||||
List<ScanFilter> filters, ScanSettings settings,
|
List<ScanFilter> filters, ScanSettings settings,
|
||||||
WorkSource workSource, ScanCallback scanCallback,
|
WorkSource workSource, ScanCallback scanCallback) {
|
||||||
List<List<ResultStorageDescriptor>> resultStorages) {
|
|
||||||
mBluetoothGatt = bluetoothGatt;
|
mBluetoothGatt = bluetoothGatt;
|
||||||
mFilters = filters;
|
mFilters = filters;
|
||||||
mSettings = settings;
|
mSettings = settings;
|
||||||
mWorkSource = workSource;
|
mWorkSource = workSource;
|
||||||
mScanCallback = scanCallback;
|
mScanCallback = scanCallback;
|
||||||
mScannerId = 0;
|
mScannerId = 0;
|
||||||
mResultStorages = resultStorages;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startRegistration() {
|
public void startRegistration() {
|
||||||
@@ -458,7 +454,7 @@ public final class BluetoothLeScanner {
|
|||||||
} else {
|
} else {
|
||||||
mScannerId = scannerId;
|
mScannerId = scannerId;
|
||||||
mBluetoothGatt.startScan(mScannerId, mSettings, mFilters,
|
mBluetoothGatt.startScan(mScannerId, mSettings, mFilters,
|
||||||
mResultStorages, mOpPackageName, mFeatureId);
|
mOpPackageName, mFeatureId);
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "fail to start le scan: " + e);
|
Log.e(TAG, "fail to start le scan: " + e);
|
||||||
|
|||||||
@@ -23,8 +23,11 @@ import android.os.Parcelable;
|
|||||||
/**
|
/**
|
||||||
* Describes the way to store scan result.
|
* Describes the way to store scan result.
|
||||||
*
|
*
|
||||||
|
* @deprecated this is not used anywhere
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@SystemApi
|
@SystemApi
|
||||||
public final class ResultStorageDescriptor implements Parcelable {
|
public final class ResultStorageDescriptor implements Parcelable {
|
||||||
private int mType;
|
private int mType;
|
||||||
|
|||||||
@@ -23,8 +23,11 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* A special scan filter that lets the client decide how the scan record should be stored.
|
* A special scan filter that lets the client decide how the scan record should be stored.
|
||||||
*
|
*
|
||||||
|
* @deprecated this is not used anywhere
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@SystemApi
|
@SystemApi
|
||||||
public final class TruncatedFilter {
|
public final class TruncatedFilter {
|
||||||
private final ScanFilter mFilter;
|
private final ScanFilter mFilter;
|
||||||
|
|||||||
Reference in New Issue
Block a user