Bug 1575995 - part4 : add the pref 'media.hardwaremediakeys.enabled' to control this feature. r=baku
authorAlastor Wu <alwu@mozilla.com>
Thu, 29 Aug 2019 01:01:04 +0000
changeset 493949 49618c34643003a9d4ed8584ecdeac18c5927569
parent 493948 deb0bc2ec44fcb4af8efca40c6938769e861bd18
child 493950 fa579e9b1e7dc010ff707dd6eae15fef44253f0e
push id95775
push useralwu@mozilla.com
push dateThu, 19 Sep 2019 01:12:57 +0000
treeherderautoland@fa579e9b1e7d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1575995
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1575995 - part4 : add the pref 'media.hardwaremediakeys.enabled' to control this feature. r=baku Differential Revision: https://phabricator.services.mozilla.com/D43316
dom/media/mediacontrol/MediaHardwareKeysManager.cpp
modules/libpref/init/StaticPrefList.yaml
--- a/dom/media/mediacontrol/MediaHardwareKeysManager.cpp
+++ b/dom/media/mediacontrol/MediaHardwareKeysManager.cpp
@@ -26,16 +26,19 @@ MediaHardwareKeysManager::MediaHardwareK
 }
 
 MediaHardwareKeysManager::~MediaHardwareKeysManager() {
   StopMonitoringHardwareKeys();
 }
 
 void MediaHardwareKeysManager::StartMonitoringHardwareKeys() {
   LOG("StartMonitoringHardwareKeys");
+  if (!StaticPrefs::media_hardwaremediakeys_enabled()) {
+    return;
+  }
   CreateEventSource();
   if (mEventSource) {
     mEventSource->AddListener(new MediaHardwareKeysEventListener());
   }
 }
 
 void MediaHardwareKeysManager::CreateEventSource() {
 #ifdef MOZ_APPLEMEDIA
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -6116,16 +6116,21 @@
   value: false
   mirror: always
 
 - name: media.audioFocus.management
   type: bool
   value: false
   mirror: always
 
+- name: media.hardwaremediakeys.enabled
+  type: bool
+  value: false
+  mirror: always
+
 - name: media.webrtc.platformencoder
   type: bool
   value: false
   mirror: always
 
 #---------------------------------------------------------------------------
 # Prefs starting with "mousewheel."
 #---------------------------------------------------------------------------