diff options
| author | 2023-12-19 19:06:37 +0000 | |
|---|---|---|
| committer | 2023-12-20 19:34:19 +0000 | |
| commit | d68c74c6bae3913b2b9c3fe29138cdabf5a5d6e9 (patch) | |
| tree | cca0c9f37982281d4ea7137cdb1a01be95d5f6db | |
| parent | ff50b586a4b987d30f11922032cd113811189ccc (diff) | |
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
| -rw-r--r-- | media/java/android/media/AudioSystem.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java index 46a0b9934376..0f6cbffef300 100644 --- a/media/java/android/media/AudioSystem.java +++ b/media/java/android/media/AudioSystem.java @@ -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; } |