Loading media/java/android/media/AudioManager.java +13 −3 Original line number Diff line number Diff line Loading @@ -643,9 +643,14 @@ public class AudioManager { try { if (mUseMasterVolume) { service.adjustMasterVolume(direction, flags, mContext.getOpPackageName()); } else { if (USE_SESSIONS) { MediaSessionLegacyHelper helper = MediaSessionLegacyHelper.getHelper(mContext); helper.sendAdjustVolumeBy(USE_DEFAULT_STREAM_TYPE, direction, flags); } else { service.adjustVolume(direction, flags, mContext.getOpPackageName()); } } } catch (RemoteException e) { Log.e(TAG, "Dead object in adjustVolume", e); } Loading Loading @@ -673,10 +678,15 @@ public class AudioManager { try { if (mUseMasterVolume) { service.adjustMasterVolume(direction, flags, mContext.getOpPackageName()); } else { if (USE_SESSIONS) { MediaSessionLegacyHelper helper = MediaSessionLegacyHelper.getHelper(mContext); helper.sendAdjustVolumeBy(suggestedStreamType, direction, flags); } else { service.adjustSuggestedStreamVolume(direction, suggestedStreamType, flags, mContext.getOpPackageName()); } } } catch (RemoteException e) { Log.e(TAG, "Dead object in adjustSuggestedStreamVolume", e); } Loading media/java/android/media/session/ISession.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -47,4 +47,8 @@ interface ISession { void setMetadata(in MediaMetadata metadata); void setPlaybackState(in PlaybackState state); void setRatingType(int type); // These commands relate to volume handling void configureVolumeHandling(int type, int arg1, int arg2); void setCurrentVolume(int currentVolume); } No newline at end of file media/java/android/media/session/ISessionCallback.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -45,4 +45,8 @@ oneway interface ISessionCallback { void onRewind(); void onSeekTo(long pos); void onRate(in Rating rating); // These callbacks are for volume handling void onAdjustVolumeBy(int delta); void onSetVolumeTo(int value); } No newline at end of file media/java/android/media/session/ISessionManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -29,4 +29,5 @@ interface ISessionManager { ISession createSession(String packageName, in ISessionCallback cb, String tag, int userId); List<IBinder> getSessions(in ComponentName compName, int userId); void dispatchMediaKeyEvent(in KeyEvent keyEvent, boolean needWakeLock); void dispatchAdjustVolumeBy(int suggestedStream, int delta, int flags); } No newline at end of file media/java/android/media/session/MediaSession.java +49 −5 Original line number Diff line number Diff line Loading @@ -124,9 +124,21 @@ public final class MediaSession { */ public static final int DISCONNECT_REASON_SESSION_DESTROYED = 5; private static final String KEY_COMMAND = "command"; private static final String KEY_EXTRAS = "extras"; private static final String KEY_CALLBACK = "callback"; /** * The session uses local playback. Used for configuring volume handling * with the system. * * @hide */ public static final int VOLUME_TYPE_LOCAL = 1; /** * The session uses remote playback. Used for configuring volume handling * with the system. * * @hide */ public static final int VOLUME_TYPE_REMOTE = 2; private final Object mLock = new Object(); Loading @@ -143,6 +155,7 @@ public final class MediaSession { = new ArrayMap<String, RouteInterface.EventListener>(); private Route mRoute; private RemoteVolumeProvider mVolumeProvider; private boolean mActive = false;; Loading Loading @@ -242,7 +255,11 @@ public final class MediaSession { * @param stream The {@link AudioManager} stream this session is playing on. */ public void setPlaybackToLocal(int stream) { // TODO try { mBinder.configureVolumeHandling(VOLUME_TYPE_LOCAL, stream, 0); } catch (RemoteException e) { Log.wtf(TAG, "Failure in setPlaybackToLocal.", e); } } /** Loading @@ -259,7 +276,14 @@ public final class MediaSession { if (volumeProvider == null) { throw new IllegalArgumentException("volumeProvider may not be null!"); } // TODO mVolumeProvider = volumeProvider; try { mBinder.configureVolumeHandling(VOLUME_TYPE_REMOTE, volumeProvider.getVolumeControl(), volumeProvider.getMaxVolume()); } catch (RemoteException e) { Log.wtf(TAG, "Failure in setPlaybackToRemote.", e); } } /** Loading Loading @@ -942,6 +966,26 @@ public final class MediaSession { } /* * (non-Javadoc) * @see android.media.session.ISessionCallback#onAdjustVolumeBy(int) */ @Override public void onAdjustVolumeBy(int delta) throws RemoteException { // TODO(epastern): Auto-generated method stub } /* * (non-Javadoc) * @see android.media.session.ISessionCallback#onSetVolumeTo(int) */ @Override public void onSetVolumeTo(int value) throws RemoteException { // TODO(epastern): Auto-generated method stub } } private class CallbackMessageHandler extends Handler { Loading Loading
media/java/android/media/AudioManager.java +13 −3 Original line number Diff line number Diff line Loading @@ -643,9 +643,14 @@ public class AudioManager { try { if (mUseMasterVolume) { service.adjustMasterVolume(direction, flags, mContext.getOpPackageName()); } else { if (USE_SESSIONS) { MediaSessionLegacyHelper helper = MediaSessionLegacyHelper.getHelper(mContext); helper.sendAdjustVolumeBy(USE_DEFAULT_STREAM_TYPE, direction, flags); } else { service.adjustVolume(direction, flags, mContext.getOpPackageName()); } } } catch (RemoteException e) { Log.e(TAG, "Dead object in adjustVolume", e); } Loading Loading @@ -673,10 +678,15 @@ public class AudioManager { try { if (mUseMasterVolume) { service.adjustMasterVolume(direction, flags, mContext.getOpPackageName()); } else { if (USE_SESSIONS) { MediaSessionLegacyHelper helper = MediaSessionLegacyHelper.getHelper(mContext); helper.sendAdjustVolumeBy(suggestedStreamType, direction, flags); } else { service.adjustSuggestedStreamVolume(direction, suggestedStreamType, flags, mContext.getOpPackageName()); } } } catch (RemoteException e) { Log.e(TAG, "Dead object in adjustSuggestedStreamVolume", e); } Loading
media/java/android/media/session/ISession.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -47,4 +47,8 @@ interface ISession { void setMetadata(in MediaMetadata metadata); void setPlaybackState(in PlaybackState state); void setRatingType(int type); // These commands relate to volume handling void configureVolumeHandling(int type, int arg1, int arg2); void setCurrentVolume(int currentVolume); } No newline at end of file
media/java/android/media/session/ISessionCallback.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -45,4 +45,8 @@ oneway interface ISessionCallback { void onRewind(); void onSeekTo(long pos); void onRate(in Rating rating); // These callbacks are for volume handling void onAdjustVolumeBy(int delta); void onSetVolumeTo(int value); } No newline at end of file
media/java/android/media/session/ISessionManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -29,4 +29,5 @@ interface ISessionManager { ISession createSession(String packageName, in ISessionCallback cb, String tag, int userId); List<IBinder> getSessions(in ComponentName compName, int userId); void dispatchMediaKeyEvent(in KeyEvent keyEvent, boolean needWakeLock); void dispatchAdjustVolumeBy(int suggestedStream, int delta, int flags); } No newline at end of file
media/java/android/media/session/MediaSession.java +49 −5 Original line number Diff line number Diff line Loading @@ -124,9 +124,21 @@ public final class MediaSession { */ public static final int DISCONNECT_REASON_SESSION_DESTROYED = 5; private static final String KEY_COMMAND = "command"; private static final String KEY_EXTRAS = "extras"; private static final String KEY_CALLBACK = "callback"; /** * The session uses local playback. Used for configuring volume handling * with the system. * * @hide */ public static final int VOLUME_TYPE_LOCAL = 1; /** * The session uses remote playback. Used for configuring volume handling * with the system. * * @hide */ public static final int VOLUME_TYPE_REMOTE = 2; private final Object mLock = new Object(); Loading @@ -143,6 +155,7 @@ public final class MediaSession { = new ArrayMap<String, RouteInterface.EventListener>(); private Route mRoute; private RemoteVolumeProvider mVolumeProvider; private boolean mActive = false;; Loading Loading @@ -242,7 +255,11 @@ public final class MediaSession { * @param stream The {@link AudioManager} stream this session is playing on. */ public void setPlaybackToLocal(int stream) { // TODO try { mBinder.configureVolumeHandling(VOLUME_TYPE_LOCAL, stream, 0); } catch (RemoteException e) { Log.wtf(TAG, "Failure in setPlaybackToLocal.", e); } } /** Loading @@ -259,7 +276,14 @@ public final class MediaSession { if (volumeProvider == null) { throw new IllegalArgumentException("volumeProvider may not be null!"); } // TODO mVolumeProvider = volumeProvider; try { mBinder.configureVolumeHandling(VOLUME_TYPE_REMOTE, volumeProvider.getVolumeControl(), volumeProvider.getMaxVolume()); } catch (RemoteException e) { Log.wtf(TAG, "Failure in setPlaybackToRemote.", e); } } /** Loading Loading @@ -942,6 +966,26 @@ public final class MediaSession { } /* * (non-Javadoc) * @see android.media.session.ISessionCallback#onAdjustVolumeBy(int) */ @Override public void onAdjustVolumeBy(int delta) throws RemoteException { // TODO(epastern): Auto-generated method stub } /* * (non-Javadoc) * @see android.media.session.ISessionCallback#onSetVolumeTo(int) */ @Override public void onSetVolumeTo(int value) throws RemoteException { // TODO(epastern): Auto-generated method stub } } private class CallbackMessageHandler extends Handler { Loading