Commit Graph

6502 Commits

Author SHA1 Message Date
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
TreeHugger Robot
e9238246b7 Merge "MediaSession2: Ask server whether a controller is trusted" into pi-dev 2018-03-06 23:06:18 +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
TreeHugger Robot
9bc5610869 Merge "MediaSession2: Update Builder" into pi-dev 2018-03-06 08:59:13 +00: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
fed495078e MediaSession2: Ask server whether a controller is trusted
Bug: 73150040
Test: Run all MediaComponents tests once
Change-Id: Ic003a40654a45e6fd367d7389216fddf320a8edc
2018-03-06 14:24:06 +09:00
Wei Jia
97d579d1ee Merge "MediaPlayer2: clarify sync/async for API's" into pi-dev 2018-03-06 03:42:25 +00:00
TreeHugger Robot
cefe0c6518 Merge "Check mMediaProvider for null" into pi-dev 2018-03-06 01:59:14 +00:00
Wei Jia
d526bc3b88 MediaPlayer2: clarify sync/async for API's
Test: MediaPlayer2 plays
Bug: 63934228
Change-Id: I48b73c75311dbb31dcebe7c7a38e444d7dc65ed8
2018-03-05 16:40:59 -08:00
Jerry Zhang
484ea675dd Check mMediaProvider for null
Getting the content provider could
return null in some cases where the user
is locked, so check for that when closing.

Bug: 73656609
Test: no crash
Change-Id: I607cd2da5348520616a1c171d0d8a1afacabe592
2018-03-05 22:25:58 +00:00
Dongwon Kang
adf77a01e8 Make MP2.prepare|play handled with task queue
Test: plays video
Bug: 63934228
Change-Id: Iecf8b2079e87241365ab6b7b7b0a5a669c948427
2018-03-05 11:33:27 -08:00
Dongwon Kang
47cab8322a Remove unused imports in MediaPlayer2.
Test: build.
Change-Id: I2f2a05ef4fc41d14f91e6805217852adf5bbb28e
2018-03-05 11:07:38 -08:00
Hyundo Moon
d4ef7b96ed MediaController2: Ensure NonNull for parameters of public methods
Bug: 73863865
Test: Passed MediaBrowser2Test
Change-Id: I65cd43045f4e7b9f16b8cf3f43688815e59dc643
2018-03-05 10:55:09 +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
TreeHugger Robot
13b4d509b8 Merge "MediaPlayer2: implement some API's" 2018-03-03 03:14:38 +00:00
TreeHugger Robot
247779b31c Merge "MediaSession2: Add caller to the callback methods" 2018-03-03 00:54:31 +00:00
Wei Jia
cde2d3ff10 MediaPlayer2: implement some API's
Test: MediaPlayer2 plays
Bug: 63934228
Change-Id: I10a4086db214b88f4a3eaea71fce81e8a994589a
2018-03-02 16:20:08 -08:00
TreeHugger Robot
053a3859a8 Merge "MediaSession2: Add reset() to the MediaPlayerBase" 2018-03-02 23:58:14 +00:00
TreeHugger Robot
20b699db64 Merge "Clarify security level default in openSession()" 2018-03-02 20:42:52 +00:00
TreeHugger Robot
c7f295f0f9 Merge "MediaMetadata2: Make Javadoc of each key consistent" 2018-03-02 15:24:32 +00: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
Jaewan Kim
de2bbb322b MediaSession2: Add reset() to the MediaPlayerBase
This would be used in response to
  - MediaController2#play()
  - KEYCODE_MEDIA_STOP

Bug: 64098437
Test: passed MediaComponentTest
Change-Id: I7cd4d855d5e1bf8e4260a9b920f30dfe2eea44e1
2018-03-02 18:03:42 +09:00
Hyundo Moon
a68f1551f0 MediaMetadata2: Make Javadoc of each key consistent
This CL makes the Javadoc of METADATA_KEY_* to be consistent.

Bug: 73877547
Test: Builds successfully
Change-Id: Icb68d62230bb4e523da2015db76d5aeaa098c69a
2018-03-02 18:03:07 +09:00
Hyundo Moon
2410a0dd31 Merge "Move MediaItem2 Builder to updatable" 2018-03-02 08:22:20 +00:00
TreeHugger Robot
2803e978d0 Merge "MediaMetadata2: Supplement Javadoc of each key" 2018-03-02 06:20:24 +00:00
TreeHugger Robot
5130fdb0ac Merge "cas: explicitly define possible key id values" 2018-03-01 18:50:18 +00:00
TreeHugger Robot
8f7aa97fa9 Merge "MediaPlayer2: clean up APIs" 2018-03-01 07:28:35 +00:00
Jean-Michel Trivi
38008955e3 Merge "AudioPolicy: support for add/remove AudioMix without unregistering" 2018-03-01 07:00:39 +00:00
TreeHugger Robot
3b0014dcad Merge "MediaSession2: Unhide setAudioFocusRequest" 2018-03-01 05:11:24 +00:00
Jean-Michel Trivi
af576a0e4f AudioPolicy: support for add/remove AudioMix without unregistering
System API for a registered AudioPolicy to attach or detach
  AudioMix without having to unregister, and then registering
  the new mix configuration.

Bug: 63906162
Test: AudioPolicyTest

Change-Id: Ib2fea8aa034d3f7b498e76dc1fc51c1ea508d3a2
2018-02-28 21:06:20 -08:00
Wei Jia
1789cc7f82 MediaPlayer2: clean up APIs
Make MediaPlayer2 derived from MediaPlayerBase
Test: MediaPlayer2 plays
Bug: 63934228
Change-Id: Ib31e3196ad65c694f778a8a79277e53017a7026f
2018-02-28 19:52:13 -08:00
TreeHugger Robot
c7c1ce8012 Merge "MediaSession2: Refine APIs" 2018-03-01 03:39:31 +00:00
Sungsoo Lim
12a1f62745 MediaSession2: Unhide setAudioFocusRequest
Bug: 64098437
Test: make update-api
Change-Id: I9244719e1a771ab7b420a95af6ba43faef7b352c
2018-03-01 12:31:52 +09:00
Sungsoo Lim
aa080a80a6 MediaSession2: Refine APIs
Bug: 64098437
Test: passed MediaComponentTest
Change-Id: I40e1ef141e47d17e2bfa0a689a680b45a3d73b03
2018-03-01 10:38:33 +09:00
TreeHugger Robot
4f7c46585d Merge "NEW API: Add Image.getHardwareBuffer()" 2018-03-01 01:26:14 +00:00
Jeff Tinker
d3f8228f4d Clarify security level default in openSession()
API review suggested that default security level
be mentioned in the older openSession method as
well as in the new one.

bug:73750379
Change-Id: I0c740fe4c9579cb8cd7ab623e940193ad34dfd16
2018-02-28 14:25:36 -08:00
Mathias Agopian
3e88ed82e5 NEW API: Add Image.getHardwareBuffer()
This mirror the corresponding NDK API. For some
reason this was missing from the java version
of Image.

Bug: 73784759
Test: manual
Change-Id: Iafa6dedda809fe38ea4453d9873d1ba886f88481
2018-02-28 22:23:54 +00:00
Jean-Michel Trivi
e00f31b3f2 Ringtone: unhide looping and volume control
Also clean up whitespace in file.

Bug: 22182606
Test: adb shell clrgt --loop true --volume 50
Change-Id: I937b678f72b4a47b0f02b3124669e2de5e743033
2018-02-28 12:57:55 -08:00
Chong Zhang
cd53855311 cas: explicitly define possible key id values
Remove cas header from media jni headers, and define flags
for PES header extraction.

bug: 73898003

test: CTS MediaCasTest, MediaDrmClearkeyTest

Change-Id: I2a512e2dbeb8be53a64bfa0b89254032c7341fa2
2018-02-28 10:57:15 -08:00
TreeHugger Robot
7f1bceb325 Merge "MediaPlayerBase API" 2018-02-28 16:36:23 +00:00
TreeHugger Robot
58c83fa7c8 Merge "Unhide VideoView2 APIs" 2018-02-28 10:43:38 +00:00
TreeHugger Robot
dc66a1d891 Merge "Unhide MediaControlView2 APIs" 2018-02-28 10:28:25 +00:00
Insun Kang
b785faa1d7 Unhide VideoView2 APIs
Test: make update-api
Bug: 64293205
Change-Id: Ie57e3ea78dd623fc095c1ad5f270f3b97320f155
2018-02-28 08:45:37 +00:00
Hyundo Moon
9edf2ca33e Move MediaItem2 Builder to updatable
This CL also removes the public constructor of MediaItem2, which was
suggested by API reviewers.

Bug: 73971203
Test: Passed MediaBrowser2Test (CTS)
Change-Id: If82c2795a4f205b9dfd4db11a173433359d1b352
2018-02-28 16:27:38 +09:00
Hyundo Moon
72706118cf MediaMetadata2: Supplement Javadoc of each key
The Javadoc of the METADATA_KEY_* does not contain type information.
This CL adds '@see' in each key so that the developer can easily notice
what method should be used.

Bug: 73877547
Test: Builds successfully
Change-Id: I04f1b0badc1b6e7af6cb04923ef4f59328248b74
2018-02-28 15:57:11 +09:00
Jean-Michel Trivi
c3a438f65b MediaPlayerBase API
Define as an abstract class the high level interface for
  media players. Consumers are MediaSession2, providers
  are MediaPlayer2, which will extend this class.

Bug: 64098437
Test: to be in MediaPlayer2 tests once it extends MPB
Change-Id: Id0d0fcb6d1b377a0e05a4a8e3d659e12a58fc45e
2018-02-27 22:53:25 -08:00