Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit adf6aff5 authored by Wei Wang's avatar Wei Wang
Browse files

Revert "Revert "APIs for BLE scan, scan filter, batch scan, onFound/onLost and...

Revert "Revert "APIs for BLE scan, scan filter, batch scan, onFound/onLost and multiple advertising.""

This reverts commit b1d9fbc0f8dea0c77ed810190b325bfdaaf21789.

Change-Id: Ic8dec9385a7c763170ebeb1bcddd221c72f46e88
parent 48bb35b9
Loading
Loading
Loading
Loading
+174 −0
Original line number Diff line number Diff line
@@ -5364,6 +5364,8 @@ package android.bluetooth {
    method public boolean disable();
    method public boolean enable();
    method public java.lang.String getAddress();
    method public android.bluetooth.BluetoothLeAdvertiser getBluetoothLeAdvertiser();
    method public android.bluetooth.BluetoothLeScanner getBluetoothLeScanner();
    method public java.util.Set<android.bluetooth.BluetoothDevice> getBondedDevices();
    method public static synchronized android.bluetooth.BluetoothAdapter getDefaultAdapter();
    method public java.lang.String getName();
@@ -6006,6 +6008,178 @@ package android.bluetooth {
    method public void onHealthChannelStateChange(android.bluetooth.BluetoothHealthAppConfiguration, android.bluetooth.BluetoothDevice, int, int, android.os.ParcelFileDescriptor, int);
  }
  public final class BluetoothLeAdvertiseScanData {
    ctor public BluetoothLeAdvertiseScanData();
    field public static final int ADVERTISING_DATA = 0; // 0x0
    field public static final int PARSED_SCAN_RECORD = 2; // 0x2
  }
  public static abstract class BluetoothLeAdvertiseScanData.AdvertiseBaseData {
    method public int getDataType();
    method public int getManufacturerId();
    method public byte[] getManufacturerSpecificData();
    method public byte[] getServiceData();
    method public android.os.ParcelUuid getServiceDataUuid();
    method public java.util.List<android.os.ParcelUuid> getServiceUuids();
  }
  public static final class BluetoothLeAdvertiseScanData.AdvertisementData extends android.bluetooth.BluetoothLeAdvertiseScanData.AdvertiseBaseData implements android.os.Parcelable {
    method public int describeContents();
    method public boolean getIncludeTxPowerLevel();
    method public static android.bluetooth.BluetoothLeAdvertiseScanData.AdvertisementData.Builder newBuilder();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
  }
  public static final class BluetoothLeAdvertiseScanData.AdvertisementData.Builder {
    ctor public BluetoothLeAdvertiseScanData.AdvertisementData.Builder();
    method public android.bluetooth.BluetoothLeAdvertiseScanData.AdvertisementData build();
    method public android.bluetooth.BluetoothLeAdvertiseScanData.AdvertisementData.Builder dataType(int);
    method public android.bluetooth.BluetoothLeAdvertiseScanData.AdvertisementData.Builder includeTxPowerLevel(boolean);
    method public android.bluetooth.BluetoothLeAdvertiseScanData.AdvertisementData.Builder manufacturerData(int, byte[]);
    method public android.bluetooth.BluetoothLeAdvertiseScanData.AdvertisementData.Builder serviceData(android.os.ParcelUuid, byte[]);
    method public android.bluetooth.BluetoothLeAdvertiseScanData.AdvertisementData.Builder serviceUuids(java.util.List<android.os.ParcelUuid>);
  }
  public static final class BluetoothLeAdvertiseScanData.ScanRecord extends android.bluetooth.BluetoothLeAdvertiseScanData.AdvertiseBaseData {
    method public int getAdvertiseFlags();
    method public java.lang.String getLocalName();
    method public static android.bluetooth.BluetoothLeAdvertiseScanData.ScanRecord.Parser getParser();
    method public int getTxPowerLevel();
  }
  public static final class BluetoothLeAdvertiseScanData.ScanRecord.Parser {
    ctor public BluetoothLeAdvertiseScanData.ScanRecord.Parser();
    method public android.bluetooth.BluetoothLeAdvertiseScanData.ScanRecord parseFromScanRecord(byte[]);
  }
  public class BluetoothLeAdvertiser {
    method public void startAdvertising(android.bluetooth.BluetoothLeAdvertiser.Settings, android.bluetooth.BluetoothLeAdvertiseScanData.AdvertisementData, android.bluetooth.BluetoothLeAdvertiser.AdvertiseCallback);
    method public void stopAdvertising(android.bluetooth.BluetoothLeAdvertiser.Settings, android.bluetooth.BluetoothLeAdvertiser.AdvertiseCallback);
  }
  public static abstract interface BluetoothLeAdvertiser.AdvertiseCallback {
    method public abstract void onFailure(int);
    method public abstract void onSuccess(android.bluetooth.BluetoothLeAdvertiser.Settings);
    field public static final int ADVERISING_NOT_STARTED = 4; // 0x4
    field public static final int ADVERTISING_ALREADY_STARTED = 3; // 0x3
    field public static final int ADVERTISING_SERVICE_UNKNOWN = 1; // 0x1
    field public static final int CONTROLLER_FAILURE = 5; // 0x5
    field public static final int TOO_MANY_ADVERTISERS = 2; // 0x2
  }
  public static final class BluetoothLeAdvertiser.Settings implements android.os.Parcelable {
    method public int describeContents();
    method public int getMode();
    method public int getTxPowerLevel();
    method public int getType();
    method public static android.bluetooth.BluetoothLeAdvertiser.Settings.Builder newBuilder();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ADVERTISE_MODE_BALANCED = 1; // 0x1
    field public static final int ADVERTISE_MODE_LOW_LATENCY = 2; // 0x2
    field public static final int ADVERTISE_MODE_LOW_POWER = 0; // 0x0
    field public static final int ADVERTISE_TX_POWER_HIGH = 3; // 0x3
    field public static final int ADVERTISE_TX_POWER_LOW = 1; // 0x1
    field public static final int ADVERTISE_TX_POWER_MEDIUM = 2; // 0x2
    field public static final int ADVERTISE_TX_POWER_ULTRA_LOW = 0; // 0x0
    field public static final int ADVERTISE_TYPE_CONNECTABLE = 2; // 0x2
    field public static final int ADVERTISE_TYPE_NON_CONNECTABLE = 0; // 0x0
    field public static final int ADVERTISE_TYPE_SCANNABLE = 1; // 0x1
    field public static final android.os.Parcelable.Creator CREATOR;
  }
  public static final class BluetoothLeAdvertiser.Settings.Builder {
    method public android.bluetooth.BluetoothLeAdvertiser.Settings.Builder advertiseMode(int);
    method public android.bluetooth.BluetoothLeAdvertiser.Settings build();
    method public android.bluetooth.BluetoothLeAdvertiser.Settings.Builder txPowerLevel(int);
    method public android.bluetooth.BluetoothLeAdvertiser.Settings.Builder type(int);
  }
  public final class BluetoothLeScanFilter implements android.os.Parcelable {
    method public int describeContents();
    method public java.lang.String getDeviceAddress();
    method public java.lang.String getLocalName();
    method public byte[] getManufacturerData();
    method public byte[] getManufacturerDataMask();
    method public int getManufacturerId();
    method public int getMaxRssi();
    method public int getMinRssi();
    method public byte[] getServiceData();
    method public byte[] getServiceDataMask();
    method public android.os.ParcelUuid getServiceUuid();
    method public android.os.ParcelUuid getServiceUuidMask();
    method public boolean matches(android.bluetooth.BluetoothLeScanner.ScanResult);
    method public static android.bluetooth.BluetoothLeScanFilter.Builder newBuilder();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
  }
  public static class BluetoothLeScanFilter.Builder {
    method public android.bluetooth.BluetoothLeScanFilter build();
    method public android.bluetooth.BluetoothLeScanFilter.Builder macAddress(java.lang.String);
    method public android.bluetooth.BluetoothLeScanFilter.Builder manufacturerData(int, byte[]);
    method public android.bluetooth.BluetoothLeScanFilter.Builder manufacturerDataMask(byte[]);
    method public android.bluetooth.BluetoothLeScanFilter.Builder name(java.lang.String);
    method public android.bluetooth.BluetoothLeScanFilter.Builder rssiRange(int, int);
    method public android.bluetooth.BluetoothLeScanFilter.Builder serviceData(byte[]);
    method public android.bluetooth.BluetoothLeScanFilter.Builder serviceDataMask(byte[]);
    method public android.bluetooth.BluetoothLeScanFilter.Builder serviceUuid(android.os.ParcelUuid);
    method public android.bluetooth.BluetoothLeScanFilter.Builder serviceUuidMask(android.os.ParcelUuid);
  }
  public class BluetoothLeScanner {
    method public void startScan(java.util.List<android.bluetooth.BluetoothLeScanFilter>, android.bluetooth.BluetoothLeScanner.Settings, android.bluetooth.BluetoothLeScanner.ScanCallback);
    method public void stopScan(android.bluetooth.BluetoothLeScanner.Settings);
  }
  public static abstract interface BluetoothLeScanner.ScanCallback {
    method public abstract void onBatchScanResults(java.util.List<android.bluetooth.BluetoothLeScanner.ScanResult>);
    method public abstract void onDeviceFound(android.bluetooth.BluetoothLeScanner.ScanResult);
    method public abstract void onDeviceLost(android.bluetooth.BluetoothDevice);
    method public abstract void onDeviceUpdate(android.bluetooth.BluetoothLeScanner.ScanResult);
    method public abstract void onScanFailed(int);
    field public static final int APPLICATION_REGISTRATION_FAILED = 2; // 0x2
    field public static final int CONTROLLER_FAILURE = 4; // 0x4
    field public static final int GATT_SERVICE_FAILURE = 3; // 0x3
    field public static final int SCAN_ALREADY_STARTED = 1; // 0x1
  }
  public static final class BluetoothLeScanner.ScanResult implements android.os.Parcelable {
    ctor public BluetoothLeScanner.ScanResult(android.bluetooth.BluetoothDevice, byte[], int, long);
    method public int describeContents();
    method public android.bluetooth.BluetoothDevice getDevice();
    method public int getRssi();
    method public byte[] getScanRecord();
    method public long getTimestampMicros();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
  }
  public static final class BluetoothLeScanner.Settings implements android.os.Parcelable {
    method public int describeContents();
    method public int getCallbackType();
    method public long getReportDelayMicros();
    method public int getScanMode();
    method public int getScanResultType();
    method public static android.bluetooth.BluetoothLeScanner.Settings.Builder newBuilder();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CALLBACK_TYPE_ON_FOUND = 1; // 0x1
    field public static final int CALLBACK_TYPE_ON_LOST = 2; // 0x2
    field public static final int CALLBACK_TYPE_ON_UPDATE = 0; // 0x0
    field public static final android.os.Parcelable.Creator CREATOR;
    field public static final int SCAN_MODE_BALANCED = 1; // 0x1
    field public static final int SCAN_MODE_LOW_LATENCY = 2; // 0x2
    field public static final int SCAN_MODE_LOW_POWER = 0; // 0x0
    field public static final int SCAN_RESULT_TYPE_FULL = 0; // 0x0
  }
  public static class BluetoothLeScanner.Settings.Builder {
    method public android.bluetooth.BluetoothLeScanner.Settings build();
    method public android.bluetooth.BluetoothLeScanner.Settings.Builder callbackType(int);
    method public android.bluetooth.BluetoothLeScanner.Settings.Builder reportDelayMicros(long);
    method public android.bluetooth.BluetoothLeScanner.Settings.Builder scanMode(int);
  }
  public final class BluetoothManager {
    method public android.bluetooth.BluetoothAdapter getAdapter();
    method public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices(int);
+32 −0
Original line number Diff line number Diff line
@@ -497,6 +497,34 @@ public final class BluetoothAdapter {
      }
    }

    /**
     * Returns a {@link BluetoothLeAdvertiser} object for Bluetooth LE Advertising operations.
     */
    public BluetoothLeAdvertiser getBluetoothLeAdvertiser() {
        // TODO: Return null if this feature is not supported by hardware.
        try {
            IBluetoothGatt iGatt = mManagerService.getBluetoothGatt();
            return new BluetoothLeAdvertiser(iGatt);
        } catch (RemoteException e) {
            Log.e(TAG, "failed to get BluetoothLeAdvertiser, error: " + e);
            return null;
        }
    }

    /**
     * Returns a {@link BluetoothLeScanner} object for Bluetooth LE scan operations.
     */
    public BluetoothLeScanner getBluetoothLeScanner() {
        // TODO: Return null if BLE scan is not supported by hardware.
        try {
            IBluetoothGatt iGatt = mManagerService.getBluetoothGatt();
            return new BluetoothLeScanner(iGatt);
        } catch (RemoteException e) {
            Log.e(TAG, "failed to get BluetoothLeScanner, error: " + e);
            return null;
        }
    }

    /**
     * Interface for BLE advertising callback.
     *
@@ -2024,6 +2052,10 @@ public final class BluetoothAdapter {
            }
        }

        @Override
        public void onMultiAdvertiseCallback(int status) {
            // no op
        }
        /**
         * Callback reporting LE ATT MTU.
         * @hide
+9 −1
Original line number Diff line number Diff line
@@ -583,6 +583,14 @@ public final class BluetoothGatt implements BluetoothProfile {
                        + state + " status=" + status);
            }

            /**
             * @hide
             */
            @Override
            public void onMultiAdvertiseCallback(int status) {
                // no op.
            }

            /**
             * Callback invoked when the MTU for a given connection changes
             * @hide
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.bluetooth;

parcelable BluetoothLeAdvertiseScanData.AdvertisementData;
 No newline at end of file
+649 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading