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

Commit ca762bee authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android Git Automerger
Browse files

am 6a570204: Merge "RemoteControlClient receives playback position change requests" into jb-mr2-dev

* commit '6a570204':
  RemoteControlClient receives playback position change requests
parents d472ad74 6a570204
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -158,7 +158,7 @@ public class TransportControlView extends FrameLayout implements OnClickListener
            }
            }
        }
        }


        public void setTransportControlFlags(int generationId, int flags) {
        public void setTransportControlInfo(int generationId, int flags, int posCapabilities) {
            Handler handler = mLocalHandler.get();
            Handler handler = mLocalHandler.get();
            if (handler != null) {
            if (handler != null) {
                handler.obtainMessage(MSG_SET_TRANSPORT_CONTROLS, generationId, flags)
                handler.obtainMessage(MSG_SET_TRANSPORT_CONTROLS, generationId, flags)
+20 −0
Original line number Original line Diff line number Diff line
@@ -2273,6 +2273,26 @@ public class AudioManager {
        }
        }
    }
    }


    /**
     * @hide
     * Request the user of a RemoteControlClient to seek to the given playback position.
     * @param generationId the RemoteControlClient generation counter for which this request is
     *         issued. Requests for an older generation than current one will be ignored.
     * @param timeMs the time in ms to seek to, must be positive.
     */
    public void setRemoteControlClientPlaybackPosition(int generationId, long timeMs) {
        if (timeMs < 0) {
            return;
        }
        IAudioService service = getService();
        try {
            service.setRemoteControlClientPlaybackPosition(generationId, timeMs);
        } catch (RemoteException e) {
            Log.e(TAG, "Dead object in setRccPlaybackPosition("+ generationId + ", "
                    + timeMs + ")", e);
        }
    }

    /**
    /**
     *  @hide
     *  @hide
     *  Reload audio settings. This method is called by Settings backup
     *  Reload audio settings. This method is called by Settings backup
+30 −1
Original line number Original line Diff line number Diff line
@@ -167,7 +167,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
    private static final int MSG_BROADCAST_BT_CONNECTION_STATE = 30;
    private static final int MSG_BROADCAST_BT_CONNECTION_STATE = 30;
    private static final int MSG_UNLOAD_SOUND_EFFECTS = 31;
    private static final int MSG_UNLOAD_SOUND_EFFECTS = 31;
    private static final int MSG_RCC_NEW_PLAYBACK_STATE = 32;
    private static final int MSG_RCC_NEW_PLAYBACK_STATE = 32;

    private static final int MSG_RCC_SEEK_REQUEST = 33;


    private static final int BTA2DP_DOCK_TIMEOUT_MILLIS = 8000;
    private static final int BTA2DP_DOCK_TIMEOUT_MILLIS = 8000;
    // Timeout for connection to bluetooth headset service
    // Timeout for connection to bluetooth headset service
@@ -4708,6 +4708,9 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
        }
        }
    };
    };


    /**
     * Synchronization on mCurrentRcLock always inside a block synchronized on mRCStack
     */
    private final Object mCurrentRcLock = new Object();
    private final Object mCurrentRcLock = new Object();
    /**
    /**
     * The one remote control client which will receive a request for display information.
     * The one remote control client which will receive a request for display information.
@@ -4979,6 +4982,9 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
                        "  -- volMax: " + rcse.mPlaybackVolumeMax +
                        "  -- volMax: " + rcse.mPlaybackVolumeMax +
                        "  -- volObs: " + rcse.mRemoteVolumeObs);
                        "  -- volObs: " + rcse.mRemoteVolumeObs);
            }
            }
            synchronized(mCurrentRcLock) {
                pw.println("\nCurrent remote control generation ID = " + mCurrentRcClientGen);
            }
        }
        }
        synchronized (mMainRemote) {
        synchronized (mMainRemote) {
            pw.println("\nRemote Volume State:");
            pw.println("\nRemote Volume State:");
@@ -5813,6 +5819,29 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
        }
        }
    }
    }


    public void setRemoteControlClientPlaybackPosition(int generationId, long timeMs) {
        sendMsg(mAudioHandler, MSG_RCC_SEEK_REQUEST, SENDMSG_QUEUE, generationId /* arg1 */,
                0 /* arg2 ignored*/, new Long(timeMs) /* obj */, 0 /* delay */);
    }

    public void onSetRemoteControlClientPlaybackPosition(int generationId, long timeMs) {
        if(DEBUG_RC) Log.d(TAG, "onSetRemoteControlClientPlaybackPosition(genId=" + generationId +
                ", timeMs=" + timeMs + ")");
        synchronized(mRCStack) {
            synchronized(mCurrentRcLock) {
                if ((mCurrentRcClient != null) && (mCurrentRcClientGen == generationId)) {
                    // tell the current client to seek to the requested location
                    try {
                        mCurrentRcClient.seekTo(generationId, timeMs);
                    } catch (RemoteException e) {
                        Log.e(TAG, "Current valid remote client is dead: "+e);
                        mCurrentRcClient = null;
                    }
                }
            }
        }
    }

    public void setPlaybackInfoForRcc(int rccId, int what, int value) {
    public void setPlaybackInfoForRcc(int rccId, int what, int value) {
        sendMsg(mAudioHandler, MSG_RCC_NEW_PLAYBACK_INFO, SENDMSG_QUEUE,
        sendMsg(mAudioHandler, MSG_RCC_NEW_PLAYBACK_INFO, SENDMSG_QUEUE,
                rccId /* arg1 */, what /* arg2 */, Integer.valueOf(value) /* obj */, 0 /* delay */);
                rccId /* arg1 */, what /* arg2 */, Integer.valueOf(value) /* obj */, 0 /* delay */);
+21 −6
Original line number Original line Diff line number Diff line
@@ -126,11 +126,6 @@ interface IAudioService {
    oneway void registerMediaButtonEventReceiverForCalls(in ComponentName c);
    oneway void registerMediaButtonEventReceiverForCalls(in ComponentName c);
    oneway void unregisterMediaButtonEventReceiverForCalls();
    oneway void unregisterMediaButtonEventReceiverForCalls();


           int registerRemoteControlClient(in PendingIntent mediaIntent,
               in IRemoteControlClient rcClient, in String callingPackageName);
    oneway void unregisterRemoteControlClient(in PendingIntent mediaIntent,
           in IRemoteControlClient rcClient);

    /**
    /**
     * Register an IRemoteControlDisplay.
     * Register an IRemoteControlDisplay.
     * Notify all IRemoteControlClient of the new display and cause the RemoteControlClient
     * Notify all IRemoteControlClient of the new display and cause the RemoteControlClient
@@ -157,6 +152,26 @@ interface IAudioService {
     *   display doesn't need to receive artwork.
     *   display doesn't need to receive artwork.
     */
     */
    oneway void remoteControlDisplayUsesBitmapSize(in IRemoteControlDisplay rcd, int w, int h);
    oneway void remoteControlDisplayUsesBitmapSize(in IRemoteControlDisplay rcd, int w, int h);
    /**
     * Request the user of a RemoteControlClient to seek to the given playback position.
     * @param generationId the RemoteControlClient generation counter for which this request is
     *         issued. Requests for an older generation than current one will be ignored.
     * @param timeMs the time in ms to seek to, must be positive.
     */
     void setRemoteControlClientPlaybackPosition(int generationId, long timeMs);

    /**
     * Do not use directly, use instead
     *     {@link android.media.AudioManager#registerRemoteControlClient(RemoteControlClient)}
     */
    int registerRemoteControlClient(in PendingIntent mediaIntent,
            in IRemoteControlClient rcClient, in String callingPackageName);
    /**
     * Do not use directly, use instead
     *     {@link android.media.AudioManager#unregisterRemoteControlClient(RemoteControlClient)}
     */
    oneway void unregisterRemoteControlClient(in PendingIntent mediaIntent,
            in IRemoteControlClient rcClient);


    oneway void setPlaybackInfoForRcc(int rccId, int what, int value);
    oneway void setPlaybackInfoForRcc(int rccId, int what, int value);
    void setPlaybackStateForRcc(int rccId, int state, long timeMs, float speed);
    void setPlaybackStateForRcc(int rccId, int state, long timeMs, float speed);
+1 −0
Original line number Original line Diff line number Diff line
@@ -47,4 +47,5 @@ oneway interface IRemoteControlClient
    void   plugRemoteControlDisplay(IRemoteControlDisplay rcd, int w, int h);
    void   plugRemoteControlDisplay(IRemoteControlDisplay rcd, int w, int h);
    void unplugRemoteControlDisplay(IRemoteControlDisplay rcd);
    void unplugRemoteControlDisplay(IRemoteControlDisplay rcd);
    void setBitmapSizeForDisplay(IRemoteControlDisplay rcd, int w, int h);
    void setBitmapSizeForDisplay(IRemoteControlDisplay rcd, int w, int h);
    void seekTo(int clientGeneration, long timeMs);
}
}
 No newline at end of file
Loading