Merge "Fix APC documentation" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-05-10 21:10:49 +00:00
committed by Android (Google) Code Review
3 changed files with 39 additions and 35 deletions

View File

@@ -716,24 +716,23 @@ public final class AudioAttributes implements Parcelable {
}
/**
* Specifies weather the audio may or may not be captured by other apps or the system.
* Specifies whether the audio may or may not be captured by other apps or the system.
*
* The default is {@link AudioAttributes#ALLOW_CAPTURE_BY_ALL}.
*
* There are multiple ways to set this policy:
* - for each tracks independently, with this method
* - application wide at runtime, with {@link AudioManager#setAllowedCapturePolicy(int)}
* - application wide at build time, see {@code allowAudioPlaybackCapture} in the
* application manifest.
* <ul>
* <li> for each track independently, with this method </li>
* <li> application-wide at runtime, with
* {@link AudioManager#setAllowedCapturePolicy(int)} </li>
* <li> application-wide at build time, see {@code allowAudioPlaybackCapture} in the
* application manifest. </li>
* </ul>
* The most restrictive policy is always applied.
*
* See {@link AudioPlaybackCaptureConfiguration} for more details on the restrictions
* See {@link AudioPlaybackCaptureConfiguration} for more details on
* which audio signals can be captured.
*
* @param capturePolicy one of
* {@link #ALLOW_CAPTURE_BY_ALL},
* {@link #ALLOW_CAPTURE_BY_SYSTEM},
* {@link #ALLOW_CAPTURE_BY_NONE}.
* @return the same Builder instance
* @throws IllegalArgumentException if the argument is not a valid value.
*/

View File

@@ -1484,20 +1484,22 @@ public class AudioManager {
}
/**
* Specifies wheather the audio played by this app may or may not be captured by other apps or
* Specifies whether the audio played by this app may or may not be captured by other apps or
* the system.
*
* The default is {@link AudioAttributes#ALLOW_CAPTURE_BY_ALL}.
*
* There are multiple ways to set this policy:
* - for each tracks independently, see
* {@link AudioAttributes.Builder#setAllowedCapturePolicy(int)}
* - application wide at runtime, with this method
* - application wide at build time, see {@code allowAudioPlaybackCapture} in the application
* manifest.
* <ul>
* <li> for each track independently, see
* {@link AudioAttributes.Builder#setAllowedCapturePolicy(int)} </li>
* <li> application-wide at runtime, with this method </li>
* <li> application-wide at build time, see {@code allowAudioPlaybackCapture} in the application
* manifest. </li>
* </ul>
* The most restrictive policy is always applied.
*
* See {@link AudioPlaybackCaptureConfiguration} for more details on the restrictions
* See {@link AudioPlaybackCaptureConfiguration} for more details on
* which audio signals can be captured.
*
* @param capturePolicy one of

View File

@@ -34,21 +34,23 @@ import java.util.function.ToIntFunction;
* When capturing audio signals played by other apps (and yours),
* you will only capture a mix of the audio signals played by players
* (such as AudioTrack or MediaPlayer) which present the following characteristics:
* - the usage value MUST be {@link AudioAttributes#USAGE_UNKNOWN} or
* {@link AudioAttributes#USAGE_GAME}
* or {@link AudioAttributes#USAGE_MEDIA}. All other usages CAN NOT be captured.
* - AND the capture policy set by their app (with ${@link AudioManager#setAllowedCapturePolicy})
* or on each player (with ${@link AudioAttributes.Builder#setAllowedCapturePolicy}) is
* {@link AudioAttributes#ALLOW_CAPTURE_BY_ALL}, whichever is the most strict.
* - AND their app attribute allowAudioPlaybackCapture in their manifest
* MUST either be:
* * set to "true"
* * not set, and their {@code targetSdkVersion} MUST be equal or higher to
* {@link android.os.Build.VERSION_CODES#Q}.
* Ie. Apps that do not target at least Android Q must explicitly opt-in to be captured by a
* MediaProjection.
* - AND their apps MUST be in the same user profile as your app
* (eg work profile can not capture user profile apps and vice-versa).
* <ul>
* <li> the usage value MUST be {@link AudioAttributes#USAGE_UNKNOWN} or
* {@link AudioAttributes#USAGE_GAME}
* or {@link AudioAttributes#USAGE_MEDIA}. All other usages CAN NOT be captured. </li>
* <li> AND the capture policy set by their app (with {@link AudioManager#setAllowedCapturePolicy})
* or on each player (with {@link AudioAttributes.Builder#setAllowedCapturePolicy}) is
* {@link AudioAttributes#ALLOW_CAPTURE_BY_ALL}, whichever is the most strict. </li>
* <li> AND their app attribute allowAudioPlaybackCapture in their manifest
* MUST either be: <ul>
* <li> set to "true" </li>
* <li> not set, and their {@code targetSdkVersion} MUST be equal to or greater than
* {@link android.os.Build.VERSION_CODES#Q}.
* Ie. Apps that do not target at least Android Q must explicitly opt-in to be captured
* by a MediaProjection. </li></ul>
* <li> AND their apps MUST be in the same user profile as your app
* (eg work profile cannot capture user profile apps and vice-versa). </li>
* </ul>
*
* <p>An example for creating a capture configuration for capturing all media playback:
*
@@ -56,7 +58,7 @@ import java.util.function.ToIntFunction;
* MediaProjection mediaProjection;
* // Retrieve a audio capable projection from the MediaProjectionManager
* AudioPlaybackCaptureConfiguration config =
* new AudioPlaybackCaptureConfiguration.Builder(mediaProjection)
* new AudioPlaybackCaptureConfiguration.Builder(mediaProjection)
* .addMatchingUsage(AudioAttributes.USAGE_MEDIA)
* .build();
* AudioRecord record = new AudioRecord.Builder()
@@ -64,7 +66,8 @@ import java.util.function.ToIntFunction;
* .build();
* </pre>
*
* @see MediaProjectionManager#getMediaProjection(int, Intent)
* @see Builder
* @see android.media.projection.MediaProjectionManager#getMediaProjection(int, Intent)
* @see AudioRecord.Builder#setAudioPlaybackCaptureConfig(AudioPlaybackCaptureConfiguration)
*/
public final class AudioPlaybackCaptureConfiguration {
@@ -80,7 +83,7 @@ public final class AudioPlaybackCaptureConfiguration {
/**
* @return the {@code MediaProjection} used to build this object.
* @see {@code Builder.Builder}
* @see Builder#Builder(MediaProjection)
*/
public @NonNull MediaProjection getMediaProjection() {
return mProjection;