Loading media/java/android/media/MediaController2.java +12 −19 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.media.MediaSession2.PlaylistParams; import android.media.session.MediaSessionManager; import android.media.update.ApiLoader; import android.media.update.MediaController2Provider; import android.media.update.PlaybackInfoProvider; import android.net.Uri; import android.os.Bundle; import android.os.ResultReceiver; Loading Loading @@ -160,21 +161,14 @@ public class MediaController2 implements AutoCloseable { */ public static final int PLAYBACK_TYPE_LOCAL = 1; private final int mVolumeType; private final int mVolumeControl; private final int mMaxVolume; private final int mCurrentVolume; private final AudioAttributes mAudioAttrs; private final PlaybackInfoProvider mProvider; /** * @hide */ public PlaybackInfo(int type, AudioAttributes attrs, int control, int max, int current) { mVolumeType = type; mAudioAttrs = attrs; mVolumeControl = control; mMaxVolume = max; mCurrentVolume = current; @SystemApi public PlaybackInfo(PlaybackInfoProvider provider) { mProvider = provider; } /** Loading @@ -187,7 +181,7 @@ public class MediaController2 implements AutoCloseable { * @return The type of playback this session is using. */ public int getPlaybackType() { return mVolumeType; return mProvider.getPlaybackType_impl(); } /** Loading @@ -199,7 +193,7 @@ public class MediaController2 implements AutoCloseable { * @return The attributes for this session. */ public AudioAttributes getAudioAttributes() { return mAudioAttrs; return mProvider.getAudioAttributes_impl(); } /** Loading @@ -210,11 +204,10 @@ public class MediaController2 implements AutoCloseable { * <li>{@link VolumeProvider#VOLUME_CONTROL_FIXED}</li> * </ul> * * @return The type of volume control that may be used with this * session. * @return The type of volume control that may be used with this session. */ public int getVolumeControl() { return mVolumeControl; public int getControlType() { return mProvider.getControlType_impl(); } /** Loading @@ -223,7 +216,7 @@ public class MediaController2 implements AutoCloseable { * @return The maximum allowed volume where this session is playing. */ public int getMaxVolume() { return mMaxVolume; return mProvider.getMaxVolume_impl(); } /** Loading @@ -232,7 +225,7 @@ public class MediaController2 implements AutoCloseable { * @return The current volume where this session is playing. */ public int getCurrentVolume() { return mCurrentVolume; return mProvider.getCurrentVolume_impl(); } } Loading media/java/android/media/update/PlaybackInfoProvider.java 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.media.update; import android.media.AudioAttributes; /** * @hide */ // TODO(jaewan): @SystemApi public interface PlaybackInfoProvider { int getPlaybackType_impl(); AudioAttributes getAudioAttributes_impl(); int getControlType_impl(); int getMaxVolume_impl(); int getCurrentVolume_impl(); } Loading
media/java/android/media/MediaController2.java +12 −19 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.media.MediaSession2.PlaylistParams; import android.media.session.MediaSessionManager; import android.media.update.ApiLoader; import android.media.update.MediaController2Provider; import android.media.update.PlaybackInfoProvider; import android.net.Uri; import android.os.Bundle; import android.os.ResultReceiver; Loading Loading @@ -160,21 +161,14 @@ public class MediaController2 implements AutoCloseable { */ public static final int PLAYBACK_TYPE_LOCAL = 1; private final int mVolumeType; private final int mVolumeControl; private final int mMaxVolume; private final int mCurrentVolume; private final AudioAttributes mAudioAttrs; private final PlaybackInfoProvider mProvider; /** * @hide */ public PlaybackInfo(int type, AudioAttributes attrs, int control, int max, int current) { mVolumeType = type; mAudioAttrs = attrs; mVolumeControl = control; mMaxVolume = max; mCurrentVolume = current; @SystemApi public PlaybackInfo(PlaybackInfoProvider provider) { mProvider = provider; } /** Loading @@ -187,7 +181,7 @@ public class MediaController2 implements AutoCloseable { * @return The type of playback this session is using. */ public int getPlaybackType() { return mVolumeType; return mProvider.getPlaybackType_impl(); } /** Loading @@ -199,7 +193,7 @@ public class MediaController2 implements AutoCloseable { * @return The attributes for this session. */ public AudioAttributes getAudioAttributes() { return mAudioAttrs; return mProvider.getAudioAttributes_impl(); } /** Loading @@ -210,11 +204,10 @@ public class MediaController2 implements AutoCloseable { * <li>{@link VolumeProvider#VOLUME_CONTROL_FIXED}</li> * </ul> * * @return The type of volume control that may be used with this * session. * @return The type of volume control that may be used with this session. */ public int getVolumeControl() { return mVolumeControl; public int getControlType() { return mProvider.getControlType_impl(); } /** Loading @@ -223,7 +216,7 @@ public class MediaController2 implements AutoCloseable { * @return The maximum allowed volume where this session is playing. */ public int getMaxVolume() { return mMaxVolume; return mProvider.getMaxVolume_impl(); } /** Loading @@ -232,7 +225,7 @@ public class MediaController2 implements AutoCloseable { * @return The current volume where this session is playing. */ public int getCurrentVolume() { return mCurrentVolume; return mProvider.getCurrentVolume_impl(); } } Loading
media/java/android/media/update/PlaybackInfoProvider.java 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.media.update; import android.media.AudioAttributes; /** * @hide */ // TODO(jaewan): @SystemApi public interface PlaybackInfoProvider { int getPlaybackType_impl(); AudioAttributes getAudioAttributes_impl(); int getControlType_impl(); int getMaxVolume_impl(); int getCurrentVolume_impl(); }