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

Commit 7c81f1f9 authored by Edward Jee's avatar Edward Jee
Browse files

Enables AT+ANDROID command in Bluetooth HFP.

Adds another vendor-specific command AT+ANDROID in Bluetooth Hands-Free
Profile. And creates an API function that sends an unsolicited result
code +ANDROID .

Bug: 8736189
Change-Id: I4757c410d31b97511c92f66d71035eb929f9fd29
parent 701e77fc
Loading
Loading
Loading
Loading
+650 −0
Original line number Diff line number Diff line
@@ -512,6 +512,656 @@ public class BluetoothAssignedNumbers {
     */
    public static final int RIVIERAWAVES = 0x0060;

    /*
     * RDA Microelectronics.
     */
    public static final int RDA_MICROELECTRONICS = 0x0061;

    /*
     * Gibson Guitars.
     */
    public static final int GIBSON_GUITARS = 0x0062;

    /*
     * MiCommand Inc.
     */
    public static final int MICOMMAND = 0x0063;

    /*
     * Band XI International, LLC.
     */
    public static final int BAND_XI_INTERNATIONAL = 0x0064;

    /*
     * Hewlett-Packard Company.
     */
    public static final int HEWLETT_PACKARD = 0x0065;

    /*
     * 9Solutions Oy.
     */
    public static final int NINE_SOLUTIONS = 0x0066;

    /*
     * GN Netcom A/S.
     */
    public static final int GN_NETCOM = 0x0067;

    /*
     * General Motors.
     */
    public static final int GENERAL_MOTORS = 0x0068;

    /*
     * A&D Engineering, Inc.
     */
    public static final int A_AND_D_ENGINEERING = 0x0069;

    /*
     * MindTree Ltd.
     */
    public static final int MINDTREE = 0x006A;

    /*
     * Polar Electro OY.
     */
    public static final int POLAR_ELECTRO = 0x006B;

    /*
     * Beautiful Enterprise Co., Ltd.
     */
    public static final int BEAUTIFUL_ENTERPRISE = 0x006C;

    /*
     * BriarTek, Inc.
     */
    public static final int BRIARTEK = 0x006D;

    /*
     * Summit Data Communications, Inc.
     */
    public static final int SUMMIT_DATA_COMMUNICATIONS = 0x006E;

    /*
     * Sound ID.
     */
    public static final int SOUND_ID = 0x006F;

    /*
     * Monster, LLC.
     */
    public static final int MONSTER = 0x0070;

    /*
     * connectBlue AB.
     */
    public static final int CONNECTBLUE = 0x0071;

    /*
     * ShangHai Super Smart Electronics Co. Ltd.
     */
    public static final int SHANGHAI_SUPER_SMART_ELECTRONICS = 0x0072;

    /*
     * Group Sense Ltd.
     */
    public static final int GROUP_SENSE = 0x0073;

    /*
     * Zomm, LLC.
     */
    public static final int ZOMM = 0x0074;

    /*
     * Samsung Electronics Co. Ltd.
     */
    public static final int SAMSUNG_ELECTRONICS = 0x0075;

    /*
     * Creative Technology Ltd.
     */
    public static final int CREATIVE_TECHNOLOGY = 0x0076;

    /*
     * Laird Technologies.
     */
    public static final int LAIRD_TECHNOLOGIES = 0x0077;

    /*
     * Nike, Inc.
     */
    public static final int NIKE = 0x0078;

    /*
     * lesswire AG.
     */
    public static final int LESSWIRE = 0x0079;

    /*
     * MStar Semiconductor, Inc.
     */
    public static final int MSTAR_SEMICONDUCTOR = 0x007A;

    /*
     * Hanlynn Technologies.
     */
    public static final int HANLYNN_TECHNOLOGIES = 0x007B;

    /*
     * A & R Cambridge.
     */
    public static final int A_AND_R_CAMBRIDGE = 0x007C;

    /*
     * Seers Technology Co. Ltd.
     */
    public static final int SEERS_TECHNOLOGY = 0x007D;

    /*
     * Sports Tracking Technologies Ltd.
     */
    public static final int SPORTS_TRACKING_TECHNOLOGIES = 0x007E;

    /*
     * Autonet Mobile.
     */
    public static final int AUTONET_MOBILE = 0x007F;

    /*
     * DeLorme Publishing Company, Inc.
     */
    public static final int DELORME_PUBLISHING_COMPANY = 0x0080;

    /*
     * WuXi Vimicro.
     */
    public static final int WUXI_VIMICRO = 0x0081;

    /*
     * Sennheiser Communications A/S.
     */
    public static final int SENNHEISER_COMMUNICATIONS = 0x0082;

    /*
     * TimeKeeping Systems, Inc.
     */
    public static final int TIMEKEEPING_SYSTEMS = 0x0083;

    /*
     * Ludus Helsinki Ltd.
     */
    public static final int LUDUS_HELSINKI = 0x0084;

    /*
     * BlueRadios, Inc.
     */
    public static final int BLUERADIOS = 0x0085;

    /*
     * equinox AG.
     */
    public static final int EQUINOX_AG = 0x0086;

    /*
     * Garmin International, Inc.
     */
    public static final int GARMIN_INTERNATIONAL = 0x0087;

    /*
     * Ecotest.
     */
    public static final int ECOTEST = 0x0088;

    /*
     * GN ReSound A/S.
     */
    public static final int GN_RESOUND = 0x0089;

    /*
     * Jawbone.
     */
    public static final int JAWBONE = 0x008A;

    /*
     * Topcorn Positioning Systems, LLC.
     */
    public static final int TOPCORN_POSITIONING_SYSTEMS = 0x008B;

    /*
     * Qualcomm Labs, Inc.
     */
    public static final int QUALCOMM_LABS = 0x008C;

    /*
     * Zscan Software.
     */
    public static final int ZSCAN_SOFTWARE = 0x008D;

    /*
     * Quintic Corp.
     */
    public static final int QUINTIC = 0x008E;

    /*
     * Stollman E+V GmbH.
     */
    public static final int STOLLMAN_E_PLUS_V = 0x008F;

    /*
     * Funai Electric Co., Ltd.
     */
    public static final int FUNAI_ELECTRIC = 0x0090;

    /*
     * Advanced PANMOBIL Systems GmbH & Co. KG.
     */
    public static final int ADVANCED_PANMOBIL_SYSTEMS = 0x0091;

    /*
     * ThinkOptics, Inc.
     */
    public static final int THINKOPTICS = 0x0092;

    /*
     * Universal Electronics, Inc.
     */
    public static final int UNIVERSAL_ELECTRONICS = 0x0093;

    /*
     * Airoha Technology Corp.
     */
    public static final int AIROHA_TECHNOLOGY = 0x0094;

    /*
     * NEC Lighting, Ltd.
     */
    public static final int NEC_LIGHTING = 0x0095;

    /*
     * ODM Technology, Inc.
     */
    public static final int ODM_TECHNOLOGY = 0x0096;

    /*
     * Bluetrek Technologies Limited.
     */
    public static final int BLUETREK_TECHNOLOGIES = 0x0097;

    /*
     * zer01.tv GmbH.
     */
    public static final int ZER01_TV = 0x0098;

    /*
     * i.Tech Dynamic Global Distribution Ltd.
     */
    public static final int I_TECH_DYNAMIC_GLOBAL_DISTRIBUTION = 0x0099;

    /*
     * Alpwise.
     */
    public static final int ALPWISE = 0x009A;

    /*
     * Jiangsu Toppower Automotive Electronics Co., Ltd.
     */
    public static final int JIANGSU_TOPPOWER_AUTOMOTIVE_ELECTRONICS = 0x009B;

    /*
     * Colorfy, Inc.
     */
    public static final int COLORFY = 0x009C;

    /*
     * Geoforce Inc.
     */
    public static final int GEOFORCE = 0x009D;

    /*
     * Bose Corporation.
     */
    public static final int BOSE = 0x009E;

    /*
     * Suunto Oy.
     */
    public static final int SUUNTO = 0x009F;

    /*
     * Kensington Computer Products Group.
     */
    public static final int KENSINGTON_COMPUTER_PRODUCTS_GROUP = 0x00A0;

    /*
     * SR-Medizinelektronik.
     */
    public static final int SR_MEDIZINELEKTRONIK = 0x00A1;

    /*
     * Vertu Corporation Limited.
     */
    public static final int VERTU = 0x00A2;

    /*
     * Meta Watch Ltd.
     */
    public static final int META_WATCH = 0x00A3;

    /*
     * LINAK A/S.
     */
    public static final int LINAK = 0x00A4;

    /*
     * OTL Dynamics LLC.
     */
    public static final int OTL_DYNAMICS = 0x00A5;

    /*
     * Panda Ocean Inc.
     */
    public static final int PANDA_OCEAN = 0x00A6;

    /*
     * Visteon Corporation.
     */
    public static final int VISTEON = 0x00A7;

    /*
     * ARP Devices Limited.
     */
    public static final int ARP_DEVICES = 0x00A8;

    /*
     * Magneti Marelli S.p.A.
     */
    public static final int MAGNETI_MARELLI = 0x00A9;

    /*
     * CAEN RFID srl.
     */
    public static final int CAEN_RFID = 0x00AA;

    /*
     * Ingenieur-Systemgruppe Zahn GmbH.
     */
    public static final int INGENIEUR_SYSTEMGRUPPE_ZAHN = 0x00AB;

    /*
     * Green Throttle Games.
     */
    public static final int GREEN_THROTTLE_GAMES = 0x00AC;

    /*
     * Peter Systemtechnik GmbH.
     */
    public static final int PETER_SYSTEMTECHNIK = 0x00AD;

    /*
     * Omegawave Oy.
     */
    public static final int OMEGAWAVE = 0x00AE;

    /*
     * Cinetix.
     */
    public static final int CINETIX = 0x00AF;

    /*
     * Passif Semiconductor Corp.
     */
    public static final int PASSIF_SEMICONDUCTOR = 0x00B0;

    /*
     * Saris Cycling Group, Inc.
     */
    public static final int SARIS_CYCLING_GROUP = 0x00B1;

    /*
     * Bekey A/S.
     */
    public static final int BEKEY = 0x00B2;

    /*
     * Clarinox Technologies Pty. Ltd.
     */
    public static final int CLARINOX_TECHNOLOGIES = 0x00B3;

    /*
     * BDE Technology Co., Ltd.
     */
    public static final int BDE_TECHNOLOGY = 0x00B4;

    /*
     * Swirl Networks.
     */
    public static final int SWIRL_NETWORKS = 0x00B5;

    /*
     * Meso international.
     */
    public static final int MESO_INTERNATIONAL = 0x00B6;

    /*
     * TreLab Ltd.
     */
    public static final int TRELAB = 0x00B7;

    /*
     * Qualcomm Innovation Center, Inc. (QuIC).
     */
    public static final int QUALCOMM_INNOVATION_CENTER = 0x00B8;

    /*
     * Johnson Controls, Inc.
     */
    public static final int JOHNSON_CONTROLS = 0x00B9;

    /*
     * Starkey Laboratories Inc.
     */
    public static final int STARKEY_LABORATORIES = 0x00BA;

    /*
     * S-Power Electronics Limited.
     */
    public static final int S_POWER_ELECTRONICS = 0x00BB;

    /*
     * Ace Sensor Inc.
     */
    public static final int ACE_SENSOR = 0x00BC;

    /*
     * Aplix Corporation.
     */
    public static final int APLIX = 0x00BD;

    /*
     * AAMP of America.
     */
    public static final int AAMP_OF_AMERICA = 0x00BE;

    /*
     * Stalmart Technology Limited.
     */
    public static final int STALMART_TECHNOLOGY = 0x00BF;

    /*
     * AMICCOM Electronics Corporation.
     */
    public static final int AMICCOM_ELECTRONICS = 0x00C0;

    /*
     * Shenzhen Excelsecu Data Technology Co.,Ltd.
     */
    public static final int SHENZHEN_EXCELSECU_DATA_TECHNOLOGY = 0x00C1;

    /*
     * Geneq Inc.
     */
    public static final int GENEQ = 0x00C2;

    /*
     * adidas AG.
     */
    public static final int ADIDAS = 0x00C3;

    /*
     * LG Electronics.
     */
    public static final int LG_ELECTRONICS = 0x00C4;

    /*
     * Onset Computer Corporation.
     */
    public static final int ONSET_COMPUTER = 0x00C5;

    /*
     * Selfly BV.
     */
    public static final int SELFLY = 0x00C6;

    /*
     * Quuppa Oy.
     */
    public static final int QUUPPA = 0x00C7;

    /*
     * GeLo Inc.
     */
    public static final int GELO = 0x00C8;

    /*
     * Evluma.
     */
    public static final int EVLUMA = 0x00C9;

    /*
     * MC10.
     */
    public static final int MC10 = 0x00CA;

    /*
     * Binauric SE.
     */
    public static final int BINAURIC = 0x00CB;

    /*
     * Beats Electronics.
     */
    public static final int BEATS_ELECTRONICS = 0x00CC;

    /*
     * Microchip Technology Inc.
     */
    public static final int MICROCHIP_TECHNOLOGY = 0x00CD;

    /*
     * Elgato Systems GmbH.
     */
    public static final int ELGATO_SYSTEMS = 0x00CE;

    /*
     * ARCHOS SA.
     */
    public static final int ARCHOS = 0x00CF;

    /*
     * Dexcom, Inc.
     */
    public static final int DEXCOM = 0x00D0;

    /*
     * Polar Electro Europe B.V.
     */
    public static final int POLAR_ELECTRO_EUROPE = 0x00D1;

    /*
     * Dialog Semiconductor B.V.
     */
    public static final int DIALOG_SEMICONDUCTOR = 0x00D2;

    /*
     * Taixingbang Technology (HK) Co,. LTD.
     */
    public static final int TAIXINGBANG_TECHNOLOGY = 0x00D3;

    /*
     * Kawantech.
     */
    public static final int KAWANTECH = 0x00D4;

    /*
     * Austco Communication Systems.
     */
    public static final int AUSTCO_COMMUNICATION_SYSTEMS = 0x00D5;

    /*
     * Timex Group USA, Inc.
     */
    public static final int TIMEX_GROUP_USA = 0x00D6;

    /*
     * Qualcomm Technologies, Inc.
     */
    public static final int QUALCOMM_TECHNOLOGIES = 0x00D7;

    /*
     * Qualcomm Connected Experiences, Inc.
     */
    public static final int QUALCOMM_CONNECTED_EXPERIENCES = 0x00D8;

    /*
     * Voyetra Turtle Beach.
     */
    public static final int VOYETRA_TURTLE_BEACH = 0x00D9;

    /*
     * txtr GmbH.
     */
    public static final int TXTR = 0x00DA;

    /*
     * Biosentronics.
     */
    public static final int BIOSENTRONICS = 0x00DB;

    /*
     * Procter & Gamble.
     */
    public static final int PROCTER_AND_GAMBLE = 0x00DC;

    /*
     * Hosiden Corporation.
     */
    public static final int HOSIDEN = 0x00DD;

    /*
     * Muzik LLC.
     */
    public static final int MUZIK = 0x00DE;

    /*
     * Misfit Wearables Corp.
     */
    public static final int MISFIT_WEARABLES = 0x00DF;

    /*
     * Google.
     */
    public static final int GOOGLE = 0x00E0;

    /*
     * Danlers Ltd.
     */
    public static final int DANLERS = 0x00E1;

    /*
     * Semilink Inc.
     */
    public static final int SEMILINK = 0x00E2;

    /*
     * You can't instantiate one of these.
     */
+45 −0
Original line number Diff line number Diff line
@@ -192,6 +192,11 @@ public final class BluetoothHeadset implements BluetoothProfile {
    public static final String VENDOR_SPECIFIC_HEADSET_EVENT_COMPANY_ID_CATEGORY  =
            "android.bluetooth.headset.intent.category.companyid";

    /**
     * A vendor-specific command for unsolicited result code.
     */
    public static final String VENDOR_RESULT_CODE_COMMAND_ANDROID = "+ANDROID";

    /**
     * Headset state when SCO audio is not connected.
     * This state can be one of
@@ -840,6 +845,46 @@ public final class BluetoothHeadset implements BluetoothProfile {
        }
    }

    /**
     * Sends a vendor-specific unsolicited result code to the headset.
     *
     * <p>The actual string to be sent is <code>command + ": " + arg</code>.
     * For example, if {@code command} is {@link VENDOR_RESULT_CODE_COMMAND_ANDROID} and {@code arg}
     * is {@code "0"}, the string <code>"+ANDROID: 0"</code> will be sent.
     *
     * <p>Currently only {@link VENDOR_RESULT_CODE_COMMAND_ANDROID} is allowed as {@code command}.
     *
     * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission.
     *
     * @param device Bluetooth headset.
     * @param command A vendor-specific command.
     * @param arg The argument that will be attached to the command.
     * @return {@code false} if there is no headset connected, or if the command is not an allowed
     *         vendor-specific unsolicited result code, or on error. {@code true} otherwise.
     * @throws IllegalArgumentException if {@code command} is {@code null}.
     */
    public boolean sendVendorSpecificResultCode(BluetoothDevice device, String command,
            String arg) {
        if (DBG) {
            log("sendVendorSpecificResultCode()");
        }
        if (command == null) {
            throw new IllegalArgumentException("command is null");
        }
        if (mService != null && isEnabled() &&
                isValidDevice(device)) {
            try {
                return mService.sendVendorSpecificResultCode(device, command, arg);
            } catch (RemoteException e) {
                Log.e(TAG, Log.getStackTraceString(new Throwable()));
            }
        }
        if (mService == null) {
            Log.w(TAG, "Proxy not attached to service");
        }
        return false;
    }

    private ServiceConnection mConnection = new ServiceConnection() {
        public void onServiceConnected(ComponentName className, IBinder service) {
            if (DBG) Log.d(TAG, "Proxy object connected");
+3 −0
Original line number Diff line number Diff line
@@ -35,6 +35,9 @@ interface IBluetoothHeadset {
    boolean startVoiceRecognition(in BluetoothDevice device);
    boolean stopVoiceRecognition(in BluetoothDevice device);
    boolean isAudioConnected(in BluetoothDevice device);
    boolean sendVendorSpecificResultCode(in BluetoothDevice device,
                                         in String command,
                                         in String arg);

    // APIs that can be made public in future
    int getBatteryUsageHint(in BluetoothDevice device);