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

Commit c8e51f85 authored by Haijie Hong's avatar Haijie Hong Committed by Android (Google) Code Review
Browse files

Merge "Data layer for device details refactor" into main

parents b1dbee02 7093f2f4
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -475,6 +475,19 @@ public class BluetoothUtils {
        return Uri.parse(data);
    }

    /**
     * Gets string metadata from Fast Pair customized fields.
     *
     * @param bluetoothDevice the BluetoothDevice to get metadata
     * @return the string metadata
     */
    @Nullable
    public static String getFastPairCustomizedField(
            @Nullable BluetoothDevice bluetoothDevice, @NonNull String key) {
        String data = getStringMetaData(bluetoothDevice, METADATA_FAST_PAIR_CUSTOMIZED_FIELDS);
        return extraTagValue(key, data);
    }

    /**
     * Get URI Bluetooth metadata for extra control
     *
@@ -482,8 +495,7 @@ public class BluetoothUtils {
     * @return the URI metadata
     */
    public static String getControlUriMetaData(BluetoothDevice bluetoothDevice) {
        String data = getStringMetaData(bluetoothDevice, METADATA_FAST_PAIR_CUSTOMIZED_FIELDS);
        return extraTagValue(KEY_HEARABLE_CONTROL_SLICE, data);
        return getFastPairCustomizedField(bluetoothDevice, KEY_HEARABLE_CONTROL_SLICE);
    }

    /**
+14 −0
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@ import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.Objects;

/** A data class representing the state of an action/switch preference. */
public class ActionSwitchPreferenceState extends DeviceSettingPreferenceState
@@ -133,4 +136,15 @@ public class ActionSwitchPreferenceState extends DeviceSettingPreferenceState
    public Bundle getExtras() {
        return mExtras;
    }

    @Override
    public boolean equals(@Nullable Object obj) {
        if (!(obj instanceof ActionSwitchPreferenceState other)) return false;
        return mChecked == other.mChecked;
    }

    @Override
    public int hashCode() {
        return Objects.hash(mChecked);
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.Objects;

@@ -134,4 +135,15 @@ public class DeviceInfo implements Parcelable {
    public Bundle getExtras() {
        return mExtras;
    }

    @Override
    public boolean equals(@Nullable Object obj) {
        if (!(obj instanceof DeviceInfo other)) return false;
        return Objects.equals(mBluetoothAddress, other.getBluetoothAddress());
    }

    @Override
    public int hashCode() {
        return Objects.hash(mBluetoothAddress);
    }
}
+13 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.Objects;

@@ -162,4 +163,16 @@ public class DeviceSettingState implements Parcelable {
    public Bundle getExtras() {
        return mExtras;
    }

    @Override
    public boolean equals(@Nullable Object obj) {
        if (!(obj instanceof DeviceSettingState other)) return false;
        return mSettingId == other.mSettingId
                && Objects.equals(mPreferenceState, other.mPreferenceState);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mSettingId, mPreferenceState);
    }
}
+24 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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 com.android.settingslib.bluetooth.devicesettings;

import com.android.settingslib.bluetooth.devicesettings.DeviceInfo;
import com.android.settingslib.bluetooth.devicesettings.DeviceSettingsConfig;

interface IDeviceSettingsConfigProviderService {
   DeviceSettingsConfig getDeviceSettingsConfig(in DeviceInfo device);
}
 No newline at end of file
Loading