Commit Graph

98 Commits

Author SHA1 Message Date
Sungsoo Lim
e7fe2a260d Implement sendSessionCommnad
Bug: 122055262
Test: build
Change-Id: Ia3269e6bafa4b79ab94bfafedc2c14f75fe84dd8
2018-12-31 20:40:29 +09:00
Sungsoo Lim
cfd36a5ab5 Handle disconnection of MediaSession2/Controller2
Bug: 122055262
Test: build
Change-Id: I388ab76beb8fc41b47e8f6310cc0bcb79b6acc9f
2018-12-31 17:01:53 +09:00
Sungsoo Lim
938e8e91e8 Add MediaSession2 builder and update JAVADOCs
Bug: 122055262
Test: build
Change-Id: I9cab65f9b09cbe5d5570e4de649ffdff09b20b80
2018-12-31 11:46:04 +09:00
Sungsoo Lim
f894f77d49 Add init MediaSession2 and MediaController2
This CL only covers the connection logic between MediaSession2
and MediaController2.

Bug: 122055262
Test: build
Change-Id: I1773aa053ea1fce0cc548f334416e47d373f7f86
2018-12-31 11:45:46 +09:00
Sungsoo Lim
6f7a0f4650 Remove unused Media 2.0 APIs
Bug: 119591238
Test: build
Change-Id: I58d00b64c86df1372eaed74899227d5787d127e2
2018-11-21 09:29:34 +09:00
Sungsoo Lim
049a32c1ff Remove unused MediaBrowser2 and relevant classes
Bug: 119591238
Test: build
Change-Id: Ib657b2e74666b957a4c3667e60a7c1ef02e0bc62
2018-11-19 23:19:25 +09:00
Jaewan Kim
598265bd86 MediaPlayerBase: Add PlayerEventCallback#onSeekCompleted()
PlayerEventCallback#onSeekCompleted() will be called when the
MediaPlayerBase#seekTo() is completed. Following callbacks are also
added to listen the event.
  - SessionCallback#onSeekCompleted()
  - ControllerCallback#onSeekCompleted()

Bug: 74370608
Test: Build
Change-Id: Ib1ecd75f7e217ed9a927db3ab443073a1aef2074
2018-03-27 16:51:51 +09:00
Jaewan Kim
3b15124ecc MediaSession2: Pull out Command/CommandGroup from the MediaSession2
Bug: 74648408
Test: Build
Change-Id: I0a3d1ab6320c7b276e7b1defdccf9fa371ae02c0
2018-03-27 16:48:26 +09:00
Jaewan Kim
ab715ec20b MediaController2: Add fastForward() / rewind()
Following CLs are included
  - Add MediaController2#fastForward() / rewind()
  - Add MediaSession2.SessionCallback#onFastForward() / rewind()

Bug: 74724709
Test: Build
Change-Id: I0dd2b6c21931df937006ae26011ea9538720afee
2018-03-27 16:48:26 +09:00
Christofer Åkersten
6823d81d8c Remove unneeded context
Bug: 76001644
Test: compile
Change-Id: Ib6d581650ff22d90da2bdc9ad295eab595aefb25
2018-03-27 11:33:17 +09:00
Jaewan Kim
d21b33d8ca Merge "MediaSession2: Change return type of CommandGroup#getCommands()" into pi-dev 2018-03-26 10:55:30 +00:00
Jaewan Kim
ec0ab63ccb Merge "MediaSession2: Revisit command code" into pi-dev 2018-03-26 10:52:22 +00:00
Jaewan Kim
2a35051051 MediaSession2: Add CommandGroup#add/removeCommand(int)
Bug: 74648408
Test: Build
Change-Id: Icfcde5946e75ad74c2123be8064eb365366f5960
2018-03-26 08:10:22 +00:00
Jaewan Kim
a84c9eb1c4 MediaSession2: Change return type of CommandGroup#getCommands()
Bug: 74648408
Test: Build
Change-Id: I443dd0a1f244b285754561a4c485ef2e8530d42d
2018-03-26 15:30:44 +09:00
Jaewan Kim
e32fa0db4a MediaSession2: Revisit command code
Bug: 74648408
Test: Build
Change-Id: I0c66d6dec7f5a25bd4c36aa6e2c140951ea38855
2018-03-26 15:28:40 +09:00
Jaewan Kim
c92f8b4053 Merge "MediaSession2: Match APIs with MediaPlayerBase" into pi-dev 2018-03-26 05:12:17 +00:00
Jaewan Kim
a6ba53d69d Merge "MediaPlayerBase: Add PlayerEventCallback#onPlaybackSpeedChanged()" into pi-dev 2018-03-26 04:57:48 +00:00
Jaewan Kim
6fac589d48 MediaPlayerBase: Add PlayerEventCallback#onPlaybackSpeedChanged()
Bug: 74093080, Bug: 75500592
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: Ibdb3bc9e3fb379c2533eb7f1867e399769f9bb72
2018-03-23 16:21:47 +09:00
Jaewan Kim
888ccd17aa MediaSession2: Match APIs with MediaPlayerBase
Bug: 75500592
Test: Build
Change-Id: Ic2cf1fc9a9d11752d84ff6f69905b5983e57d10a
2018-03-23 16:08:33 +09:00
TreeHugger Robot
ff1c9fa576 Merge "Use SessionPlaylistAgent in MediaSession2Impl" into pi-dev 2018-03-23 07:08:08 +00:00
Jaewan Kim
e41b39d6e9 Merge "MediaSession2: Add more detailed documentation for addPlaylistItem()" into pi-dev 2018-03-23 02:47:25 +00:00
Jean-Michel Trivi
d847d7d0a9 Merge "Hide Media*2 APIs" into pi-dev 2018-03-23 01:12:14 +00:00
Jean-Michel Trivi
3a582e73c1 Hide Media*2 APIs
Bug: 76121592
Test: make offline-sdk-docs
Change-Id: Ic5eba5ba0b3ef9f11c582ab6db7d8d61934941dd
2018-03-22 16:30:14 -07:00
Jaewan Kim
f73bc870c0 MediaSession2: Add more detailed documentation for addPlaylistItem()
Bug: 73149584
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: Ifc16e9d4ee210ac901941d8f3a6a228aa3f1ddd8
2018-03-22 21:29:03 +09:00
Sungsoo Lim
5d7e96b1d1 Use SessionPlaylistAgent in MediaSession2Impl
Bug: 74090741
Test: SessionPlaylistAgentTest, MediaComponentTests
Change-Id: I3f5ad7ab233fb1be51c5211b12a8292b173f3738
2018-03-22 20:44:29 +09:00
Christofer Åkersten
6bd3ab6dc6 Remove unnecessary Context from ApiLoader
Bug: 76001644
Test: compile
Change-Id: I6ac81dac16374d90facfe33c68607c5c286b335f
2018-03-22 14:55:55 +09:00
Jaewan Kim
83bc984a6c MediaSession2: Implement fastForward() / rewind()
Bug: 74724709
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: Ibd313dc6eed82a5d7cc9fc156f7851aba13f9e29
2018-03-19 17:39:02 +09:00
Hyundo Moon
78e4f84f04 MediaSession2: Implement getPlayerState/Position/BufferedPosition
Bug: 74578458
Test: Passed CTS
Change-Id: If215e8e16bdce9fdc04ca18ed8d08ed374d13a98
2018-03-16 18:03:17 +09:00
Jaewan Kim
f10ca2f960 MediaSession2: Implement PlaylistParams replacements
This includes following changes
  - Remove PlaylistParams
  - Implement PlaylistParams replacements. Here's the list.
    - get/setShuffleMode()
    - get/setRepeatMode()
    - Note: Playlist metadata APIs are already submitted (b/74174649)

Bug: 74116823, Bug: 74118768
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: I0267ffeaf92257eb7b81ffc8b6a3f40b5a2f6f9c
2018-03-16 12:21:29 +09:00
Jaewan Kim
8e17db5554 MediaSession2: Remove MediaSession2#registerPlayerEventCallback()
Bug: 74157064
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: Ia976c0ebe9f2b7eff0ae603db96ab106aa045cbc
2018-03-16 10:59:32 +09:00
Hyundo Moon
e14acb53fa MediaSession2: Convert DataSourceDesc to MediaItem2 in MyPlayerEventCallback
This CL adds a hidden API getMediaItem() in MediaPlaylistAgent.

Bug: 74506462
Test: Passed CTS
Change-Id: I1aefd7e47e1881fe14fcd1cc681095a6130624cf
2018-03-15 20:37:35 +09:00
Jaewan Kim
68c774a1ee MediaSession2: Implement skipTo APIs
This implements following APIs from both session and controller.
  - skipToPlaylistItem()
  - skipToNextItem()
  - skipToPreviousItem()

Bug: 74175632
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: I47d94346c997314ff39797bac3034aa507058036
2018-03-15 15:49:58 +09:00
Jaewan Kim
009c393ca1 MediaSession2: Refactor incoming binder calls to the MediaSession2Stub
This CL refactors methods in MediaSession2Stub that handles incoming
binder calls from the controller by adding methods to do followings
in one place.
  1. Check if the session hasn't closed.
  2. Check if the controller is allowed for the command
  3. Call SessionCallback#onCommandRequest() for APIs that would be
     sent directly to the MediaPlayerBase or MediaPlaylistAgent if
     allowed.

This CL also adds missing command code for setRating().

Bug: 74581821
Test: Run CTS tests with MediaComponents/runcts.sh
Change-Id: I9b96e26b7644cff3c54269773590c73ff30f956c
2018-03-14 10:02:36 +09:00
Hyundo Moon
c006dc2a85 MediaSession2: Replace PlaybackState2
This CL removes PlaybackState2 and replaces it with other APIs.

Bug: 74370608, Bug: 73971431
Test: Passed CTS
Change-Id: Ifa16b1d551957ab4bb06979ddf29b18772093035
2018-03-13 17:05:55 +09:00
Jaewan Kim
8562fd9504 MediaSession2: Implement add/remove/replacePlaylistItem()
Bug: 73149584
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: I29804f52eaca45de21fd66634e4eeee2c72a9a25
2018-03-13 11:59:18 +09:00
Jaewan Kim
dc5ab8095a MediaSession2: Implement update/getPlaylistMetadata()
Bug: 74174649
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: I3ac2dabfc7f532bf7d7262940e3dc309e97fd45a
2018-03-13 11:55:55 +09:00
Jaewan Kim
25db3cdb93 MediaSession2: Implement get/setPlaylist()
Bug: 74326040
Test: Run CtsMediaTests for MediaSession2
Change-Id: Ib799c03edd2f79c6f9ffa989aea1137018ec55b3
2018-03-13 11:48:30 +09:00
Hyundo Moon
5cef8984ba Merge "MediaSession2: Ensure NonNull/Nullable for parameters of public methods" into pi-dev 2018-03-09 08:28:08 +00:00
Hyundo Moon
c896d9d7e6 MediaSession2: Ensure NonNull/Nullable for parameters of public methods
Bug: 73863865
Test: runtest-MediaComponents
Change-Id: Id40f221ae60b1e63afd9ff71950589fe13a7f526
2018-03-09 14:00:11 +09:00
Jaewan Kim
9af5bc8370 MediaSession2: Implement MediaSession2#updatePlayer()
Bug: 74364873
Test: Run MediaSession2Test in CTS
Change-Id: I5161c0d771afd5036e2c09b2cc2a165f80c534f7
2018-03-08 18:11:55 +09:00
Jaewan Kim
525c88c2b7 MediaSession2: Clean up TODOs under frameworks/base
This change includes
  - Addressed trivial TODOs (takes less than 1min)
  - Renamed playlist controller to playlist agent
  - Renamed mplc to playlistAgent
  - Renamed mpb to player
  - Assigned buganizer issues for TODOs

Bug: 74361045
Test: Run MediaComponentsTest
Change-Id: I45e97081b5a3f24988c3daadd007edcb51be5288
2018-03-08 13:54:34 +09:00
Sungsoo Lim
df0e8fdffd Remove MediaPlaylistController, add MediaPlaylistAgent
MediaPlaylistAgent is the abstract class an application needs to
derive from to pass an object to a MediaSession2 that will override
default playlist handling behaviors. It contains a set of notify*
methods to signal MediaSession2 that playlist-related state has
changed.

Bug: 64098437
Test: make update-api
Change-Id: Icb3c57ddc14eba276f49d4ba85f11adbeb3e0917
2018-03-07 16:41:19 +09:00
Jaewan Kim
87086f59ad MediaSession2: Add SessionCallback#onCurrentMediaItemChanged()
Added callback for session to know the currently playing media item has
changed.

Note that the callback is called in response to the
MediaPlayerBase#PlayerEventCallback#onCurrentDataSourceChanged(mpb, dsd
is called. Session will translate dsd to the media item and calls
onCurrentMediaItemChanged().

Following changes are also included
  - Removed MediaPlaylistController#getCurrentPlaylistItem(),
    because currently playing item is managed by the MediaPlayerBase.
  - Renamed ControllerCallback#onCurrentPlaylistItemChanged() to the
    ControllerCallback#onCurrentMediaItemChanged(), to make it more
    obvious that the event is from MediaPlayerBase, not
    MediaPlaylistController.
  - Added SessionCallback#onCurrentMediaItemChanged()

Bug: 64098437
Test: Run MediaComponents test
Change-Id: I78b124a7da0f968b097b2576507b9a73e36081ec
2018-03-07 16:31:56 +09:00
Jaewan Kim
4d4a8c95ae MediaSession2: Add onDataSourceMissingHelper
This allows a developer to create DataSourceDesc when the item is about
to be played. Typical example of the usages are,

    1. For a playlist consists of FileDescriptors, its developer may not
        want to open all files when MediaSession2.setPlaylist() is
        called.
    2. A controller has called setPlaylist(), addPlaylistItem(), or
        replacePlaylistItem(). Controller cannot know the
        DataSourceDesc, and only the session developer can know about
        it.

Bug: 64098437
Test: Run MediaComponents test
Change-Id: I73f27ca0a799b1cddf5046b41f0ca01d08037103
2018-03-07 16:31:53 +09:00
Jaewan Kim
ccf41b87a9 Merge changes from topic "session2-pi-listcallback" into pi-dev
* changes:
  MediaSession2: Pass player info for the callbacks from MediaPlayerBase
  MediaSession2: Add MediaPlaylistController.PlaylistEventCallback
2018-03-07 00:02:09 +00:00
Jaewan Kim
42a36c341d MediaSession2: Pass player info for the callbacks from MediaPlayerBase
Player can be updated meantime, and player event from the previous
player can be sent after the update. Providing player information will
provide developers more opportunity to filter out unecessary callbacks.

Bug: 64098437
Test: Run MediaComponents test
Change-Id: I9c23101df139e26351c008462c726ae7069130eb
2018-03-07 00:12:14 +09:00
Jaewan Kim
273130dc9a MediaSession2: Add MediaPlaylistController.PlaylistEventCallback
This includes following changes per offline discussion
  - Add MediaPlaylistController.PlaylistEventCallback
  - Add following APIs to the MediaPlaylistController
    * registerPlaylistControllerCallback() /
      unregisterPlaylistControllerCallback()
    * getRepeatMode() / setRepeatMode()
    * getShuffleMode() / setShuffleMode()
    * setPlaylist() with metadata
    * setPlaylistMetadata() / getPlaylistMetadata()
  - Add following APIs to the SessionCallback
    * onMediaPrepared()
    * onPlayerStateChanged()
    * onBufferingStateChanged()
  - Remove following methods from ControllerCallback
    * onPlaylistChanged()

Bug: 64098437
Bug: 74157064
Test: passed MediaComponentTest
Change-Id: I5ad12a9a5d6a7d9e23a577dca8ea26fbacb8f259
2018-03-07 00:11:25 +09:00
Hyundo Moon
66bc3c1f78 MediaSession2: Update Builder
This CL updates following APIs of session builder:
 - setPlayer
 - setPlaylistController
 - setVolumeController

Bug: 74093082
Test: runtest-MediaComponents
Change-Id: I88365e740df7e14edf439cbed2106f788d027f53
2018-03-06 15:56:34 +09:00
Jaewan Kim
7a0cefa583 MediaSession2: Clean up TODOs under frameworks/base/media
This CL includes following changes
  - Remove outdated TODOs
  - Added buganizer issue if the remaining work take more than 5m

Test: Run MediaComponents tests
Change-Id: I8968e12aabcbc67f69dbf14485b3716d0e95779b
2018-03-04 18:47:49 +09:00
Jaewan Kim
3fb60d56c2 MediaSession2: Add caller to the callback methods
This is to follow MediaPlayer2 and MediaPlayerBase's API style.

Bug: 64098437
Test: make update-api
Change-Id: I7fe17852d16237fac801c716eab1007cd0337867
2018-03-02 23:14:40 +09:00