Unreviewed, rolling out r245890, 245887.
authorryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 May 2019 03:14:35 +0000 (03:14 +0000)
committerryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 May 2019 03:14:35 +0000 (03:14 +0000)
Breaks internal builds.

Reverted changeset:
"Video playback in Safari should continue when CarPlay is plugged in"
https://bugs.webkit.org/show_bug.cgi?id=198345
https://trac.webkit.org/changeset/245887/webkit# Please enter the commit message for your changes. Lines starting

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245944 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/media/video-isplayingtoautomotiveheadunit-expected.txt [deleted file]
LayoutTests/media/video-isplayingtoautomotiveheadunit.html [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
Source/WebCore/platform/audio/PlatformMediaSessionManager.h
Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h
Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl

index 950b9c0..279b28d 100644 (file)
@@ -1,3 +1,15 @@
+2019-05-30  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r245890, 245887.
+
+        Breaks internal builds.
+
+        Reverted changeset:
+        "Video playback in Safari should continue when CarPlay is plugged in"
+        https://bugs.webkit.org/show_bug.cgi?id=198345
+        https://trac.webkit.org/changeset/245887/webkit
+
+
 2019-05-30  Dean Jackson  <dino@apple.com>
 
         Media documents on iPad are too wide in split screen
diff --git a/LayoutTests/media/video-isplayingtoautomotiveheadunit-expected.txt b/LayoutTests/media/video-isplayingtoautomotiveheadunit-expected.txt
deleted file mode 100644 (file)
index 063e5ed..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-
-RUN(video.src = findMediaFile("video", "content/test"))
-EVENT(canplaythrough)
-RUN(video.play())
-EVENT(playing)
-RUN(internals.setMediaSessionRestrictions("videoaudio", "suspendedunderlockplaybackrestricted"))
-RUN(internals.applicationDidEnterBackground(true))
-EVENT(pause)
-RUN(internals.applicationWillEnterForeground(true))
-EVENT(playing)
-RUN(internals.setIsPlayingToAutomotiveHeadUnit(true))
-RUN(internals.applicationDidEnterBackground(true))
-EXPECTED (video.paused == 'false') OK
-END OF TEST
-
diff --git a/LayoutTests/media/video-isplayingtoautomotiveheadunit.html b/LayoutTests/media/video-isplayingtoautomotiveheadunit.html
deleted file mode 100644 (file)
index b1053f9..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <title>video-isplayingtoautomotiveheadunit</title>
-    <script src="video-test.js"></script>
-    <script src="media-file.js"></script>
-    <script>
-    window.addEventListener('load', async event => {
-        findMediaElement();
-
-        run('video.src = findMediaFile("video", "content/test")');
-        await waitFor(video, 'canplaythrough');
-
-        runWithKeyDown('video.play()');
-        await waitFor(video, 'playing');
-
-        run('internals.setMediaSessionRestrictions("videoaudio", "suspendedunderlockplaybackrestricted")')
-        run('internals.applicationDidEnterBackground(true)');
-        await waitFor(video, 'pause');
-
-        run('internals.applicationWillEnterForeground(true)');
-        await waitFor(video, 'playing');
-
-        run('internals.setIsPlayingToAutomotiveHeadUnit(true)');
-        run('internals.applicationDidEnterBackground(true)');
-        testExpected('video.paused', false);
-        endTest();
-    });
-    </script>
-</head>
-<body>
-    <video controls></video>
-</body>
-</html>
\ No newline at end of file
index 60ef2cf..10e75b0 100644 (file)
@@ -1,3 +1,14 @@
+2019-05-30  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r245890, 245887.
+
+        Breaks internal builds.
+
+        Reverted changeset:
+        "Video playback in Safari should continue when CarPlay is plugged in"
+        https://bugs.webkit.org/show_bug.cgi?id=198345
+        https://trac.webkit.org/changeset/245887/webkit
+
 2019-05-30  Dean Jackson  <dino@apple.com>
 
         Media documents on iPad are too wide in split screen
index 75f1938..f00d81c 100644 (file)
@@ -7715,10 +7715,6 @@ bool HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(PlatformMedia
             INFO_LOG(LOGIDENTIFIER, "returning true because isPlayingToExternalTarget() is true");
             return true;
         }
-        if (PlatformMediaSessionManager::sharedManager().isPlayingToAutomotiveHeadUnit()) {
-            INFO_LOG(LOGIDENTIFIER, "returning true because isPlayingToAutomotiveHeadUnit() is true");
-            return true;
-        }
         if (m_videoFullscreenMode & VideoFullscreenModePictureInPicture)
             return true;
 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
@@ -7730,10 +7726,6 @@ bool HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(PlatformMedia
             INFO_LOG(LOGIDENTIFIER, "returning true because isPlayingToExternalTarget() is true");
             return true;
         }
-        if (PlatformMediaSessionManager::sharedManager().isPlayingToAutomotiveHeadUnit()) {
-            INFO_LOG(LOGIDENTIFIER, "returning true because isPlayingToAutomotiveHeadUnit() is true");
-            return true;
-        }
     }
     return false;
 }
index b42c214..8370fb0 100644 (file)
@@ -391,14 +391,6 @@ void PlatformMediaSessionManager::processDidResume()
 #endif
 }
 
-void PlatformMediaSessionManager::setIsPlayingToAutomotiveHeadUnit(bool isPlayingToAutomotiveHeadUnit)
-{
-    if (isPlayingToAutomotiveHeadUnit == m_isPlayingToAutomotiveHeadUnit)
-        return;
-
-    ALWAYS_LOG(LOGIDENTIFIER, isPlayingToAutomotiveHeadUnit);
-    m_isPlayingToAutomotiveHeadUnit = isPlayingToAutomotiveHeadUnit;
-}
 
 void PlatformMediaSessionManager::sessionIsPlayingToWirelessPlaybackTargetChanged(PlatformMediaSession& session)
 {
index b9119e0..3685307 100644 (file)
@@ -129,9 +129,6 @@ public:
 
     void sessionIsPlayingToWirelessPlaybackTargetChanged(PlatformMediaSession&);
 
-    WEBCORE_EXPORT void setIsPlayingToAutomotiveHeadUnit(bool);
-    bool isPlayingToAutomotiveHeadUnit() const { return m_isPlayingToAutomotiveHeadUnit; }
-
     void forEachMatchingSession(const Function<bool(const PlatformMediaSession&)>& predicate, const Function<void(PlatformMediaSession&)>& matchingCallback);
 
 protected:
@@ -191,7 +188,6 @@ private:
     mutable bool m_isApplicationInBackground { false };
     bool m_willIgnoreSystemInterruptions { false };
     bool m_processIsSuspended { false };
-    bool m_isPlayingToAutomotiveHeadUnit { false };
 
 #if USE(AUDIO_SESSION)
     bool m_becameActive { false };
index 479da7a..eb01d6f 100644 (file)
@@ -47,8 +47,6 @@ public:
 
     void externalOutputDeviceAvailableDidChange();
     bool hasWirelessTargetsAvailable() override;
-    void carPlayServerDied();
-    void updateCarPlayIsConnected(Optional<bool>&&);
 
 private:
     friend class PlatformMediaSessionManager;
index 4afe286..0043904 100644 (file)
@@ -56,10 +56,6 @@ WEBCORE_EXPORT NSString* WebUIApplicationDidEnterBackgroundNotification = @"WebU
 SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(Celestial)
 SOFT_LINK_CLASS_OPTIONAL(Celestial, AVSystemController)
 SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_PIDToInheritApplicationStateFrom, NSString *)
-SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_CarPlayIsConnectedAttribute, NSString *)
-SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_CarPlayIsConnectedDidChangeNotification, NSString *)
-SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_CarPlayIsConnectedNotificationParameter, NSString *)
-SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_ServerConnectionDiedNotification, NSString *)
 #endif
 
 using namespace WebCore;
@@ -113,8 +109,6 @@ MediaSessionManageriOS::MediaSessionManageriOS()
     m_objcObserver = adoptNS([[WebMediaSessionHelper alloc] initWithCallback:this]);
     END_BLOCK_OBJC_EXCEPTIONS
     resetRestrictions();
-
-    updateCarPlayIsConnected(WTF::nullopt);
 }
 
 MediaSessionManageriOS::~MediaSessionManageriOS()
@@ -200,27 +194,6 @@ void MediaSessionManageriOS::externalOutputDeviceAvailableDidChange()
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
-void MediaSessionManageriOS::carPlayServerDied()
-{
-    ALWAYS_LOG(LOGIDENTIFIER);
-    updateCarPlayIsConnected(WTF::nullopt);
-}
-
-void MediaSessionManageriOS::updateCarPlayIsConnected(Optional<bool>&& carPlayIsConnected)
-{
-    if (carPlayIsConnected) {
-        setIsPlayingToAutomotiveHeadUnit(carPlayIsConnected.value());
-        return;
-    }
-
-    if (!canLoadAVSystemController_CarPlayIsConnectedAttribute()) {
-        setIsPlayingToAutomotiveHeadUnit(false);
-        return;
-    }
-
-    setIsPlayingToAutomotiveHeadUnit([[[getAVSystemControllerClass() sharedAVSystemController] attributeForKey:getAVSystemController_CarPlayIsConnectedAttribute()] boolValue]);
-}
-
 } // namespace WebCore
 
 @implementation WebMediaSessionHelper
@@ -245,10 +218,6 @@ void MediaSessionManageriOS::updateCarPlayIsConnected(Optional<bool>&& carPlayIs
     [center addObserver:self selector:@selector(applicationWillResignActive:) name:WebUIApplicationWillResignActiveNotification object:nil];
     [center addObserver:self selector:@selector(applicationDidEnterBackground:) name:PAL::get_UIKit_UIApplicationDidEnterBackgroundNotification() object:nil];
     [center addObserver:self selector:@selector(applicationDidEnterBackground:) name:WebUIApplicationDidEnterBackgroundNotification object:nil];
-    if (canLoadAVSystemController_ServerConnectionDiedNotification())
-        [center addObserver:self selector:@selector(carPlayServerDied:) name:getAVSystemController_ServerConnectionDiedNotification() object:nil];
-    if (canLoadAVSystemController_CarPlayIsConnectedDidChangeNotification())
-        [center addObserver:self selector:@selector(carPlayIsConnectedDidChange:) name:getAVSystemController_CarPlayIsConnectedDidChangeNotification() object:nil];
 
     // Now playing won't work unless we turn on the delivery of remote control events.
     dispatch_async(dispatch_get_main_queue(), ^ {
@@ -317,14 +286,14 @@ void MediaSessionManageriOS::updateCarPlayIsConnected(Optional<bool>&& carPlayIs
 
     LOG(Media, "-[WebMediaSessionHelper startMonitoringAirPlayRoutes]");
 
-    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = retainPtr(self)]() mutable {
+    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = WTFMove(self)]() mutable {
         ASSERT(!protectedSelf->_routeDetector);
 
         if (protectedSelf->_callback) {
             BEGIN_BLOCK_OBJC_EXCEPTIONS
             protectedSelf->_routeDetector = adoptNS([PAL::allocAVRouteDetectorInstance() init]);
             protectedSelf->_routeDetector.get().routeDetectionEnabled = protectedSelf->_monitoringAirPlayRoutes;
-            [[NSNotificationCenter defaultCenter] addObserver:protectedSelf.get() selector:@selector(wirelessRoutesAvailableDidChange:) name:AVRouteDetectorMultipleRoutesDetectedDidChangeNotification object:protectedSelf->_routeDetector.get()];
+            [[NSNotificationCenter defaultCenter] addObserver:protectedSelf selector:@selector(wirelessRoutesAvailableDidChange:) name:AVRouteDetectorMultipleRoutesDetectedDidChangeNotification object:protectedSelf->_routeDetector.get()];
 
             protectedSelf->_callback->externalOutputDeviceAvailableDidChange();
             END_BLOCK_OBJC_EXCEPTIONS
@@ -359,7 +328,7 @@ void MediaSessionManageriOS::updateCarPlayIsConnected(Optional<bool>&& carPlayIs
     if (type == AVAudioSessionInterruptionTypeEnded && [[[notification userInfo] objectForKey:AVAudioSessionInterruptionOptionKey] unsignedIntegerValue] == AVAudioSessionInterruptionOptionShouldResume)
         flags = PlatformMediaSession::MayResumePlaying;
 
-    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = retainPtr(self), type, flags]() mutable {
+    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = WTFMove(self), type, flags]() mutable {
         auto* callback = protectedSelf->_callback;
         if (!callback)
             return;
@@ -382,7 +351,7 @@ void MediaSessionManageriOS::updateCarPlayIsConnected(Optional<bool>&& carPlayIs
     LOG(Media, "-[WebMediaSessionHelper applicationWillEnterForeground]");
 
     BOOL isSuspendedUnderLock = [[[notification userInfo] objectForKey:@"isSuspendedUnderLock"] boolValue];
-    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = retainPtr(self), isSuspendedUnderLock]() mutable {
+    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = WTFMove(self), isSuspendedUnderLock]() mutable {
         if (auto* callback = protectedSelf->_callback)
             callback->applicationWillEnterForeground(isSuspendedUnderLock);
     });
@@ -397,7 +366,7 @@ void MediaSessionManageriOS::updateCarPlayIsConnected(Optional<bool>&& carPlayIs
 
     LOG(Media, "-[WebMediaSessionHelper applicationDidBecomeActive]");
 
-    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = retainPtr(self)]() mutable {
+    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = WTFMove(self)]() mutable {
         if (auto* callback = protectedSelf->_callback)
             callback->applicationDidBecomeActive();
     });
@@ -412,7 +381,7 @@ void MediaSessionManageriOS::updateCarPlayIsConnected(Optional<bool>&& carPlayIs
 
     LOG(Media, "-[WebMediaSessionHelper applicationWillResignActive]");
 
-    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = retainPtr(self)]() mutable {
+    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = WTFMove(self)]() mutable {
         if (auto* callback = protectedSelf->_callback)
             callback->applicationWillBecomeInactive();
     });
@@ -427,7 +396,7 @@ void MediaSessionManageriOS::updateCarPlayIsConnected(Optional<bool>&& carPlayIs
 
     LOG(Media, "-[WebMediaSessionHelper wirelessRoutesAvailableDidChange]");
 
-    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = retainPtr(self)]() mutable {
+    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = WTFMove(self)]() mutable {
         if (auto* callback = protectedSelf->_callback)
             callback->externalOutputDeviceAvailableDidChange();
     });
@@ -441,42 +410,11 @@ void MediaSessionManageriOS::updateCarPlayIsConnected(Optional<bool>&& carPlayIs
     LOG(Media, "-[WebMediaSessionHelper applicationDidEnterBackground]");
 
     BOOL isSuspendedUnderLock = [[[notification userInfo] objectForKey:@"isSuspendedUnderLock"] boolValue];
-    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = retainPtr(self), isSuspendedUnderLock]() mutable {
+    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = WTFMove(self), isSuspendedUnderLock]() mutable {
         if (auto* callback = protectedSelf->_callback)
             callback->applicationDidEnterBackground(isSuspendedUnderLock);
     });
 }
-
-- (void)carPlayServerDied:(NSNotification *)notification
-{
-    if (!_callback)
-        return;
-
-    LOG(Media, "-[WebMediaSessionHelper carPlayServerDied:]");
-    UNUSED_PARAM(notification);
-    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = retainPtr(self)]() mutable {
-        if (auto* callback = protectedSelf->_callback)
-            callback->carPlayServerDied();
-    });
-}
-
-- (void)carPlayIsConnectedDidChange:(NSNotification *)notification
-{
-    if (!_callback)
-        return;
-
-    Optional<bool> carPlayIsConnected;
-    if (notification && canLoadAVSystemController_CarPlayIsConnectedNotificationParameter()) {
-        NSNumber *nsCarPlayIsConnected = [[notification userInfo] valueForKey:getAVSystemController_CarPlayIsConnectedNotificationParameter()];
-        if (nsCarPlayIsConnected)
-            carPlayIsConnected = [nsCarPlayIsConnected boolValue];
-    }
-
-    callOnWebThreadOrDispatchAsyncOnMainThread([protectedSelf = retainPtr(self), carPlayIsConnected = WTFMove(carPlayIsConnected)]() mutable {
-        if (auto* callback = protectedSelf->_callback)
-            callback->updateCarPlayIsConnected(WTFMove(carPlayIsConnected));
-    });
-}
 @end
 
 #endif // PLATFORM(IOS_FAMILY)
index 2730dfe..510ef0d 100644 (file)
@@ -492,7 +492,6 @@ void Internals::resetToConsistentState(Page& page)
     PlatformMediaSessionManager::sharedManager().resetRestrictions();
     PlatformMediaSessionManager::sharedManager().setWillIgnoreSystemInterruptions(true);
 #endif
-    PlatformMediaSessionManager::sharedManager().setIsPlayingToAutomotiveHeadUnit(false);
 #if HAVE(ACCESSIBILITY)
     AXObjectCache::setEnhancedUserInterfaceAccessibility(false);
     AXObjectCache::disableAccessibility();
@@ -5068,9 +5067,4 @@ void Internals::setXHRMaximumIntervalForUserGestureForwarding(XMLHttpRequest& re
     request.setMaximumIntervalForUserGestureForwarding(interval);
 }
 
-void Internals::setIsPlayingToAutomotiveHeadUnit(bool isPlaying)
-{
-    PlatformMediaSessionManager::sharedManager().setIsPlayingToAutomotiveHeadUnit(isPlaying);
-}
-
 } // namespace WebCore
index 46d426a..3ac66f7 100644 (file)
@@ -823,8 +823,6 @@ public:
 
     void setXHRMaximumIntervalForUserGestureForwarding(XMLHttpRequest&, double);
 
-    void setIsPlayingToAutomotiveHeadUnit(bool);
-
 private:
     explicit Internals(Document&);
     Document* contextDocument() const;
index 3a59b4d..ca2bc54 100644 (file)
@@ -753,6 +753,4 @@ enum CompositingPolicy {
     void testDictionaryLogging();
 
     void setXHRMaximumIntervalForUserGestureForwarding(XMLHttpRequest xhr, double interval);
-
-    void setIsPlayingToAutomotiveHeadUnit(boolean value);
 };