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

Commit 375b13e3 authored by Sravan voleti's avatar Sravan voleti Committed by Bruno Martins
Browse files

Group-UI: UI frameworks changes

Add system APIS to support Group UI
Add AUDIO MCOD related flags
Add new icon for Group supported Adv Audio device

CRs-Fixed: 2832643
Change-Id: Iab3b23115fb7b9917faed3cbb30f32538824e7db
parent 0b4a3a66
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -119,6 +119,11 @@ public final class BluetoothClass implements Parcelable {
        private static final int BITMASK = 0xFFE000;

        public static final int LIMITED_DISCOVERABILITY = 0x002000;
        /**
          * @hide
          */
        public static final int GROUP = 0x004000;

        public static final int POSITIONING = 0x010000;
        public static final int NETWORKING = 0x020000;
        public static final int RENDER = 0x040000;
+76 −0
Original line number Diff line number Diff line
<!--
Copyright (c) 2020, The Linux Foundation. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
*     Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above
      copyright notice, this list of conditions and the following
      disclaimer in the documentation and/or other materials provided
      with the distribution.
    * Neither the name of The Linux Foundation nor the names of its
      contributors may be used to endorse or promote products derived
      from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="999"
    android:viewportHeight="1024">
    <path
        android:fillColor="#000"
        android:pathData="M126.97,182.76c-69.56,50.96 -64.68,331.98 6.48,372.82 40.96,
        23.51 103.33,7.01 155.5,-41.12 11.31,-10.43 23.38,-18.97 26.84,-18.97 3.45,
        0 6.28,89.19 6.28,198.19v198.19h97.29l5.89,-154.84c12.93,-339.91 6.16,
        -424.43 -37.81,-471.62 -8.7,-9.34 -15.82,-18.82 -15.82,-21.08 0,
        -8.58 -42.51,-46.14 -52.22,-46.14 -5.6,0 -18.17,-5.6 -27.94,-12.44 -33.07,
        -23.17 -134.44,-25.01 -164.49,-2.99zM677.16,172.87c-140.96,32.47 -196.8,
        164.49 -174.23,411.9 4.99,54.65 9.07,146.1 9.07,203.23v103.87h99.1v-198.19c0,
        -109.01 2.83,-198.19 6.28,-198.19s15.79,8.82 27.42,19.6c78.81,73.08 184.06,
        62.19 200.65,-20.75 8.23,-41.14 5.84,-231.48 -3.31,-263.11 -15.38,-53.2 -83.2,
        -77.2 -164.97,-58.36zM173.42,372.1c0,165.4 -0.69,172.93 -15.95,172.93 -67.68,
        0 -75.96,-327.13 -8.82,-348.86 23.27,-7.53 24.77,3.17 24.77,175.93zM299.36,
        207.78c7.95,4.13 14.45,11.1 14.45,15.48 0,4.38 3.53,7.97 7.83,7.97 11.05,0 49.97,
        37.26 49.97,47.84 0,4.83 5.84,14.62 12.98,21.76 20.07,20.07 31.7,
        148.52 24.55,271.05l-6.15,105.29h-64.4v-103.22c0,-111.14 -11.44,-130.96 -51.26,
        -88.77 -18.66,19.77 -37.85,35.1 -43.95,35.1 -2.79,0 -10.64,5.58 -17.45,12.39 -33.37,
        33.37 -35.98,21.32 -35.98,-165.75v-178.14l47.48,5.76c26.12,3.17 53.99,9.14 61.94,
        13.27zM743.23,367.48c0,116.88 -2.92,177.55 -8.55,177.55 -12.77,0 -58.22,-29.95 -91.65,
        -60.38 -41.28,-37.58 -52.36,-19.13 -54.9,91.35l-2.32,101.16h-54.51l-9.64,-98.54c-10.42,
        -106.47 -2.79,-204.87 19.66,-253.67 6.59,-14.31 12.11,-29.18 12.27,-33.03 1.21,
        -28.46 85.25,-91.54 127.7,-95.85 18.17,-1.84 39.54,-3.98 47.49,-4.74 13.36,-1.28 14.45,
        12.04 14.45,176.16zM812.47,218.55c22.28,34.01 19.36,270.05 -3.74,302.5 -37.51,
        52.68 -41.31,38.36 -39.66,-149.44 1.64,-185.86 7.76,-207.46 43.4,-153.06zM616.83,
        253.02c-6.6,6.6 0.86,19.49 11.27,19.49 4.27,0 7.77,-5.57 7.77,-12.39 0,-12.77 -9.74,
        -16.41 -19.04,-7.1zM645.57,406.71c-1.32,35.85 0.16,39.14 17.14,38.27 13.26,-0.68 14.57,
        -2.01 4.58,-4.65 -9.63,-2.54 -14.98,-14.48 -17.14,-38.27l-3.14,-34.58 -1.44,39.23zM688.67,
        383.3c-10.64,27.73 0.38,58.47 21.52,60.03 11.92,0.88 14.54,-0.25 6.19,-2.67 -7.95,
        -2.31 -14.45,-9.22 -14.45,-15.37s6.5,-12.88 14.45,-14.95c13.76,-3.6 13.76,-3.82 0,
        -4.73 -17.58,-1.17 -19.51,-17.47 -2.07,-17.47 6.82,0 12.39,-3.72 12.39,-8.26 0,
        -12.74 -32.97,-9.77 -38.04,3.43zM214.71,412.9c0,30.76 1.56,32.97 22.71,
        32.08 13.97,-0.59 17.15,-2.41 8.26,-4.73 -10.22,-2.67 -14.45,-12.07 -14.45,
        -32.08 0,-15.56 -3.72,-28.3 -8.26,-28.3s-8.26,14.87 -8.26,33.03zM264.26,412.9c0,
        30.76 1.56,32.97 22.71,32.08 13.97,-0.59 17.15,-2.41 8.26,-4.73 -7.95,-2.08 -14.45,
        -8.81 -14.45,-14.95s6.5,-12.88 14.45,-14.95c13.76,-3.6 13.76,-3.82 0,-4.73 -7.95,
        -0.53 -14.45,-4.4 -14.45,-8.61s6.5,-9.35 14.45,-11.43c8.89,-2.32 5.71,-4.14 -8.26,
        -4.73 -21.15,-0.89 -22.71,1.31 -22.71,32.07zM396.39,
        788.64v86.71h-57.81v-173.42h57.81v86.71zM586.32,
        788.64v86.71h-49.55v-173.42h49.55v86.71zM546.68,807.22c1.86,35.6 5.58,
        47.49 14.86,47.49 9.29,0 13.01,-11.88 14.86,-47.49 2.27,-43.52 1.03,-47.48 -14.86,
        -47.48 -15.89,0 -17.13,3.97 -14.86,47.48zM367.2,778.14c-7.37,19.21 -0.98,76.57 8.54,
        76.57 11.27,0 15.55,-70.34 4.93,-80.96 -5.85,-5.85 -10.07,-4.48 -13.47,4.38z" />
</vector>
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -334,6 +334,9 @@
    <!-- Message for telling the user the kind of BT device being displayed in list. [CHAR LIMIT=30 BACKUP_MESSAGE_ID=551146170554589119] -->
    <string name="bluetooth_talkback_imaging">Imaging</string>

    <!-- Message for telling the user the kind of BT device being displayed. [CHAR LIMIT=30] -->
    <string name="bluetooth_talkback_group">Group Devices</string>

    <!-- Message for telling the user the kind of BT device being displayed in list. [CHAR LIMIT=30 BACKUP_MESSAGE_ID=26580326066627664] -->
    <string name="bluetooth_talkback_headphone">Headphone</string>

+38 −0
Original line number Diff line number Diff line
@@ -293,6 +293,7 @@ public class BluetoothEventManager {
    protected void dispatchNewGroupFound(
            CachedBluetoothDevice cachedDevice, int groupId, UUID setPrimaryServiceUuid) {
        synchronized(mCallbacks) {
            updateCacheDeviceInfo(groupId, cachedDevice);
            for (BluetoothCallback callback : mCallbacks) {
                callback.onNewGroupFound(cachedDevice, groupId,
                        setPrimaryServiceUuid);
@@ -429,6 +430,21 @@ public class BluetoothEventManager {
                cachedDevice = mDeviceManager.addDevice(device);
            }

            if(bondState == BluetoothDevice.BOND_BONDED) {
                int groupId  = intent.getIntExtra(BluetoothDevice.EXTRA_GROUP_ID,
                        BluetoothDevice.ERROR);
                if (groupId != BluetoothDevice.ERROR && groupId >= 0) {
                    updateCacheDeviceInfo(groupId, cachedDevice);
                } else if (intent.getBooleanExtra(BluetoothDevice.EXTRA_IS_PRIVATE_ADDRESS,
                        false)) {
                    /*
                     * Do not show private address in UI, just ignore assuming remaining
                     * events will receive on public address (connection, disconnection)
                     */
                    Log.d(TAG, "Hide showing private address in UI  " + cachedDevice);
                    updateIgnoreDeviceFlag(cachedDevice);
                }
            }
            for (BluetoothCallback callback : mCallbacks) {
                callback.onDeviceBondStateChanged(cachedDevice, bondState);
            }
@@ -628,4 +644,26 @@ public class BluetoothEventManager {
            dispatchA2dpCodecConfigChanged(cachedDevice, codecStatus);
        }
    }

    private void updateCacheDeviceInfo(int groupId, CachedBluetoothDevice cachedDevice) {
        BluetoothDevice device = cachedDevice.getDevice();
        boolean isGroup = cachedDevice.isGroupDevice();
        Log.d(TAG, "updateCacheDeviceInfo groupId " + groupId
                + ", cachedDevice :" + cachedDevice + ", name :" + cachedDevice.getName()
                +" isGroup :" + isGroup + " groupId " + cachedDevice.getSetId());
        if (isGroup) {
            if (groupId !=  cachedDevice.getSetId()) {
                Log.d(TAG, "groupId mismatch ignore" + cachedDevice.getSetId());
                return;
            }
            Log.d(TAG, "updateCacheDeviceInfo update ignored ");
        } else {
            cachedDevice.setDeviceType(groupId);
        }
    }

    private void updateIgnoreDeviceFlag(CachedBluetoothDevice cachedDevice) {
        cachedDevice.setDeviceType(CachedBluetoothDevice.PRIVATE_ADDR);
    }

}
+6 −0
Original line number Diff line number Diff line
@@ -100,6 +100,12 @@ public class BluetoothUtils {
                default:
                    // unrecognized device class; continue
            }
            int tmpBtClass = btClass.getClassOfDevice() & BluetoothClass.Service.GROUP;
            if (tmpBtClass == BluetoothClass.Service.GROUP) {
                return new Pair<>(
                    getBluetoothDrawable(context, R.drawable.ic_adv_audio),
                        context.getString(R.string.bluetooth_talkback_group));
            }
        }

        List<LocalBluetoothProfile> profiles = cachedDevice.getProfiles();
Loading