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

Commit 6fa706a6 authored by Zach Johnson's avatar Zach Johnson
Browse files

Simplify get/set custom metadata

Bug: 145171640
Test: compile & run
Change-Id: Ic395af2937e6f92744b08de2aed91c6fcb546e3f
parent 2ade3f3f
Loading
Loading
Loading
Loading
+7 −14
Original line number Diff line number Diff line
@@ -2078,7 +2078,11 @@ public class AdapterService extends Service {
            if (service == null) {
                return false;
            }
            return service.setMetadata(device, key, value);

            if (value.length > BluetoothDevice.METADATA_MAX_LENGTH) {
                return false;
            }
            return service.mDatabaseManager.setCustomMeta(device, key, value);
        }

        @Override
@@ -2087,7 +2091,8 @@ public class AdapterService extends Service {
            if (service == null) {
                return null;
            }
            return service.getMetadata(device, key);

            return service.mDatabaseManager.getCustomMeta(device, key);
        }

        @Override
@@ -2900,18 +2905,6 @@ public class AdapterService extends Service {
                + ctrlState + "traffic = " + Arrays.toString(data));
    }

    boolean setMetadata(BluetoothDevice device, int key, byte[] value) {
        if (value.length > BluetoothDevice.METADATA_MAX_LENGTH) {
            Log.e(TAG, "setMetadata: value length too long " + value.length);
            return false;
        }
        return mDatabaseManager.setCustomMeta(device, key, value);
    }

    byte[] getMetadata(BluetoothDevice device, int key) {
        return mDatabaseManager.getCustomMeta(device, key);
    }

    /**
     * Update metadata change to registered listeners
     */