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

Commit d31a4e40 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 2641

* changes:
  Framework changes for bluez4.
parents 9da6971d d5ac1ae3
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ LOCAL_SRC_FILES += \
	core/java/android/backup/IRestoreSession.aidl \
	core/java/android/bluetooth/IBluetoothA2dp.aidl \
	core/java/android/bluetooth/IBluetoothDevice.aidl \
	core/java/android/bluetooth/IBluetoothDeviceCallback.aidl \
	core/java/android/bluetooth/IBluetoothHeadset.aidl \
        core/java/android/content/IContentService.aidl \
	core/java/android/content/ISyncAdapter.aidl \
@@ -481,5 +480,3 @@ include $(BUILD_JAVA_LIBRARY)
ifeq (,$(ONE_SHOT_MAKEFILE))
include $(call first-makefiles-under,$(LOCAL_PATH))
endif

+15 −177
Original line number Diff line number Diff line
@@ -180,31 +180,6 @@ public class BluetoothDevice {
        return false;
    }

    public String getVersion() {
        try {
            return mService.getVersion();
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
    }
    public String getRevision() {
        try {
            return mService.getRevision();
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
    }
    public String getManufacturer() {
        try {
            return mService.getManufacturer();
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
    }
    public String getCompany() {
        try {
            return mService.getCompany();
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
    }

    /**
     * Get the current scan mode.
     * Used to determine if the local device is connectable and/or discoverable
@@ -241,11 +216,8 @@ public class BluetoothDevice {
    }

    public boolean startDiscovery() {
        return startDiscovery(true);
    }
    public boolean startDiscovery(boolean resolveNames) {
        try {
            return mService.startDiscovery(resolveNames);
            return mService.startDiscovery();
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return false;
    }
@@ -263,88 +235,17 @@ public class BluetoothDevice {
        return false;
    }

    public boolean startPeriodicDiscovery() {
        try {
            return mService.startPeriodicDiscovery();
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return false;
    }
    public boolean stopPeriodicDiscovery() {
        try {
            return mService.stopPeriodicDiscovery();
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return false;
    }
    public boolean isPeriodicDiscovery() {
        try {
            return mService.isPeriodicDiscovery();
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return false;
    }

    public String[] listRemoteDevices() {
        try {
            return mService.listRemoteDevices();
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
    }

    /**
     * List remote devices that have a low level (ACL) connection.
     *
     * RFCOMM, SDP and L2CAP are all built on ACL connections. Devices can have
     * an ACL connection even when not paired - this is common for SDP queries
     * or for in-progress pairing requests.
     *
     * In most cases you probably want to test if a higher level protocol is
     * connected, rather than testing ACL connections.
     *
     * @return bluetooth hardware addresses of remote devices with a current
     *         ACL connection. Array size is 0 if no devices have a
     *         connection. Null on error.
     */
    public String[] listAclConnections() {
        try {
            return mService.listAclConnections();
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
    }

    /**
     * Check if a specified remote device has a low level (ACL) connection.
     *
     * RFCOMM, SDP and L2CAP are all built on ACL connections. Devices can have
     * an ACL connection even when not paired - this is common for SDP queries
     * or for in-progress pairing requests.
     *
     * In most cases you probably want to test if a higher level protocol is
     * connected, rather than testing ACL connections.
     *
     * @param address the Bluetooth hardware address you want to check.
     * @return true if there is an ACL connection, false otherwise and on
     *         error.
     */
    public boolean isAclConnected(String address) {
        try {
            return mService.isAclConnected(address);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return false;
    }

    /**
     * Perform a low level (ACL) disconnection of a remote device.
     *
     * This forcably disconnects the ACL layer connection to a remote device,
     * which will cause all RFCOMM, SDP and L2CAP connections to this remote
     * device to close.
     * Removes the remote device and the pairing information associated
     * with it.
     *
     * @param address the Bluetooth hardware address you want to disconnect.
     * @return true if the device was disconnected, false otherwise and on
     *         error.
     */
    public boolean disconnectRemoteDeviceAcl(String address) {
    public boolean removeBond(String address) {
        try {
            return mService.disconnectRemoteDeviceAcl(address);
            return mService.removeBond(address);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return false;
    }
@@ -376,16 +277,6 @@ public class BluetoothDevice {
        return false;
    }

    /**
     * Remove an already exisiting bonding (delete the link key).
     */
    public boolean removeBond(String address) {
        try {
            return mService.removeBond(address);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return false;
    }

    /**
     * List remote devices that are bonded (paired) to the local device.
     *
@@ -440,78 +331,25 @@ public class BluetoothDevice {
        return null;
    }

    public String getRemoteVersion(String address) {
        try {
            return mService.getRemoteVersion(address);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
    }
    public String getRemoteRevision(String address) {
        try {
            return mService.getRemoteRevision(address);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
    }
    public String getRemoteManufacturer(String address) {
        try {
            return mService.getRemoteManufacturer(address);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
    }
    public String getRemoteCompany(String address) {
        try {
            return mService.getRemoteCompany(address);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
    }

    /**
     * Returns the RFCOMM channel associated with the 16-byte UUID on
     * the remote Bluetooth address.
     *
     * Performs a SDP ServiceSearchAttributeRequest transaction. The provided
     * uuid is verified in the returned record. If there was a problem, or the
     * specified uuid does not exist, -1 is returned.
     */
    public boolean getRemoteServiceChannel(String address, short uuid16,
            IBluetoothDeviceCallback callback) {
        try {
            return mService.getRemoteServiceChannel(address, uuid16, callback);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return false;
    }

    /**
     * Get the major, minor and servics classes of a remote device.
     * These classes are encoded as a 32-bit integer. See BluetoothClass.
     * @param address remote device
     * @return 32-bit class suitable for use with BluetoothClass, or
     *         BluetoothClass.ERROR on error
     */
    public int getRemoteClass(String address) {
        try {
            return mService.getRemoteClass(address);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return BluetoothClass.ERROR;
        return BluetoothError.ERROR_IPC;
    }

    public byte[] getRemoteFeatures(String address) {
     public String[] getRemoteUuids(String address) {
        try {
            return mService.getRemoteFeatures(address);
            return mService.getRemoteUuids(address);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
    }
    public String lastSeen(String address) {
        try {
            return mService.lastSeen(address);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
    }
    public String lastUsed(String address) {

    public int getRemoteServiceChannel(String address, String uuid) {
         try {
            return mService.lastUsed(address);
             return mService.getRemoteServiceChannel(address, uuid);
         } catch (RemoteException e) {Log.e(TAG, "", e);}
        return null;
         return BluetoothError.ERROR_IPC;
    }

    public boolean setPin(String address, byte[] pin) {
+62 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 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;

import java.util.UUID;

/**
* Static helper methods and constants to decode the UUID of remote devices.
*  @hide
*/
public final class BluetoothUuid {

    /* See Bluetooth Assigned Numbers document - SDP section, to get the values of UUIDs
     * for the various services.
     *
     * The following 128 bit values are calculated as:
     *  uuid * 2^96 + BASE_UUID
     */
    public static final UUID AudioSink = UUID.fromString("0000110A-0000-1000-8000-00805F9B34FB");
    public static final UUID AudioSource = UUID.fromString("0000110B-0000-1000-8000-00805F9B34FB");
    public static final UUID AdvAudioDist = UUID.fromString("0000110D-0000-1000-8000-00805F9B34FB");
    public static final UUID HSP       = UUID.fromString("00001108-0000-1000-8000-00805F9B34FB");
    public static final UUID HeadsetHS = UUID.fromString("00001131-0000-1000-8000-00805F9B34FB");
    public static final UUID Handsfree  = UUID.fromString("0000111e-0000-1000-8000-00805F9B34FB");
    public static final UUID HandsfreeAudioGateway
                                          = UUID.fromString("0000111f-0000-1000-8000-00805F9B34FB");

    public static boolean isAudioSource(UUID uuid) {
        return uuid.equals(AudioSource);
    }

    public static boolean isAudioSink(UUID uuid) {
        return uuid.equals(AudioSink);
    }

    public static boolean isAdvAudioDist(UUID uuid) {
        return uuid.equals(AdvAudioDist);
    }

    public static boolean isHandsfree(UUID uuid) {
        return uuid.equals(Handsfree) || uuid.equals(HandsfreeAudioGateway);
    }

    public static boolean isHeadset(UUID uuid) {
        return uuid.equals(HSP) || uuid.equals(HeadsetHS);
    }
}
+3 −23
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.bluetooth;

import android.bluetooth.IBluetoothDeviceCallback;

/**
 * System private API for talking with the Bluetooth service.
 *
@@ -33,10 +31,6 @@ interface IBluetoothDevice
    String getAddress();
    String getName();
    boolean setName(in String name);
    String getVersion();
    String getRevision();
    String getManufacturer();
    String getCompany();

    int getScanMode();
    boolean setScanMode(int mode);
@@ -44,17 +38,9 @@ interface IBluetoothDevice
    int getDiscoverableTimeout();
    boolean setDiscoverableTimeout(int timeout);

    boolean startDiscovery(boolean resolveNames);
    boolean startDiscovery();
    boolean cancelDiscovery();
    boolean isDiscovering();
    boolean startPeriodicDiscovery();
    boolean stopPeriodicDiscovery();
    boolean isPeriodicDiscovery();
    String[] listRemoteDevices();

    String[] listAclConnections();
    boolean isAclConnected(in String address);
    boolean disconnectRemoteDeviceAcl(in String address);

    boolean createBond(in String address);
    boolean cancelBondProcess(in String address);
@@ -63,15 +49,9 @@ interface IBluetoothDevice
    int getBondState(in String address);

    String getRemoteName(in String address);
    String getRemoteVersion(in String address);
    String getRemoteRevision(in String address);
    int getRemoteClass(in String address);
    String getRemoteManufacturer(in String address);
    String getRemoteCompany(in String address);
    boolean getRemoteServiceChannel(in String address, int uuid16, in IBluetoothDeviceCallback callback);
    byte[] getRemoteFeatures(in String adddress);
    String lastSeen(in String address);
    String lastUsed(in String address);
    String[] getRemoteUuids(in String address);
    int getRemoteServiceChannel(in String address, String uuid);

    boolean setPin(in String address, in byte[] pin);
    boolean cancelPin(in String address);
+0 −25
Original line number Diff line number Diff line
/*
 * Copyright (C) 2008, 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;

/**
 * {@hide}
 */
oneway interface IBluetoothDeviceCallback
{
    void onGetRemoteServiceChannelResult(in String address, int channel);
}
Loading