Bug 1651165 - Rename idle service r=Gijs,geckoview-reviewers,snorp
authorDoug Thayer <dothayer@mozilla.com>
Mon, 20 Jul 2020 16:06:59 +0000
changeset 541396 2a646a7936e7ffbe168a3a354e3bf31b536ff815
parent 541395 94dcb2fb29ce891e55f198246edc299d8a72a333
child 541397 d67baa90813190ce036daa12ffe0f93700c5a5c4
push id122216
push userdothayer@mozilla.com
push dateTue, 21 Jul 2020 04:34:14 +0000
treeherderautoland@d67baa908131 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, geckoview-reviewers, snorp
bugs1651165
milestone80.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 1651165 - Rename idle service r=Gijs,geckoview-reviewers,snorp Differential Revision: https://phabricator.services.mozilla.com/D83413
browser/components/BrowserGlue.jsm
browser/components/sessionstore/SessionSaver.jsm
browser/components/sessionstore/test/browser_not_collect_when_idle.js
browser/modules/WindowsJumpLists.jsm
dom/base/nsContentUtils.cpp
dom/base/nsGlobalWindowInner.h
dom/ipc/ContentParent.cpp
dom/quota/QuotaManagerService.cpp
extensions/permissions/PermissionManager.cpp
services/sync/modules/policies.js
testing/xpcshell/example/unit/test_get_idle.js
testing/xpcshell/head.js
toolkit/components/extensions/parent/ext-idle.js
toolkit/components/extensions/test/mochitest/test_ext_idle.html
toolkit/components/extensions/test/xpcshell/test_ext_idle.js
toolkit/components/places/PlacesExpiration.jsm
toolkit/components/places/tests/gtest/places_test_harness_tail.h
toolkit/components/search/SearchService.jsm
toolkit/components/search/tests/SearchTestUtils.jsm
toolkit/components/telemetry/app/TelemetryScheduler.jsm
widget/android/components.conf
widget/android/moz.build
widget/android/nsIdleServiceAndroid.cpp
widget/android/nsIdleServiceAndroid.h
widget/android/nsUserIdleServiceAndroid.cpp
widget/android/nsUserIdleServiceAndroid.h
widget/android/nsWindow.cpp
widget/android/nsWindow.h
widget/cocoa/moz.build
widget/cocoa/nsIdleServiceX.h
widget/cocoa/nsIdleServiceX.mm
widget/cocoa/nsMenuX.mm
widget/cocoa/nsUserIdleServiceX.h
widget/cocoa/nsUserIdleServiceX.mm
widget/cocoa/nsWidgetFactory.mm
widget/gtk/components.conf
widget/gtk/moz.build
widget/gtk/nsIdleServiceGTK.cpp
widget/gtk/nsIdleServiceGTK.h
widget/gtk/nsUserIdleServiceGTK.cpp
widget/gtk/nsUserIdleServiceGTK.h
widget/gtk/nsWindow.cpp
widget/moz.build
widget/nsIIdleService.idl
widget/nsIIdleServiceInternal.idl
widget/nsIUserIdleService.idl
widget/nsIUserIdleServiceInternal.idl
widget/nsIdleService.cpp
widget/nsIdleService.h
widget/nsUserIdleService.cpp
widget/nsUserIdleService.h
widget/tests/test_bug343416.xhtml
widget/windows/KeyboardLayout.cpp
widget/windows/KeyboardLayout.h
widget/windows/components.conf
widget/windows/moz.build
widget/windows/nsIdleServiceWin.cpp
widget/windows/nsIdleServiceWin.h
widget/windows/nsUserIdleServiceWin.cpp
widget/windows/nsUserIdleServiceWin.h
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
xpcom/io/nsAnonymousTemporaryFile.cpp
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -835,19 +835,19 @@ const STARTUP_CRASHES_END_DELAY_MS = 30 
  * OS X has the concept of zero-window sessions and therefore ignores the
  * browser-lastwindow-close-* topics.
  */
 const OBSERVE_LASTWINDOW_CLOSE_TOPICS = AppConstants.platform != "macosx";
 
 function BrowserGlue() {
   XPCOMUtils.defineLazyServiceGetter(
     this,
-    "_idleService",
-    "@mozilla.org/widget/idleservice;1",
-    "nsIIdleService"
+    "_userIdleService",
+    "@mozilla.org/widget/useridleservice;1",
+    "nsIUserIdleService"
   );
 
   XPCOMUtils.defineLazyGetter(this, "_distributionCustomizer", function() {
     const { DistributionCustomizer } = ChromeUtils.import(
       "resource:///modules/distribution.js"
     );
     return new DistributionCustomizer();
   });
@@ -1186,21 +1186,24 @@ BrowserGlue.prototype = {
     os.removeObserver(this, "fxaccounts:onverified");
     os.removeObserver(this, "fxaccounts:device_connected");
     os.removeObserver(this, "fxaccounts:verify_login");
     os.removeObserver(this, "fxaccounts:device_disconnected");
     os.removeObserver(this, "fxaccounts:commands:open-uri");
     os.removeObserver(this, "weave:engine:clients:display-uris");
     os.removeObserver(this, "session-save");
     if (this._bookmarksBackupIdleTime) {
-      this._idleService.removeIdleObserver(this, this._bookmarksBackupIdleTime);
+      this._userIdleService.removeIdleObserver(
+        this,
+        this._bookmarksBackupIdleTime
+      );
       delete this._bookmarksBackupIdleTime;
     }
     if (this._lateTasksIdleObserver) {
-      this._idleService.removeIdleObserver(
+      this._userIdleService.removeIdleObserver(
         this._lateTasksIdleObserver,
         LATE_TASKS_IDLE_TIME_SEC
       );
       delete this._lateTasksIdleObserver;
     }
     if (this._gmpInstallManager) {
       this._gmpInstallManager.uninit();
       delete this._gmpInstallManager;
@@ -1984,17 +1987,20 @@ BrowserGlue.prototype = {
       Services.startup.trackStartupCrashEnd();
     } catch (e) {
       Cu.reportError(
         "Could not end startup crash tracking in quit-application-granted: " + e
       );
     }
 
     if (this._bookmarksBackupIdleTime) {
-      this._idleService.removeIdleObserver(this, this._bookmarksBackupIdleTime);
+      this._userIdleService.removeIdleObserver(
+        this,
+        this._bookmarksBackupIdleTime
+      );
       delete this._bookmarksBackupIdleTime;
     }
 
     for (let mod of Object.values(initializedModules)) {
       if (mod.uninit) {
         mod.uninit();
       }
     }
@@ -2241,17 +2247,17 @@ BrowserGlue.prototype = {
         idleService.removeIdleObserver(
           this._lateTasksIdleObserver,
           LATE_TASKS_IDLE_TIME_SEC
         );
         delete this._lateTasksIdleObserver;
         this._scheduleArbitrarilyLateIdleTasks();
       }
     };
-    this._idleService.addIdleObserver(
+    this._userIdleService.addIdleObserver(
       this._lateTasksIdleObserver,
       LATE_TASKS_IDLE_TIME_SEC
     );
 
     this._monitorScreenshotsPref();
     this._monitorWebcompatReporterPref();
     this._monitorHTTPSOnlyPref();
     this._monitorPioneerPref();
@@ -2983,17 +2989,20 @@ BrowserGlue.prototype = {
               Cu.reportError(new Error("Unable to report telemetry."));
             }
 
             if (backupAge > BOOKMARKS_BACKUP_MAX_INTERVAL_DAYS) {
               this._bookmarksBackupIdleTime /= 2;
             }
           }
         }
-        this._idleService.addIdleObserver(this, this._bookmarksBackupIdleTime);
+        this._userIdleService.addIdleObserver(
+          this,
+          this._bookmarksBackupIdleTime
+        );
       }
 
       if (this._isNewProfile) {
         try {
           // New profiles may have existing bookmarks (imported from another browser or
           // copied into the profile) and we want to show the bookmark toolbar for them
           // in some cases.
           this._maybeToggleBookmarkToolbarVisibility();
--- a/browser/components/sessionstore/SessionSaver.jsm
+++ b/browser/components/sessionstore/SessionSaver.jsm
@@ -115,17 +115,17 @@ var SessionSaverInternal = {
    * this to determine the correct interval between delayed saves to not deceed
    * the configured session write interval.
    */
   _lastSaveTime: 0,
 
   /**
    * `true` if the user has been idle for at least
    * `SessionSaverInternal._intervalWhileIdle` ms. Idleness is computed
-   * with `nsIIdleService`.
+   * with `nsIUserIdleService`.
    */
   _isIdle: false,
 
   /**
    * `true` if the user was idle when we last scheduled a delayed save.
    * See `_isIdle` for details on idleness.
    */
   _wasIdle: false,
@@ -389,27 +389,27 @@ XPCOMUtils.defineLazyPreferenceGetter(
   "_idleDelay",
   PREF_IDLE_DELAY,
   180000 /* 3 minutes */,
   (key, previous, latest) => {
     // Update the idle observer for the new `PREF_IDLE_DELAY` value. Here we need
     // to re-fetch the service instead of the original one in use; This is for a
     // case that the Mock service in the unit test needs to be fetched to
     // replace the original one.
-    var idleService = Cc["@mozilla.org/widget/idleservice;1"].getService(
-      Ci.nsIIdleService
+    var idleService = Cc["@mozilla.org/widget/useridleservice;1"].getService(
+      Ci.nsIUserIdleService
     );
     if (previous != undefined) {
       idleService.removeIdleObserver(SessionSaverInternal, previous);
     }
     if (latest != undefined) {
       idleService.addIdleObserver(SessionSaverInternal, latest);
     }
   }
 );
 
-var idleService = Cc["@mozilla.org/widget/idleservice;1"].getService(
-  Ci.nsIIdleService
+var idleService = Cc["@mozilla.org/widget/useridleservice;1"].getService(
+  Ci.nsIUserIdleService
 );
 idleService.addIdleObserver(
   SessionSaverInternal,
   SessionSaverInternal._idleDelay
 );
--- a/browser/components/sessionstore/test/browser_not_collect_when_idle.js
+++ b/browser/components/sessionstore/test/browser_not_collect_when_idle.js
@@ -20,17 +20,17 @@ var idleService = {
 
   _fireObservers(state) {
     for (let observer of this._observers.values()) {
       observer.observe(observer, state, null);
       this._activity.observerFires.push(state);
     }
   },
 
-  QueryInterface: ChromeUtils.generateQI(["nsIIdleService"]),
+  QueryInterface: ChromeUtils.generateQI(["nsIUserIdleService"]),
   idleTime: 19999,
 
   addIdleObserver(observer, time) {
     this._observers.add(observer);
     this._activity.addCalls.push(time);
   },
 
   removeIdleObserver(observer, time) {
@@ -48,17 +48,17 @@ add_task(async function testIntervalChan
 
   // Increase `idleDelay` to 1 day to update the pre-registered idle observer
   // in "real" idle service to avoid possible interference, especially for the
   // CI server environment.
   Services.prefs.setIntPref("browser.sessionstore.idleDelay", 86400000);
 
   // Mock an idle service.
   let fakeIdleService = MockRegistrar.register(
-    "@mozilla.org/widget/idleservice;1",
+    "@mozilla.org/widget/useridleservice;1",
     idleService
   );
   idleService._reset();
 
   registerCleanupFunction(function() {
     Services.prefs.clearUserPref("browser.sessionstore.interval");
     MockRegistrar.unregister(fakeIdleService);
   });
--- a/browser/modules/WindowsJumpLists.jsm
+++ b/browser/modules/WindowsJumpLists.jsm
@@ -44,18 +44,18 @@ XPCOMUtils.defineLazyGetter(this, "_stri
   return Services.strings.createBundle(
     "chrome://browser/locale/taskbar.properties"
   );
 });
 
 XPCOMUtils.defineLazyServiceGetter(
   this,
   "_idle",
-  "@mozilla.org/widget/idleservice;1",
-  "nsIIdleService"
+  "@mozilla.org/widget/useridleservice;1",
+  "nsIUserIdleService"
 );
 XPCOMUtils.defineLazyServiceGetter(
   this,
   "_taskbarService",
   "@mozilla.org/windows-taskbar;1",
   "nsIWinTaskbar"
 );
 
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -170,17 +170,17 @@
 #include "nsIDOMWindowUtils.h"
 #include "nsIDragService.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsIFragmentContentSink.h"
 #include "nsContainerFrame.h"
 #include "nsIClassifiedChannel.h"
 #include "nsIHttpChannelInternal.h"
-#include "nsIIdleService.h"
+#include "nsIUserIdleService.h"
 #include "nsIImageLoadingContent.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIIOService.h"
 #include "nsILoadContext.h"
 #include "nsILoadGroup.h"
 #include "nsIMemoryReporter.h"
 #include "nsIMIMEService.h"
@@ -1414,18 +1414,18 @@ void nsContentUtils::SplitMimeType(const
     aType = aValue;
   }
   aType.StripWhitespace();
 }
 
 nsresult nsContentUtils::IsUserIdle(uint32_t aRequestedIdleTimeInMS,
                                     bool* aUserIsIdle) {
   nsresult rv;
-  nsCOMPtr<nsIIdleService> idleService =
-      do_GetService("@mozilla.org/widget/idleservice;1", &rv);
+  nsCOMPtr<nsIUserIdleService> idleService =
+      do_GetService("@mozilla.org/widget/useridleservice;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   uint32_t idleTimeInMS;
   rv = idleService->GetIdleTime(&idleTimeInMS);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *aUserIsIdle = idleTimeInMS >= aRequestedIdleTimeInMS;
   return NS_OK;
--- a/dom/base/nsGlobalWindowInner.h
+++ b/dom/base/nsGlobalWindowInner.h
@@ -76,17 +76,17 @@ class nsITimeoutHandler;
 class nsIWebBrowserChrome;
 class mozIDOMWindowProxy;
 
 class nsScreen;
 class nsHistory;
 class nsGlobalWindowObserver;
 class nsGlobalWindowOuter;
 class nsDOMWindowUtils;
-class nsIIdleService;
+class nsIUserIdleService;
 struct nsRect;
 
 class nsWindowSizes;
 
 class IdleRequestExecutor;
 
 class DialogValueHolder;
 
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -189,17 +189,17 @@
 #include "nsICrashService.h"
 #include "nsICycleCollectorListener.h"
 #include "nsIDOMChromeWindow.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIDragService.h"
 #include "nsIExternalProtocolService.h"
 #include "nsIGfxInfo.h"
-#include "nsIIdleService.h"
+#include "nsIUserIdleService.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsILocalStorageManager.h"
 #include "nsIMemoryInfoDumper.h"
 #include "nsIMemoryReporter.h"
 #include "nsIMozBrowserFrame.h"
 #include "nsINetworkLinkService.h"
 #include "nsIObserverService.h"
 #include "nsIParentChannel.h"
@@ -1865,18 +1865,18 @@ void ContentParent::ActorDestroy(ActorDe
     }
     nsAutoString cpId;
     cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
     obs->NotifyObservers((nsIPropertyBag2*)props, "ipc:content-shutdown",
                          cpId.get());
   }
 
   // Remove any and all idle listeners.
-  nsCOMPtr<nsIIdleService> idleService =
-      do_GetService("@mozilla.org/widget/idleservice;1");
+  nsCOMPtr<nsIUserIdleService> idleService =
+      do_GetService("@mozilla.org/widget/useridleservice;1");
   MOZ_ASSERT(idleService);
   RefPtr<ParentIdleListener> listener;
   for (int32_t i = mIdleListeners.Length() - 1; i >= 0; --i) {
     listener = static_cast<ParentIdleListener*>(mIdleListeners[i].get());
     idleService->RemoveIdleObserver(listener, listener->mTime);
   }
   mIdleListeners.Clear();
 
@@ -4571,18 +4571,18 @@ mozilla::ipc::IPCResult ContentParent::R
         "ContentParent::RecvRecordingDeviceEvents.");
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult ContentParent::RecvAddIdleObserver(
     const uint64_t& aObserver, const uint32_t& aIdleTimeInS) {
   nsresult rv;
-  nsCOMPtr<nsIIdleService> idleService =
-      do_GetService("@mozilla.org/widget/idleservice;1", &rv);
+  nsCOMPtr<nsIUserIdleService> idleService =
+      do_GetService("@mozilla.org/widget/useridleservice;1", &rv);
   NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
 
   RefPtr<ParentIdleListener> listener =
       new ParentIdleListener(this, aObserver, aIdleTimeInS);
   rv = idleService->AddIdleObserver(listener, aIdleTimeInS);
   NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
   mIdleListeners.AppendElement(listener);
   return IPC_OK();
@@ -4590,18 +4590,18 @@ mozilla::ipc::IPCResult ContentParent::R
 
 mozilla::ipc::IPCResult ContentParent::RecvRemoveIdleObserver(
     const uint64_t& aObserver, const uint32_t& aIdleTimeInS) {
   RefPtr<ParentIdleListener> listener;
   for (int32_t i = mIdleListeners.Length() - 1; i >= 0; --i) {
     listener = static_cast<ParentIdleListener*>(mIdleListeners[i].get());
     if (listener->mObserver == aObserver && listener->mTime == aIdleTimeInS) {
       nsresult rv;
-      nsCOMPtr<nsIIdleService> idleService =
-          do_GetService("@mozilla.org/widget/idleservice;1", &rv);
+      nsCOMPtr<nsIUserIdleService> idleService =
+          do_GetService("@mozilla.org/widget/useridleservice;1", &rv);
       NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
       idleService->RemoveIdleObserver(listener, aIdleTimeInS);
       mIdleListeners.RemoveElementAt(i);
       break;
     }
   }
   return IPC_OK();
 }
--- a/dom/quota/QuotaManagerService.cpp
+++ b/dom/quota/QuotaManagerService.cpp
@@ -12,33 +12,33 @@
 #include "mozilla/Hal.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/StaticPrefs_dom.h"
 #include "mozilla/Unused.h"
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/ipc/BackgroundParent.h"
 #include "mozilla/ipc/BackgroundUtils.h"
 #include "mozilla/ipc/PBackgroundChild.h"
-#include "nsIIdleService.h"
+#include "nsIUserIdleService.h"
 #include "nsIObserverService.h"
 #include "nsXULAppAPI.h"
 #include "QuotaManager.h"
 #include "QuotaRequests.h"
 
 #define PROFILE_BEFORE_CHANGE_QM_OBSERVER_ID "profile-before-change-qm"
 
 namespace mozilla {
 namespace dom {
 namespace quota {
 
 using namespace mozilla::ipc;
 
 namespace {
 
-const char kIdleServiceContractId[] = "@mozilla.org/widget/idleservice;1";
+const char kIdleServiceContractId[] = "@mozilla.org/widget/useridleservice;1";
 
 // The number of seconds we will wait after receiving the idle-daily
 // notification before beginning maintenance.
 const uint32_t kIdleObserverTimeSec = 1;
 
 mozilla::StaticRefPtr<QuotaManagerService> gQuotaManagerService;
 
 mozilla::Atomic<bool> gInitialized(false);
@@ -344,33 +344,33 @@ void QuotaManagerService::PerformIdleMai
   if (NS_WARN_IF(!batteryInfo.charging())) {
     return;
   }
 
   if (QuotaManager::IsRunningXPCShellTests()) {
     // We don't want user activity to impact this code if we're running tests.
     Unused << Observe(nullptr, OBSERVER_TOPIC_IDLE, nullptr);
   } else if (!mIdleObserverRegistered) {
-    nsCOMPtr<nsIIdleService> idleService =
+    nsCOMPtr<nsIUserIdleService> idleService =
         do_GetService(kIdleServiceContractId);
     MOZ_ASSERT(idleService);
 
     MOZ_ALWAYS_SUCCEEDS(
         idleService->AddIdleObserver(this, kIdleObserverTimeSec));
 
     mIdleObserverRegistered = true;
   }
 }
 
 void QuotaManagerService::RemoveIdleObserver() {
   MOZ_ASSERT(XRE_IsParentProcess());
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mIdleObserverRegistered) {
-    nsCOMPtr<nsIIdleService> idleService =
+    nsCOMPtr<nsIUserIdleService> idleService =
         do_GetService(kIdleServiceContractId);
     MOZ_ASSERT(idleService);
 
     // Ignore the return value of RemoveIdleObserver, it may fail if the
     // observer has already been unregistered during shutdown.
     Unused << idleService->RemoveIdleObserver(this, kIdleObserverTimeSec);
 
     mIdleObserverRegistered = false;
--- a/extensions/permissions/PermissionManager.cpp
+++ b/extensions/permissions/PermissionManager.cpp
@@ -23,17 +23,17 @@
 #include "mozIStorageStatement.h"
 #include "mozStorageCID.h"
 
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsContentUtils.h"
 #include "nsCRT.h"
 #include "nsEffectiveTLDService.h"
 #include "nsIConsoleService.h"
-#include "nsIIdleService.h"
+#include "nsIUserIdleService.h"
 #include "nsIInputStream.h"
 #include "nsINavHistoryService.h"
 #include "nsIObserverService.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrincipal.h"
 #include "nsIURIMutator.h"
 #include "nsIWritablePropertyBag2.h"
 #include "nsReadLine.h"
--- a/services/sync/modules/policies.js
+++ b/services/sync/modules/policies.js
@@ -59,18 +59,18 @@ ChromeUtils.defineModuleGetter(
 ChromeUtils.defineModuleGetter(
   this,
   "fxAccounts",
   "resource://gre/modules/FxAccounts.jsm"
 );
 XPCOMUtils.defineLazyServiceGetter(
   this,
   "IdleService",
-  "@mozilla.org/widget/idleservice;1",
-  "nsIIdleService"
+  "@mozilla.org/widget/useridleservice;1",
+  "nsIUserIdleService"
 );
 XPCOMUtils.defineLazyServiceGetter(
   this,
   "CaptivePortalService",
   "@mozilla.org/network/captive-portal-service;1",
   "nsICaptivePortalService"
 );
 
--- a/testing/xpcshell/example/unit/test_get_idle.js
+++ b/testing/xpcshell/example/unit/test_get_idle.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 function run_test() {
   print("Init the fake idle service and check its identity.");
-  let fakeIdleService = Cc["@mozilla.org/widget/idleservice;1"].getService(
-    Ci.nsIIdleService
+  let fakeIdleService = Cc["@mozilla.org/widget/useridleservice;1"].getService(
+    Ci.nsIUserIdleService
   );
   try {
     fakeIdleService.QueryInterface(Ci.nsIFactory);
   } catch (ex) {
     do_throw("The fake idle service implements nsIFactory.");
   }
   // We need at least one PASS, thus sanity check the idle time.
   Assert.equal(fakeIdleService.idleTime, 0);
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -272,17 +272,17 @@ void Cc["@mozilla.org/widget/transferabl
  */
 var _fakeIdleService = {
   get registrar() {
     delete this.registrar;
     return (this.registrar = Components.manager.QueryInterface(
       Ci.nsIComponentRegistrar
     ));
   },
-  contractID: "@mozilla.org/widget/idleservice;1",
+  contractID: "@mozilla.org/widget/useridleservice;1",
   CID: Components.ID("{9163a4ae-70c2-446c-9ac1-bbe4ab93004e}"),
 
   activate: function FIS_activate() {
     if (!this.originalCID) {
       this.originalCID = this.registrar.contractIDToCID(this.contractID);
       // Replace with the mock.
       this.registrar.registerFactory(
         this.CID,
@@ -317,43 +317,43 @@ var _fakeIdleService = {
       return _fakeIdleService.QueryInterface(aIID);
     },
     lockFactory(aLock) {
       throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
     },
     QueryInterface: ChromeUtils.generateQI(["nsIFactory"]),
   },
 
-  // nsIIdleService
+  // nsIUserIdleService
   get idleTime() {
     return 0;
   },
   addIdleObserver() {},
   removeIdleObserver() {},
 
   // eslint-disable-next-line mozilla/use-chromeutils-generateqi
   QueryInterface(aIID) {
     // Useful for testing purposes, see test_get_idle.js.
     if (aIID.equals(Ci.nsIFactory)) {
       return this.factory;
     }
-    if (aIID.equals(Ci.nsIIdleService) || aIID.equals(Ci.nsISupports)) {
+    if (aIID.equals(Ci.nsIUserIdleService) || aIID.equals(Ci.nsISupports)) {
       return this;
     }
     throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
   },
 };
 
 /**
  * Restores the idle service factory if needed and returns the service's handle.
  * @return A handle to the idle service.
  */
 function do_get_idle() {
   _fakeIdleService.deactivate();
-  return Cc[_fakeIdleService.contractID].getService(Ci.nsIIdleService);
+  return Cc[_fakeIdleService.contractID].getService(Ci.nsIUserIdleService);
 }
 
 // Map resource://test/ to current working directory and
 // resource://testing-common/ to the shared test modules directory.
 function _register_protocol_handlers() {
   let protocolHandler = _Services.io
     .getProtocolHandler("resource")
     .QueryInterface(Ci.nsIResProtocolHandler);
--- a/toolkit/components/extensions/parent/ext-idle.js
+++ b/toolkit/components/extensions/parent/ext-idle.js
@@ -2,18 +2,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 XPCOMUtils.defineLazyServiceGetter(
   this,
   "idleService",
-  "@mozilla.org/widget/idleservice;1",
-  "nsIIdleService"
+  "@mozilla.org/widget/useridleservice;1",
+  "nsIUserIdleService"
 );
 
 // WeakMap[Extension -> Object]
 let observersMap = new WeakMap();
 
 const getIdleObserverInfo = (extension, context) => {
   let observerInfo = observersMap.get(extension);
   if (!observerInfo) {
--- a/toolkit/components/extensions/test/mochitest/test_ext_idle.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_idle.html
@@ -39,17 +39,17 @@ add_task(async function testWithRealIdle
       permissions: ["idle"],
     },
   });
 
   await extension.startup();
 
   let chromeScript = loadChromeScript(() => {
     const {sendAsyncMessage} = this;
-    const idleService = Cc["@mozilla.org/widget/idleservice;1"].getService(Ci.nsIIdleService);
+    const idleService = Cc["@mozilla.org/widget/useridleservice;1"].getService(Ci.nsIUserIdleService);
     let idleTime = idleService.idleTime;
     sendAsyncMessage("detectionInterval", Math.max(Math.ceil(idleTime / 1000) + 10, 15));
   });
   let detectionInterval = await chromeScript.promiseOneMessage("detectionInterval");
   chromeScript.destroy();
 
   info(`Setting interval to ${detectionInterval}`);
   extension.sendMessage("addListener", detectionInterval);
--- a/toolkit/components/extensions/test/xpcshell/test_ext_idle.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_idle.js
@@ -20,17 +20,17 @@ let idleService = {
     this._activity.observerFires = [];
   },
   _fireObservers: function(state) {
     for (let observer of this._observers.values()) {
       observer.observe(observer, state, null);
       this._activity.observerFires.push(state);
     }
   },
-  QueryInterface: ChromeUtils.generateQI(["nsIIdleService"]),
+  QueryInterface: ChromeUtils.generateQI(["nsIUserIdleService"]),
   idleTime: 19999,
   addIdleObserver: function(observer, time) {
     this._observers.add(observer);
     this._activity.addCalls.push(time);
   },
   removeIdleObserver: function(observer, time) {
     this._observers.delete(observer);
     this._activity.removeCalls.push(time);
@@ -69,17 +69,17 @@ function checkActivity(expectedActivity)
     observerFires,
     expectedFires,
     "expected topic passed to idle observer"
   );
 }
 
 add_task(async function setup() {
   let fakeIdleService = MockRegistrar.register(
-    "@mozilla.org/widget/idleservice;1",
+    "@mozilla.org/widget/useridleservice;1",
     idleService
   );
   registerCleanupFunction(() => {
     MockRegistrar.unregister(fakeIdleService);
   });
 });
 
 add_task(async function testQueryStateActive() {
--- a/toolkit/components/places/PlacesExpiration.jsm
+++ b/toolkit/components/places/PlacesExpiration.jsm
@@ -465,18 +465,18 @@ function nsPlacesExpiration() {
     stmt.finalize();
 
     return db;
   });
 
   XPCOMUtils.defineLazyServiceGetter(
     this,
     "_idle",
-    "@mozilla.org/widget/idleservice;1",
-    "nsIIdleService"
+    "@mozilla.org/widget/useridleservice;1",
+    "nsIUserIdleService"
   );
 
   this._prefBranch = Services.prefs.getBranch(PREF_BRANCH);
 
   this._loadPrefsPromise = this._loadPrefs().then(() => {
     // Observe our preferences branch for changes.
     this._prefBranch.addObserver("", this, true);
 
--- a/toolkit/components/places/tests/gtest/places_test_harness_tail.h
+++ b/toolkit/components/places/tests/gtest/places_test_harness_tail.h
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsWidgetsCID.h"
-#include "nsIIdleService.h"
+#include "nsIUserIdleService.h"
 
 #ifndef TEST_NAME
 #  error "Must #define TEST_NAME before including places_test_harness_tail.h"
 #endif
 
 int gTestsIndex = 0;
 
 #define TEST_INFO_STR "TEST-INFO | "
@@ -58,18 +58,18 @@ void do_test_finished() {
   NS_ASSERTION(NS_IsMainThread(), "Not running on the main thread?");
   NS_ASSERTION(gPendingTests > 0, "Invalid pending test count!");
   gPendingTests--;
 }
 
 void disable_idle_service() {
   (void)fprintf(stderr, TEST_INFO_STR "Disabling Idle Service.\n");
 
-  nsCOMPtr<nsIIdleService> idle =
-      do_GetService("@mozilla.org/widget/idleservice;1");
+  nsCOMPtr<nsIUserIdleService> idle =
+      do_GetService("@mozilla.org/widget/useridleservice;1");
   idle->SetDisabled(true);
 }
 
 TEST(IHistory, Test)
 {
   RefPtr<WaitForConnectionClosed> spinClose = new WaitForConnectionClosed();
 
   // Tinderboxes are constantly on idle.  Since idle tasks can interact with
--- a/toolkit/components/search/SearchService.jsm
+++ b/toolkit/components/search/SearchService.jsm
@@ -3758,18 +3758,18 @@ var engineUpdateService = {
       (testEngine || engine)._setIcon(engine._iconUpdateURL, true);
     }
   },
 };
 
 XPCOMUtils.defineLazyServiceGetter(
   SearchService.prototype,
   "idleService",
-  "@mozilla.org/widget/idleservice;1",
-  "nsIIdleService"
+  "@mozilla.org/widget/useridleservice;1",
+  "nsIUserIdleService"
 );
 
 /**
  * Handles getting and checking extensions against the allow list.
  */
 class SearchDefaultOverrideAllowlistHandler {
   /**
    * @param {function} listener
--- a/toolkit/components/search/tests/SearchTestUtils.jsm
+++ b/toolkit/components/search/tests/SearchTestUtils.jsm
@@ -261,17 +261,17 @@ var SearchTestUtils = Object.freeze({
     },
 
     _fireObservers(state) {
       for (let observer of this._observers.values()) {
         observer.observe(observer, state, null);
       }
     },
 
-    QueryInterface: ChromeUtils.generateQI(["nsIIdleService"]),
+    QueryInterface: ChromeUtils.generateQI(["nsIUserIdleService"]),
     idleTime: 19999,
 
     addIdleObserver(observer, time) {
       this._observers.add(observer);
     },
 
     removeIdleObserver(observer, time) {
       this._observers.delete(observer);
@@ -280,17 +280,17 @@ var SearchTestUtils = Object.freeze({
 
   /**
    * Register the mock idleSerice.
    *
    * @param {Fun} registerCleanupFunction
    */
   useMockIdleService(registerCleanupFunction) {
     let fakeIdleService = MockRegistrar.register(
-      "@mozilla.org/widget/idleservice;1",
+      "@mozilla.org/widget/useridleservice;1",
       SearchTestUtils.idleService
     );
     registerCleanupFunction(() => {
       MockRegistrar.unregister(fakeIdleService);
     });
   },
 
   /**
--- a/toolkit/components/telemetry/app/TelemetryScheduler.jsm
+++ b/toolkit/components/telemetry/app/TelemetryScheduler.jsm
@@ -25,17 +25,17 @@ const { clearTimeout, setTimeout } = Chr
 const { EcosystemTelemetry } = ChromeUtils.import(
   "resource://gre/modules/EcosystemTelemetry.jsm"
 );
 const { TelemetryPrioPing } = ChromeUtils.import(
   "resource://gre/modules/PrioPing.jsm"
 );
 
 XPCOMUtils.defineLazyServiceGetters(this, {
-  idleService: ["@mozilla.org/widget/idleservice;1", "nsIIdleService"],
+  idleService: ["@mozilla.org/widget/useridleservice;1", "nsIUserIdleService"],
 });
 
 const MIN_SUBSESSION_LENGTH_MS =
   Services.prefs.getIntPref("toolkit.telemetry.minSubsessionLength", 5 * 60) *
   1000;
 
 const LOGGER_NAME = "Toolkit.Telemetry";
 
--- a/widget/android/components.conf
+++ b/widget/android/components.conf
@@ -25,21 +25,21 @@ Classes = [
         'singleton': True,
         'type': 'mozilla::widget::ScreenManager',
         'headers': ['mozilla/widget/ScreenManager.h'],
         'constructor': 'mozilla::widget::ScreenManager::GetAddRefedSingleton',
         'processes': ProcessSelector.MAIN_PROCESS_ONLY,
     },
     {
         'cid': '{6987230e-0098-4e78-bc5f-1493ee7519fa}',
-        'contract_ids': ['@mozilla.org/widget/idleservice;1'],
+        'contract_ids': ['@mozilla.org/widget/useridleservice;1'],
         'singleton': True,
-        'type': 'nsIdleServiceAndroid',
-        'headers': ['/widget/android/nsIdleServiceAndroid.h'],
-        'constructor': 'nsIdleServiceAndroid::GetInstance',
+        'type': 'nsUserIdleServiceAndroid',
+        'headers': ['/widget/android/nsUserIdleServiceAndroid.h'],
+        'constructor': 'nsUserIdleServiceAndroid::GetInstance',
     },
     {
         'cid': '{8b5314bc-db01-11d2-96ce-0060b0fb9956}',
         'contract_ids': ['@mozilla.org/widget/transferable;1'],
         'type': 'nsTransferable',
         'headers': ['/widget/nsTransferable.h'],
     },
     {
--- a/widget/android/moz.build
+++ b/widget/android/moz.build
@@ -128,19 +128,19 @@ UNIFIED_SOURCES += [
     'GeckoEditableSupport.cpp',
     'GeckoProcessManager.cpp',
     'GfxInfo.cpp',
     'ImageDecoderSupport.cpp',
     'nsAndroidProtocolHandler.cpp',
     'nsAppShell.cpp',
     'nsClipboard.cpp',
     'nsDeviceContextAndroid.cpp',
-    'nsIdleServiceAndroid.cpp',
     'nsLookAndFeel.cpp',
     'nsPrintSettingsServiceAndroid.cpp',
+    'nsUserIdleServiceAndroid.cpp',
     'nsWidgetFactory.cpp',
     'nsWindow.cpp',
     'ProcInfo.cpp',
     'ScreenHelperAndroid.cpp',
     'WebAuthnTokenManager.cpp',
     'WebExecutorSupport.cpp',
 ]
 
rename from widget/android/nsIdleServiceAndroid.cpp
rename to widget/android/nsUserIdleServiceAndroid.cpp
--- a/widget/android/nsIdleServiceAndroid.cpp
+++ b/widget/android/nsUserIdleServiceAndroid.cpp
@@ -1,12 +1,14 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=4:tabstop=4:
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "nsIdleServiceAndroid.h"
+#include "nsUserIdleServiceAndroid.h"
 
-bool nsIdleServiceAndroid::PollIdleTime(uint32_t* aIdleTime) { return false; }
+bool nsUserIdleServiceAndroid::PollIdleTime(uint32_t* aIdleTime) {
+  return false;
+}
 
-bool nsIdleServiceAndroid::UsePollMode() { return false; }
+bool nsUserIdleServiceAndroid::UsePollMode() { return false; }
rename from widget/android/nsIdleServiceAndroid.h
rename to widget/android/nsUserIdleServiceAndroid.h
--- a/widget/android/nsIdleServiceAndroid.h
+++ b/widget/android/nsUserIdleServiceAndroid.h
@@ -1,34 +1,35 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=4:tabstop=4:
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef nsIdleServiceAndroid_h__
-#define nsIdleServiceAndroid_h__
+#ifndef nsUserIdleServiceAndroid_h__
+#define nsUserIdleServiceAndroid_h__
+
+#include "nsUserIdleService.h"
 
-#include "nsIdleService.h"
-
-class nsIdleServiceAndroid : public nsIdleService {
+class nsUserIdleServiceAndroid : public nsUserIdleService {
  public:
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsIdleServiceAndroid, nsIdleService)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsUserIdleServiceAndroid,
+                                       nsUserIdleService)
 
   bool PollIdleTime(uint32_t* aIdleTime) override;
 
-  static already_AddRefed<nsIdleServiceAndroid> GetInstance() {
-    RefPtr<nsIdleService> idleService = nsIdleService::GetInstance();
+  static already_AddRefed<nsUserIdleServiceAndroid> GetInstance() {
+    RefPtr<nsUserIdleService> idleService = nsUserIdleService::GetInstance();
     if (!idleService) {
-      idleService = new nsIdleServiceAndroid();
+      idleService = new nsUserIdleServiceAndroid();
     }
 
-    return idleService.forget().downcast<nsIdleServiceAndroid>();
+    return idleService.forget().downcast<nsUserIdleServiceAndroid>();
   }
 
  protected:
-  nsIdleServiceAndroid() {}
-  virtual ~nsIdleServiceAndroid() {}
+  nsUserIdleServiceAndroid() {}
+  virtual ~nsUserIdleServiceAndroid() {}
   bool UsePollMode() override;
 };
 
-#endif  // nsIdleServiceAndroid_h__
+#endif  // nsUserIdleServiceAndroid_h__
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -44,17 +44,17 @@ using mozilla::dom::ContentParent;
 #include "JavaExceptions.h"
 
 #include "nsIWidgetListener.h"
 #include "nsIWindowWatcher.h"
 #include "nsIAppWindow.h"
 
 #include "nsAppShell.h"
 #include "nsFocusManager.h"
-#include "nsIdleService.h"
+#include "nsUserIdleService.h"
 #include "nsLayoutUtils.h"
 #include "nsViewManager.h"
 
 #include "WidgetUtils.h"
 #include "nsContentUtils.h"
 
 #include "nsGfxCIID.h"
 #include "nsGkAtoms.h"
@@ -2160,17 +2160,17 @@ void nsWindow::GeckoViewSupport::OnReady
     return;
   }
   window->OnReady(aQueue);
   mIsReady = true;
 }
 
 void nsWindow::UserActivity() {
   if (!mIdleService) {
-    mIdleService = do_GetService("@mozilla.org/widget/idleservice;1");
+    mIdleService = do_GetService("@mozilla.org/widget/useridleservice;1");
   }
 
   if (mIdleService) {
     mIdleService->ResetIdleTimeOut(0);
   }
 
   if (FindTopLevel() != nsWindow::TopWindow()) {
     BringToFront();
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef NSWINDOW_H_
 #define NSWINDOW_H_
 
 #include "nsBaseWidget.h"
 #include "gfxPoint.h"
-#include "nsIIdleServiceInternal.h"
+#include "nsIUserIdleServiceInternal.h"
 #include "nsTArray.h"
 #include "EventDispatcher.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/java/GeckoBundleWrappers.h"
 #include "mozilla/MozPromise.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/TextRange.h"
@@ -347,17 +347,17 @@ class nsWindow final : public nsBaseWidg
 
   already_AddRefed<GeckoContentController> CreateRootContentController()
       override;
 
   bool mIsVisible;
   nsTArray<nsWindow*> mChildren;
   nsWindow* mParent;
 
-  nsCOMPtr<nsIIdleServiceInternal> mIdleService;
+  nsCOMPtr<nsIUserIdleServiceInternal> mIdleService;
   mozilla::ScreenIntCoord mDynamicToolbarMaxHeight;
   mozilla::ScreenIntMargin mSafeAreaInsets;
 
   bool mIsFullScreen;
   bool mIsDisablingWebRender;
 
   bool UseExternalCompositingSurface() const override { return true; }
 
--- a/widget/cocoa/moz.build
+++ b/widget/cocoa/moz.build
@@ -37,17 +37,16 @@ UNIFIED_SOURCES += [
     'nsCocoaFeatures.mm',
     'nsCocoaUtils.mm',
     'nsCocoaWindow.mm',
     'nsColorPicker.mm',
     'nsCursorManager.mm',
     'nsDeviceContextSpecX.mm',
     'nsFilePicker.mm',
     'nsIconLoaderService.mm',
-    'nsIdleServiceX.mm',
     'nsLookAndFeel.mm',
     'nsMacCursor.mm',
     'nsMacDockSupport.mm',
     'nsMacFinderProgress.mm',
     'nsMacSharingService.mm',
     'nsMacWebAppUtils.mm',
     'nsMenuBarX.mm',
     'nsMenuGroupOwnerX.mm',
@@ -61,16 +60,17 @@ UNIFIED_SOURCES += [
     'nsSound.mm',
     'nsStandaloneNativeMenu.mm',
     'nsSystemStatusBarCocoa.mm',
     'nsToolkit.mm',
     'nsTouchBar.mm',
     'nsTouchBarInput.mm',
     'nsTouchBarInputIcon.mm',
     'nsTouchBarUpdater.mm',
+    'nsUserIdleServiceX.mm',
     'nsWidgetFactory.mm',
     'nsWindowMap.mm',
     'OSXNotificationCenter.mm',
     'ProcInfo.mm',
     'ScreenHelperCocoa.mm',
     'SwipeTracker.mm',
     'TextInputHandler.mm',
     'VibrancyManager.mm',
--- a/widget/cocoa/nsMenuX.mm
+++ b/widget/cocoa/nsMenuX.mm
@@ -33,16 +33,17 @@
 #include "nsIServiceManager.h"
 #include "nsXULPopupManager.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/EventDispatcher.h"
 
 #include "mozilla/MouseEvents.h"
 
 using namespace mozilla;
+using namespace mozilla::dom;
 
 static bool gConstructingMenu = false;
 static bool gMenuMethodsSwizzled = false;
 
 int32_t nsMenuX::sIndexingMenuLevel = 0;
 
 //
 // Objective-C class used for representedObject
rename from widget/cocoa/nsIdleServiceX.h
rename to widget/cocoa/nsUserIdleServiceX.h
--- a/widget/cocoa/nsIdleServiceX.h
+++ b/widget/cocoa/nsUserIdleServiceX.h
@@ -1,31 +1,31 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef nsIdleServiceX_h_
-#define nsIdleServiceX_h_
+#ifndef nsUserIdleServiceX_h_
+#define nsUserIdleServiceX_h_
 
-#include "nsIdleService.h"
+#include "nsUserIdleService.h"
 
-class nsIdleServiceX : public nsIdleService {
+class nsUserIdleServiceX : public nsUserIdleService {
  public:
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsIdleServiceX, nsIdleService)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsUserIdleServiceX, nsUserIdleService)
 
   bool PollIdleTime(uint32_t* aIdleTime) override;
 
-  static already_AddRefed<nsIdleServiceX> GetInstance() {
-    RefPtr<nsIdleService> idleService = nsIdleService::GetInstance();
+  static already_AddRefed<nsUserIdleServiceX> GetInstance() {
+    RefPtr<nsUserIdleService> idleService = nsUserIdleService::GetInstance();
     if (!idleService) {
-      idleService = new nsIdleServiceX();
+      idleService = new nsUserIdleServiceX();
     }
 
-    return idleService.forget().downcast<nsIdleServiceX>();
+    return idleService.forget().downcast<nsUserIdleServiceX>();
   }
 
  protected:
-  nsIdleServiceX() {}
-  virtual ~nsIdleServiceX() {}
+  nsUserIdleServiceX() {}
+  virtual ~nsUserIdleServiceX() {}
   bool UsePollMode() override;
 };
 
-#endif  // nsIdleServiceX_h_
+#endif  // nsUserIdleServiceX_h_
rename from widget/cocoa/nsIdleServiceX.mm
rename to widget/cocoa/nsUserIdleServiceX.mm
--- a/widget/cocoa/nsIdleServiceX.mm
+++ b/widget/cocoa/nsUserIdleServiceX.mm
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "nsIdleServiceX.h"
+#include "nsUserIdleServiceX.h"
 #include "nsObjCExceptions.h"
 #import <Foundation/Foundation.h>
 
-bool nsIdleServiceX::PollIdleTime(uint32_t* aIdleTime) {
+bool nsUserIdleServiceX::PollIdleTime(uint32_t* aIdleTime) {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   kern_return_t rval;
   mach_port_t masterPort;
 
   rval = IOMasterPort(kIOMasterPortDefault, &masterPort);
   if (rval != KERN_SUCCESS) return false;
 
@@ -52,9 +52,9 @@ bool nsIdleServiceX::PollIdleTime(uint32
 
   *aIdleTime = static_cast<uint32_t>(time);
 
   return true;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
 }
 
-bool nsIdleServiceX::UsePollMode() { return true; }
+bool nsUserIdleServiceX::UsePollMode() { return true; }
--- a/widget/cocoa/nsWidgetFactory.mm
+++ b/widget/cocoa/nsWidgetFactory.mm
@@ -23,17 +23,17 @@
 #include "nsTransferable.h"
 #include "nsHTMLFormatConverter.h"
 #include "nsDragService.h"
 #include "nsToolkit.h"
 
 #include "nsLookAndFeel.h"
 
 #include "nsSound.h"
-#include "nsIdleServiceX.h"
+#include "nsUserIdleServiceX.h"
 #include "NativeKeyBindings.h"
 #include "OSXNotificationCenter.h"
 
 #include "nsDeviceContextSpecX.h"
 #include "nsPrintSettingsServiceX.h"
 #include "nsPrintDialogX.h"
 #include "nsPrintSession.h"
 #include "nsToolkitCompsCID.h"
@@ -61,17 +61,17 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransfe
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecX)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterListX)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSettingsServiceX, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceX, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceX, nsIdleServiceX::GetInstance)
+NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsUserIdleServiceX, nsUserIdleServiceX::GetInstance)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ScreenManager, ScreenManager::GetAddRefedSingleton)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(OSXNotificationCenter, Init)
 
 #include "nsMenuBarX.h"
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeMenuServiceX)
 
 #include "nsMacDockSupport.h"
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacDockSupport)
@@ -142,17 +142,17 @@ static const mozilla::Module::CIDEntry k
      mozilla::Module::MAIN_PROCESS_ONLY},
     {&kNS_SCREENMANAGER_CID, false, NULL, ScreenManagerConstructor,
      mozilla::Module::MAIN_PROCESS_ONLY},
     {&kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecXConstructor},
     {&kNS_PRINTER_LIST_CID, false, NULL, nsPrinterListXConstructor},
     {&kNS_PRINTSESSION_CID, false, NULL, nsPrintSessionConstructor},
     {&kNS_PRINTSETTINGSSERVICE_CID, false, NULL, nsPrintSettingsServiceXConstructor},
     {&kNS_PRINTDIALOGSERVICE_CID, false, NULL, nsPrintDialogServiceXConstructor},
-    {&kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceXConstructor},
+    {&kNS_IDLE_SERVICE_CID, false, NULL, nsUserIdleServiceXConstructor},
     {&kNS_SYSTEMALERTSSERVICE_CID, false, NULL, OSXNotificationCenterConstructor},
     {&kNS_NATIVEMENUSERVICE_CID, false, NULL, nsNativeMenuServiceXConstructor},
     {&kNS_MACDOCKSUPPORT_CID, false, NULL, nsMacDockSupportConstructor},
     {&kNS_MACFINDERPROGRESS_CID, false, NULL, nsMacFinderProgressConstructor},
     {&kNS_MACSHARINGSERVICE_CID, false, NULL, nsMacSharingServiceConstructor},
     {&kNS_MACWEBAPPUTILS_CID, false, NULL, nsMacWebAppUtilsConstructor},
     {&kNS_STANDALONENATIVEMENU_CID, false, NULL, nsStandaloneNativeMenuConstructor},
     {&kNS_MACSYSTEMSTATUSBAR_CID, false, NULL, nsSystemStatusBarCocoaConstructor},
@@ -172,17 +172,17 @@ static const mozilla::Module::ContractID
     {"@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, mozilla::Module::MAIN_PROCESS_ONLY},
     {"@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID,
      mozilla::Module::MAIN_PROCESS_ONLY},
     {"@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID},
     {"@mozilla.org/gfx/printerlist;1", &kNS_PRINTER_LIST_CID},
     {"@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID},
     {"@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID},
     {NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID},
-    {"@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID},
+    {"@mozilla.org/widget/useridleservice;1", &kNS_IDLE_SERVICE_CID},
     {"@mozilla.org/system-alerts-service;1", &kNS_SYSTEMALERTSSERVICE_CID},
     {"@mozilla.org/widget/nativemenuservice;1", &kNS_NATIVEMENUSERVICE_CID},
     {"@mozilla.org/widget/macdocksupport;1", &kNS_MACDOCKSUPPORT_CID},
     {"@mozilla.org/widget/macfinderprogress;1", &kNS_MACFINDERPROGRESS_CID},
     {"@mozilla.org/widget/macsharingservice;1", &kNS_MACSHARINGSERVICE_CID},
     {"@mozilla.org/widget/mac-web-app-utils;1", &kNS_MACWEBAPPUTILS_CID},
     {"@mozilla.org/widget/standalonenativemenu;1", &kNS_STANDALONENATIVEMENU_CID},
     {"@mozilla.org/widget/macsystemstatusbar;1", &kNS_MACSYSTEMSTATUSBAR_CID},
--- a/widget/gtk/components.conf
+++ b/widget/gtk/components.conf
@@ -114,21 +114,21 @@ if defined('MOZ_X11'):
             'cid': '{d755a760-9f27-11df-0800-200c9a664242}',
             'contract_ids': ['@mozilla.org/gfx/info;1'],
             'type': 'mozilla::widget::GfxInfo',
             'headers': ['/widget/GfxInfoX11.h'],
             'init_method': 'Init',
         },
         {
             'cid': '{6987230e-0098-4e78-bc5f-1493ee7519fa}',
-            'contract_ids': ['@mozilla.org/widget/idleservice;1'],
+            'contract_ids': ['@mozilla.org/widget/useridleservice;1'],
             'singleton': True,
-            'type': 'nsIdleService',
-            'headers': ['/widget/gtk/nsIdleServiceGTK.h'],
-            'constructor': 'nsIdleServiceGTK::GetInstance',
+            'type': 'nsUserIdleService',
+            'headers': ['/widget/gtk/nsUserIdleServiceGTK.h'],
+            'constructor': 'nsUserIdleServiceGTK::GetInstance',
         },
     ]
 
 if defined('NS_PRINTING'):
     Classes += [
         {
             'cid': '{d3f69889-e13a-4321-980c-a39332e21f34}',
             'contract_ids': ['@mozilla.org/gfx/devicecontextspec;1'],
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -60,17 +60,17 @@ SOURCES += [
 ]
 
 if CONFIG['MOZ_X11']:
     UNIFIED_SOURCES += [
         'CompositorWidgetChild.cpp',
         'CompositorWidgetParent.cpp',
         'GtkCompositorWidget.cpp',
         'InProcessGtkCompositorWidget.cpp',
-        'nsIdleServiceGTK.cpp',
+        'nsUserIdleServiceGTK.cpp',
     ]
     EXPORTS.mozilla.widget += [
         'CompositorWidgetChild.h',
         'CompositorWidgetParent.h',
         'GtkCompositorWidget.h',
         'InProcessGtkCompositorWidget.h',
     ]
 
rename from widget/gtk/nsIdleServiceGTK.cpp
rename to widget/gtk/nsUserIdleServiceGTK.cpp
--- a/widget/gtk/nsIdleServiceGTK.cpp
+++ b/widget/gtk/nsUserIdleServiceGTK.cpp
@@ -2,24 +2,24 @@
 /* vim:expandtab:shiftwidth=4:tabstop=4:
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <gtk/gtk.h>
 
-#include "nsIdleServiceGTK.h"
+#include "nsUserIdleServiceGTK.h"
 #include "nsDebug.h"
 #include "prlink.h"
 #include "mozilla/Logging.h"
 
 using mozilla::LogLevel;
 
-static mozilla::LazyLogModule sIdleLog("nsIIdleService");
+static mozilla::LazyLogModule sIdleLog("nsIUserIdleService");
 
 typedef bool (*_XScreenSaverQueryExtension_fn)(Display* dpy, int* event_base,
                                                int* error_base);
 
 typedef XScreenSaverInfo* (*_XScreenSaverAllocInfo_fn)(void);
 
 typedef void (*_XScreenSaverQueryInfo_fn)(Display* dpy, Drawable drw,
                                           XScreenSaverInfo* info);
@@ -30,17 +30,17 @@ static _XScreenSaverAllocInfo_fn _XSSAll
 static _XScreenSaverQueryInfo_fn _XSSQueryInfo = nullptr;
 
 static void Initialize() {
   if (!gdk_display_get_default() ||
       !GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
     return;
   }
 
-  // This will leak - See comments in ~nsIdleServiceGTK().
+  // This will leak - See comments in ~nsUserIdleServiceGTK().
   PRLibrary* xsslib = PR_LoadLibrary("libXss.so.1");
   if (!xsslib)  // ouch.
   {
     MOZ_LOG(sIdleLog, LogLevel::Warning, ("Failed to find libXss.so!\n"));
     return;
   }
 
   _XSSQueryExtension = (_XScreenSaverQueryExtension_fn)PR_FindFunctionSymbol(
@@ -56,33 +56,35 @@ static void Initialize() {
   if (!_XSSAllocInfo)
     MOZ_LOG(sIdleLog, LogLevel::Warning, ("Failed to get XSSAllocInfo!\n"));
   if (!_XSSQueryInfo)
     MOZ_LOG(sIdleLog, LogLevel::Warning, ("Failed to get XSSQueryInfo!\n"));
 
   sInitialized = true;
 }
 
-nsIdleServiceGTK::nsIdleServiceGTK() : mXssInfo(nullptr) { Initialize(); }
+nsUserIdleServiceGTK::nsUserIdleServiceGTK() : mXssInfo(nullptr) {
+  Initialize();
+}
 
-nsIdleServiceGTK::~nsIdleServiceGTK() {
+nsUserIdleServiceGTK::~nsUserIdleServiceGTK() {
   if (mXssInfo) XFree(mXssInfo);
 
 // It is not safe to unload libXScrnSaver until each display is closed because
 // the library registers callbacks through XESetCloseDisplay (Bug 397607).
 // (Also the library and its functions are scoped for the file not the object.)
 #if 0
     if (xsslib) {
         PR_UnloadLibrary(xsslib);
         xsslib = nullptr;
     }
 #endif
 }
 
-bool nsIdleServiceGTK::PollIdleTime(uint32_t* aIdleTime) {
+bool nsUserIdleServiceGTK::PollIdleTime(uint32_t* aIdleTime) {
   if (!sInitialized) {
     // For some reason, we could not find xscreensaver.
     return false;
   }
 
   // Ask xscreensaver about idle time:
   *aIdleTime = 0;
 
@@ -105,9 +107,9 @@ bool nsIdleServiceGTK::PollIdleTime(uint
     *aIdleTime = mXssInfo->idle;
     return true;
   }
   // If we get here, we couldn't get to XScreenSaver:
   MOZ_LOG(sIdleLog, LogLevel::Warning, ("XSSQueryExtension returned false!\n"));
   return false;
 }
 
-bool nsIdleServiceGTK::UsePollMode() { return sInitialized; }
+bool nsUserIdleServiceGTK::UsePollMode() { return sInitialized; }
rename from widget/gtk/nsIdleServiceGTK.h
rename to widget/gtk/nsUserIdleServiceGTK.h
--- a/widget/gtk/nsIdleServiceGTK.h
+++ b/widget/gtk/nsUserIdleServiceGTK.h
@@ -1,50 +1,50 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=4:tabstop=4:
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef nsIdleServiceGTK_h__
-#define nsIdleServiceGTK_h__
+#ifndef nsUserIdleServiceGTK_h__
+#define nsUserIdleServiceGTK_h__
 
-#include "nsIdleService.h"
+#include "nsUserIdleService.h"
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <gdk/gdkx.h>
 
 typedef struct {
   Window window;               // Screen saver window
   int state;                   // ScreenSaver(Off,On,Disabled)
   int kind;                    // ScreenSaver(Blanked,Internal,External)
   unsigned long til_or_since;  // milliseconds since/til screensaver kicks in
   unsigned long idle;          // milliseconds idle
   unsigned long event_mask;    // event stuff
 } XScreenSaverInfo;
 
-class nsIdleServiceGTK : public nsIdleService {
+class nsUserIdleServiceGTK : public nsUserIdleService {
  public:
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsIdleServiceGTK, nsIdleService)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsUserIdleServiceGTK, nsUserIdleService)
 
   virtual bool PollIdleTime(uint32_t* aIdleTime) override;
 
-  static already_AddRefed<nsIdleServiceGTK> GetInstance() {
-    RefPtr<nsIdleServiceGTK> idleService =
-        nsIdleService::GetInstance().downcast<nsIdleServiceGTK>();
+  static already_AddRefed<nsUserIdleServiceGTK> GetInstance() {
+    RefPtr<nsUserIdleServiceGTK> idleService =
+        nsUserIdleService::GetInstance().downcast<nsUserIdleServiceGTK>();
     if (!idleService) {
-      idleService = new nsIdleServiceGTK();
+      idleService = new nsUserIdleServiceGTK();
     }
 
     return idleService.forget();
   }
 
  private:
-  ~nsIdleServiceGTK();
+  ~nsUserIdleServiceGTK();
   XScreenSaverInfo* mXssInfo;
 
  protected:
-  nsIdleServiceGTK();
+  nsUserIdleServiceGTK();
   virtual bool UsePollMode() override;
 };
 
-#endif  // nsIdleServiceGTK_h__
+#endif  // nsUserIdleServiceGTK_h__
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -69,17 +69,17 @@
 #include "nsGkAtoms.h"
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Likely.h"
 #include "mozilla/Preferences.h"
 #include "nsGfxCIID.h"
 #include "nsGtkUtils.h"
 #include "mozilla/layers/LayersTypes.h"
-#include "nsIIdleServiceInternal.h"
+#include "nsIUserIdleServiceInternal.h"
 #include "GLContext.h"
 #include "gfx2DGlue.h"
 
 #ifdef ACCESSIBILITY
 #  include "mozilla/a11y/Accessible.h"
 #  include "mozilla/a11y/Platform.h"
 #  include "nsAccessibilityService.h"
 
@@ -362,18 +362,18 @@ static inline int32_t GetBitmapStride(in
 
 static inline bool TimestampIsNewerThan(guint32 a, guint32 b) {
   // Timestamps are just the least significant bits of a monotonically
   // increasing function, and so the use of unsigned overflow arithmetic.
   return a - b <= G_MAXUINT32 / 2;
 }
 
 static void UpdateLastInputEventTime(void* aGdkEvent) {
-  nsCOMPtr<nsIIdleServiceInternal> idleService =
-      do_GetService("@mozilla.org/widget/idleservice;1");
+  nsCOMPtr<nsIUserIdleServiceInternal> idleService =
+      do_GetService("@mozilla.org/widget/useridleservice;1");
   if (idleService) {
     idleService->ResetIdleTimeOut(0);
   }
 
   guint timestamp = gdk_event_get_time(static_cast<GdkEvent*>(aGdkEvent));
   if (timestamp == GDK_CURRENT_TIME) return;
 
   sLastUserInputTime = timestamp;
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -104,53 +104,53 @@ XPIDL_SOURCES += [
     'nsIColorPicker.idl',
     'nsIDisplayInfo.idl',
     'nsIDragService.idl',
     'nsIDragSession.idl',
     'nsIFilePicker.idl',
     'nsIFormatConverter.idl',
     'nsIGfxInfo.idl',
     'nsIGfxInfoDebug.idl',
-    'nsIIdleService.idl',
-    'nsIIdleServiceInternal.idl',
     'nsIPaper.idl',
     'nsIPrinter.idl',
     'nsIPrinterList.idl',
     'nsIPrintSession.idl',
     'nsIPrintSettings.idl',
     'nsIPrintSettingsService.idl',
     'nsIScreen.idl',
     'nsIScreenManager.idl',
     'nsISharePicker.idl',
     'nsISound.idl',
     'nsITransferable.idl',
+    'nsIUserIdleService.idl',
+    'nsIUserIdleServiceInternal.idl',
 ]
 
 XPIDL_MODULE = 'widget'
 
 EXPORTS += [
     'GfxDriverInfo.h',
     'GfxInfoBase.h',
     'GfxInfoCollector.h',
     'InputData.h',
     'nsBaseAppShell.h',
     'nsBaseDragService.h',
     'nsBaseFilePicker.h',
     'nsBaseScreen.h',
     'nsBaseWidget.h',
     'nsIDeviceContextSpec.h',
-    'nsIdleService.h',
     'nsIKeyEventInPluginCallback.h',
     'nsIPluginWidget.h',
     'nsIPrintDialogService.h',
     'nsIRollupListener.h',
     'nsIWidget.h',
     'nsIWidgetListener.h',
     'nsPaper.h',
     'nsPrinter.h',
+    'nsUserIdleService.h',
     'nsWidgetInitData.h',
     'nsWidgetsCID.h',
     'PuppetWidget.h',
 ]
 
 EXPORTS.mozilla += [
     'BasicEvents.h',
     'CommandList.h',
@@ -200,25 +200,25 @@ UNIFIED_SOURCES += [
     'nsBaseScreen.cpp',
     'nsClipboardHelper.cpp',
     'nsClipboardProxy.cpp',
     'nsColorPickerProxy.cpp',
     'nsContentProcessWidgetFactory.cpp',
     'nsDragServiceProxy.cpp',
     'nsFilePickerProxy.cpp',
     'nsHTMLFormatConverter.cpp',
-    'nsIdleService.cpp',
     'nsIWidgetListener.cpp',
     'nsNativeBasicTheme.cpp',
     'nsPaper.cpp',
     'nsPrimitiveHelpers.cpp',
     'nsPrinter.cpp',
     'nsPrintSettingsImpl.cpp',
     'nsSoundProxy.cpp',
     'nsTransferable.cpp',
+    'nsUserIdleService.cpp',
     'nsXPLookAndFeel.cpp',
     'PuppetBidiKeyboard.cpp',
     'PuppetWidget.cpp',
     'Screen.cpp',
     'SharedWidgetUtils.cpp',
     'TextEventDispatcher.cpp',
     'VsyncDispatcher.cpp',
     'WidgetEventImpl.cpp',
rename from widget/nsIIdleService.idl
rename to widget/nsIUserIdleService.idl
--- a/widget/nsIIdleService.idl
+++ b/widget/nsIUserIdleService.idl
@@ -12,17 +12,17 @@ interface nsIObserver;
  * i.e. not used their mouse or keyboard. You can get the idle time directly,
  * but in most cases you will want to register an observer for a predefined
  * interval. The observer will get an 'idle' notification when the user is idle
  * for that interval (or longer), and receive an 'active' notification when the
  * user starts using their computer again.
  */
 
 [scriptable, uuid(cc52f19a-63ae-4a1c-9cc3-e79eace0b471)]
-interface nsIIdleService : nsISupports
+interface nsIUserIdleService : nsISupports
 {
     /**
      * The amount of time in milliseconds that has passed
      * since the last user activity.
      *
      * If we do not have a valid idle time to report, 0 is returned
      * (this can happen if the user never interacted with the browser
      * at all, and if we are also unable to poll for idle time manually).
@@ -34,17 +34,17 @@ interface nsIIdleService : nsISupports
      * time, and when they get back from that.
      *
      * @param observer the observer to be notified
      * @param time the amount of time in seconds the user should be idle before
      *             the observer should be notified.
      *
      * @note
      * The subject of the notification the observer will get is always the
-     * nsIIdleService itself.
+     * nsIUserIdleService itself.
      * When the user goes idle, the observer topic is "idle" and when he gets
      * back, the observer topic is "active".
      * The data param for the notification contains the current user idle time.
      *
      * @note
      * You can add the same observer twice.
      * @note
      * Most implementations need to poll the OS for idle info themselves,
rename from widget/nsIIdleServiceInternal.idl
rename to widget/nsIUserIdleServiceInternal.idl
--- a/widget/nsIIdleServiceInternal.idl
+++ b/widget/nsIUserIdleServiceInternal.idl
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "nsIIdleService.idl"
+#include "nsIUserIdleService.idl"
 
 [scriptable, uuid(7b89a2e7-ed12-42e0-b86d-4984239abd7b)]
-interface nsIIdleServiceInternal : nsIIdleService
+interface nsIUserIdleServiceInternal : nsIUserIdleService
 {
  /**
    * "Resets the idle time to the value specified."
    *
    * @param idleDelta the time (in milliseconds) since the last user inter
    *                  action
    **/
   void resetIdleTimeOut(in unsigned long idleDeltaInMS);
rename from widget/nsIdleService.cpp
rename to widget/nsUserIdleService.cpp
--- a/widget/nsIdleService.cpp
+++ b/widget/nsUserIdleService.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=2:tabstop=2:
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "nsIdleService.h"
+#include "nsUserIdleService.h"
 #include "nsString.h"
 #include "nsIObserverService.h"
 #include "nsDebug.h"
 #include "nsCOMArray.h"
 #include "nsXULAppAPI.h"
 #include "prinrval.h"
 #include "mozilla/Logging.h"
 #include "prtime.h"
@@ -54,25 +54,26 @@ static LazyLogModule sLog("idleService")
 class IdleListenerComparator {
  public:
   bool Equals(IdleListener a, IdleListener b) const {
     return (a.observer == b.observer) && (a.reqIdleTime == b.reqIdleTime);
   }
 };
 
 ////////////////////////////////////////////////////////////////////////////////
-//// nsIdleServiceDaily
+//// nsUserIdleServiceDaily
 
-NS_IMPL_ISUPPORTS(nsIdleServiceDaily, nsIObserver, nsISupportsWeakReference)
+NS_IMPL_ISUPPORTS(nsUserIdleServiceDaily, nsIObserver, nsISupportsWeakReference)
 
 NS_IMETHODIMP
-nsIdleServiceDaily::Observe(nsISupports*, const char* aTopic, const char16_t*) {
-  MOZ_LOG(
-      sLog, LogLevel::Debug,
-      ("nsIdleServiceDaily: Observe '%s' (%d)", aTopic, mShutdownInProgress));
+nsUserIdleServiceDaily::Observe(nsISupports*, const char* aTopic,
+                                const char16_t*) {
+  MOZ_LOG(sLog, LogLevel::Debug,
+          ("nsUserIdleServiceDaily: Observe '%s' (%d)", aTopic,
+           mShutdownInProgress));
 
   if (strcmp(aTopic, "profile-after-change") == 0) {
     // We are back. Start sending notifications again.
     mShutdownInProgress = false;
     return NS_OK;
   }
 
   if (strcmp(aTopic, "xpcom-will-shutdown") == 0 ||
@@ -81,17 +82,17 @@ nsIdleServiceDaily::Observe(nsISupports*
   }
 
   if (mShutdownInProgress || strcmp(aTopic, OBSERVER_TOPIC_ACTIVE) == 0) {
     return NS_OK;
   }
   MOZ_ASSERT(strcmp(aTopic, OBSERVER_TOPIC_IDLE) == 0);
 
   MOZ_LOG(sLog, LogLevel::Debug,
-          ("nsIdleServiceDaily: Notifying idle-daily observers"));
+          ("nsUserIdleServiceDaily: Notifying idle-daily observers"));
 #ifdef MOZ_WIDGET_ANDROID
   __android_log_print(LOG_LEVEL, LOG_TAG, "Notifying idle-daily observers");
 #endif
 
   // Send the idle-daily observer event
   nsCOMPtr<nsIObserverService> observerService =
       mozilla::services::GetObserverService();
   NS_ENSURE_STATE(observerService);
@@ -114,178 +115,182 @@ nsIdleServiceDaily::Observe(nsISupports*
 
   // Force that to be stored so we don't retrigger twice a day under
   // any circumstances.
   nsIPrefService* prefs = Preferences::GetService();
   if (prefs) {
     prefs->SavePrefFile(nullptr);
   }
 
-  MOZ_LOG(sLog, LogLevel::Debug,
-          ("nsIdleServiceDaily: Storing last idle time as %d sec.", nowSec));
+  MOZ_LOG(
+      sLog, LogLevel::Debug,
+      ("nsUserIdleServiceDaily: Storing last idle time as %d sec.", nowSec));
 #ifdef MOZ_WIDGET_ANDROID
   __android_log_print(LOG_LEVEL, LOG_TAG, "Storing last idle time as %d",
                       nowSec);
 #endif
 
   // Note the moment we expect to get the next timer callback
   mExpectedTriggerTime =
       PR_Now() + ((PRTime)SECONDS_PER_DAY * (PRTime)PR_USEC_PER_SEC);
 
   MOZ_LOG(sLog, LogLevel::Debug,
-          ("nsIdleServiceDaily: Restarting daily timer"));
+          ("nsUserIdleServiceDaily: Restarting daily timer"));
 
   // Start timer for the next check in one day.
   (void)mTimer->InitWithNamedFuncCallback(
       DailyCallback, this, SECONDS_PER_DAY * PR_MSEC_PER_SEC,
-      nsITimer::TYPE_ONE_SHOT, "nsIdleServiceDaily::Observe");
+      nsITimer::TYPE_ONE_SHOT, "nsUserIdleServiceDaily::Observe");
 
   return NS_OK;
 }
 
-nsIdleServiceDaily::nsIdleServiceDaily(nsIIdleService* aIdleService)
+nsUserIdleServiceDaily::nsUserIdleServiceDaily(nsIUserIdleService* aIdleService)
     : mIdleService(aIdleService),
       mTimer(NS_NewTimer()),
       mCategoryObservers(OBSERVER_TOPIC_IDLE_DAILY),
       mShutdownInProgress(false),
       mExpectedTriggerTime(0),
       mIdleDailyTriggerWait(DAILY_SIGNIFICANT_IDLE_SERVICE_SEC) {}
 
-void nsIdleServiceDaily::Init() {
+void nsUserIdleServiceDaily::Init() {
   // First check the time of the last idle-daily event notification. If it
   // has been 24 hours or higher, or if we have never sent an idle-daily,
   // get ready to send an idle-daily event. Otherwise set a timer targeted
   // at 24 hours past the last idle-daily we sent.
 
   int32_t lastDaily = Preferences::GetInt(PREF_LAST_DAILY, 0);
   // Setting the pref to -1 allows to disable idle-daily, and it's particularly
   // useful in tests. Normally there should be no need for the user to set
   // this value.
   if (lastDaily == -1) {
     MOZ_LOG(sLog, LogLevel::Debug,
-            ("nsIdleServiceDaily: Init: disabled idle-daily"));
+            ("nsUserIdleServiceDaily: Init: disabled idle-daily"));
     return;
   }
 
   int32_t nowSec = static_cast<int32_t>(PR_Now() / PR_USEC_PER_SEC);
   if (lastDaily < 0 || lastDaily > nowSec) {
     // The time is bogus, use default.
     lastDaily = 0;
   }
   int32_t secondsSinceLastDaily = nowSec - lastDaily;
 
   MOZ_LOG(sLog, LogLevel::Debug,
-          ("nsIdleServiceDaily: Init: seconds since last daily: %d",
+          ("nsUserIdleServiceDaily: Init: seconds since last daily: %d",
            secondsSinceLastDaily));
 
   // If it has been twenty four hours or more or if we have never sent an
   // idle-daily event get ready to send it during the next idle period.
   if (secondsSinceLastDaily > SECONDS_PER_DAY) {
     // Check for a "long wait", e.g. 48-hours or more.
     bool hasBeenLongWait =
         (lastDaily && (secondsSinceLastDaily > (SECONDS_PER_DAY * 2)));
 
-    MOZ_LOG(sLog, LogLevel::Debug,
-            ("nsIdleServiceDaily: has been long wait? %d", hasBeenLongWait));
+    MOZ_LOG(
+        sLog, LogLevel::Debug,
+        ("nsUserIdleServiceDaily: has been long wait? %d", hasBeenLongWait));
 
     // StageIdleDaily sets up a wait for the user to become idle and then
     // sends the idle-daily event.
     StageIdleDaily(hasBeenLongWait);
   } else {
     MOZ_LOG(sLog, LogLevel::Debug,
-            ("nsIdleServiceDaily: Setting timer a day from now"));
+            ("nsUserIdleServiceDaily: Setting timer a day from now"));
 #ifdef MOZ_WIDGET_ANDROID
     __android_log_print(LOG_LEVEL, LOG_TAG, "Setting timer a day from now");
 #endif
 
     // According to our last idle-daily pref, the last idle-daily was fired
     // less then 24 hours ago. Set a wait for the amount of time remaining.
     int32_t milliSecLeftUntilDaily =
         (SECONDS_PER_DAY - secondsSinceLastDaily) * PR_MSEC_PER_SEC;
 
     MOZ_LOG(sLog, LogLevel::Debug,
-            ("nsIdleServiceDaily: Seconds till next timeout: %d",
+            ("nsUserIdleServiceDaily: Seconds till next timeout: %d",
              (SECONDS_PER_DAY - secondsSinceLastDaily)));
 
     // Mark the time at which we expect this to fire. On systems with faulty
     // timers, we need to be able to cross check that the timer fired at the
     // expected time.
     mExpectedTriggerTime =
         PR_Now() + (milliSecLeftUntilDaily * PR_USEC_PER_MSEC);
 
     (void)mTimer->InitWithNamedFuncCallback(
         DailyCallback, this, milliSecLeftUntilDaily, nsITimer::TYPE_ONE_SHOT,
-        "nsIdleServiceDaily::Init");
+        "nsUserIdleServiceDaily::Init");
   }
 
   // Register for when we should terminate/pause
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
   if (obs) {
-    MOZ_LOG(sLog, LogLevel::Debug,
-            ("nsIdleServiceDaily: Registering for system event observers."));
+    MOZ_LOG(
+        sLog, LogLevel::Debug,
+        ("nsUserIdleServiceDaily: Registering for system event observers."));
     obs->AddObserver(this, "xpcom-will-shutdown", true);
     obs->AddObserver(this, "profile-change-teardown", true);
     obs->AddObserver(this, "profile-after-change", true);
   }
 }
 
-nsIdleServiceDaily::~nsIdleServiceDaily() {
+nsUserIdleServiceDaily::~nsUserIdleServiceDaily() {
   if (mTimer) {
     mTimer->Cancel();
     mTimer = nullptr;
   }
 }
 
-void nsIdleServiceDaily::StageIdleDaily(bool aHasBeenLongWait) {
+void nsUserIdleServiceDaily::StageIdleDaily(bool aHasBeenLongWait) {
   NS_ASSERTION(mIdleService, "No idle service available?");
   MOZ_LOG(sLog, LogLevel::Debug,
-          ("nsIdleServiceDaily: Registering Idle observer callback "
+          ("nsUserIdleServiceDaily: Registering Idle observer callback "
            "(short wait requested? %d)",
            aHasBeenLongWait));
 #ifdef MOZ_WIDGET_ANDROID
   __android_log_print(LOG_LEVEL, LOG_TAG, "Registering Idle observer callback");
 #endif
   mIdleDailyTriggerWait =
       (aHasBeenLongWait ? DAILY_SHORTENED_IDLE_SERVICE_SEC
                         : DAILY_SIGNIFICANT_IDLE_SERVICE_SEC);
   (void)mIdleService->AddIdleObserver(this, mIdleDailyTriggerWait);
 }
 
 // static
-void nsIdleServiceDaily::DailyCallback(nsITimer* aTimer, void* aClosure) {
-  MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: DailyCallback running"));
+void nsUserIdleServiceDaily::DailyCallback(nsITimer* aTimer, void* aClosure) {
+  MOZ_LOG(sLog, LogLevel::Debug,
+          ("nsUserIdleServiceDaily: DailyCallback running"));
 #ifdef MOZ_WIDGET_ANDROID
   __android_log_print(LOG_LEVEL, LOG_TAG, "DailyCallback running");
 #endif
 
-  nsIdleServiceDaily* self = static_cast<nsIdleServiceDaily*>(aClosure);
+  nsUserIdleServiceDaily* self = static_cast<nsUserIdleServiceDaily*>(aClosure);
 
   // Check to be sure the timer didn't fire early. This currently only
   // happens on android.
   PRTime now = PR_Now();
   if (self->mExpectedTriggerTime && now < self->mExpectedTriggerTime) {
     // Timer returned early, reschedule to the appropriate time.
     PRTime delayTime = self->mExpectedTriggerTime - now;
 
     // Add 10 ms to ensure we don't undershoot, and never get a "0" timer.
     delayTime += 10 * PR_USEC_PER_MSEC;
 
     MOZ_LOG(sLog, LogLevel::Debug,
-            ("nsIdleServiceDaily: DailyCallback resetting timer to %" PRId64
+            ("nsUserIdleServiceDaily: DailyCallback resetting timer to %" PRId64
              " msec",
              delayTime / PR_USEC_PER_MSEC));
 #ifdef MOZ_WIDGET_ANDROID
     __android_log_print(LOG_LEVEL, LOG_TAG,
                         "DailyCallback resetting timer to %" PRId64 " msec",
                         delayTime / PR_USEC_PER_MSEC);
 #endif
 
     (void)self->mTimer->InitWithNamedFuncCallback(
         DailyCallback, self, delayTime / PR_USEC_PER_MSEC,
-        nsITimer::TYPE_ONE_SHOT, "nsIdleServiceDaily::DailyCallback");
+        nsITimer::TYPE_ONE_SHOT, "nsUserIdleServiceDaily::DailyCallback");
     return;
   }
 
   // Register for a short term wait for idle event. When this fires we fire
   // our idle-daily event.
   self->StageIdleDaily(false);
 }
 
@@ -354,53 +359,55 @@ void nsIdleServiceDaily::DailyCallback(n
  *
  * In order to avoid restarting the timer endlessly, the timer function has
  * logic that will only restart the timer, if the requested timeout is before
  * the current timeout.
  *
  */
 
 ////////////////////////////////////////////////////////////////////////////////
-//// nsIdleService
+//// nsUserIdleService
 
 namespace {
-nsIdleService* gIdleService;
+nsUserIdleService* gIdleService;
 }  // namespace
 
-already_AddRefed<nsIdleService> nsIdleService::GetInstance() {
-  RefPtr<nsIdleService> instance(gIdleService);
+already_AddRefed<nsUserIdleService> nsUserIdleService::GetInstance() {
+  RefPtr<nsUserIdleService> instance(gIdleService);
   return instance.forget();
 }
 
-nsIdleService::nsIdleService()
+nsUserIdleService::nsUserIdleService()
     : mCurrentlySetToTimeoutAt(TimeStamp()),
       mIdleObserverCount(0),
       mDeltaToNextIdleSwitchInS(UINT32_MAX),
       mLastUserInteraction(TimeStamp::Now()) {
   MOZ_ASSERT(!gIdleService);
   gIdleService = this;
   if (XRE_IsParentProcess()) {
-    mDailyIdle = new nsIdleServiceDaily(this);
+    mDailyIdle = new nsUserIdleServiceDaily(this);
     mDailyIdle->Init();
   }
 }
 
-nsIdleService::~nsIdleService() {
+nsUserIdleService::~nsUserIdleService() {
   if (mTimer) {
     mTimer->Cancel();
   }
 
   MOZ_ASSERT(gIdleService == this);
   gIdleService = nullptr;
 }
 
-NS_IMPL_ISUPPORTS(nsIdleService, nsIIdleService, nsIIdleServiceInternal)
+NS_IMPL_ISUPPORTS(nsUserIdleService, nsIUserIdleService,
+                  nsIUserIdleServiceInternal)
 
 NS_IMETHODIMP
-nsIdleService::AddIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS) {
+nsUserIdleService::AddIdleObserver(nsIObserver* aObserver,
+                                   uint32_t aIdleTimeInS) {
   NS_ENSURE_ARG_POINTER(aObserver);
   // We don't accept idle time at 0, and we can't handle idle time that are too
   // high either - no more than ~136 years.
   NS_ENSURE_ARG_RANGE(aIdleTimeInS, 1, (UINT32_MAX / 10) - 1);
 
   if (XRE_IsContentProcess()) {
     dom::ContentChild* cpc = dom::ContentChild::GetSingleton();
     cpc->AddIdleObserver(aObserver, aIdleTimeInS);
@@ -449,17 +456,18 @@ nsIdleService::AddIdleObserver(nsIObserv
 
   // Ensure timer is running.
   ReconfigureTimer();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsIdleService::RemoveIdleObserver(nsIObserver* aObserver, uint32_t aTimeInS) {
+nsUserIdleService::RemoveIdleObserver(nsIObserver* aObserver,
+                                      uint32_t aTimeInS) {
   NS_ENSURE_ARG_POINTER(aObserver);
   NS_ENSURE_ARG(aTimeInS);
 
   if (XRE_IsContentProcess()) {
     dom::ContentChild* cpc = dom::ContentChild::GetSingleton();
     cpc->RemoveIdleObserver(aObserver, aTimeInS);
     return NS_OK;
   }
@@ -494,17 +502,17 @@ nsIdleService::RemoveIdleObserver(nsIObs
   __android_log_print(LOG_LEVEL, LOG_TAG,
                       "Failed to remove idle observer %p (%d seconds)",
                       aObserver, aTimeInS);
 #endif
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-nsIdleService::ResetIdleTimeOut(uint32_t idleDeltaInMS) {
+nsUserIdleService::ResetIdleTimeOut(uint32_t idleDeltaInMS) {
   MOZ_LOG(sLog, LogLevel::Debug,
           ("idleService: Reset idle timeout (last interaction %u msec)",
            idleDeltaInMS));
 
   // Store the time
   mLastUserInteraction =
       TimeStamp::Now() - TimeDuration::FromMilliseconds(idleDeltaInMS);
 
@@ -567,17 +575,17 @@ nsIdleService::ResetIdleTimeOut(uint32_t
 #endif
     notifyList[numberOfPendingNotifications]->Observe(
         this, OBSERVER_TOPIC_ACTIVE, timeStr.get());
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsIdleService::GetIdleTime(uint32_t* idleTime) {
+nsUserIdleService::GetIdleTime(uint32_t* idleTime) {
   // Check sanity of in parameter.
   if (!idleTime) {
     return NS_ERROR_NULL_POINTER;
   }
 
   // Polled idle time in ms.
   uint32_t polledIdleTimeMS;
 
@@ -608,41 +616,42 @@ nsIdleService::GetIdleTime(uint32_t* idl
   }
 
   // Otherwise return the shortest time detected (in ms).
   *idleTime = std::min(timeSinceResetInMS, polledIdleTimeMS);
 
   return NS_OK;
 }
 
-bool nsIdleService::PollIdleTime(uint32_t* /*aIdleTime*/) {
+bool nsUserIdleService::PollIdleTime(uint32_t* /*aIdleTime*/) {
   // Default behavior is not to have the ability to poll an idle time.
   return false;
 }
 
-bool nsIdleService::UsePollMode() {
+bool nsUserIdleService::UsePollMode() {
   uint32_t dummy;
   return PollIdleTime(&dummy);
 }
 
-nsresult nsIdleService::GetDisabled(bool* aResult) {
+nsresult nsUserIdleService::GetDisabled(bool* aResult) {
   *aResult = mDisabled;
   return NS_OK;
 }
 
-nsresult nsIdleService::SetDisabled(bool aDisabled) {
+nsresult nsUserIdleService::SetDisabled(bool aDisabled) {
   mDisabled = aDisabled;
   return NS_OK;
 }
 
-void nsIdleService::StaticIdleTimerCallback(nsITimer* aTimer, void* aClosure) {
-  static_cast<nsIdleService*>(aClosure)->IdleTimerCallback();
+void nsUserIdleService::StaticIdleTimerCallback(nsITimer* aTimer,
+                                                void* aClosure) {
+  static_cast<nsUserIdleService*>(aClosure)->IdleTimerCallback();
 }
 
-void nsIdleService::IdleTimerCallback(void) {
+void nsUserIdleService::IdleTimerCallback(void) {
   // Remember that we no longer have a timer running.
   mCurrentlySetToTimeoutAt = TimeStamp();
 
   // Find the last detected idle time.
   uint32_t lastIdleTimeInMS = static_cast<uint32_t>(
       (TimeStamp::Now() - mLastUserInteraction).ToMilliseconds());
   // Get the current idle time.
   uint32_t currentIdleTimeInMS;
@@ -755,17 +764,17 @@ void nsIdleService::IdleTimerCallback(vo
                         "Idle timer callback: tell observer %p user is idle",
                         notifyList[numberOfPendingNotifications]);
 #endif
     notifyList[numberOfPendingNotifications]->Observe(this, OBSERVER_TOPIC_IDLE,
                                                       timeStr.get());
   }
 }
 
-void nsIdleService::SetTimerExpiryIfBefore(TimeStamp aNextTimeout) {
+void nsUserIdleService::SetTimerExpiryIfBefore(TimeStamp aNextTimeout) {
   TimeDuration nextTimeoutDuration = aNextTimeout - TimeStamp::Now();
 
   MOZ_LOG(
       sLog, LogLevel::Debug,
       ("idleService: SetTimerExpiryIfBefore: next timeout %0.f msec from now",
        nextTimeoutDuration.ToMilliseconds()));
 
 #ifdef MOZ_WIDGET_ANDROID
@@ -806,21 +815,21 @@ void nsIdleService::SetTimerExpiryIfBefo
     __android_log_print(LOG_LEVEL, LOG_TAG,
                         "reset timer expiry to %0.f msec from now",
                         deltaTime.ToMilliseconds());
 #endif
 
     // Start the timer
     mTimer->InitWithNamedFuncCallback(
         StaticIdleTimerCallback, this, deltaTime.ToMilliseconds(),
-        nsITimer::TYPE_ONE_SHOT, "nsIdleService::SetTimerExpiryIfBefore");
+        nsITimer::TYPE_ONE_SHOT, "nsUserIdleService::SetTimerExpiryIfBefore");
   }
 }
 
-void nsIdleService::ReconfigureTimer(void) {
+void nsUserIdleService::ReconfigureTimer(void) {
   // Check if either someone is idle, or someone will become idle.
   if ((mIdleObserverCount == 0) && UINT32_MAX == mDeltaToNextIdleSwitchInS) {
     // If not, just let any existing timers run to completion
     // And bail out.
     MOZ_LOG(sLog, LogLevel::Debug,
             ("idleService: ReconfigureTimer: no idle or waiting observers"));
 #ifdef MOZ_WIDGET_ANDROID
     __android_log_print(LOG_LEVEL, LOG_TAG,
rename from widget/nsIdleService.h
rename to widget/nsUserIdleService.h
--- a/widget/nsIdleService.h
+++ b/widget/nsUserIdleService.h
@@ -1,24 +1,24 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=2:tabstop=2:
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef nsIdleService_h__
-#define nsIdleService_h__
+#ifndef nsUserIdleService_h__
+#define nsUserIdleService_h__
 
-#include "nsIIdleServiceInternal.h"
+#include "nsIUserIdleServiceInternal.h"
 #include "nsCOMPtr.h"
 #include "nsITimer.h"
 #include "nsTArray.h"
 #include "nsIObserver.h"
-#include "nsIIdleService.h"
+#include "nsIUserIdleService.h"
 #include "nsCategoryCache.h"
 #include "nsWeakReference.h"
 #include "mozilla/TimeStamp.h"
 
 /**
  * Class we can use to store an observer with its associated idle time
  * requirement and whether or not the observer thinks it's "idle".
  */
@@ -29,56 +29,57 @@ class IdleListener {
   bool isIdle;
 
   IdleListener(nsIObserver* obs, uint32_t reqIT, bool aIsIdle = false)
       : observer(obs), reqIdleTime(reqIT), isIdle(aIsIdle) {}
   ~IdleListener() = default;
 };
 
 // This one will be declared later.
-class nsIdleService;
+class nsUserIdleService;
 
 /**
  * Class to handle the daily idle timer.
  */
-class nsIdleServiceDaily : public nsIObserver, public nsSupportsWeakReference {
+class nsUserIdleServiceDaily : public nsIObserver,
+                               public nsSupportsWeakReference {
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 
-  explicit nsIdleServiceDaily(nsIIdleService* aIdleService);
+  explicit nsUserIdleServiceDaily(nsIUserIdleService* aIdleService);
 
   /**
    * Initializes the daily idle observer.
    * Keep this separated from the constructor, since it could cause pointer
    * corruption due to AddRef/Release of "this".
    */
   void Init();
 
  private:
-  virtual ~nsIdleServiceDaily();
+  virtual ~nsUserIdleServiceDaily();
 
   /**
    * StageIdleDaily is the interim call made when an idle-daily event is due.
    * However we don't want to fire idle-daily until the user is idle for this
    * session, so this sets up a short wait for an idle event which triggers
    * the actual idle-daily event.
    *
-   * @param aHasBeenLongWait Pass true indicating nsIdleServiceDaily is having
-   * trouble getting the idle-daily event fired. If true StageIdleDaily will
-   * use a shorter idle wait time before firing idle-daily.
+   * @param aHasBeenLongWait Pass true indicating nsUserIdleServiceDaily is
+   * having trouble getting the idle-daily event fired. If true StageIdleDaily
+   * will use a shorter idle wait time before firing idle-daily.
    */
   void StageIdleDaily(bool aHasBeenLongWait);
 
   /**
    * @note This is a normal pointer, part to avoid creating a cycle with the
    * idle service, part to avoid potential pointer corruption due to this class
    * being instantiated in the constructor of the service itself.
    */
-  nsIIdleService* mIdleService;
+  nsIUserIdleService* mIdleService;
 
   /**
    * Place to hold the timer used by this class to determine when a day has
    * passed, after that it will wait for idle time to be detected.
    */
   nsCOMPtr<nsITimer> mTimer;
 
   /**
@@ -105,27 +106,26 @@ class nsIdleServiceDaily : public nsIObs
   /**
    * Tracks which idle daily observer callback we ask for. There are two: a
    * regular long idle wait and a shorter wait if we've been waiting to fire
    * idle daily for an extended period. Set by StageIdleDaily.
    */
   int32_t mIdleDailyTriggerWait;
 };
 
-class nsIdleService : public nsIIdleServiceInternal {
+class nsUserIdleService : public nsIUserIdleServiceInternal {
  public:
   NS_DECL_ISUPPORTS
-  NS_DECL_NSIIDLESERVICE
-  NS_DECL_NSIIDLESERVICEINTERNAL
+  NS_DECL_NSIUSERIDLESERVICE NS_DECL_NSIUSERIDLESERVICEINTERNAL
 
- protected:
-  static already_AddRefed<nsIdleService> GetInstance();
+      protected : static already_AddRefed<nsUserIdleService>
+                  GetInstance();
 
-  nsIdleService();
-  virtual ~nsIdleService();
+  nsUserIdleService();
+  virtual ~nsUserIdleService();
 
   /**
    * If there is a platform specific function to poll the system idel time
    * then that must be returned in this function, and the function MUST return
    * true, otherwise then the function should be left unimplemented or made
    * to return false (this can also be used for systems where it depends on
    * the configuration of the system if the idle time can be determined)
    *
@@ -172,17 +172,17 @@ class nsIdleService : public nsIIdleServ
   /**
    * Array of listeners that wants to be notified about idle time.
    */
   nsTArray<IdleListener> mArrayListeners;
 
   /**
    * Object keeping track of the daily idle thingy.
    */
-  RefPtr<nsIdleServiceDaily> mDailyIdle;
+  RefPtr<nsUserIdleServiceDaily> mDailyIdle;
 
   /**
    * Number of observers currently in idle mode.
    */
   uint32_t mIdleObserverCount;
 
   /**
    * Delta time from last non idle time to when the next observer should switch
@@ -219,9 +219,9 @@ class nsIdleService : public nsIIdleServ
   static void StaticIdleTimerCallback(nsITimer* aTimer, void* aClosure);
 
   /**
    * Function that handles when a timer has expired
    */
   void IdleTimerCallback(void);
 };
 
-#endif  // nsIdleService_h__
+#endif  // nsUserIdleService_h__
--- a/widget/tests/test_bug343416.xhtml
+++ b/widget/tests/test_bug343416.xhtml
@@ -45,26 +45,26 @@ var idleObserver =
         
         var diff = Math.abs(data - newIdleSeconds * 1000);
 
 //        ok (diff < 5000, "The idle time should have increased by roughly 6 seconds, " +
 //                         "as that's when we told this listener to fire.");
 //        if (diff >= 5000)
 //            alert(data + "  " + newIdleSeconds);
 
-        // Attempt to get to the nsIIdleService        
+        // Attempt to get to the nsIUserIdleService        
         var subjectOK = false;
         try {
-            var idleService = subject.QueryInterface(nsIIdleService);
+            var idleService = subject.QueryInterface(nsIUserIdleService);
             subjectOK = true;
         }
         catch (ex)
         {}
         ok(subjectOK, "The subject of the notification should be the " +
-                      "nsIIdleService.");
+                      "nsIUserIdleService.");
 
         // Attempt to remove ourselves.
         var removedObserver = false;
         try {
             idleService.removeIdleObserver(this, newIdleSeconds);
             removedObserver = true;
         }
         catch (ex)
@@ -75,27 +75,27 @@ var idleObserver =
         {
             clearTimeout(testBailout);
             finishThisTest();
         }
     }
 };
 
 
-const nsIIdleService = Ci.nsIIdleService;
-const nsIISCID = "@mozilla.org/widget/idleservice;1";
+const nsIUserIdleService = Ci.nsIUserIdleService;
+const nsIISCID = "@mozilla.org/widget/useridleservice;1";
 var idleService = null;
 try
 {
-    idleService = Cc[nsIISCID].getService(nsIIdleService);
+    idleService = Cc[nsIISCID].getService(nsIUserIdleService);
 }
 catch (ex)
 {}
 
-ok(idleService, "nsIIdleService should exist and be implemented on all tier 1 platforms.");
+ok(idleService, "nsIUserIdleService should exist and be implemented on all tier 1 platforms.");
 
 var idleTime = null;
 var gotIdleTime = false;
 try
 {
     idleTime = idleService.idleTime;
     gotIdleTime = true;
 }
@@ -115,39 +115,39 @@ var addedObserver = false;
 try
 {
     idleService.addIdleObserver(idleObserver, newIdleSeconds);
     addedObserver = true;
 }
 catch (ex)
 {}
 
-ok(addedObserver, "The nsIIdleService should allow us to add an observer.");
+ok(addedObserver, "The nsIUserIdleService should allow us to add an observer.");
 
 addedObserver = false;
 try
 {
     idleService.addIdleObserver(idleObserver, newIdleSeconds);
     addedObserver = true;
 }
 catch (ex)
 {}
 
-ok(addedObserver, "The nsIIdleService should allow us to add the same observer again.");
+ok(addedObserver, "The nsIUserIdleService should allow us to add the same observer again.");
 
 var removedObserver = false;
 try
 {
     idleService.removeIdleObserver(idleObserver, newIdleSeconds);
     removedObserver = true;
 }
 catch (ex)
 {}
 
-ok(removedObserver, "The nsIIdleService should allow us to remove the observer just once.");
+ok(removedObserver, "The nsIUserIdleService should allow us to remove the observer just once.");
 
 function testIdleTime()
 {
     /* eslint-disable-next-line no-shadow */
     var gotIdleTime = false
     try
     {
         var newIdleTime = idleService.idleTime;
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -11,17 +11,17 @@
 #include "mozilla/MouseEvents.h"
 #include "mozilla/MiscEvents.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TextEvents.h"
 
 #include "nsAlgorithm.h"
 #include "nsExceptionHandler.h"
 #include "nsGkAtoms.h"
-#include "nsIIdleServiceInternal.h"
+#include "nsIUserIdleServiceInternal.h"
 #include "nsIWindowsRegKey.h"
 #include "nsMemory.h"
 #include "nsPrintfCString.h"
 #include "nsQuickSort.h"
 #include "nsServiceManagerUtils.h"
 #include "nsToolkit.h"
 #include "nsUnicharUtils.h"
 #include "nsWindowDbg.h"
@@ -3861,30 +3861,30 @@ void NativeKey::WillDispatchKeyboardEven
   }
 }
 
 /*****************************************************************************
  * mozilla::widget::KeyboardLayout
  *****************************************************************************/
 
 KeyboardLayout* KeyboardLayout::sInstance = nullptr;
-nsIIdleServiceInternal* KeyboardLayout::sIdleService = nullptr;
+nsIUserIdleServiceInternal* KeyboardLayout::sIdleService = nullptr;
 
 // This log is very noisy if you don't want to retrieve the mapping table
 // of specific keyboard layout.  LogLevel::Debug and LogLevel::Verbose are
 // used to log the layout mapping.  If you need to log some behavior of
 // KeyboardLayout class, you should use LogLevel::Info or lower level.
 LazyLogModule sKeyboardLayoutLogger("KeyboardLayoutWidgets");
 
 // static
 KeyboardLayout* KeyboardLayout::GetInstance() {
   if (!sInstance) {
     sInstance = new KeyboardLayout();
-    nsCOMPtr<nsIIdleServiceInternal> idleService =
-        do_GetService("@mozilla.org/widget/idleservice;1");
+    nsCOMPtr<nsIUserIdleServiceInternal> idleService =
+        do_GetService("@mozilla.org/widget/useridleservice;1");
     // The refcount will be decreased at shut down.
     sIdleService = idleService.forget().take();
   }
   return sInstance;
 }
 
 // static
 void KeyboardLayout::Shutdown() {
--- a/widget/windows/KeyboardLayout.h
+++ b/widget/windows/KeyboardLayout.h
@@ -34,17 +34,17 @@
 #define VK_OEM_4 0xDB
 #define VK_OEM_5 0xDC
 #define VK_OEM_6 0xDD
 #define VK_OEM_7 0xDE
 #define VK_OEM_8 0xDF
 #define VK_OEM_102 0xE2
 #define VK_OEM_CLEAR 0xFE
 
-class nsIIdleServiceInternal;
+class nsIUserIdleServiceInternal;
 
 namespace mozilla {
 namespace widget {
 
 enum ScanCode : uint16_t {
   eCapsLock = 0x003A,
   eNumLock = 0xE045,
   eShiftLeft = 0x002A,
@@ -950,17 +950,17 @@ class KeyboardLayout {
                                     const nsAString& aCharacters,
                                     const nsAString& aUnmodifiedCharacters);
 
  private:
   KeyboardLayout();
   ~KeyboardLayout();
 
   static KeyboardLayout* sInstance;
-  static nsIIdleServiceInternal* sIdleService;
+  static nsIUserIdleServiceInternal* sIdleService;
 
   struct DeadKeyTableListEntry {
     DeadKeyTableListEntry* next;
     uint8_t data[1];
   };
 
   HKL mKeyboardLayout;
 
--- a/widget/windows/components.conf
+++ b/widget/windows/components.conf
@@ -25,21 +25,21 @@ Classes = [
         'cid': '{2d96b3df-c051-11d1-a827-0040959a28c9}',
         'contract_ids': ['@mozilla.org/widget/appshell/win;1'],
         'headers': ['/widget/windows/nsWidgetFactory.h'],
         'legacy_constructor': 'nsAppShellConstructor',
         'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS,
     },
     {
         'cid': '{6987230e-0098-4e78-bc5f-1493ee7519fa}',
-        'contract_ids': ['@mozilla.org/widget/idleservice;1'],
+        'contract_ids': ['@mozilla.org/widget/useridleservice;1'],
         'singleton': True,
-        'type': 'nsIdleServiceWin',
-        'constructor': 'nsIdleServiceWin::GetInstance',
-        'headers': ['/widget/windows/nsIdleServiceWin.h', 'nsIdleService.h'],
+        'type': 'nsUserIdleServiceWin',
+        'constructor': 'nsUserIdleServiceWin::GetInstance',
+        'headers': ['/widget/windows/nsUserIdleServiceWin.h', 'nsUserIdleService.h'],
     },
     {
         'cid': '{b148eed2-236d-11d3-b35c-00a0cc3c1cde}',
         'contract_ids': ['@mozilla.org/sound;1'],
         'singleton': True,
         'type': 'nsISound',
         'constructor': 'nsSound::GetInstance',
         'headers': ['/widget/windows/nsSound.h'],
--- a/widget/windows/moz.build
+++ b/widget/windows/moz.build
@@ -55,23 +55,23 @@ UNIFIED_SOURCES += [
     'KeyboardLayout.cpp',
     'LSPAnnotator.cpp',
     'nsAppShell.cpp',
     'nsClipboard.cpp',
     'nsColorPicker.cpp',
     'nsDataObj.cpp',
     'nsDataObjCollection.cpp',
     'nsDragService.cpp',
-    'nsIdleServiceWin.cpp',
     'nsLookAndFeel.cpp',
     'nsNativeDragSource.cpp',
     'nsNativeDragTarget.cpp',
     'nsNativeThemeWin.cpp',
     'nsSound.cpp',
     'nsToolkit.cpp',
+    'nsUserIdleServiceWin.cpp',
     'nsUXThemeData.cpp',
     'nsWindow.cpp',
     'nsWindowBase.cpp',
     'nsWindowDbg.cpp',
     'nsWindowGfx.cpp',
     'nsWinGesture.cpp',
     'ProcInfo.cpp',
     'RemoteBackbuffer.cpp',
rename from widget/windows/nsIdleServiceWin.cpp
rename to widget/windows/nsUserIdleServiceWin.cpp
--- a/widget/windows/nsIdleServiceWin.cpp
+++ b/widget/windows/nsUserIdleServiceWin.cpp
@@ -1,22 +1,22 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=4:tabstop=4:
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "nsIdleServiceWin.h"
+#include "nsUserIdleServiceWin.h"
 #include <windows.h>
 
-bool nsIdleServiceWin::PollIdleTime(uint32_t* aIdleTime) {
+bool nsUserIdleServiceWin::PollIdleTime(uint32_t* aIdleTime) {
   LASTINPUTINFO inputInfo;
   inputInfo.cbSize = sizeof(inputInfo);
   if (!::GetLastInputInfo(&inputInfo)) return false;
 
   *aIdleTime =
       SAFE_COMPARE_EVEN_WITH_WRAPPING(GetTickCount(), inputInfo.dwTime);
 
   return true;
 }
 
-bool nsIdleServiceWin::UsePollMode() { return true; }
+bool nsUserIdleServiceWin::UsePollMode() { return true; }
rename from widget/windows/nsIdleServiceWin.h
rename to widget/windows/nsUserIdleServiceWin.h
--- a/widget/windows/nsIdleServiceWin.h
+++ b/widget/windows/nsUserIdleServiceWin.h
@@ -1,43 +1,43 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=4:tabstop=4:
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef nsIdleServiceWin_h__
-#define nsIdleServiceWin_h__
+#ifndef nsUserIdleServiceWin_h__
+#define nsUserIdleServiceWin_h__
 
-#include "nsIdleService.h"
+#include "nsUserIdleService.h"
 
 /* NOTE: Compare of GetTickCount() could overflow.  This corrects for
  * overflow situations.
  ***/
 #ifndef SAFE_COMPARE_EVEN_WITH_WRAPPING
 #  define SAFE_COMPARE_EVEN_WITH_WRAPPING(A, B) \
     (((int)((long)A - (long)B) & 0xFFFFFFFF))
 #endif
 
-class nsIdleServiceWin : public nsIdleService {
+class nsUserIdleServiceWin : public nsUserIdleService {
  public:
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsIdleServiceWin, nsIdleService)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsUserIdleServiceWin, nsUserIdleService)
 
   bool PollIdleTime(uint32_t* aIdleTime) override;
 
-  static already_AddRefed<nsIdleServiceWin> GetInstance() {
-    RefPtr<nsIdleServiceWin> idleService =
-        nsIdleService::GetInstance().downcast<nsIdleServiceWin>();
+  static already_AddRefed<nsUserIdleServiceWin> GetInstance() {
+    RefPtr<nsUserIdleServiceWin> idleService =
+        nsUserIdleService::GetInstance().downcast<nsUserIdleServiceWin>();
     if (!idleService) {
-      idleService = new nsIdleServiceWin();
+      idleService = new nsUserIdleServiceWin();
     }
 
     return idleService.forget();
   }
 
  protected:
-  nsIdleServiceWin() {}
-  virtual ~nsIdleServiceWin() {}
+  nsUserIdleServiceWin() {}
+  virtual ~nsUserIdleServiceWin() {}
   bool UsePollMode() override;
 };
 
-#endif  // nsIdleServiceWin_h__
+#endif  // nsUserIdleServiceWin_h__
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -6917,17 +6917,17 @@ void nsWindow::OnWindowPosChanging(LPWIN
       mWidgetListener->ShouldNotBeVisible()) {
     info->flags &= ~SWP_SHOWWINDOW;
   }
 }
 
 void nsWindow::UserActivity() {
   // Check if we have the idle service, if not we try to get it.
   if (!mIdleService) {
-    mIdleService = do_GetService("@mozilla.org/widget/idleservice;1");
+    mIdleService = do_GetService("@mozilla.org/widget/useridleservice;1");
   }
 
   // Check that we now have the idle service.
   if (mIdleService) {
     mIdleService->ResetIdleTimeOut(0);
   }
 }
 
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -10,17 +10,17 @@
  * nsWindow - Native window management and event handling.
  */
 
 #include "mozilla/RefPtr.h"
 #include "nsBaseWidget.h"
 #include "CompositorWidget.h"
 #include "nsWindowBase.h"
 #include "nsdefs.h"
-#include "nsIdleService.h"
+#include "nsUserIdleService.h"
 #include "nsToolkit.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "gfxWindowsPlatform.h"
 #include "gfxWindowsSurface.h"
 #include "nsWindowDbg.h"
 #include "cairo.h"
 #include "nsRegion.h"
@@ -41,17 +41,17 @@
 #include "TaskbarWindowPreview.h"
 
 #ifdef ACCESSIBILITY
 #  include "oleacc.h"
 #  include "mozilla/a11y/Accessible.h"
 #endif
 
 #include "nsUXThemeData.h"
-#include "nsIIdleServiceInternal.h"
+#include "nsIUserIdleServiceInternal.h"
 
 #include "IMMHandler.h"
 
 /**
  * Forward class definitions
  */
 
 class nsNativeDragTarget;
@@ -652,17 +652,17 @@ class nsWindow final : public nsWindowBa
   int32_t mVertResizeMargin;
   // Height of the caption plus border
   int32_t mCaptionHeight;
 
   double mDefaultScale;
 
   float mAspectRatio;
 
-  nsCOMPtr<nsIIdleServiceInternal> mIdleService;
+  nsCOMPtr<nsIUserIdleServiceInternal> mIdleService;
 
   // Draggable titlebar region maintained by UpdateWindowDraggingRegion
   LayoutDeviceIntRegion mDraggableRegion;
 
   // Hook Data Memebers for Dropdowns. sProcessHook Tells the
   // hook methods whether they should be processing the hook
   // messages.
   static HHOOK sMsgFilterHook;
--- a/xpcom/io/nsAnonymousTemporaryFile.cpp
+++ b/xpcom/io/nsAnonymousTemporaryFile.cpp
@@ -11,17 +11,17 @@
 #include "prio.h"
 #include "SpecialSystemDirectory.h"
 
 #ifdef XP_WIN
 #  include "nsIObserver.h"
 #  include "nsIObserverService.h"
 #  include "mozilla/ResultExtensions.h"
 #  include "mozilla/Services.h"
-#  include "nsIIdleService.h"
+#  include "nsIUserIdleService.h"
 #  include "nsISimpleEnumerator.h"
 #  include "nsIFile.h"
 #  include "nsITimer.h"
 #  include "nsCRT.h"
 
 #endif
 
 using namespace mozilla;
@@ -178,18 +178,18 @@ class nsAnonTempFileRemover final : publ
 
   void Cleanup() {
     // Cancel timer.
     if (mTimer) {
       mTimer->Cancel();
       mTimer = nullptr;
     }
     // Remove idle service observer.
-    nsCOMPtr<nsIIdleService> idleSvc =
-        do_GetService("@mozilla.org/widget/idleservice;1");
+    nsCOMPtr<nsIUserIdleService> idleSvc =
+        do_GetService("@mozilla.org/widget/useridleservice;1");
     if (idleSvc) {
       idleSvc->RemoveIdleObserver(this, TEMP_FILE_IDLE_TIME_S);
     }
     // Remove shutdown observer.
     nsCOMPtr<nsIObserverService> obsSrv = services::GetObserverService();
     if (obsSrv) {
       obsSrv->RemoveObserver(this, XPCOM_SHUTDOWN_TOPIC);
     }
@@ -211,18 +211,18 @@ class nsAnonTempFileRemover final : publ
     }
     return NS_OK;
   }
 
   nsresult RegisterIdleObserver() {
     // Add this as an idle observer. When we've been idle for
     // TEMP_FILE_IDLE_TIME_S seconds, we'll get a notification, and we'll then
     // try to delete any stray temp files.
-    nsCOMPtr<nsIIdleService> idleSvc =
-        do_GetService("@mozilla.org/widget/idleservice;1");
+    nsCOMPtr<nsIUserIdleService> idleSvc =
+        do_GetService("@mozilla.org/widget/useridleservice;1");
     if (!idleSvc) {
       return NS_ERROR_FAILURE;
     }
     return idleSvc->AddIdleObserver(this, TEMP_FILE_IDLE_TIME_S);
   }
 
   void RemoveAnonTempFileFiles() {
     nsCOMPtr<nsIFile> tmpDir;