Loading framework/java/android/bluetooth/BluetoothAdapter.java +24 −2 Original line number Diff line number Diff line Loading @@ -1899,6 +1899,20 @@ public final class BluetoothAdapter { return 0; } /** * Return true if Hearing Aid Profile is supported. * * @return true if phone supports Hearing Aid Profile */ private boolean isHearingAidProfileSupported() { try { return mManagerService.isHearingAidProfileSupported(); } catch (RemoteException e) { Log.e(TAG, "remote expection when calling isHearingAidProfileSupported", e); return false; } } /** * Get the maximum number of connected audio devices. * Loading Loading @@ -2051,6 +2065,11 @@ public final class BluetoothAdapter { supportedProfiles.add(i); } } } else { // Bluetooth is disabled. Just fill in known supported Profiles if (isHearingAidProfileSupported()) { supportedProfiles.add(BluetoothProfile.HEARING_AID); } } } } catch (RemoteException e) { Loading Loading @@ -2525,8 +2544,11 @@ public final class BluetoothAdapter { BluetoothHidDevice hidDevice = new BluetoothHidDevice(context, listener); return true; } else if (profile == BluetoothProfile.HEARING_AID) { if (isHearingAidProfileSupported()) { BluetoothHearingAid hearingAid = new BluetoothHearingAid(context, listener); return true; } return false; } else { return false; } Loading service/java/com/android/server/bluetooth/BluetoothManagerService.java +15 −2 Original line number Diff line number Diff line Loading @@ -208,6 +208,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub { private int mErrorRecoveryRetryCounter; private final int mSystemUiUid; private boolean mIsHearingAidProfileSupported; // Save a ProfileServiceConnections object for each of the bound // bluetooth profile services private final Map<Integer, ProfileServiceConnections> mProfileServices = new HashMap<>(); Loading Loading @@ -391,13 +393,19 @@ class BluetoothManagerService extends IBluetoothManager.Stub { mCallbacks = new RemoteCallbackList<IBluetoothManagerCallback>(); mStateChangeCallbacks = new RemoteCallbackList<IBluetoothStateChangeCallback>(); mIsHearingAidProfileSupported = context.getResources() .getBoolean(com.android.internal.R.bool.config_hearing_aid_profile_supported); // 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); boolean isHearingAidEnabled = Boolean.parseBoolean(value); Log.v(TAG, "set feature flag HEARING_AID_SETTINGS to " + isHearingAidEnabled); FeatureFlagUtils.setEnabled(context, FeatureFlagUtils.HEARING_AID_SETTINGS, isHearingAidEnabled); if (isHearingAidEnabled && !mIsHearingAidProfileSupported) { // Overwrite to enable support by FeatureFlag mIsHearingAidProfileSupported = true; } } IntentFilter filter = new IntentFilter(); Loading Loading @@ -679,6 +687,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub { return false; } @Override public boolean isHearingAidProfileSupported() { return mIsHearingAidProfileSupported; } // Monitor change of BLE scan only mode settings. private void registerForBleScanModeChange() { ContentObserver contentObserver = new ContentObserver(null) { Loading Loading
framework/java/android/bluetooth/BluetoothAdapter.java +24 −2 Original line number Diff line number Diff line Loading @@ -1899,6 +1899,20 @@ public final class BluetoothAdapter { return 0; } /** * Return true if Hearing Aid Profile is supported. * * @return true if phone supports Hearing Aid Profile */ private boolean isHearingAidProfileSupported() { try { return mManagerService.isHearingAidProfileSupported(); } catch (RemoteException e) { Log.e(TAG, "remote expection when calling isHearingAidProfileSupported", e); return false; } } /** * Get the maximum number of connected audio devices. * Loading Loading @@ -2051,6 +2065,11 @@ public final class BluetoothAdapter { supportedProfiles.add(i); } } } else { // Bluetooth is disabled. Just fill in known supported Profiles if (isHearingAidProfileSupported()) { supportedProfiles.add(BluetoothProfile.HEARING_AID); } } } } catch (RemoteException e) { Loading Loading @@ -2525,8 +2544,11 @@ public final class BluetoothAdapter { BluetoothHidDevice hidDevice = new BluetoothHidDevice(context, listener); return true; } else if (profile == BluetoothProfile.HEARING_AID) { if (isHearingAidProfileSupported()) { BluetoothHearingAid hearingAid = new BluetoothHearingAid(context, listener); return true; } return false; } else { return false; } Loading
service/java/com/android/server/bluetooth/BluetoothManagerService.java +15 −2 Original line number Diff line number Diff line Loading @@ -208,6 +208,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub { private int mErrorRecoveryRetryCounter; private final int mSystemUiUid; private boolean mIsHearingAidProfileSupported; // Save a ProfileServiceConnections object for each of the bound // bluetooth profile services private final Map<Integer, ProfileServiceConnections> mProfileServices = new HashMap<>(); Loading Loading @@ -391,13 +393,19 @@ class BluetoothManagerService extends IBluetoothManager.Stub { mCallbacks = new RemoteCallbackList<IBluetoothManagerCallback>(); mStateChangeCallbacks = new RemoteCallbackList<IBluetoothStateChangeCallback>(); mIsHearingAidProfileSupported = context.getResources() .getBoolean(com.android.internal.R.bool.config_hearing_aid_profile_supported); // 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); boolean isHearingAidEnabled = Boolean.parseBoolean(value); Log.v(TAG, "set feature flag HEARING_AID_SETTINGS to " + isHearingAidEnabled); FeatureFlagUtils.setEnabled(context, FeatureFlagUtils.HEARING_AID_SETTINGS, isHearingAidEnabled); if (isHearingAidEnabled && !mIsHearingAidProfileSupported) { // Overwrite to enable support by FeatureFlag mIsHearingAidProfileSupported = true; } } IntentFilter filter = new IntentFilter(); Loading Loading @@ -679,6 +687,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub { return false; } @Override public boolean isHearingAidProfileSupported() { return mIsHearingAidProfileSupported; } // Monitor change of BLE scan only mode settings. private void registerForBleScanModeChange() { ContentObserver contentObserver = new ContentObserver(null) { Loading