diff --git a/core/modules/system/src/Tests/Theme/ThemeTest.php b/core/modules/system/src/Tests/Theme/ThemeTest.php
index 4573d01..7243f9e 100644
--- a/core/modules/system/src/Tests/Theme/ThemeTest.php
+++ b/core/modules/system/src/Tests/Theme/ThemeTest.php
@@ -208,11 +208,10 @@ function testListThemes() {
     $themes = $theme_handler->listInfo();
 
     $themes = \Drupal::service('theme_handler')->listInfo();
-    // Check if drupal_theme_access() retrieves enabled themes properly from
-    // ThemeHandlerInterface::listInfo().
-    $this->assertTrue(drupal_theme_access('test_theme'), 'Installed theme detected');
+    // Check if \Drupal::service('access_check.theme')->checkAccess() retrieves
+    // enabled themes properly from ThemeHandlerInterface::listInfo().
+    $this->assertTrue(\Drupal::service('access_check.theme')->checkAccess('test_theme'), 'Enabled theme detected');
 
-    $this->assertTrue(drupal_theme_access('test_theme'), 'Enabled theme detected');
     // Check if ThemeHandlerInterface::listInfo() returns disabled themes.
     // Check for base theme and subtheme lists.
     $base_theme_list = array('test_basetheme' => 'Theme test base theme');
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 8a55125..e30a99f 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -309,13 +309,6 @@ function system_theme_suggestions_field(array $variables) {
 }
 
 /**
- * Menu item access callback - only installed themes can be accessed.
- */
-function _system_themes_access($theme) {
-  return \Drupal::currentUser()->hasPermission('administer themes') && drupal_theme_access($theme);
-}
-
-/**
  * @defgroup authorize Authorized operations
  * @{
  * Functions to run operations with elevated privileges via authorize.php.
