mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Merge pull request #9498 from DolbyLaboratories:dev-v2-direct-automotive
PiperOrigin-RevId: 400134426
This commit is contained in:
commit
9926a8f6e3
@ -2305,6 +2305,17 @@ public final class Util {
|
|||||||
&& uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION;
|
&& uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the app is running on an automotive device.
|
||||||
|
*
|
||||||
|
* @param context Any context.
|
||||||
|
* @return Whether the app is running on an automotive device.
|
||||||
|
*/
|
||||||
|
public static boolean isAutomotive(Context context) {
|
||||||
|
return Util.SDK_INT >= 23
|
||||||
|
&& context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the size of the current mode of the default display, in pixels.
|
* Gets the size of the current mode of the default display, in pixels.
|
||||||
*
|
*
|
||||||
|
@ -90,8 +90,9 @@ public final class AudioCapabilities {
|
|||||||
}
|
}
|
||||||
// AudioTrack.isDirectPlaybackSupported returns true for encodings that are supported for audio
|
// AudioTrack.isDirectPlaybackSupported returns true for encodings that are supported for audio
|
||||||
// offload, as well as for encodings we want to list for passthrough mode. Therefore we only use
|
// offload, as well as for encodings we want to list for passthrough mode. Therefore we only use
|
||||||
// it on TV devices, which generally shouldn't support audio offload for surround encodings.
|
// it on TV and automotive devices, which generally shouldn't support audio offload for surround
|
||||||
if (Util.SDK_INT >= 29 && Util.isTv(context)) {
|
// encodings.
|
||||||
|
if (Util.SDK_INT >= 29 && (Util.isTv(context) || Util.isAutomotive(context))) {
|
||||||
return new AudioCapabilities(
|
return new AudioCapabilities(
|
||||||
Api29.getDirectPlaybackSupportedEncodings(), DEFAULT_MAX_CHANNEL_COUNT);
|
Api29.getDirectPlaybackSupportedEncodings(), DEFAULT_MAX_CHANNEL_COUNT);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user