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

Commit 6c52ba12 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use component flag to configure profile support flag."

parents b40a6d2a 38f522ed
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources;
import android.provider.Settings;
import android.provider.Settings;
import android.util.ArrayMap;
import android.util.FeatureFlagUtils;
import android.util.FeatureFlagUtils;
import android.util.Log;
import android.util.Log;


@@ -42,6 +43,7 @@ import com.android.bluetooth.pan.PanService;
import com.android.bluetooth.pbap.BluetoothPbapService;
import com.android.bluetooth.pbap.BluetoothPbapService;
import com.android.bluetooth.pbapclient.PbapClientService;
import com.android.bluetooth.pbapclient.PbapClientService;
import com.android.bluetooth.sap.SapService;
import com.android.bluetooth.sap.SapService;
import com.android.server.SystemConfig;


import java.util.ArrayList;
import java.util.ArrayList;


@@ -112,6 +114,11 @@ public class Config {
        if (resources == null) {
        if (resources == null) {
            return;
            return;
        }
        }
        SystemConfig systemConfig = SystemConfig.getInstance();
        ArrayMap<String, Boolean> componentEnabledStates = null;
        if (systemConfig != null) {
            componentEnabledStates = systemConfig.getComponentsEnabledStates(ctx.getPackageName());
        }


        ArrayList<Class> profiles = new ArrayList<>(PROFILE_SERVICES_AND_FLAGS.length);
        ArrayList<Class> profiles = new ArrayList<>(PROFILE_SERVICES_AND_FLAGS.length);
        for (ProfileConfig config : PROFILE_SERVICES_AND_FLAGS) {
        for (ProfileConfig config : PROFILE_SERVICES_AND_FLAGS) {
@@ -123,6 +130,13 @@ public class Config {
                supported = true;
                supported = true;
            }
            }


            if (componentEnabledStates != null
                    && componentEnabledStates.containsKey(config.mClass.getName())) {
                supported = componentEnabledStates.get(config.mClass.getName());
                Log.v(TAG, config.mClass.getSimpleName() + " Feature Flag set to " + supported
                        + " by components configuration");
            }

            if (supported && !isProfileDisabled(ctx, config.mMask)) {
            if (supported && !isProfileDisabled(ctx, config.mMask)) {
                Log.v(TAG, "Adding " + config.mClass.getSimpleName());
                Log.v(TAG, "Adding " + config.mClass.getSimpleName());
                profiles.add(config.mClass);
                profiles.add(config.mClass);