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

Commit 07baad83 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4683893 from 7b4ab788 to pi-release

Change-Id: Id7d3b0122a2e31f858a9d6b5a1344972c9224ec3
parents fa753612 7b4ab788
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -313,6 +313,7 @@ ACameraMetadata::isCaptureRequestTag(const uint32_t tag) {
        case ACAMERA_TONEMAP_GAMMA:
        case ACAMERA_TONEMAP_PRESET_CURVE:
        case ACAMERA_BLACK_LEVEL_LOCK:
        case ACAMERA_DISTORTION_CORRECTION_MODE:
            return true;
        default:
            return false;
+84 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ typedef enum acamera_metadata_section {
    ACAMERA_REPROCESS,
    ACAMERA_DEPTH,
    ACAMERA_LOGICAL_MULTI_CAMERA,
    ACAMERA_DISTORTION_CORRECTION,
    ACAMERA_SECTION_COUNT,

    ACAMERA_VENDOR = 0x8000
@@ -108,6 +109,9 @@ typedef enum acamera_metadata_section_start {
    ACAMERA_LOGICAL_MULTI_CAMERA_START
                                   = ACAMERA_LOGICAL_MULTI_CAMERA
                                                                << 16,
    ACAMERA_DISTORTION_CORRECTION_START
                                   = ACAMERA_DISTORTION_CORRECTION
                                                                << 16,
    ACAMERA_VENDOR_START           = ACAMERA_VENDOR            << 16
} acamera_metadata_section_start_t;

@@ -5285,6 +5289,63 @@ typedef enum acamera_metadata_tag {
            ACAMERA_LOGICAL_MULTI_CAMERA_START + 1,
    ACAMERA_LOGICAL_MULTI_CAMERA_END,

    /**
     * <p>Mode of operation for the lens distortion correction block.</p>
     *
     * <p>Type: byte (acamera_metadata_enum_android_distortion_correction_mode_t)</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks</li>
     *   <li>ACaptureRequest</li>
     * </ul></p>
     *
     * <p>The lens distortion correction block attempts to improve image quality by fixing
     * radial, tangential, or other geometric aberrations in the camera device's optics.  If
     * available, the ACAMERA_LENS_DISTORTION field documents the lens's distortion parameters.</p>
     * <p>OFF means no distortion correction is done.</p>
     * <p>FAST/HIGH_QUALITY both mean camera device determined distortion correction will be
     * applied. HIGH_QUALITY mode indicates that the camera device will use the highest-quality
     * correction algorithms, even if it slows down capture rate. FAST means the camera device
     * will not slow down capture rate when applying correction. FAST may be the same as OFF if
     * any correction at all would slow down capture rate.  Every output stream will have a
     * similar amount of enhancement applied.</p>
     * <p>The correction only applies to processed outputs such as YUV, JPEG, or DEPTH16; it is not
     * applied to any RAW output.  Metadata coordinates such as face rectangles or metering
     * regions are also not affected by correction.</p>
     * <p>Applications enabling distortion correction need to pay extra attention when converting
     * image coordinates between corrected output buffers and the sensor array. For example, if
     * the app supports tap-to-focus and enables correction, it then has to apply the distortion
     * model described in ACAMERA_LENS_DISTORTION to the image buffer tap coordinates to properly
     * calculate the tap position on the sensor active array to be used with
     * ACAMERA_CONTROL_AF_REGIONS. The same applies in reverse to detected face rectangles if
     * they need to be drawn on top of the corrected output buffers.</p>
     *
     * @see ACAMERA_CONTROL_AF_REGIONS
     * @see ACAMERA_LENS_DISTORTION
     */
    ACAMERA_DISTORTION_CORRECTION_MODE =                        // byte (acamera_metadata_enum_android_distortion_correction_mode_t)
            ACAMERA_DISTORTION_CORRECTION_START,
    /**
     * <p>List of distortion correction modes for ACAMERA_DISTORTION_CORRECTION_MODE that are
     * supported by this camera device.</p>
     *
     * @see ACAMERA_DISTORTION_CORRECTION_MODE
     *
     * <p>Type: byte[n]</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
     * </ul></p>
     *
     * <p>No device is required to support this API; such devices will always list only 'OFF'.
     * All devices that support this API will list both FAST and HIGH_QUALITY.</p>
     */
    ACAMERA_DISTORTION_CORRECTION_AVAILABLE_MODES =             // byte[n]
            ACAMERA_DISTORTION_CORRECTION_START + 1,
    ACAMERA_DISTORTION_CORRECTION_END,

} acamera_metadata_tag_t;

/**
@@ -7682,6 +7743,29 @@ typedef enum acamera_metadata_enum_acamera_logical_multi_camera_sensor_sync_type
} acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t;


// ACAMERA_DISTORTION_CORRECTION_MODE
typedef enum acamera_metadata_enum_acamera_distortion_correction_mode {
    /**
     * <p>No distortion correction is applied.</p>
     */
    ACAMERA_DISTORTION_CORRECTION_MODE_OFF                           = 0,

    /**
     * <p>Lens distortion correction is applied without reducing frame rate
     * relative to sensor output. It may be the same as OFF if distortion correction would
     * reduce frame rate relative to sensor.</p>
     */
    ACAMERA_DISTORTION_CORRECTION_MODE_FAST                          = 1,

    /**
     * <p>High-quality distortion correction is applied, at the cost of
     * possibly reduced frame rate relative to sensor output.</p>
     */
    ACAMERA_DISTORTION_CORRECTION_MODE_HIGH_QUALITY                  = 2,

} acamera_metadata_enum_android_distortion_correction_mode_t;


#endif /* __ANDROID_API__ >= 24 */

__END_DECLS
+4 −2
Original line number Diff line number Diff line
@@ -903,13 +903,15 @@ status_t BnAudioFlinger::onTransact(
        case SET_MODE:
        case SET_MIC_MUTE:
        case SET_LOW_RAM_DEVICE:
        case SYSTEM_READY:
            if (IPCThreadState::self()->getCallingUid() >= AID_APP_START) {
        case SYSTEM_READY: {
            uid_t multiUserClientUid = IPCThreadState::self()->getCallingUid() % AID_USER_OFFSET;
            if (multiUserClientUid >= AID_APP_START) {
                ALOGW("%s: transaction %d received from PID %d unauthorized UID %d",
                      __func__, code, IPCThreadState::self()->getCallingPid(),
                      IPCThreadState::self()->getCallingUid());
                return INVALID_OPERATION;
            }
        } break;
        default:
            break;
    }
+18 −3
Original line number Diff line number Diff line
@@ -872,18 +872,33 @@ status_t BnAudioPolicyService::onTransact(
        case INIT_STREAM_VOLUME:
        case SET_STREAM_VOLUME:
        case REGISTER_POLICY_MIXES:
        case SET_MASTER_MONO:
            if (IPCThreadState::self()->getCallingUid() >= AID_APP_START) {
        case SET_MASTER_MONO: {
            uid_t multiUserClientUid = IPCThreadState::self()->getCallingUid() % AID_USER_OFFSET;
            if (multiUserClientUid >= AID_APP_START) {
                ALOGW("%s: transaction %d received from PID %d unauthorized UID %d",
                      __func__, code, IPCThreadState::self()->getCallingPid(),
                      IPCThreadState::self()->getCallingUid());
                return INVALID_OPERATION;
            }
        } break;
        default:
            break;
    }

    // FIXME: extend timeout for SET_DEVICE_CONNECTION_STATE and HANDLE_DEVICE_CONFIG_CHANGE
    // while we investigate why BT A2DP device connection/disconnection can sometimes
    // take more than 5 seconds
    uint32_t timeoutMs = TimeCheck::kDefaultTimeOutMs;
    switch (code) {
        case SET_DEVICE_CONNECTION_STATE:
        case HANDLE_DEVICE_CONFIG_CHANGE:
            timeoutMs *= 2;
            break;
        default:
            break;
    }

    TimeCheck check("IAudioPolicyService");
    TimeCheck check("IAudioPolicyService", timeoutMs);

    switch (code) {
        case SET_DEVICE_CONNECTION_STATE: {
+44 −45
Original line number Diff line number Diff line
@@ -16,20 +16,20 @@

package com.android.media;

import static android.media.MediaSession2.COMMAND_CODE_PLAYBACK_SET_VOLUME;
import static android.media.MediaSession2.COMMAND_CODE_PLAYLIST_ADD_ITEM;
import static android.media.MediaSession2.COMMAND_CODE_PLAYLIST_REMOVE_ITEM;
import static android.media.MediaSession2.COMMAND_CODE_PLAYLIST_REPLACE_ITEM;
import static android.media.MediaSession2.COMMAND_CODE_PLAYLIST_SET_LIST;
import static android.media.MediaSession2.COMMAND_CODE_PLAYLIST_SET_LIST_METADATA;
import static android.media.MediaSession2.COMMAND_CODE_PLAYLIST_SET_REPEAT_MODE;
import static android.media.MediaSession2.COMMAND_CODE_PLAYLIST_SET_SHUFFLE_MODE;
import static android.media.MediaSession2.COMMAND_CODE_SESSION_PLAY_FROM_MEDIA_ID;
import static android.media.MediaSession2.COMMAND_CODE_SESSION_PLAY_FROM_SEARCH;
import static android.media.MediaSession2.COMMAND_CODE_SESSION_PLAY_FROM_URI;
import static android.media.MediaSession2.COMMAND_CODE_SESSION_PREPARE_FROM_MEDIA_ID;
import static android.media.MediaSession2.COMMAND_CODE_SESSION_PREPARE_FROM_SEARCH;
import static android.media.MediaSession2.COMMAND_CODE_SESSION_PREPARE_FROM_URI;
import static android.media.SessionCommand2.COMMAND_CODE_SET_VOLUME;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_ADD_ITEM;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_REMOVE_ITEM;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_REPLACE_ITEM;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SET_LIST;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SET_LIST_METADATA;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SET_REPEAT_MODE;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SET_SHUFFLE_MODE;
import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PLAY_FROM_MEDIA_ID;
import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PLAY_FROM_SEARCH;
import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PLAY_FROM_URI;
import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PREPARE_FROM_MEDIA_ID;
import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PREPARE_FROM_SEARCH;
import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PREPARE_FROM_URI;

import android.app.PendingIntent;
import android.content.ComponentName;
@@ -44,10 +44,9 @@ import android.media.MediaItem2;
import android.media.MediaMetadata2;
import android.media.MediaPlaylistAgent.RepeatMode;
import android.media.MediaPlaylistAgent.ShuffleMode;
import android.media.MediaSession2;
import android.media.MediaSession2.Command;
import android.media.SessionCommand2;
import android.media.MediaSession2.CommandButton;
import android.media.MediaSession2.CommandGroup;
import android.media.SessionCommandGroup2;
import android.media.MediaSessionService2;
import android.media.Rating2;
import android.media.SessionToken2;
@@ -108,7 +107,7 @@ public class MediaController2Impl implements MediaController2Provider {
    @GuardedBy("mLock")
    private PendingIntent mSessionActivity;
    @GuardedBy("mLock")
    private CommandGroup mAllowedCommands;
    private SessionCommandGroup2 mAllowedCommands;

    // Assignment should be used with the lock hold, but should be used without a lock to prevent
    // potential deadlock.
@@ -297,7 +296,7 @@ public class MediaController2Impl implements MediaController2Provider {
    }

    // Returns session binder if the controller can send the command.
    IMediaSession2 getSessionBinderIfAble(Command command) {
    IMediaSession2 getSessionBinderIfAble(SessionCommand2 command) {
        synchronized (mLock) {
            if (!mAllowedCommands.hasCommand(command)) {
                Log.w(TAG, "Controller isn't allowed to call command, command=" + command);
@@ -326,17 +325,17 @@ public class MediaController2Impl implements MediaController2Provider {

    @Override
    public void play_impl() {
        sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_PLAY);
        sendTransportControlCommand(SessionCommand2.COMMAND_CODE_PLAYBACK_PLAY);
    }

    @Override
    public void pause_impl() {
        sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_PAUSE);
        sendTransportControlCommand(SessionCommand2.COMMAND_CODE_PLAYBACK_PAUSE);
    }

    @Override
    public void stop_impl() {
        sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_STOP);
        sendTransportControlCommand(SessionCommand2.COMMAND_CODE_PLAYBACK_STOP);
    }

    @Override
@@ -409,7 +408,7 @@ public class MediaController2Impl implements MediaController2Provider {
    @Override
    public void setVolumeTo_impl(int value, int flags) {
        // TODO(hdmoon): sanity check
        final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAYBACK_SET_VOLUME);
        final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_SET_VOLUME);
        if (binder != null) {
            try {
                binder.setVolumeTo(mControllerStub, value, flags);
@@ -424,7 +423,7 @@ public class MediaController2Impl implements MediaController2Provider {
    @Override
    public void adjustVolume_impl(int direction, int flags) {
        // TODO(hdmoon): sanity check
        final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_PLAYBACK_SET_VOLUME);
        final IMediaSession2 binder = getSessionBinderIfAble(COMMAND_CODE_SET_VOLUME);
        if (binder != null) {
            try {
                binder.adjustVolume(mControllerStub, direction, flags);
@@ -563,7 +562,7 @@ public class MediaController2Impl implements MediaController2Provider {
    }

    @Override
    public void sendCustomCommand_impl(Command command, Bundle args, ResultReceiver cb) {
    public void sendCustomCommand_impl(SessionCommand2 command, Bundle args, ResultReceiver cb) {
        if (command == null) {
            throw new IllegalArgumentException("command shouldn't be null");
        }
@@ -633,17 +632,19 @@ public class MediaController2Impl implements MediaController2Provider {

    @Override
    public void prepare_impl() {
        sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_PREPARE);
        sendTransportControlCommand(SessionCommand2.COMMAND_CODE_PLAYBACK_PREPARE);
    }

    @Override
    public void fastForward_impl() {
        sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_FAST_FORWARD);
        // TODO(jaewan): Implement this. Note that fast forward isn't a transport command anymore
        //sendTransportControlCommand(MediaSession2.COMMAND_CODE_SESSION_FAST_FORWARD);
    }

    @Override
    public void rewind_impl() {
        sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_REWIND);
        // TODO(jaewan): Implement this. Note that rewind isn't a transport command anymore
        //sendTransportControlCommand(MediaSession2.COMMAND_CODE_SESSION_REWIND);
    }

    @Override
@@ -653,7 +654,7 @@ public class MediaController2Impl implements MediaController2Provider {
        }
        Bundle args = new Bundle();
        args.putLong(MediaSession2Stub.ARGUMENT_KEY_POSITION, pos);
        sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_SEEK_TO, args);
        sendTransportControlCommand(SessionCommand2.COMMAND_CODE_PLAYBACK_SEEK_TO, args);
    }

    @Override
@@ -807,6 +808,7 @@ public class MediaController2Impl implements MediaController2Provider {
        });
    }

    // TODO(jaewan): Rename to seek completed
    void pushPositionChanges(final long eventTimeMs, final long positionMs) {
        synchronized (mLock) {
            mPositionEventTimeMs = eventTimeMs;
@@ -816,7 +818,7 @@ public class MediaController2Impl implements MediaController2Provider {
            if (!mInstance.isConnected()) {
                return;
            }
            mCallback.onPositionChanged(mInstance, eventTimeMs, positionMs);
            mCallback.onSeekCompleted(mInstance, positionMs);
        });
    }

@@ -917,7 +919,7 @@ public class MediaController2Impl implements MediaController2Provider {

    // Should be used without a lock to prevent potential deadlock.
    void onConnectedNotLocked(IMediaSession2 sessionBinder,
            final CommandGroup allowedCommands,
            final SessionCommandGroup2 allowedCommands,
            final int playerState,
            final long positionEventTimeMs,
            final long positionMs,
@@ -989,7 +991,7 @@ public class MediaController2Impl implements MediaController2Provider {
        }
    }

    void onCustomCommand(final Command command, final Bundle args,
    void onCustomCommand(final SessionCommand2 command, final Bundle args,
            final ResultReceiver receiver) {
        if (DEBUG) {
            Log.d(TAG, "onCustomCommand cmd=" + command);
@@ -1000,7 +1002,7 @@ public class MediaController2Impl implements MediaController2Provider {
        });
    }

    void onAllowedCommandsChanged(final CommandGroup commands) {
    void onAllowedCommandsChanged(final SessionCommandGroup2 commands) {
        mCallbackExecutor.execute(() -> {
            mCallback.onAllowedCommandsChanged(mInstance, commands);
        });
@@ -1062,7 +1064,6 @@ public class MediaController2Impl implements MediaController2Provider {
        private static final String KEY_AUDIO_ATTRIBUTES =
                "android.media.playbackinfo_impl.audio_attrs";

        private final Context mContext;
        private final PlaybackInfo mInstance;

        private final int mPlaybackType;
@@ -1071,9 +1072,8 @@ public class MediaController2Impl implements MediaController2Provider {
        private final int mCurrentVolume;
        private final AudioAttributes mAudioAttrs;

        private PlaybackInfoImpl(Context context, int playbackType, AudioAttributes attrs,
                int controlType, int max, int current) {
            mContext = context;
        private PlaybackInfoImpl(int playbackType, AudioAttributes attrs, int controlType,
                int max, int current) {
            mPlaybackType = playbackType;
            mAudioAttrs = attrs;
            mControlType = controlType;
@@ -1107,11 +1107,11 @@ public class MediaController2Impl implements MediaController2Provider {
            return mCurrentVolume;
        }

        public PlaybackInfo getInstance() {
        PlaybackInfo getInstance() {
            return mInstance;
        }

        public Bundle toBundle() {
        Bundle toBundle() {
            Bundle bundle = new Bundle();
            bundle.putInt(KEY_PLAYBACK_TYPE, mPlaybackType);
            bundle.putInt(KEY_CONTROL_TYPE, mControlType);
@@ -1121,13 +1121,13 @@ public class MediaController2Impl implements MediaController2Provider {
            return bundle;
        }

        public static PlaybackInfo createPlaybackInfo(Context context, int playbackType,
                AudioAttributes attrs, int controlType, int max, int current) {
            return new PlaybackInfoImpl(context, playbackType, attrs, controlType, max, current)
        static PlaybackInfo createPlaybackInfo(int playbackType, AudioAttributes attrs,
                int controlType, int max, int current) {
            return new PlaybackInfoImpl(playbackType, attrs, controlType, max, current)
                    .getInstance();
        }

        public static PlaybackInfo fromBundle(Context context, Bundle bundle) {
        static PlaybackInfo fromBundle(Bundle bundle) {
            if (bundle == null) {
                return null;
            }
@@ -1137,8 +1137,7 @@ public class MediaController2Impl implements MediaController2Provider {
            final int currentVolume = bundle.getInt(KEY_CURRENT_VOLUME);
            final AudioAttributes attrs = bundle.getParcelable(KEY_AUDIO_ATTRIBUTES);

            return createPlaybackInfo(
                    context, volumeType, attrs, volumeControl, maxVolume, currentVolume);
            return createPlaybackInfo(volumeType, attrs, volumeControl, maxVolume, currentVolume);
        }
    }
}
Loading