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

Commit cfb97d48 authored by Norman Bintang's avatar Norman Bintang
Browse files

audio: Add PLATFORM_PC in AudioSystem

Add PLATFORM_PC in AudioSystem. And change getPlatformType to return
PLATFORM_PC when the device defines FEATURE_PC.

Bug: 414709012
Test: Together with the next CL, AL device is not unmuted on volume
down.
Flag: android.media.audio.enable_platform_pc_type

Cq-Depend: CL:33868354
Change-Id: I7ad68eb7f66c79adf3c7e9ac7a83401b653f00f7
parent 19cd64e7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.bluetooth.BluetoothLeAudioCodecConfig;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.pm.PackageManager;
import android.media.audio.Flags;
import android.media.audio.common.AidlConversion;
import android.media.audiofx.AudioEffect;
import android.media.audiopolicy.AudioMix;
@@ -2657,6 +2658,8 @@ public class AudioSystem
    public static final int PLATFORM_TELEVISION = 2;
    /** @hide The platform is automotive */
    public static final int PLATFORM_AUTOMOTIVE = 3;
    /** @hide The platform is pc */
    public static final int PLATFORM_PC = 4;

    /**
     * @hide
@@ -2664,6 +2667,8 @@ public class AudioSystem
     * <ul>
     * <li>{@link #PLATFORM_VOICE}</li>
     * <li>{@link #PLATFORM_TELEVISION}</li>
     * <li>{@link #PLATFORM_AUTOMOTIVE}</li>
     * <li>{@link #PLATFORM_PC}</li>
     * <li>{@link #PLATFORM_DEFAULT}</li>
     * </ul>
     */
@@ -2674,6 +2679,9 @@ public class AudioSystem
            return PLATFORM_VOICE;
        } else if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
            return PLATFORM_TELEVISION;
        } else if (Flags.enablePlatformPcType()
                       && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_PC)) {
            return PLATFORM_PC;
        } else {
            return PLATFORM_DEFAULT;
        }
+4 −0
Original line number Diff line number Diff line
@@ -425,6 +425,10 @@ public class AudioService extends IAudioService.Stub
        return mPlatformType == AudioSystem.PLATFORM_AUTOMOTIVE;
    }
    /*package*/ boolean isPlatformPc() {
        return mPlatformType == AudioSystem.PLATFORM_PC;
    }
    /** The controller for the volume UI. */
    private final VolumeController mVolumeController = new VolumeController();