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

Commit bf23e6ae authored by Vlad Popa's avatar Vlad Popa Committed by Automerger Merge Worker
Browse files

Merge "CSD: Implement new logic for enabling CSD" into udc-qpr-dev am: 2dcffbe7

parents c7c28eca 2dcffbe7
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -9974,6 +9974,13 @@ public final class Settings {
         */
        public static final String AUDIO_DEVICE_INVENTORY = "audio_device_inventory";
        /**
         * Stores a boolean that defines whether the CSD as a feature is enabled or not.
         * @hide
         */
        public static final String AUDIO_SAFE_CSD_AS_A_FEATURE_ENABLED =
                "audio_safe_csd_as_a_feature_enabled";
        /**
         * Indicates whether notification display on the lock screen is enabled.
         * <p>
+7 −6
Original line number Diff line number Diff line
@@ -3013,14 +3013,15 @@
         on the headphone/microphone jack. When false use the older uevent framework. -->
    <bool name="config_useDevInputEventForAudioJack">false</bool>

    <!-- Whether safe headphone volume is enabled or not (country specific). -->
    <!-- Whether safe headphone hearing is enforced by any regulation (e.g.
         EN50332-3, EN50332-2) or not (country specific). -->
    <bool name="config_safe_media_volume_enabled">true</bool>

    <!-- Whether safe headphone sound dosage warning is enabled or not
         (country specific). This value should only be overlaid to true
         when a vendor supports offload and has the HAL sound dose
         interfaces implemented. Otherwise, this can lead to a compliance
         issue with the safe hearing standards EN50332-3 and IEC62368-1.
    <!-- Whether safe headphone sound dosage warning is enabled or not.
         This value should only be overlaid to true when a vendor supports
         offload and has the HAL sound dose interfaces implemented.
         Otherwise, this can lead to a compliance issue with the safe
         hearing standards EN50332-3 and IEC62368-1.
    -->
    <bool name="config_safe_sound_dosage_enabled">false</bool>

+47 −1
Original line number Diff line number Diff line
@@ -6915,7 +6915,10 @@ public class AudioManager {

    /**
     * @hide
     * Returns whether CSD is enabled and supported by the HAL on this device.
     * Returns whether CSD is enabled and supported by the current active audio module HAL.
     * This method will return {@code false) for setups in which CSD as a feature is available
     * (see {@link AudioManager#isCsdAsAFeatureAvailable()}) and not enabled (see
     * {@link AudioManager#isCsdAsAFeatureEnabled()}).
     */
    @TestApi
    @RequiresPermission(Manifest.permission.MODIFY_AUDIO_SETTINGS_PRIVILEGED)
@@ -6927,6 +6930,49 @@ public class AudioManager {
        }
    }

    /**
     * @hide
     * Returns whether CSD as a feature can be manipulated by a client. This method
     * returns {@code true} in countries where there isn't a safe hearing regulation
     * enforced.
     */
    @RequiresPermission(Manifest.permission.MODIFY_AUDIO_SETTINGS_PRIVILEGED)
    public boolean isCsdAsAFeatureAvailable() {
        try {
            return getService().isCsdAsAFeatureAvailable();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * @hide
     * Returns {@code true} if the client has enabled CSD. This function should only
     * be called if {@link AudioManager#isCsdAsAFeatureAvailable()} returns {@code true}.
     */
    @RequiresPermission(Manifest.permission.MODIFY_AUDIO_SETTINGS_PRIVILEGED)
    public boolean isCsdAsAFeatureEnabled() {
        try {
            return getService().isCsdAsAFeatureEnabled();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * @hide
     * Enables/disables the CSD feature. This function should only be called if
     * {@link AudioManager#isCsdAsAFeatureAvailable()} returns {@code true}.
     */
    @RequiresPermission(Manifest.permission.MODIFY_AUDIO_SETTINGS_PRIVILEGED)
    public void setCsdAsAFeatureEnabled(boolean csdToggleValue) {
        try {
            getService().setCsdAsAFeatureEnabled(csdToggleValue);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * @hide
     * Describes an audio device that has not been categorized with a specific
+9 −0
Original line number Diff line number Diff line
@@ -322,6 +322,15 @@ interface IAudioService {
    @EnforcePermission("MODIFY_AUDIO_SETTINGS_PRIVILEGED")
    boolean isCsdEnabled();

    @EnforcePermission("MODIFY_AUDIO_SETTINGS_PRIVILEGED")
    boolean isCsdAsAFeatureAvailable();

    @EnforcePermission("MODIFY_AUDIO_SETTINGS_PRIVILEGED")
    boolean isCsdAsAFeatureEnabled();

    @EnforcePermission("MODIFY_AUDIO_SETTINGS_PRIVILEGED")
    oneway void setCsdAsAFeatureEnabled(boolean csdToggleValue);

    @EnforcePermission("MODIFY_AUDIO_SETTINGS_PRIVILEGED")
    oneway void setBluetoothAudioDeviceCategory(in String address, boolean isBle, int deviceType);

+2 −1
Original line number Diff line number Diff line
@@ -703,7 +703,8 @@ public class SettingsBackupTest {
                 Settings.Secure.ASSIST_SCREENSHOT_ENABLED,
                 Settings.Secure.ASSIST_STRUCTURE_ENABLED,
                 Settings.Secure.ATTENTIVE_TIMEOUT,
                 Settings.Secure.AUDIO_DEVICE_INVENTORY, // setting not controllable by user
                 Settings.Secure.AUDIO_DEVICE_INVENTORY, // not controllable by user
                 Settings.Secure.AUDIO_SAFE_CSD_AS_A_FEATURE_ENABLED, // not controllable by user
                 Settings.Secure.AUTOFILL_FEATURE_FIELD_CLASSIFICATION,
                 Settings.Secure.AUTOFILL_USER_DATA_MAX_CATEGORY_COUNT,
                 Settings.Secure.AUTOFILL_USER_DATA_MAX_FIELD_CLASSIFICATION_IDS_SIZE,
Loading