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

Commit 533f65d3 authored by David Duarte's avatar David Duarte Committed by Gerrit Code Review
Browse files

Merge "Config: Replace removeProfileFromSupportedList by setProfileEnabled" into main

parents 67dd5e02 a1a3d0f1
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -1041,19 +1041,14 @@ public class AdapterService extends Service {
                    false, LeAudioService.class, BluetoothProfile.LE_AUDIO_BROADCAST);
        }

        if (!nonSupportedProfiles.isEmpty()) {
            // Remove non-supported profiles from the supported list
            // since the controller doesn't support
            Config.removeProfileFromSupportedList(nonSupportedProfiles);

        // Disable the non-supported profiles service
        for (Class profileService : nonSupportedProfiles) {
            Config.setProfileEnabled(profileService, false);
            if (isStartedProfile(profileService.getSimpleName())) {
                setProfileServiceState(profileService, BluetoothAdapter.STATE_OFF);
            }
        }
    }
    }

    void updateAdapterState(int prevState, int newState) {
        mAdapterProperties.setState(newState);
+0 −18
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ import com.android.internal.annotations.VisibleForTesting;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;

public class Config {
@@ -236,23 +235,6 @@ public class Config {
        }
    }

    /**
     * Remove the input profiles from the supported list.
     */
    static void removeProfileFromSupportedList(HashSet<Class> nonSupportedProfiles) {
        synchronized (sSupportedProfiles) {
            Iterator<Class> iter = sSupportedProfiles.iterator();
            while (iter.hasNext()) {
                Class profileClass = iter.next();

                if (nonSupportedProfiles.contains(profileClass)) {
                    iter.remove();
                    Log.v(TAG, "Remove " + profileClass.getSimpleName() + " from supported list.");
                }
            }
        }
    }

    static void updateSupportedProfileMask(Boolean enable, Class profile, int supportedProfile) {
        for (ProfileConfig config : PROFILE_SERVICES_AND_FLAGS) {
            if (config.mClass == profile) {