Refactor Clank cast code to use MediaNotificationManager
This CL removes cast's own notification and lock screen classes, and
replaces them with a wrapper of MediaNotificationManager.
BUG=579919
Committed: https://crrev.com/f6db886968fd5493172f2941d6466a021e520a4e
Cr-Commit-Position: refs/heads/master@{#373536}
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1652163002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1652163002/1
4 years, 10 months ago
(2016-02-01 17:56:21 UTC)
#4
Dry run: Try jobs failed on following builders: android_arm64_dbg_recipe on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm64_dbg_recipe/builds/15574) android_clang_dbg_recipe on ...
4 years, 10 months ago
(2016-02-01 18:13:15 UTC)
#7
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1652163002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1652163002/20001
4 years, 10 months ago
(2016-02-01 18:42:13 UTC)
#9
Dry run: Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_clang_dbg_recipe/builds/15717)
4 years, 10 months ago
(2016-02-01 19:29:39 UTC)
#13
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1652163002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1652163002/40001
4 years, 10 months ago
(2016-02-02 14:31:07 UTC)
#17
4 years, 10 months ago
(2016-02-02 14:31:11 UTC)
#18
https://codereview.chromium.org/1652163002/diff/20001/chrome/android/java/src...
File
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java
(right):
https://codereview.chromium.org/1652163002/diff/20001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java:26:
MediaNotificationListener, AudioManager.OnAudioFocusChangeListener {
On 2016/02/01 20:54:14, whywhat wrote:
> Do you need to handle any audio focus changes?
> How does it work if one casts a video and then plays another video locally
(that
> would request audio focus for the remote playback first, then for the local
> playback)?
> I guess it should be fine since we had this behavior before.
It seems that the most recent item gets audio focus. The whole audio focus
concept seems a bit of a mess when one has multiple audio outputs, but that is
an Android problem.
As you say, this is no different from the the previous behaviour.
https://codereview.chromium.org/1652163002/diff/20001/chrome/android/java/src...
File
chrome/android/java/src/org/chromium/chrome/browser/media/remote/ExpandedControllerActivity.java
(right):
https://codereview.chromium.org/1652163002/diff/20001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/media/remote/ExpandedControllerActivity.java:34:
* TODO(cimamoglu): Refactor to merge some common logic with {@link
CastNotificationControl}.
On 2016/02/01 20:54:14, whywhat wrote:
> I doubt Cihat will ever fix this, maybe change the name to yours?
Done, assuming we don't get rid of this completely.
https://codereview.chromium.org/1652163002/diff/20001/chrome/android/java/src...
File
chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerController.java
(right):
https://codereview.chromium.org/1652163002/diff/20001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerController.java:46:
private CastNotificationControl mNotificationControl;
On 2016/02/01 20:54:14, whywhat wrote:
> It's probably concern the whole MediaNotification* classes family (what other
> name could we use? SystemMediaControls?) but since they're handling the lock
> screen as well and other things, maybe leave a comment above clarifying that?
The class comment already mentions the lock screen, so I think a comment here is
unnecessary, especially since modern versions of Android tightly link the two
together.
https://codereview.chromium.org/1652163002/diff/20001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerController.java:278:
return mNotificationControl;
On 2016/02/01 20:54:14, whywhat wrote:
> when does this return null?
I don't think it can be, but I am not absolutely certain, and I have only done
the minimum possible changes to RemoteMediaPlayerController in this CL. In fact
RemoteMediaPlayerController is quite messy, but I will sort this out in a
different CL.
https://codereview.chromium.org/1652163002/diff/20001/chrome/android/javatest...
File
chrome/android/javatests/src/org/chromium/chrome/browser/media/remote/CastTestBase.java
(right):
https://codereview.chromium.org/1652163002/diff/20001/chrome/android/javatest...
chrome/android/javatests/src/org/chromium/chrome/browser/media/remote/CastTestBase.java:91:
private CountDownLatch mLatch;
On 2016/02/01 20:54:14, whywhat wrote:
> I never heard of a latch in programming :( You should tell me what it is so I
> learn.
I only learnt about them recently. They are quite nice because, unlike most
other concurrency primitives they only block the receiver, not the sender. As
such they are quite nice for this sort of situation, where one doesn't want to
fundamentally change the behaviour of the sender.
I think one can do cleverer things with them than I am here, such as having
multiple threads wait for the same events; but even with the simple use here
they are quite useful.
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
4 years, 10 months ago
(2016-02-02 15:14:23 UTC)
#19
some drive-by comments https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java File chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java (right): https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java#newcode97 chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java:97: AudioManager.AUDIOFOCUS_GAIN); Why do we take audio ...
4 years, 10 months ago
(2016-02-02 16:02:53 UTC)
#22
some drive-by comments
https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src...
File
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java
(right):
https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java:97:
AudioManager.AUDIOFOCUS_GAIN);
Why do we take audio focus if we don't do anything with it? (ie. we don't play
on the device and don't stop if asked to)
If this is an Android requirement to have something on the lock screen,
shouldn't we take audio focus back as soon as the Chrome activity is visible?
Otherwise, something might take audio focus and lose it. Taking it will make the
remote playback to lose audio focus then we will end up with no more audio focus
on the system, thus no lock screen integration?
https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java:208:
static CastNotificationControl getIfExists() {
style: getForTests()
https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java:213:
boolean isShowing() {
style: isShowingForTests()
4 years, 10 months ago
(2016-02-02 21:34:06 UTC)
#23
avayvod@ PTAL
https://codereview.chromium.org/1652163002/diff/80001/chrome/android/javatest...
File
chrome/android/javatests/src/org/chromium/chrome/browser/media/remote/CastNotificationTest.java
(left):
https://codereview.chromium.org/1652163002/diff/80001/chrome/android/javatest...
chrome/android/javatests/src/org/chromium/chrome/browser/media/remote/CastNotificationTest.java:74:
public void testNotificationSelect() throws InterruptedException,
TimeoutException {
Since the cast code no longer gets involved in starting the expanded controller
activity (when the notification is tapped) it is no longer useful to test this
at this level. Doing so would simply test Android Intent handling.
aberent
On 2016/02/02 16:02:53, Mounir Lamouri wrote: > some drive-by comments > > https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java > File ...
4 years, 10 months ago
(2016-02-02 21:52:18 UTC)
#24
On 2016/02/02 16:02:53, Mounir Lamouri wrote:
> some drive-by comments
>
>
https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src...
> File
>
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java
> (right):
>
>
https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src...
>
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java:97:
> AudioManager.AUDIOFOCUS_GAIN);
> Why do we take audio focus if we don't do anything with it? (ie. we don't play
> on the device and don't stop if asked to)
>
> If this is an Android requirement to have something on the lock screen,
> shouldn't we take audio focus back as soon as the Chrome activity is visible?
> Otherwise, something might take audio focus and lose it. Taking it will make
the
> remote playback to lose audio focus then we will end up with no more audio
focus
> on the system, thus no lock screen integration?
>
>
https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src...
>
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java:208:
> static CastNotificationControl getIfExists() {
> style: getForTests()
>
>
https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src...
>
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java:213:
> boolean isShowing() {
> style: isShowingForTests()
Missed these comments in my new patchset. Will reply (and possibly update)
tomorrow.
aberent
The CQ bit was checked by aberent@chromium.org to run a CQ dry run
4 years, 10 months ago
(2016-02-02 21:52:38 UTC)
#25
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1652163002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1652163002/80001
4 years, 10 months ago
(2016-02-02 21:56:54 UTC)
#26
4 years, 10 months ago
(2016-02-03 11:58:48 UTC)
#29
https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src...
File
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java
(right):
https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java:97:
AudioManager.AUDIOFOCUS_GAIN);
On 2016/02/02 16:02:53, Mounir Lamouri wrote:
> Why do we take audio focus if we don't do anything with it? (ie. we don't play
> on the device and don't stop if asked to)
>
> If this is an Android requirement to have something on the lock screen,
> shouldn't we take audio focus back as soon as the Chrome activity is visible?
> Otherwise, something might take audio focus and lose it. Taking it will make
the
> remote playback to lose audio focus then we will end up with no more audio
focus
> on the system, thus no lock screen integration?
I admit I don't fully understand how audio focus works on Android or in Chrome;
however this reproduces the previous behaviour. I tried removing this, but doing
so had two effects:
1 - The local playback notification didn't go away when switching to remote
playback.
2 - If we had switched from local to remote playback (rather than starting
remote playback directly) we didn't get a lock screen.
You are right that, if we play a video in a different app (e.g. YouTube), we
lose the lock screen, and don't regain it when Chrome comes back into foreground
(although we do if the user presses play on Chrome), so there are things to be
fixed here. It isn't, however, obvious how to wire through the onResume() event
to here.
As such I left it as it is for now but have added a TODO to investigate in more
detail.
https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java:208:
static CastNotificationControl getIfExists() {
On 2016/02/02 16:02:53, Mounir Lamouri wrote:
> style: getForTests()
Done.
https://codereview.chromium.org/1652163002/diff/40001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java:213:
boolean isShowing() {
On 2016/02/02 16:02:53, Mounir Lamouri wrote:
> style: isShowingForTests()
Done.
aberent
The CQ bit was checked by aberent@chromium.org to run a CQ dry run
4 years, 10 months ago
(2016-02-03 11:59:33 UTC)
#30
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1652163002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1652163002/100001
4 years, 10 months ago
(2016-02-03 12:00:00 UTC)
#31
4 years, 10 months ago
(2016-02-03 12:50:23 UTC)
#33
Dry run: This issue passed the CQ dry run.
mlamouri (slow - plz ping)
lgtm with comments applied https://codereview.chromium.org/1652163002/diff/100001/chrome/android/java/AndroidManifest.xml File chrome/android/java/AndroidManifest.xml (right): https://codereview.chromium.org/1652163002/diff/100001/chrome/android/java/AndroidManifest.xml#newcode679 chrome/android/java/AndroidManifest.xml:679: </service> You are adding these ...
4 years, 10 months ago
(2016-02-03 14:47:18 UTC)
#34
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1652163002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1652163002/120001
4 years, 10 months ago
(2016-02-04 14:37:35 UTC)
#38
4 years, 10 months ago
(2016-02-04 15:23:16 UTC)
#39
Message was sent while issue was closed.
Committed patchset #7 (id:120001)
commit-bot: I haz the power
Description was changed from ========== Refactor Clank cast code to use MediaNotificationManager This CL removes ...
4 years, 10 months ago
(2016-02-04 15:24:37 UTC)
#40
Message was sent while issue was closed.
Description was changed from
==========
Refactor Clank cast code to use MediaNotificationManager
This CL removes cast's own notification and lock screen classes, and
replaces them with a wrapper of MediaNotificationManager.
BUG=579919
==========
to
==========
Refactor Clank cast code to use MediaNotificationManager
This CL removes cast's own notification and lock screen classes, and
replaces them with a wrapper of MediaNotificationManager.
BUG=579919
Committed: https://crrev.com/f6db886968fd5493172f2941d6466a021e520a4e
Cr-Commit-Position: refs/heads/master@{#373536}
==========
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/f6db886968fd5493172f2941d6466a021e520a4e Cr-Commit-Position: refs/heads/master@{#373536}
4 years, 10 months ago
(2016-02-04 15:24:38 UTC)
#41
Issue 1652163002: Refactor Clank cast code to use MediaNotificationManager
(Closed)
Created 4 years, 10 months ago by aberent
Modified 4 years, 10 months ago
Reviewers: mlamouri (slow - plz ping), whywhat, Bernhard Bauer, Ted C
Base URL: https://chromium.googlesource.com/chromium/src.git@MediaUi
Comments: 23