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

Commit d68c74c6 authored by bkchoi's avatar bkchoi
Browse files

Set the correct platform type in AudioSystem#getPlatformType().

Due to a recent change, AudioService#isPlatformAutomotive() was
returning false on Automotive devices when TELEPHONEY_SERVICE is
enabled. It casued a regression in some CTS.
Change the order that decides the platform type in
AudioSystem#getPlatformType() to set the platfrom type correctly.

Fixes: 313554195

Test: atest com.android.cts.devicepolicy.MixedProfileOwnerTest#testAudioRestriction

Change-Id: I1e1937ea5135262bd7941f084bda1679c8753ac7
parent ff50b586
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -2499,14 +2499,12 @@ public class AudioSystem
     * </ul>
     */
    public static int getPlatformType(Context context) {
        if (((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE))
                .isVoiceCapable()) {
        if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
            return PLATFORM_AUTOMOTIVE;
        } else if ((context.getSystemService(TelephonyManager.class)).isVoiceCapable()) {
            return PLATFORM_VOICE;
        } else if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
            return PLATFORM_TELEVISION;
        } else if (context.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_AUTOMOTIVE)) {
            return PLATFORM_AUTOMOTIVE;
        } else {
            return PLATFORM_DEFAULT;
        }