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

Commit 2a2cd5db authored by Stanley Tng's avatar Stanley Tng
Browse files

Add Feature Flag for Hearing Aid Profile

Using the Settings App-Developer Options-Feature Flag, allow the user to
enable or disable the Hearing Aid Profile.

Bug: 116317072
Bug: 116044083
Test: Manual testing using Settings App
Change-Id: I58a9d339941e235242c443c85b6f4194b5a296c9
Merged-In: I58a9d339941e235242c443c85b6f4194b5a296c9
(cherry picked from commit dea97b7e)
parent e88bc0ae
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -53,12 +53,16 @@ import android.os.Process;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManagerInternal;
import android.os.UserManagerInternal.UserRestrictionsListener;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import android.util.Log;
import android.util.Slog;
import android.util.StatsLog;

@@ -386,6 +390,15 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
        mCallbacks = new RemoteCallbackList<IBluetoothManagerCallback>();
        mStateChangeCallbacks = new RemoteCallbackList<IBluetoothStateChangeCallback>();

        // TODO: We need a more generic way to initialize the persist keys of FeatureFlagUtils
        boolean isHearingAidEnabled;
        String value = SystemProperties.get(FeatureFlagUtils.PERSIST_PREFIX + FeatureFlagUtils.HEARING_AID_SETTINGS);
        if (!TextUtils.isEmpty(value)) {
            isHearingAidEnabled = Boolean.parseBoolean(value);
            Log.v(TAG, "set feature flag HEARING_AID_SETTINGS to " + isHearingAidEnabled);
            FeatureFlagUtils.setEnabled(context, FeatureFlagUtils.HEARING_AID_SETTINGS, isHearingAidEnabled);
        }

        IntentFilter filter = new IntentFilter();
        filter.addAction(BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED);
        filter.addAction(BluetoothAdapter.ACTION_BLUETOOTH_ADDRESS_CHANGED);