Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.app; |
| 18 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 19 | import android.accounts.AccountManager; |
| 20 | import android.accounts.IAccountManager; |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 21 | import android.annotation.NonNull; |
Makoto Onuki | d67070e | 2018-03-30 12:39:14 -0700 | [diff] [blame] | 22 | import android.app.ContextImpl.ServiceInitializationState; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 23 | import android.app.admin.DevicePolicyManager; |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 24 | import android.app.admin.IDevicePolicyManager; |
Sudheer Shanka | f5b3696 | 2019-10-04 16:16:13 -0700 | [diff] [blame] | 25 | import android.app.blob.BlobStoreManagerFrameworkInitializer; |
Winson Chung | 3fb0f25 | 2019-01-08 17:41:55 -0800 | [diff] [blame] | 26 | import android.app.contentsuggestions.ContentSuggestionsManager; |
| 27 | import android.app.contentsuggestions.IContentSuggestionsManager; |
Makoto Onuki | 54c4e03 | 2019-10-30 12:05:20 -0700 | [diff] [blame] | 28 | import android.app.job.JobSchedulerFrameworkInitializer; |
Sunny Goyal | 54e9134 | 2018-11-14 11:59:02 -0800 | [diff] [blame] | 29 | import android.app.prediction.AppPredictionManager; |
Hai Zhang | a4959e5 | 2019-03-06 12:21:07 -0800 | [diff] [blame] | 30 | import android.app.role.RoleControllerManager; |
Hai Zhang | 4ef21d0 | 2018-11-09 14:43:51 -0800 | [diff] [blame] | 31 | import android.app.role.RoleManager; |
Jason Monk | 8f5f7ff | 2017-10-17 14:12:42 -0400 | [diff] [blame] | 32 | import android.app.slice.SliceManager; |
Neil Fuller | feeee68 | 2018-05-30 14:35:24 +0100 | [diff] [blame] | 33 | import android.app.timedetector.TimeDetector; |
Neil Fuller | 328532a | 2017-03-16 18:32:21 +0000 | [diff] [blame] | 34 | import android.app.timezone.RulesManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 35 | import android.app.trust.TrustManager; |
Jeff Sharkey | e8cece9 | 2017-01-04 11:33:33 -0700 | [diff] [blame] | 36 | import android.app.usage.IStorageStatsManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 37 | import android.app.usage.IUsageStatsManager; |
Zoltan Szatmary-Ban | 9c5dfa5 | 2015-02-23 17:20:20 +0000 | [diff] [blame] | 38 | import android.app.usage.NetworkStatsManager; |
Jeff Sharkey | e8cece9 | 2017-01-04 11:33:33 -0700 | [diff] [blame] | 39 | import android.app.usage.StorageStatsManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 40 | import android.app.usage.UsageStatsManager; |
| 41 | import android.appwidget.AppWidgetManager; |
| 42 | import android.bluetooth.BluetoothManager; |
Eugene Susla | 6ed45d8 | 2017-01-22 13:52:51 -0800 | [diff] [blame] | 43 | import android.companion.CompanionDeviceManager; |
| 44 | import android.companion.ICompanionDeviceManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 45 | import android.content.ClipboardManager; |
Felipe Leme | 326f15a | 2019-02-19 09:42:24 -0800 | [diff] [blame] | 46 | import android.content.ContentCaptureOptions; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 47 | import android.content.Context; |
| 48 | import android.content.IRestrictionsManager; |
| 49 | import android.content.RestrictionsManager; |
Hyunyoung Song | 880a951 | 2018-12-20 11:24:48 -0800 | [diff] [blame] | 50 | import android.content.om.IOverlayManager; |
| 51 | import android.content.om.OverlayManager; |
Tony Mak | b0d2262 | 2018-01-18 12:49:49 +0000 | [diff] [blame] | 52 | import android.content.pm.CrossProfileApps; |
| 53 | import android.content.pm.ICrossProfileApps; |
Svet Ganov | d8eb8b2 | 2019-04-05 18:52:08 -0700 | [diff] [blame] | 54 | import android.content.pm.IPackageManager; |
Makoto Onuki | 6f7362d9 | 2016-03-04 13:39:41 -0800 | [diff] [blame] | 55 | import android.content.pm.IShortcutService; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 56 | import android.content.pm.LauncherApps; |
Svet Ganov | ec7daa5 | 2017-06-30 12:02:59 -0700 | [diff] [blame] | 57 | import android.content.pm.PackageManager; |
Makoto Onuki | 6f7362d9 | 2016-03-04 13:39:41 -0800 | [diff] [blame] | 58 | import android.content.pm.ShortcutManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 59 | import android.content.res.Resources; |
Richard Uhler | b29f145 | 2018-09-12 16:38:15 +0100 | [diff] [blame] | 60 | import android.content.rollback.IRollbackManager; |
| 61 | import android.content.rollback.RollbackManager; |
Kenny Root | f74bfde | 2018-01-18 15:42:48 -0800 | [diff] [blame] | 62 | import android.debug.AdbManager; |
| 63 | import android.debug.IAdbManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 64 | import android.hardware.ConsumerIrManager; |
| 65 | import android.hardware.ISerialManager; |
| 66 | import android.hardware.SensorManager; |
Chad Brubaker | 90f391f | 2018-10-19 10:26:19 -0700 | [diff] [blame] | 67 | import android.hardware.SensorPrivacyManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 68 | import android.hardware.SerialManager; |
| 69 | import android.hardware.SystemSensorManager; |
Kevin Chyn | 05c2150 | 2018-09-18 13:07:19 -0700 | [diff] [blame] | 70 | import android.hardware.biometrics.BiometricManager; |
Ilya Matyukhin | e4675b3 | 2019-11-07 16:07:19 -0800 | [diff] [blame] | 71 | import android.hardware.biometrics.IAuthService; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 72 | import android.hardware.camera2.CameraManager; |
Christine Franks | 39b0311 | 2018-07-03 14:46:07 -0700 | [diff] [blame] | 73 | import android.hardware.display.ColorDisplayManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 74 | import android.hardware.display.DisplayManager; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 75 | import android.hardware.face.FaceManager; |
| 76 | import android.hardware.face.IFaceService; |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 77 | import android.hardware.fingerprint.FingerprintManager; |
| 78 | import android.hardware.fingerprint.IFingerprintService; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 79 | import android.hardware.hdmi.HdmiControlManager; |
| 80 | import android.hardware.hdmi.IHdmiControlService; |
| 81 | import android.hardware.input.InputManager; |
Kevin Chyn | 51676d2 | 2018-11-05 18:00:43 -0800 | [diff] [blame] | 82 | import android.hardware.iris.IIrisService; |
Felipe Leme | e348dc3 | 2018-11-05 12:35:29 -0800 | [diff] [blame] | 83 | import android.hardware.iris.IrisManager; |
Peng Xu | 9ff7d22 | 2016-02-11 13:02:05 -0800 | [diff] [blame] | 84 | import android.hardware.location.ContextHubManager; |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 85 | import android.hardware.radio.RadioManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 86 | import android.hardware.usb.IUsbManager; |
| 87 | import android.hardware.usb.UsbManager; |
| 88 | import android.location.CountryDetector; |
| 89 | import android.location.ICountryDetector; |
| 90 | import android.location.ILocationManager; |
| 91 | import android.location.LocationManager; |
| 92 | import android.media.AudioManager; |
| 93 | import android.media.MediaRouter; |
| 94 | import android.media.midi.IMidiManager; |
| 95 | import android.media.midi.MidiManager; |
| 96 | import android.media.projection.MediaProjectionManager; |
| 97 | import android.media.session.MediaSessionManager; |
Arunesh Mishra | a772e5f | 2016-01-25 10:33:11 -0800 | [diff] [blame] | 98 | import android.media.soundtrigger.SoundTriggerManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 99 | import android.media.tv.ITvInputManager; |
| 100 | import android.media.tv.TvInputManager; |
| 101 | import android.net.ConnectivityManager; |
Paul Stewart | bf8cbb05 | 2016-03-17 10:11:54 -0700 | [diff] [blame] | 102 | import android.net.ConnectivityThread; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 103 | import android.net.EthernetManager; |
| 104 | import android.net.IConnectivityManager; |
| 105 | import android.net.IEthernetManager; |
Nathan Harold | 28084d8 | 2017-03-01 18:55:06 -0800 | [diff] [blame] | 106 | import android.net.IIpSecService; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 107 | import android.net.INetworkPolicyManager; |
Benedict Wong | 99a4841 | 2018-11-09 14:45:34 -0800 | [diff] [blame] | 108 | import android.net.ITestNetworkManager; |
Nathan Harold | 28084d8 | 2017-03-01 18:55:06 -0800 | [diff] [blame] | 109 | import android.net.IpSecManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 110 | import android.net.NetworkPolicyManager; |
| 111 | import android.net.NetworkScoreManager; |
Ricky Wai | 1a6e667 | 2017-10-27 14:46:01 +0100 | [diff] [blame] | 112 | import android.net.NetworkWatchlistManager; |
Benedict Wong | 99a4841 | 2018-11-09 14:45:34 -0800 | [diff] [blame] | 113 | import android.net.TestNetworkManager; |
Robert Quattlebaum | 87a7104 | 2017-05-15 15:45:20 -0700 | [diff] [blame] | 114 | import android.net.lowpan.ILowpanManager; |
| 115 | import android.net.lowpan.LowpanManager; |
Etan Cohen | 17ba472 | 2017-08-21 10:52:17 -0700 | [diff] [blame] | 116 | import android.net.nsd.INsdManager; |
| 117 | import android.net.nsd.NsdManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 118 | import android.net.wifi.IWifiScanner; |
| 119 | import android.net.wifi.RttManager; |
| 120 | import android.net.wifi.WifiManager; |
| 121 | import android.net.wifi.WifiScanner; |
Etan Cohen | 0413327 | 2016-10-26 11:22:06 -0700 | [diff] [blame] | 122 | import android.net.wifi.aware.IWifiAwareManager; |
| 123 | import android.net.wifi.aware.WifiAwareManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 124 | import android.net.wifi.p2p.IWifiP2pManager; |
| 125 | import android.net.wifi.p2p.WifiP2pManager; |
Etan Cohen | 17ba472 | 2017-08-21 10:52:17 -0700 | [diff] [blame] | 126 | import android.net.wifi.rtt.IWifiRttManager; |
| 127 | import android.net.wifi.rtt.WifiRttManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 128 | import android.nfc.NfcManager; |
| 129 | import android.os.BatteryManager; |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 130 | import android.os.BatteryStats; |
Roshan Pius | 848513e | 2019-10-11 13:44:00 -0700 | [diff] [blame] | 131 | import android.os.BatteryStatsManager; |
Nandana Dutt | d11850c | 2018-12-12 17:26:57 +0000 | [diff] [blame] | 132 | import android.os.BugreportManager; |
Jeff Sharkey | 351c2c2 | 2017-03-18 16:48:02 -0600 | [diff] [blame] | 133 | import android.os.Build; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 134 | import android.os.DropBoxManager; |
Polina Bondarenko | 965ecbb | 2015-11-13 15:34:28 +0100 | [diff] [blame] | 135 | import android.os.HardwarePropertiesManager; |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 136 | import android.os.IBatteryPropertiesRegistrar; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 137 | import android.os.IBinder; |
Nandana Dutt | d11850c | 2018-12-12 17:26:57 +0000 | [diff] [blame] | 138 | import android.os.IDumpstate; |
Polina Bondarenko | f8754ac | 2016-02-12 20:38:23 +0100 | [diff] [blame] | 139 | import android.os.IHardwarePropertiesManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 140 | import android.os.IPowerManager; |
Tao Bao | e8a403d | 2015-12-31 07:44:55 -0800 | [diff] [blame] | 141 | import android.os.IRecoverySystem; |
Tao Bao | 07342dc | 2017-01-24 15:08:21 -0800 | [diff] [blame] | 142 | import android.os.ISystemUpdateManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 143 | import android.os.IUserManager; |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 144 | import android.os.IncidentManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 145 | import android.os.PowerManager; |
Tao Bao | e8a403d | 2015-12-31 07:44:55 -0800 | [diff] [blame] | 146 | import android.os.RecoverySystem; |
Benedict Wong | 99a4841 | 2018-11-09 14:45:34 -0800 | [diff] [blame] | 147 | import android.os.RemoteException; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 148 | import android.os.ServiceManager; |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 149 | import android.os.ServiceManager.ServiceNotFoundException; |
Tao Bao | 07342dc | 2017-01-24 15:08:21 -0800 | [diff] [blame] | 150 | import android.os.SystemUpdateManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 151 | import android.os.SystemVibrator; |
| 152 | import android.os.UserHandle; |
| 153 | import android.os.UserManager; |
| 154 | import android.os.Vibrator; |
Joe Onorato | 713fec8 | 2016-03-04 10:34:02 -0800 | [diff] [blame] | 155 | import android.os.health.SystemHealthManager; |
Po-Chien Hsueh | 4e908c2 | 2019-03-07 11:57:17 +0800 | [diff] [blame] | 156 | import android.os.image.DynamicSystemManager; |
| 157 | import android.os.image.IDynamicSystemService; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 158 | import android.os.storage.StorageManager; |
Philip P. Moltmann | bc054d8 | 2018-12-21 09:41:58 -0800 | [diff] [blame] | 159 | import android.permission.PermissionControllerManager; |
Philip P. Moltmann | 039678e | 2018-09-18 13:04:38 -0700 | [diff] [blame] | 160 | import android.permission.PermissionManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 161 | import android.print.IPrintManager; |
| 162 | import android.print.PrintManager; |
Andrew Scull | 3b8b46f | 2017-02-13 18:12:15 +0000 | [diff] [blame] | 163 | import android.service.oemlock.IOemLockService; |
| 164 | import android.service.oemlock.OemLockManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 165 | import android.service.persistentdata.IPersistentDataBlockService; |
| 166 | import android.service.persistentdata.PersistentDataBlockManager; |
Zak Cohen | 56345f4 | 2017-01-26 13:54:28 -0800 | [diff] [blame] | 167 | import android.service.vr.IVrManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 168 | import android.telecom.TelecomManager; |
Jonathan Basseri | 9a1c9b6 | 2015-02-25 13:01:52 -0800 | [diff] [blame] | 169 | import android.telephony.CarrierConfigManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 170 | import android.telephony.SubscriptionManager; |
| 171 | import android.telephony.TelephonyManager; |
Makoto Onuki | 54c4e03 | 2019-10-30 12:05:20 -0700 | [diff] [blame] | 172 | import android.telephony.TelephonyRegistryManager; |
Holly Jiuyu Sun | 5c11024 | 2017-12-21 18:44:59 -0800 | [diff] [blame] | 173 | import android.telephony.euicc.EuiccCardManager; |
Neil Fuller | 009e77a | 2017-05-04 16:53:41 +0100 | [diff] [blame] | 174 | import android.telephony.euicc.EuiccManager; |
Robert Benea | 1901a5b | 2018-05-15 16:36:07 -0700 | [diff] [blame] | 175 | import android.util.ArrayMap; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 176 | import android.util.Log; |
| 177 | import android.view.ContextThemeWrapper; |
| 178 | import android.view.LayoutInflater; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 179 | import android.view.WindowManager; |
| 180 | import android.view.WindowManagerImpl; |
| 181 | import android.view.accessibility.AccessibilityManager; |
| 182 | import android.view.accessibility.CaptioningManager; |
Neil Fuller | 009e77a | 2017-05-04 16:53:41 +0100 | [diff] [blame] | 183 | import android.view.autofill.AutofillManager; |
| 184 | import android.view.autofill.IAutoFillManager; |
Felipe Leme | 749b889 | 2018-12-03 16:30:30 -0800 | [diff] [blame] | 185 | import android.view.contentcapture.ContentCaptureManager; |
| 186 | import android.view.contentcapture.IContentCaptureManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 187 | import android.view.inputmethod.InputMethodManager; |
Abodunrinwa Toki | f001fef | 2017-01-04 23:51:42 +0000 | [diff] [blame] | 188 | import android.view.textclassifier.TextClassificationManager; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 189 | import android.view.textservice.TextServicesManager; |
| 190 | |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 191 | import com.android.internal.app.IAppOpsService; |
| 192 | import com.android.internal.app.IBatteryStats; |
| 193 | import com.android.internal.app.ISoundTriggerService; |
| 194 | import com.android.internal.appwidget.IAppWidgetService; |
Ricky Wai | 1a6e667 | 2017-10-27 14:46:01 +0100 | [diff] [blame] | 195 | import com.android.internal.net.INetworkWatchlistManager; |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 196 | import com.android.internal.os.IDropBoxManagerService; |
| 197 | import com.android.internal.policy.PhoneLayoutInflater; |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 198 | import com.android.internal.util.Preconditions; |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 199 | |
Robert Benea | 1901a5b | 2018-05-15 16:36:07 -0700 | [diff] [blame] | 200 | import java.util.Map; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 201 | |
| 202 | /** |
| 203 | * Manages all of the system services that can be returned by {@link Context#getSystemService}. |
| 204 | * Used by {@link ContextImpl}. |
Makoto Onuki | 792de8d | 2019-07-16 16:19:01 -0700 | [diff] [blame] | 205 | * |
| 206 | * @hide |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 207 | */ |
Makoto Onuki | 792de8d | 2019-07-16 16:19:01 -0700 | [diff] [blame] | 208 | public final class SystemServiceRegistry { |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 209 | private static final String TAG = "SystemServiceRegistry"; |
| 210 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 211 | // Service registry information. |
| 212 | // This information is never changed once static initialization has completed. |
Robert Benea | 1901a5b | 2018-05-15 16:36:07 -0700 | [diff] [blame] | 213 | private static final Map<Class<?>, String> SYSTEM_SERVICE_NAMES = |
| 214 | new ArrayMap<Class<?>, String>(); |
| 215 | private static final Map<String, ServiceFetcher<?>> SYSTEM_SERVICE_FETCHERS = |
| 216 | new ArrayMap<String, ServiceFetcher<?>>(); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 217 | private static int sServiceCacheSize; |
| 218 | |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 219 | private static volatile boolean sInitializing; |
| 220 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 221 | // Not instantiable. |
| 222 | private SystemServiceRegistry() { } |
| 223 | |
| 224 | static { |
Felipe Leme | ecb08be | 2018-11-27 15:48:47 -0800 | [diff] [blame] | 225 | //CHECKSTYLE:OFF IndentationCheck |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 226 | registerService(Context.ACCESSIBILITY_SERVICE, AccessibilityManager.class, |
| 227 | new CachedServiceFetcher<AccessibilityManager>() { |
| 228 | @Override |
| 229 | public AccessibilityManager createService(ContextImpl ctx) { |
| 230 | return AccessibilityManager.getInstance(ctx); |
| 231 | }}); |
| 232 | |
| 233 | registerService(Context.CAPTIONING_SERVICE, CaptioningManager.class, |
| 234 | new CachedServiceFetcher<CaptioningManager>() { |
| 235 | @Override |
| 236 | public CaptioningManager createService(ContextImpl ctx) { |
| 237 | return new CaptioningManager(ctx); |
| 238 | }}); |
| 239 | |
| 240 | registerService(Context.ACCOUNT_SERVICE, AccountManager.class, |
| 241 | new CachedServiceFetcher<AccountManager>() { |
| 242 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 243 | public AccountManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 244 | IBinder b = ServiceManager.getServiceOrThrow(Context.ACCOUNT_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 245 | IAccountManager service = IAccountManager.Stub.asInterface(b); |
| 246 | return new AccountManager(ctx, service); |
| 247 | }}); |
| 248 | |
| 249 | registerService(Context.ACTIVITY_SERVICE, ActivityManager.class, |
| 250 | new CachedServiceFetcher<ActivityManager>() { |
| 251 | @Override |
| 252 | public ActivityManager createService(ContextImpl ctx) { |
| 253 | return new ActivityManager(ctx.getOuterContext(), ctx.mMainThread.getHandler()); |
| 254 | }}); |
| 255 | |
Wale Ogunwale | 65ebd95 | 2018-04-25 15:41:44 -0700 | [diff] [blame] | 256 | registerService(Context.ACTIVITY_TASK_SERVICE, ActivityTaskManager.class, |
| 257 | new CachedServiceFetcher<ActivityTaskManager>() { |
| 258 | @Override |
| 259 | public ActivityTaskManager createService(ContextImpl ctx) { |
| 260 | return new ActivityTaskManager( |
| 261 | ctx.getOuterContext(), ctx.mMainThread.getHandler()); |
| 262 | }}); |
| 263 | |
Wale Ogunwale | 6d50dcc | 2018-07-21 23:00:40 -0700 | [diff] [blame] | 264 | registerService(Context.URI_GRANTS_SERVICE, UriGrantsManager.class, |
| 265 | new CachedServiceFetcher<UriGrantsManager>() { |
| 266 | @Override |
| 267 | public UriGrantsManager createService(ContextImpl ctx) { |
| 268 | return new UriGrantsManager( |
| 269 | ctx.getOuterContext(), ctx.mMainThread.getHandler()); |
| 270 | }}); |
| 271 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 272 | registerService(Context.ALARM_SERVICE, AlarmManager.class, |
| 273 | new CachedServiceFetcher<AlarmManager>() { |
| 274 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 275 | public AlarmManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 276 | IBinder b = ServiceManager.getServiceOrThrow(Context.ALARM_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 277 | IAlarmManager service = IAlarmManager.Stub.asInterface(b); |
| 278 | return new AlarmManager(service, ctx); |
| 279 | }}); |
| 280 | |
| 281 | registerService(Context.AUDIO_SERVICE, AudioManager.class, |
| 282 | new CachedServiceFetcher<AudioManager>() { |
| 283 | @Override |
| 284 | public AudioManager createService(ContextImpl ctx) { |
| 285 | return new AudioManager(ctx); |
| 286 | }}); |
| 287 | |
| 288 | registerService(Context.MEDIA_ROUTER_SERVICE, MediaRouter.class, |
| 289 | new CachedServiceFetcher<MediaRouter>() { |
| 290 | @Override |
| 291 | public MediaRouter createService(ContextImpl ctx) { |
| 292 | return new MediaRouter(ctx); |
| 293 | }}); |
| 294 | |
| 295 | registerService(Context.BLUETOOTH_SERVICE, BluetoothManager.class, |
| 296 | new CachedServiceFetcher<BluetoothManager>() { |
| 297 | @Override |
| 298 | public BluetoothManager createService(ContextImpl ctx) { |
| 299 | return new BluetoothManager(ctx); |
| 300 | }}); |
| 301 | |
| 302 | registerService(Context.HDMI_CONTROL_SERVICE, HdmiControlManager.class, |
| 303 | new StaticServiceFetcher<HdmiControlManager>() { |
| 304 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 305 | public HdmiControlManager createService() throws ServiceNotFoundException { |
| 306 | IBinder b = ServiceManager.getServiceOrThrow(Context.HDMI_CONTROL_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 307 | return new HdmiControlManager(IHdmiControlService.Stub.asInterface(b)); |
| 308 | }}); |
| 309 | |
Abodunrinwa Toki | 8158af5 | 2016-11-23 20:41:09 +0000 | [diff] [blame] | 310 | registerService(Context.TEXT_CLASSIFICATION_SERVICE, TextClassificationManager.class, |
Abodunrinwa Toki | f001fef | 2017-01-04 23:51:42 +0000 | [diff] [blame] | 311 | new CachedServiceFetcher<TextClassificationManager>() { |
Abodunrinwa Toki | 8158af5 | 2016-11-23 20:41:09 +0000 | [diff] [blame] | 312 | @Override |
Abodunrinwa Toki | f001fef | 2017-01-04 23:51:42 +0000 | [diff] [blame] | 313 | public TextClassificationManager createService(ContextImpl ctx) { |
| 314 | return new TextClassificationManager(ctx); |
Abodunrinwa Toki | 8158af5 | 2016-11-23 20:41:09 +0000 | [diff] [blame] | 315 | }}); |
| 316 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 317 | registerService(Context.CLIPBOARD_SERVICE, ClipboardManager.class, |
| 318 | new CachedServiceFetcher<ClipboardManager>() { |
| 319 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 320 | public ClipboardManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 321 | return new ClipboardManager(ctx.getOuterContext(), |
| 322 | ctx.mMainThread.getHandler()); |
| 323 | }}); |
| 324 | |
| 325 | // The clipboard service moved to a new package. If someone asks for the old |
| 326 | // interface by class then we want to redirect over to the new interface instead |
| 327 | // (which extends it). |
| 328 | SYSTEM_SERVICE_NAMES.put(android.text.ClipboardManager.class, Context.CLIPBOARD_SERVICE); |
| 329 | |
| 330 | registerService(Context.CONNECTIVITY_SERVICE, ConnectivityManager.class, |
Lorenzo Colitti | cf95977 | 2016-02-29 16:07:37 +0900 | [diff] [blame] | 331 | new StaticApplicationContextServiceFetcher<ConnectivityManager>() { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 332 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 333 | public ConnectivityManager createService(Context context) throws ServiceNotFoundException { |
| 334 | IBinder b = ServiceManager.getServiceOrThrow(Context.CONNECTIVITY_SERVICE); |
Lorenzo Colitti | ffc42b0 | 2015-07-29 11:41:21 +0900 | [diff] [blame] | 335 | IConnectivityManager service = IConnectivityManager.Stub.asInterface(b); |
| 336 | return new ConnectivityManager(context, service); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 337 | }}); |
| 338 | |
Remi NGUYEN VAN | f9a8c2e | 2019-02-13 18:28:35 +0900 | [diff] [blame] | 339 | registerService(Context.NETD_SERVICE, IBinder.class, new StaticServiceFetcher<IBinder>() { |
Remi NGUYEN VAN | 3193598 | 2019-01-28 11:40:08 +0900 | [diff] [blame] | 340 | @Override |
Remi NGUYEN VAN | f9a8c2e | 2019-02-13 18:28:35 +0900 | [diff] [blame] | 341 | public IBinder createService() throws ServiceNotFoundException { |
| 342 | return ServiceManager.getServiceOrThrow(Context.NETD_SERVICE); |
Remi NGUYEN VAN | 3193598 | 2019-01-28 11:40:08 +0900 | [diff] [blame] | 343 | } |
| 344 | }); |
| 345 | |
Nathan Harold | 28084d8 | 2017-03-01 18:55:06 -0800 | [diff] [blame] | 346 | registerService(Context.IPSEC_SERVICE, IpSecManager.class, |
Nathan Harold | 592dadb | 2018-03-15 18:06:06 -0700 | [diff] [blame] | 347 | new CachedServiceFetcher<IpSecManager>() { |
Nathan Harold | 28084d8 | 2017-03-01 18:55:06 -0800 | [diff] [blame] | 348 | @Override |
Nathan Harold | 592dadb | 2018-03-15 18:06:06 -0700 | [diff] [blame] | 349 | public IpSecManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Nathan Harold | 28084d8 | 2017-03-01 18:55:06 -0800 | [diff] [blame] | 350 | IBinder b = ServiceManager.getService(Context.IPSEC_SERVICE); |
| 351 | IIpSecService service = IIpSecService.Stub.asInterface(b); |
Nathan Harold | 592dadb | 2018-03-15 18:06:06 -0700 | [diff] [blame] | 352 | return new IpSecManager(ctx, service); |
Nathan Harold | 28084d8 | 2017-03-01 18:55:06 -0800 | [diff] [blame] | 353 | }}); |
| 354 | |
Benedict Wong | 99a4841 | 2018-11-09 14:45:34 -0800 | [diff] [blame] | 355 | registerService( |
| 356 | Context.TEST_NETWORK_SERVICE, |
| 357 | TestNetworkManager.class, |
| 358 | new StaticApplicationContextServiceFetcher<TestNetworkManager>() { |
| 359 | @Override |
| 360 | public TestNetworkManager createService(Context context) |
| 361 | throws ServiceNotFoundException { |
| 362 | IBinder csBinder = |
| 363 | ServiceManager.getServiceOrThrow(Context.CONNECTIVITY_SERVICE); |
| 364 | IConnectivityManager csMgr = |
| 365 | IConnectivityManager.Stub.asInterface(csBinder); |
| 366 | |
| 367 | final IBinder tnBinder; |
| 368 | try { |
| 369 | tnBinder = csMgr.startOrGetTestNetworkService(); |
| 370 | } catch (RemoteException e) { |
| 371 | throw new ServiceNotFoundException(Context.TEST_NETWORK_SERVICE); |
| 372 | } |
| 373 | ITestNetworkManager tnMgr = ITestNetworkManager.Stub.asInterface(tnBinder); |
Benedict Wong | b4e98f3 | 2019-03-12 21:54:16 -0700 | [diff] [blame] | 374 | return new TestNetworkManager(tnMgr); |
Benedict Wong | 99a4841 | 2018-11-09 14:45:34 -0800 | [diff] [blame] | 375 | } |
| 376 | }); |
| 377 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 378 | registerService(Context.COUNTRY_DETECTOR, CountryDetector.class, |
| 379 | new StaticServiceFetcher<CountryDetector>() { |
| 380 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 381 | public CountryDetector createService() throws ServiceNotFoundException { |
| 382 | IBinder b = ServiceManager.getServiceOrThrow(Context.COUNTRY_DETECTOR); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 383 | return new CountryDetector(ICountryDetector.Stub.asInterface(b)); |
| 384 | }}); |
| 385 | |
| 386 | registerService(Context.DEVICE_POLICY_SERVICE, DevicePolicyManager.class, |
| 387 | new CachedServiceFetcher<DevicePolicyManager>() { |
| 388 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 389 | public DevicePolicyManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 390 | IBinder b = ServiceManager.getServiceOrThrow(Context.DEVICE_POLICY_SERVICE); |
| 391 | return new DevicePolicyManager(ctx, IDevicePolicyManager.Stub.asInterface(b)); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 392 | }}); |
| 393 | |
| 394 | registerService(Context.DOWNLOAD_SERVICE, DownloadManager.class, |
| 395 | new CachedServiceFetcher<DownloadManager>() { |
| 396 | @Override |
| 397 | public DownloadManager createService(ContextImpl ctx) { |
Jeff Sharkey | 60cfad8 | 2016-01-05 17:30:57 -0700 | [diff] [blame] | 398 | return new DownloadManager(ctx); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 399 | }}); |
| 400 | |
| 401 | registerService(Context.BATTERY_SERVICE, BatteryManager.class, |
Yifan Hong | b0f1352 | 2017-10-31 15:48:50 -0700 | [diff] [blame] | 402 | new CachedServiceFetcher<BatteryManager>() { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 403 | @Override |
Yifan Hong | b0f1352 | 2017-10-31 15:48:50 -0700 | [diff] [blame] | 404 | public BatteryManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 405 | IBatteryStats stats = IBatteryStats.Stub.asInterface( |
| 406 | ServiceManager.getServiceOrThrow(BatteryStats.SERVICE_NAME)); |
| 407 | IBatteryPropertiesRegistrar registrar = IBatteryPropertiesRegistrar.Stub |
| 408 | .asInterface(ServiceManager.getServiceOrThrow("batteryproperties")); |
Yifan Hong | b0f1352 | 2017-10-31 15:48:50 -0700 | [diff] [blame] | 409 | return new BatteryManager(ctx, stats, registrar); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 410 | }}); |
| 411 | |
| 412 | registerService(Context.NFC_SERVICE, NfcManager.class, |
| 413 | new CachedServiceFetcher<NfcManager>() { |
| 414 | @Override |
| 415 | public NfcManager createService(ContextImpl ctx) { |
| 416 | return new NfcManager(ctx); |
| 417 | }}); |
| 418 | |
| 419 | registerService(Context.DROPBOX_SERVICE, DropBoxManager.class, |
Jeff Sharkey | b8e8a91 | 2016-03-09 16:27:40 -0700 | [diff] [blame] | 420 | new CachedServiceFetcher<DropBoxManager>() { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 421 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 422 | public DropBoxManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 423 | IBinder b = ServiceManager.getServiceOrThrow(Context.DROPBOX_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 424 | IDropBoxManagerService service = IDropBoxManagerService.Stub.asInterface(b); |
Jeff Sharkey | b8e8a91 | 2016-03-09 16:27:40 -0700 | [diff] [blame] | 425 | return new DropBoxManager(ctx, service); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 426 | }}); |
| 427 | |
| 428 | registerService(Context.INPUT_SERVICE, InputManager.class, |
| 429 | new StaticServiceFetcher<InputManager>() { |
| 430 | @Override |
| 431 | public InputManager createService() { |
| 432 | return InputManager.getInstance(); |
| 433 | }}); |
| 434 | |
| 435 | registerService(Context.DISPLAY_SERVICE, DisplayManager.class, |
| 436 | new CachedServiceFetcher<DisplayManager>() { |
| 437 | @Override |
| 438 | public DisplayManager createService(ContextImpl ctx) { |
| 439 | return new DisplayManager(ctx.getOuterContext()); |
| 440 | }}); |
| 441 | |
Christine Franks | 39b0311 | 2018-07-03 14:46:07 -0700 | [diff] [blame] | 442 | registerService(Context.COLOR_DISPLAY_SERVICE, ColorDisplayManager.class, |
| 443 | new CachedServiceFetcher<ColorDisplayManager>() { |
| 444 | @Override |
| 445 | public ColorDisplayManager createService(ContextImpl ctx) { |
| 446 | return new ColorDisplayManager(); |
| 447 | } |
| 448 | }); |
| 449 | |
Yohei Yukawa | 4052a10f | 2018-10-15 15:35:55 +0800 | [diff] [blame] | 450 | // InputMethodManager has its own cache strategy based on display id to support apps that |
| 451 | // still assume InputMethodManager is a per-process singleton and it's safe to directly |
| 452 | // access internal fields via reflection. Hence directly use ServiceFetcher instead of |
| 453 | // StaticServiceFetcher/CachedServiceFetcher. |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 454 | registerService(Context.INPUT_METHOD_SERVICE, InputMethodManager.class, |
Yohei Yukawa | 4052a10f | 2018-10-15 15:35:55 +0800 | [diff] [blame] | 455 | new ServiceFetcher<InputMethodManager>() { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 456 | @Override |
Yohei Yukawa | 4052a10f | 2018-10-15 15:35:55 +0800 | [diff] [blame] | 457 | public InputMethodManager getService(ContextImpl ctx) { |
| 458 | return InputMethodManager.forContext(ctx.getOuterContext()); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 459 | }}); |
| 460 | |
| 461 | registerService(Context.TEXT_SERVICES_MANAGER_SERVICE, TextServicesManager.class, |
Yohei Yukawa | 9f141ee | 2019-01-18 09:17:16 -0800 | [diff] [blame] | 462 | new CachedServiceFetcher<TextServicesManager>() { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 463 | @Override |
Yohei Yukawa | 9f141ee | 2019-01-18 09:17:16 -0800 | [diff] [blame] | 464 | public TextServicesManager createService(ContextImpl ctx) |
| 465 | throws ServiceNotFoundException { |
| 466 | return TextServicesManager.createInstance(ctx); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 467 | }}); |
| 468 | |
| 469 | registerService(Context.KEYGUARD_SERVICE, KeyguardManager.class, |
Nancy Zheng | 43f166d | 2016-11-18 18:15:09 -0800 | [diff] [blame] | 470 | new CachedServiceFetcher<KeyguardManager>() { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 471 | @Override |
Nancy Zheng | 40cd8e4 | 2016-11-21 12:58:16 -0800 | [diff] [blame] | 472 | public KeyguardManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Nancy Zheng | 43f166d | 2016-11-18 18:15:09 -0800 | [diff] [blame] | 473 | return new KeyguardManager(ctx); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 474 | }}); |
| 475 | |
| 476 | registerService(Context.LAYOUT_INFLATER_SERVICE, LayoutInflater.class, |
| 477 | new CachedServiceFetcher<LayoutInflater>() { |
| 478 | @Override |
| 479 | public LayoutInflater createService(ContextImpl ctx) { |
| 480 | return new PhoneLayoutInflater(ctx.getOuterContext()); |
| 481 | }}); |
| 482 | |
| 483 | registerService(Context.LOCATION_SERVICE, LocationManager.class, |
| 484 | new CachedServiceFetcher<LocationManager>() { |
| 485 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 486 | public LocationManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 487 | IBinder b = ServiceManager.getServiceOrThrow(Context.LOCATION_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 488 | return new LocationManager(ctx, ILocationManager.Stub.asInterface(b)); |
| 489 | }}); |
| 490 | |
| 491 | registerService(Context.NETWORK_POLICY_SERVICE, NetworkPolicyManager.class, |
Svet Ganov | 16a1689 | 2015-04-16 10:32:04 -0700 | [diff] [blame] | 492 | new CachedServiceFetcher<NetworkPolicyManager>() { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 493 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 494 | public NetworkPolicyManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Svet Ganov | 16a1689 | 2015-04-16 10:32:04 -0700 | [diff] [blame] | 495 | return new NetworkPolicyManager(ctx, INetworkPolicyManager.Stub.asInterface( |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 496 | ServiceManager.getServiceOrThrow(Context.NETWORK_POLICY_SERVICE))); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 497 | }}); |
| 498 | |
| 499 | registerService(Context.NOTIFICATION_SERVICE, NotificationManager.class, |
| 500 | new CachedServiceFetcher<NotificationManager>() { |
| 501 | @Override |
| 502 | public NotificationManager createService(ContextImpl ctx) { |
| 503 | final Context outerContext = ctx.getOuterContext(); |
| 504 | return new NotificationManager( |
| 505 | new ContextThemeWrapper(outerContext, |
| 506 | Resources.selectSystemTheme(0, |
| 507 | outerContext.getApplicationInfo().targetSdkVersion, |
| 508 | com.android.internal.R.style.Theme_Dialog, |
| 509 | com.android.internal.R.style.Theme_Holo_Dialog, |
| 510 | com.android.internal.R.style.Theme_DeviceDefault_Dialog, |
| 511 | com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog)), |
| 512 | ctx.mMainThread.getHandler()); |
| 513 | }}); |
| 514 | |
| 515 | registerService(Context.NSD_SERVICE, NsdManager.class, |
| 516 | new CachedServiceFetcher<NsdManager>() { |
| 517 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 518 | public NsdManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 519 | IBinder b = ServiceManager.getServiceOrThrow(Context.NSD_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 520 | INsdManager service = INsdManager.Stub.asInterface(b); |
| 521 | return new NsdManager(ctx.getOuterContext(), service); |
| 522 | }}); |
| 523 | |
| 524 | registerService(Context.POWER_SERVICE, PowerManager.class, |
| 525 | new CachedServiceFetcher<PowerManager>() { |
| 526 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 527 | public PowerManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 528 | IBinder b = ServiceManager.getServiceOrThrow(Context.POWER_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 529 | IPowerManager service = IPowerManager.Stub.asInterface(b); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 530 | return new PowerManager(ctx.getOuterContext(), |
| 531 | service, ctx.mMainThread.getHandler()); |
| 532 | }}); |
| 533 | |
Tao Bao | e8a403d | 2015-12-31 07:44:55 -0800 | [diff] [blame] | 534 | registerService(Context.RECOVERY_SERVICE, RecoverySystem.class, |
| 535 | new CachedServiceFetcher<RecoverySystem>() { |
| 536 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 537 | public RecoverySystem createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 538 | IBinder b = ServiceManager.getServiceOrThrow(Context.RECOVERY_SERVICE); |
Tao Bao | e8a403d | 2015-12-31 07:44:55 -0800 | [diff] [blame] | 539 | IRecoverySystem service = IRecoverySystem.Stub.asInterface(b); |
Tao Bao | e8a403d | 2015-12-31 07:44:55 -0800 | [diff] [blame] | 540 | return new RecoverySystem(service); |
| 541 | }}); |
| 542 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 543 | registerService(Context.SEARCH_SERVICE, SearchManager.class, |
| 544 | new CachedServiceFetcher<SearchManager>() { |
| 545 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 546 | public SearchManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 547 | return new SearchManager(ctx.getOuterContext(), |
| 548 | ctx.mMainThread.getHandler()); |
| 549 | }}); |
| 550 | |
| 551 | registerService(Context.SENSOR_SERVICE, SensorManager.class, |
| 552 | new CachedServiceFetcher<SensorManager>() { |
| 553 | @Override |
| 554 | public SensorManager createService(ContextImpl ctx) { |
| 555 | return new SystemSensorManager(ctx.getOuterContext(), |
| 556 | ctx.mMainThread.getHandler().getLooper()); |
| 557 | }}); |
| 558 | |
Chad Brubaker | 90f391f | 2018-10-19 10:26:19 -0700 | [diff] [blame] | 559 | registerService(Context.SENSOR_PRIVACY_SERVICE, SensorPrivacyManager.class, |
| 560 | new CachedServiceFetcher<SensorPrivacyManager>() { |
| 561 | @Override |
| 562 | public SensorPrivacyManager createService(ContextImpl ctx) { |
| 563 | return SensorPrivacyManager.getInstance(ctx); |
| 564 | }}); |
| 565 | |
David Chen | adaf8b3 | 2017-11-03 15:42:08 -0700 | [diff] [blame] | 566 | registerService(Context.STATS_MANAGER, StatsManager.class, |
Jeff Sharkey | 6b64925 | 2018-04-16 09:50:22 -0600 | [diff] [blame] | 567 | new CachedServiceFetcher<StatsManager>() { |
| 568 | @Override |
| 569 | public StatsManager createService(ContextImpl ctx) { |
| 570 | return new StatsManager(ctx.getOuterContext()); |
| 571 | }}); |
David Chen | adaf8b3 | 2017-11-03 15:42:08 -0700 | [diff] [blame] | 572 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 573 | registerService(Context.STATUS_BAR_SERVICE, StatusBarManager.class, |
| 574 | new CachedServiceFetcher<StatusBarManager>() { |
| 575 | @Override |
| 576 | public StatusBarManager createService(ContextImpl ctx) { |
| 577 | return new StatusBarManager(ctx.getOuterContext()); |
| 578 | }}); |
| 579 | |
| 580 | registerService(Context.STORAGE_SERVICE, StorageManager.class, |
| 581 | new CachedServiceFetcher<StorageManager>() { |
| 582 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 583 | public StorageManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Jeff Sharkey | 4887789 | 2015-03-18 11:27:19 -0700 | [diff] [blame] | 584 | return new StorageManager(ctx, ctx.mMainThread.getHandler().getLooper()); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 585 | }}); |
| 586 | |
Jeff Sharkey | e8cece9 | 2017-01-04 11:33:33 -0700 | [diff] [blame] | 587 | registerService(Context.STORAGE_STATS_SERVICE, StorageStatsManager.class, |
| 588 | new CachedServiceFetcher<StorageStatsManager>() { |
| 589 | @Override |
| 590 | public StorageStatsManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 591 | IStorageStatsManager service = IStorageStatsManager.Stub.asInterface( |
| 592 | ServiceManager.getServiceOrThrow(Context.STORAGE_STATS_SERVICE)); |
| 593 | return new StorageStatsManager(ctx, service); |
| 594 | }}); |
| 595 | |
Tao Bao | 07342dc | 2017-01-24 15:08:21 -0800 | [diff] [blame] | 596 | registerService(Context.SYSTEM_UPDATE_SERVICE, SystemUpdateManager.class, |
| 597 | new CachedServiceFetcher<SystemUpdateManager>() { |
| 598 | @Override |
| 599 | public SystemUpdateManager createService(ContextImpl ctx) |
| 600 | throws ServiceNotFoundException { |
| 601 | IBinder b = ServiceManager.getServiceOrThrow( |
| 602 | Context.SYSTEM_UPDATE_SERVICE); |
| 603 | ISystemUpdateManager service = ISystemUpdateManager.Stub.asInterface(b); |
| 604 | return new SystemUpdateManager(service); |
| 605 | }}); |
| 606 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 607 | registerService(Context.TELEPHONY_SERVICE, TelephonyManager.class, |
| 608 | new CachedServiceFetcher<TelephonyManager>() { |
| 609 | @Override |
| 610 | public TelephonyManager createService(ContextImpl ctx) { |
| 611 | return new TelephonyManager(ctx.getOuterContext()); |
| 612 | }}); |
| 613 | |
Chen Xu | 288b71c | 2019-09-15 18:28:21 -0700 | [diff] [blame] | 614 | registerService(Context.TELEPHONY_REGISTRY_SERVICE, TelephonyRegistryManager.class, |
| 615 | new CachedServiceFetcher<TelephonyRegistryManager>() { |
| 616 | @Override |
| 617 | public TelephonyRegistryManager createService(ContextImpl ctx) { |
Chen Xu | 1f6cfa5 | 2019-10-13 17:30:32 -0700 | [diff] [blame] | 618 | return new TelephonyRegistryManager(ctx); |
Chen Xu | 288b71c | 2019-09-15 18:28:21 -0700 | [diff] [blame] | 619 | }}); |
| 620 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 621 | registerService(Context.TELEPHONY_SUBSCRIPTION_SERVICE, SubscriptionManager.class, |
| 622 | new CachedServiceFetcher<SubscriptionManager>() { |
| 623 | @Override |
Jeff Sharkey | 717f52f | 2018-01-04 16:04:11 -0700 | [diff] [blame] | 624 | public SubscriptionManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 625 | return new SubscriptionManager(ctx.getOuterContext()); |
| 626 | }}); |
| 627 | |
Jonathan Basseri | 9a1c9b6 | 2015-02-25 13:01:52 -0800 | [diff] [blame] | 628 | registerService(Context.CARRIER_CONFIG_SERVICE, CarrierConfigManager.class, |
| 629 | new CachedServiceFetcher<CarrierConfigManager>() { |
| 630 | @Override |
| 631 | public CarrierConfigManager createService(ContextImpl ctx) { |
Malcolm Chen | d1272d1 | 2018-02-28 15:20:45 -0800 | [diff] [blame] | 632 | return new CarrierConfigManager(ctx.getOuterContext()); |
Jonathan Basseri | 9a1c9b6 | 2015-02-25 13:01:52 -0800 | [diff] [blame] | 633 | }}); |
| 634 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 635 | registerService(Context.TELECOM_SERVICE, TelecomManager.class, |
| 636 | new CachedServiceFetcher<TelecomManager>() { |
| 637 | @Override |
| 638 | public TelecomManager createService(ContextImpl ctx) { |
| 639 | return new TelecomManager(ctx.getOuterContext()); |
| 640 | }}); |
| 641 | |
Jeff Davidson | 35cda39 | 2017-02-27 09:46:00 -0800 | [diff] [blame] | 642 | registerService(Context.EUICC_SERVICE, EuiccManager.class, |
| 643 | new CachedServiceFetcher<EuiccManager>() { |
| 644 | @Override |
| 645 | public EuiccManager createService(ContextImpl ctx) { |
| 646 | return new EuiccManager(ctx.getOuterContext()); |
| 647 | }}); |
| 648 | |
Holly Jiuyu Sun | 5c11024 | 2017-12-21 18:44:59 -0800 | [diff] [blame] | 649 | registerService(Context.EUICC_CARD_SERVICE, EuiccCardManager.class, |
| 650 | new CachedServiceFetcher<EuiccCardManager>() { |
| 651 | @Override |
| 652 | public EuiccCardManager createService(ContextImpl ctx) { |
| 653 | return new EuiccCardManager(ctx.getOuterContext()); |
| 654 | }}); |
| 655 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 656 | registerService(Context.UI_MODE_SERVICE, UiModeManager.class, |
| 657 | new CachedServiceFetcher<UiModeManager>() { |
| 658 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 659 | public UiModeManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Tyler Gunn | daef668 | 2019-09-30 15:12:24 -0700 | [diff] [blame] | 660 | return new UiModeManager(ctx.getOuterContext()); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 661 | }}); |
| 662 | |
| 663 | registerService(Context.USB_SERVICE, UsbManager.class, |
| 664 | new CachedServiceFetcher<UsbManager>() { |
| 665 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 666 | public UsbManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 667 | IBinder b = ServiceManager.getServiceOrThrow(Context.USB_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 668 | return new UsbManager(ctx, IUsbManager.Stub.asInterface(b)); |
| 669 | }}); |
| 670 | |
Kenny Root | f74bfde | 2018-01-18 15:42:48 -0800 | [diff] [blame] | 671 | registerService(Context.ADB_SERVICE, AdbManager.class, |
| 672 | new CachedServiceFetcher<AdbManager>() { |
| 673 | @Override |
| 674 | public AdbManager createService(ContextImpl ctx) |
| 675 | throws ServiceNotFoundException { |
| 676 | IBinder b = ServiceManager.getServiceOrThrow(Context.ADB_SERVICE); |
| 677 | return new AdbManager(ctx, IAdbManager.Stub.asInterface(b)); |
| 678 | }}); |
| 679 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 680 | registerService(Context.SERIAL_SERVICE, SerialManager.class, |
| 681 | new CachedServiceFetcher<SerialManager>() { |
| 682 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 683 | public SerialManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 684 | IBinder b = ServiceManager.getServiceOrThrow(Context.SERIAL_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 685 | return new SerialManager(ctx, ISerialManager.Stub.asInterface(b)); |
| 686 | }}); |
| 687 | |
| 688 | registerService(Context.VIBRATOR_SERVICE, Vibrator.class, |
| 689 | new CachedServiceFetcher<Vibrator>() { |
| 690 | @Override |
| 691 | public Vibrator createService(ContextImpl ctx) { |
| 692 | return new SystemVibrator(ctx); |
| 693 | }}); |
| 694 | |
| 695 | registerService(Context.WALLPAPER_SERVICE, WallpaperManager.class, |
| 696 | new CachedServiceFetcher<WallpaperManager>() { |
| 697 | @Override |
Svet Ganov | 8f90bcc | 2017-12-22 23:29:24 -0800 | [diff] [blame] | 698 | public WallpaperManager createService(ContextImpl ctx) |
| 699 | throws ServiceNotFoundException { |
Felipe Leme | 34a861a | 2019-08-05 16:00:12 -0700 | [diff] [blame] | 700 | final IBinder b = ServiceManager.getService(Context.WALLPAPER_SERVICE); |
| 701 | if (b == null) { |
| 702 | // There are 2 reason service can be null: |
| 703 | // 1.Device doesn't support it - that's fine |
| 704 | // 2.App is running on instant mode - should fail |
| 705 | final boolean enabled = Resources.getSystem() |
| 706 | .getBoolean(com.android.internal.R.bool.config_enableWallpaperService); |
| 707 | if (!enabled) { |
| 708 | // Life moves on... |
| 709 | return DisabledWallpaperManager.getInstance(); |
| 710 | } |
| 711 | if (ctx.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P) { |
| 712 | // Instant app |
| 713 | throw new ServiceNotFoundException(Context.WALLPAPER_SERVICE); |
| 714 | } |
| 715 | // Bad state - WallpaperManager methods will throw exception |
Svet Ganov | 8f90bcc | 2017-12-22 23:29:24 -0800 | [diff] [blame] | 716 | } |
| 717 | IWallpaperManager service = IWallpaperManager.Stub.asInterface(b); |
| 718 | return new WallpaperManager(service, ctx.getOuterContext(), |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 719 | ctx.mMainThread.getHandler()); |
| 720 | }}); |
| 721 | |
Robert Quattlebaum | 87a7104 | 2017-05-15 15:45:20 -0700 | [diff] [blame] | 722 | registerService(Context.LOWPAN_SERVICE, LowpanManager.class, |
| 723 | new CachedServiceFetcher<LowpanManager>() { |
| 724 | @Override |
| 725 | public LowpanManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 726 | IBinder b = ServiceManager.getServiceOrThrow(Context.LOWPAN_SERVICE); |
| 727 | ILowpanManager service = ILowpanManager.Stub.asInterface(b); |
| 728 | return new LowpanManager(ctx.getOuterContext(), service, |
| 729 | ConnectivityThread.getInstanceLooper()); |
| 730 | }}); |
| 731 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 732 | registerService(Context.WIFI_SERVICE, WifiManager.class, |
| 733 | new CachedServiceFetcher<WifiManager>() { |
| 734 | @Override |
Roshan Pius | 2161b39 | 2019-07-12 11:06:16 -0700 | [diff] [blame] | 735 | public WifiManager createService(ContextImpl ctx) { |
| 736 | return new WifiManager(ctx.getOuterContext(), |
Paul Stewart | bf8cbb05 | 2016-03-17 10:11:54 -0700 | [diff] [blame] | 737 | ConnectivityThread.getInstanceLooper()); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 738 | }}); |
| 739 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 740 | registerService(Context.WIFI_P2P_SERVICE, WifiP2pManager.class, |
| 741 | new StaticServiceFetcher<WifiP2pManager>() { |
| 742 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 743 | public WifiP2pManager createService() throws ServiceNotFoundException { |
| 744 | IBinder b = ServiceManager.getServiceOrThrow(Context.WIFI_P2P_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 745 | IWifiP2pManager service = IWifiP2pManager.Stub.asInterface(b); |
| 746 | return new WifiP2pManager(service); |
| 747 | }}); |
| 748 | |
Etan Cohen | 0413327 | 2016-10-26 11:22:06 -0700 | [diff] [blame] | 749 | registerService(Context.WIFI_AWARE_SERVICE, WifiAwareManager.class, |
| 750 | new CachedServiceFetcher<WifiAwareManager>() { |
Etan Cohen | 20d329b | 2015-09-29 13:49:02 -0700 | [diff] [blame] | 751 | @Override |
Etan Cohen | 0413327 | 2016-10-26 11:22:06 -0700 | [diff] [blame] | 752 | public WifiAwareManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Jeff Sharkey | 589f309 | 2016-11-29 12:54:39 -0700 | [diff] [blame] | 753 | IBinder b = ServiceManager.getServiceOrThrow(Context.WIFI_AWARE_SERVICE); |
Etan Cohen | 0413327 | 2016-10-26 11:22:06 -0700 | [diff] [blame] | 754 | IWifiAwareManager service = IWifiAwareManager.Stub.asInterface(b); |
Etan Cohen | 20d329b | 2015-09-29 13:49:02 -0700 | [diff] [blame] | 755 | if (service == null) { |
| 756 | return null; |
| 757 | } |
Etan Cohen | 0413327 | 2016-10-26 11:22:06 -0700 | [diff] [blame] | 758 | return new WifiAwareManager(ctx.getOuterContext(), service); |
Etan Cohen | 20d329b | 2015-09-29 13:49:02 -0700 | [diff] [blame] | 759 | }}); |
| 760 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 761 | registerService(Context.WIFI_SCANNING_SERVICE, WifiScanner.class, |
| 762 | new CachedServiceFetcher<WifiScanner>() { |
| 763 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 764 | public WifiScanner createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 765 | IBinder b = ServiceManager.getServiceOrThrow(Context.WIFI_SCANNING_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 766 | IWifiScanner service = IWifiScanner.Stub.asInterface(b); |
Mitchell Wills | 91312c7 | 2016-04-06 17:03:35 -0700 | [diff] [blame] | 767 | return new WifiScanner(ctx.getOuterContext(), service, |
| 768 | ConnectivityThread.getInstanceLooper()); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 769 | }}); |
| 770 | |
| 771 | registerService(Context.WIFI_RTT_SERVICE, RttManager.class, |
| 772 | new CachedServiceFetcher<RttManager>() { |
Etan Cohen | 9accbba | 2018-01-30 16:41:00 -0800 | [diff] [blame] | 773 | @Override |
| 774 | public RttManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 775 | IBinder b = ServiceManager.getServiceOrThrow(Context.WIFI_RTT_RANGING_SERVICE); |
| 776 | IWifiRttManager service = IWifiRttManager.Stub.asInterface(b); |
| 777 | return new RttManager(ctx.getOuterContext(), |
| 778 | new WifiRttManager(ctx.getOuterContext(), service)); |
| 779 | }}); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 780 | |
Etan Cohen | 46efb48 | 2017-12-07 13:50:57 -0800 | [diff] [blame] | 781 | registerService(Context.WIFI_RTT_RANGING_SERVICE, WifiRttManager.class, |
Etan Cohen | 17ba472 | 2017-08-21 10:52:17 -0700 | [diff] [blame] | 782 | new CachedServiceFetcher<WifiRttManager>() { |
| 783 | @Override |
| 784 | public WifiRttManager createService(ContextImpl ctx) |
| 785 | throws ServiceNotFoundException { |
Etan Cohen | 46efb48 | 2017-12-07 13:50:57 -0800 | [diff] [blame] | 786 | IBinder b = ServiceManager.getServiceOrThrow( |
| 787 | Context.WIFI_RTT_RANGING_SERVICE); |
Etan Cohen | 17ba472 | 2017-08-21 10:52:17 -0700 | [diff] [blame] | 788 | IWifiRttManager service = IWifiRttManager.Stub.asInterface(b); |
| 789 | return new WifiRttManager(ctx.getOuterContext(), service); |
| 790 | }}); |
| 791 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 792 | registerService(Context.ETHERNET_SERVICE, EthernetManager.class, |
| 793 | new CachedServiceFetcher<EthernetManager>() { |
| 794 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 795 | public EthernetManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 796 | IBinder b = ServiceManager.getServiceOrThrow(Context.ETHERNET_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 797 | IEthernetManager service = IEthernetManager.Stub.asInterface(b); |
| 798 | return new EthernetManager(ctx.getOuterContext(), service); |
| 799 | }}); |
| 800 | |
| 801 | registerService(Context.WINDOW_SERVICE, WindowManager.class, |
| 802 | new CachedServiceFetcher<WindowManager>() { |
| 803 | @Override |
| 804 | public WindowManager createService(ContextImpl ctx) { |
Adam Lesinski | 4ece3d6 | 2016-06-16 18:05:41 -0700 | [diff] [blame] | 805 | return new WindowManagerImpl(ctx); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 806 | }}); |
| 807 | |
| 808 | registerService(Context.USER_SERVICE, UserManager.class, |
| 809 | new CachedServiceFetcher<UserManager>() { |
| 810 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 811 | public UserManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 812 | IBinder b = ServiceManager.getServiceOrThrow(Context.USER_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 813 | IUserManager service = IUserManager.Stub.asInterface(b); |
| 814 | return new UserManager(ctx, service); |
| 815 | }}); |
| 816 | |
| 817 | registerService(Context.APP_OPS_SERVICE, AppOpsManager.class, |
| 818 | new CachedServiceFetcher<AppOpsManager>() { |
| 819 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 820 | public AppOpsManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 821 | IBinder b = ServiceManager.getServiceOrThrow(Context.APP_OPS_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 822 | IAppOpsService service = IAppOpsService.Stub.asInterface(b); |
| 823 | return new AppOpsManager(ctx, service); |
| 824 | }}); |
| 825 | |
| 826 | registerService(Context.CAMERA_SERVICE, CameraManager.class, |
| 827 | new CachedServiceFetcher<CameraManager>() { |
| 828 | @Override |
| 829 | public CameraManager createService(ContextImpl ctx) { |
| 830 | return new CameraManager(ctx); |
| 831 | }}); |
| 832 | |
| 833 | registerService(Context.LAUNCHER_APPS_SERVICE, LauncherApps.class, |
| 834 | new CachedServiceFetcher<LauncherApps>() { |
| 835 | @Override |
| 836 | public LauncherApps createService(ContextImpl ctx) { |
Makoto Onuki | 5ba0d3e | 2016-04-11 14:03:46 -0700 | [diff] [blame] | 837 | return new LauncherApps(ctx); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 838 | }}); |
| 839 | |
| 840 | registerService(Context.RESTRICTIONS_SERVICE, RestrictionsManager.class, |
| 841 | new CachedServiceFetcher<RestrictionsManager>() { |
| 842 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 843 | public RestrictionsManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 844 | IBinder b = ServiceManager.getServiceOrThrow(Context.RESTRICTIONS_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 845 | IRestrictionsManager service = IRestrictionsManager.Stub.asInterface(b); |
| 846 | return new RestrictionsManager(ctx, service); |
| 847 | }}); |
| 848 | |
| 849 | registerService(Context.PRINT_SERVICE, PrintManager.class, |
| 850 | new CachedServiceFetcher<PrintManager>() { |
| 851 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 852 | public PrintManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Svet Ganov | ec7daa5 | 2017-06-30 12:02:59 -0700 | [diff] [blame] | 853 | IPrintManager service = null; |
| 854 | // If the feature not present, don't try to look up every time |
| 855 | if (ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_PRINTING)) { |
| 856 | service = IPrintManager.Stub.asInterface(ServiceManager |
| 857 | .getServiceOrThrow(Context.PRINT_SERVICE)); |
| 858 | } |
Jeff Sharkey | ad357d1 | 2018-02-02 13:25:31 -0700 | [diff] [blame] | 859 | final int userId = ctx.getUserId(); |
| 860 | final int appId = UserHandle.getAppId(ctx.getApplicationInfo().uid); |
| 861 | return new PrintManager(ctx.getOuterContext(), service, userId, appId); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 862 | }}); |
| 863 | |
Eugene Susla | 6ed45d8 | 2017-01-22 13:52:51 -0800 | [diff] [blame] | 864 | registerService(Context.COMPANION_DEVICE_SERVICE, CompanionDeviceManager.class, |
| 865 | new CachedServiceFetcher<CompanionDeviceManager>() { |
Svet Ganov | ec7daa5 | 2017-06-30 12:02:59 -0700 | [diff] [blame] | 866 | @Override |
| 867 | public CompanionDeviceManager createService(ContextImpl ctx) |
| 868 | throws ServiceNotFoundException { |
| 869 | ICompanionDeviceManager service = null; |
| 870 | // If the feature not present, don't try to look up every time |
| 871 | if (ctx.getPackageManager().hasSystemFeature( |
| 872 | PackageManager.FEATURE_COMPANION_DEVICE_SETUP)) { |
| 873 | service = ICompanionDeviceManager.Stub.asInterface( |
| 874 | ServiceManager.getServiceOrThrow(Context.COMPANION_DEVICE_SERVICE)); |
| 875 | } |
| 876 | return new CompanionDeviceManager(service, ctx.getOuterContext()); |
| 877 | }}); |
Eugene Susla | 6ed45d8 | 2017-01-22 13:52:51 -0800 | [diff] [blame] | 878 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 879 | registerService(Context.CONSUMER_IR_SERVICE, ConsumerIrManager.class, |
| 880 | new CachedServiceFetcher<ConsumerIrManager>() { |
| 881 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 882 | public ConsumerIrManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 883 | return new ConsumerIrManager(ctx); |
| 884 | }}); |
| 885 | |
| 886 | registerService(Context.MEDIA_SESSION_SERVICE, MediaSessionManager.class, |
| 887 | new CachedServiceFetcher<MediaSessionManager>() { |
| 888 | @Override |
| 889 | public MediaSessionManager createService(ContextImpl ctx) { |
| 890 | return new MediaSessionManager(ctx); |
| 891 | }}); |
| 892 | |
| 893 | registerService(Context.TRUST_SERVICE, TrustManager.class, |
| 894 | new StaticServiceFetcher<TrustManager>() { |
| 895 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 896 | public TrustManager createService() throws ServiceNotFoundException { |
| 897 | IBinder b = ServiceManager.getServiceOrThrow(Context.TRUST_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 898 | return new TrustManager(b); |
| 899 | }}); |
| 900 | |
| 901 | registerService(Context.FINGERPRINT_SERVICE, FingerprintManager.class, |
| 902 | new CachedServiceFetcher<FingerprintManager>() { |
| 903 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 904 | public FingerprintManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Jeff Sharkey | 351c2c2 | 2017-03-18 16:48:02 -0600 | [diff] [blame] | 905 | final IBinder binder; |
| 906 | if (ctx.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.O) { |
| 907 | binder = ServiceManager.getServiceOrThrow(Context.FINGERPRINT_SERVICE); |
| 908 | } else { |
| 909 | binder = ServiceManager.getService(Context.FINGERPRINT_SERVICE); |
| 910 | } |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 911 | IFingerprintService service = IFingerprintService.Stub.asInterface(binder); |
| 912 | return new FingerprintManager(ctx.getOuterContext(), service); |
| 913 | }}); |
| 914 | |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 915 | registerService(Context.FACE_SERVICE, FaceManager.class, |
| 916 | new CachedServiceFetcher<FaceManager>() { |
| 917 | @Override |
| 918 | public FaceManager createService(ContextImpl ctx) |
| 919 | throws ServiceNotFoundException { |
| 920 | final IBinder binder; |
| 921 | if (ctx.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.O) { |
| 922 | binder = ServiceManager.getServiceOrThrow(Context.FACE_SERVICE); |
| 923 | } else { |
| 924 | binder = ServiceManager.getService(Context.FACE_SERVICE); |
| 925 | } |
| 926 | IFaceService service = IFaceService.Stub.asInterface(binder); |
| 927 | return new FaceManager(ctx.getOuterContext(), service); |
| 928 | } |
| 929 | }); |
| 930 | |
Kevin Chyn | 51676d2 | 2018-11-05 18:00:43 -0800 | [diff] [blame] | 931 | registerService(Context.IRIS_SERVICE, IrisManager.class, |
| 932 | new CachedServiceFetcher<IrisManager>() { |
| 933 | @Override |
| 934 | public IrisManager createService(ContextImpl ctx) |
| 935 | throws ServiceNotFoundException { |
| 936 | final IBinder binder = |
| 937 | ServiceManager.getServiceOrThrow(Context.IRIS_SERVICE); |
| 938 | IIrisService service = IIrisService.Stub.asInterface(binder); |
| 939 | return new IrisManager(ctx.getOuterContext(), service); |
| 940 | } |
| 941 | }); |
| 942 | |
Kevin Chyn | 05c2150 | 2018-09-18 13:07:19 -0700 | [diff] [blame] | 943 | registerService(Context.BIOMETRIC_SERVICE, BiometricManager.class, |
| 944 | new CachedServiceFetcher<BiometricManager>() { |
| 945 | @Override |
| 946 | public BiometricManager createService(ContextImpl ctx) |
| 947 | throws ServiceNotFoundException { |
Kevin Chyn | e739daf | 2018-11-06 17:11:06 -0800 | [diff] [blame] | 948 | if (BiometricManager.hasBiometrics(ctx)) { |
| 949 | final IBinder binder = |
Ilya Matyukhin | e4675b3 | 2019-11-07 16:07:19 -0800 | [diff] [blame] | 950 | ServiceManager.getServiceOrThrow(Context.AUTH_SERVICE); |
| 951 | final IAuthService service = |
| 952 | IAuthService.Stub.asInterface(binder); |
Kevin Chyn | e739daf | 2018-11-06 17:11:06 -0800 | [diff] [blame] | 953 | return new BiometricManager(ctx.getOuterContext(), service); |
| 954 | } else { |
| 955 | // Allow access to the manager when service is null. This saves memory |
| 956 | // on devices without biometric hardware. |
| 957 | return new BiometricManager(ctx.getOuterContext(), null); |
| 958 | } |
Kevin Chyn | 05c2150 | 2018-09-18 13:07:19 -0700 | [diff] [blame] | 959 | } |
| 960 | }); |
| 961 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 962 | registerService(Context.TV_INPUT_SERVICE, TvInputManager.class, |
Jeff Sharkey | ad357d1 | 2018-02-02 13:25:31 -0700 | [diff] [blame] | 963 | new CachedServiceFetcher<TvInputManager>() { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 964 | @Override |
Jeff Sharkey | ad357d1 | 2018-02-02 13:25:31 -0700 | [diff] [blame] | 965 | public TvInputManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 966 | IBinder iBinder = ServiceManager.getServiceOrThrow(Context.TV_INPUT_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 967 | ITvInputManager service = ITvInputManager.Stub.asInterface(iBinder); |
Jeff Sharkey | ad357d1 | 2018-02-02 13:25:31 -0700 | [diff] [blame] | 968 | return new TvInputManager(service, ctx.getUserId()); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 969 | }}); |
| 970 | |
| 971 | registerService(Context.NETWORK_SCORE_SERVICE, NetworkScoreManager.class, |
| 972 | new CachedServiceFetcher<NetworkScoreManager>() { |
| 973 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 974 | public NetworkScoreManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 975 | return new NetworkScoreManager(ctx); |
| 976 | }}); |
| 977 | |
| 978 | registerService(Context.USAGE_STATS_SERVICE, UsageStatsManager.class, |
| 979 | new CachedServiceFetcher<UsageStatsManager>() { |
| 980 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 981 | public UsageStatsManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 982 | IBinder iBinder = ServiceManager.getServiceOrThrow(Context.USAGE_STATS_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 983 | IUsageStatsManager service = IUsageStatsManager.Stub.asInterface(iBinder); |
| 984 | return new UsageStatsManager(ctx.getOuterContext(), service); |
| 985 | }}); |
| 986 | |
Zoltan Szatmary-Ban | 9c5dfa5 | 2015-02-23 17:20:20 +0000 | [diff] [blame] | 987 | registerService(Context.NETWORK_STATS_SERVICE, NetworkStatsManager.class, |
| 988 | new CachedServiceFetcher<NetworkStatsManager>() { |
| 989 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 990 | public NetworkStatsManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Zoltan Szatmary-Ban | 9c5dfa5 | 2015-02-23 17:20:20 +0000 | [diff] [blame] | 991 | return new NetworkStatsManager(ctx.getOuterContext()); |
| 992 | }}); |
| 993 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 994 | registerService(Context.PERSISTENT_DATA_BLOCK_SERVICE, PersistentDataBlockManager.class, |
| 995 | new StaticServiceFetcher<PersistentDataBlockManager>() { |
| 996 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 997 | public PersistentDataBlockManager createService() throws ServiceNotFoundException { |
| 998 | IBinder b = ServiceManager.getServiceOrThrow(Context.PERSISTENT_DATA_BLOCK_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 999 | IPersistentDataBlockService persistentDataBlockService = |
| 1000 | IPersistentDataBlockService.Stub.asInterface(b); |
| 1001 | if (persistentDataBlockService != null) { |
| 1002 | return new PersistentDataBlockManager(persistentDataBlockService); |
| 1003 | } else { |
| 1004 | // not supported |
| 1005 | return null; |
| 1006 | } |
| 1007 | }}); |
| 1008 | |
Andrew Scull | 3b8b46f | 2017-02-13 18:12:15 +0000 | [diff] [blame] | 1009 | registerService(Context.OEM_LOCK_SERVICE, OemLockManager.class, |
| 1010 | new StaticServiceFetcher<OemLockManager>() { |
| 1011 | @Override |
| 1012 | public OemLockManager createService() throws ServiceNotFoundException { |
| 1013 | IBinder b = ServiceManager.getServiceOrThrow(Context.OEM_LOCK_SERVICE); |
| 1014 | IOemLockService oemLockService = IOemLockService.Stub.asInterface(b); |
| 1015 | if (oemLockService != null) { |
| 1016 | return new OemLockManager(oemLockService); |
| 1017 | } else { |
| 1018 | // not supported |
| 1019 | return null; |
| 1020 | } |
| 1021 | }}); |
| 1022 | |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1023 | registerService(Context.MEDIA_PROJECTION_SERVICE, MediaProjectionManager.class, |
| 1024 | new CachedServiceFetcher<MediaProjectionManager>() { |
| 1025 | @Override |
| 1026 | public MediaProjectionManager createService(ContextImpl ctx) { |
| 1027 | return new MediaProjectionManager(ctx); |
| 1028 | }}); |
| 1029 | |
| 1030 | registerService(Context.APPWIDGET_SERVICE, AppWidgetManager.class, |
| 1031 | new CachedServiceFetcher<AppWidgetManager>() { |
| 1032 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1033 | public AppWidgetManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 1034 | IBinder b = ServiceManager.getServiceOrThrow(Context.APPWIDGET_SERVICE); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1035 | return new AppWidgetManager(ctx, IAppWidgetService.Stub.asInterface(b)); |
| 1036 | }}); |
| 1037 | |
| 1038 | registerService(Context.MIDI_SERVICE, MidiManager.class, |
| 1039 | new CachedServiceFetcher<MidiManager>() { |
| 1040 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1041 | public MidiManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 1042 | IBinder b = ServiceManager.getServiceOrThrow(Context.MIDI_SERVICE); |
Mike Lockwood | e0a6ca6 | 2015-06-04 13:43:56 -0700 | [diff] [blame] | 1043 | return new MidiManager(IMidiManager.Stub.asInterface(b)); |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1044 | }}); |
Eric Laurent | 2035ac8 | 2015-03-05 15:18:44 -0800 | [diff] [blame] | 1045 | |
| 1046 | registerService(Context.RADIO_SERVICE, RadioManager.class, |
| 1047 | new CachedServiceFetcher<RadioManager>() { |
| 1048 | @Override |
Tomasz Wasilczyk | 347192e | 2017-04-04 11:13:44 -0700 | [diff] [blame] | 1049 | public RadioManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Eric Laurent | 2035ac8 | 2015-03-05 15:18:44 -0800 | [diff] [blame] | 1050 | return new RadioManager(ctx); |
| 1051 | }}); |
Arunesh Mishra | a772e5f | 2016-01-25 10:33:11 -0800 | [diff] [blame] | 1052 | |
Polina Bondarenko | 965ecbb | 2015-11-13 15:34:28 +0100 | [diff] [blame] | 1053 | registerService(Context.HARDWARE_PROPERTIES_SERVICE, HardwarePropertiesManager.class, |
| 1054 | new CachedServiceFetcher<HardwarePropertiesManager>() { |
| 1055 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1056 | public HardwarePropertiesManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 1057 | IBinder b = ServiceManager.getServiceOrThrow(Context.HARDWARE_PROPERTIES_SERVICE); |
| 1058 | IHardwarePropertiesManager service = |
| 1059 | IHardwarePropertiesManager.Stub.asInterface(b); |
| 1060 | return new HardwarePropertiesManager(ctx, service); |
Polina Bondarenko | 965ecbb | 2015-11-13 15:34:28 +0100 | [diff] [blame] | 1061 | }}); |
Arunesh Mishra | a772e5f | 2016-01-25 10:33:11 -0800 | [diff] [blame] | 1062 | |
| 1063 | registerService(Context.SOUND_TRIGGER_SERVICE, SoundTriggerManager.class, |
| 1064 | new CachedServiceFetcher<SoundTriggerManager>() { |
| 1065 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1066 | public SoundTriggerManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 1067 | IBinder b = ServiceManager.getServiceOrThrow(Context.SOUND_TRIGGER_SERVICE); |
Arunesh Mishra | a772e5f | 2016-01-25 10:33:11 -0800 | [diff] [blame] | 1068 | return new SoundTriggerManager(ctx, ISoundTriggerService.Stub.asInterface(b)); |
| 1069 | }}); |
Makoto Onuki | 6f7362d9 | 2016-03-04 13:39:41 -0800 | [diff] [blame] | 1070 | |
| 1071 | registerService(Context.SHORTCUT_SERVICE, ShortcutManager.class, |
| 1072 | new CachedServiceFetcher<ShortcutManager>() { |
Makoto Onuki | 5504622 | 2016-03-08 10:49:47 -0800 | [diff] [blame] | 1073 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1074 | public ShortcutManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 1075 | IBinder b = ServiceManager.getServiceOrThrow(Context.SHORTCUT_SERVICE); |
| 1076 | return new ShortcutManager(ctx, IShortcutService.Stub.asInterface(b)); |
Makoto Onuki | 5504622 | 2016-03-08 10:49:47 -0800 | [diff] [blame] | 1077 | }}); |
Joe Onorato | 713fec8 | 2016-03-04 10:34:02 -0800 | [diff] [blame] | 1078 | |
Hyunyoung Song | 880a951 | 2018-12-20 11:24:48 -0800 | [diff] [blame] | 1079 | registerService(Context.OVERLAY_SERVICE, OverlayManager.class, |
| 1080 | new CachedServiceFetcher<OverlayManager>() { |
| 1081 | @Override |
| 1082 | public OverlayManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 1083 | IBinder b = ServiceManager.getServiceOrThrow(Context.OVERLAY_SERVICE); |
| 1084 | return new OverlayManager(ctx, IOverlayManager.Stub.asInterface(b)); |
| 1085 | }}); |
| 1086 | |
Ricky Wai | 1a6e667 | 2017-10-27 14:46:01 +0100 | [diff] [blame] | 1087 | registerService(Context.NETWORK_WATCHLIST_SERVICE, NetworkWatchlistManager.class, |
| 1088 | new CachedServiceFetcher<NetworkWatchlistManager>() { |
| 1089 | @Override |
| 1090 | public NetworkWatchlistManager createService(ContextImpl ctx) |
| 1091 | throws ServiceNotFoundException { |
| 1092 | IBinder b = |
| 1093 | ServiceManager.getServiceOrThrow(Context.NETWORK_WATCHLIST_SERVICE); |
| 1094 | return new NetworkWatchlistManager(ctx, |
| 1095 | INetworkWatchlistManager.Stub.asInterface(b)); |
| 1096 | }}); |
| 1097 | |
Joe Onorato | 713fec8 | 2016-03-04 10:34:02 -0800 | [diff] [blame] | 1098 | registerService(Context.SYSTEM_HEALTH_SERVICE, SystemHealthManager.class, |
| 1099 | new CachedServiceFetcher<SystemHealthManager>() { |
| 1100 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1101 | public SystemHealthManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 1102 | IBinder b = ServiceManager.getServiceOrThrow(BatteryStats.SERVICE_NAME); |
| 1103 | return new SystemHealthManager(IBatteryStats.Stub.asInterface(b)); |
Joe Onorato | 713fec8 | 2016-03-04 10:34:02 -0800 | [diff] [blame] | 1104 | }}); |
Peng Xu | 9ff7d22 | 2016-02-11 13:02:05 -0800 | [diff] [blame] | 1105 | |
| 1106 | registerService(Context.CONTEXTHUB_SERVICE, ContextHubManager.class, |
| 1107 | new CachedServiceFetcher<ContextHubManager>() { |
| 1108 | @Override |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1109 | public ContextHubManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Peng Xu | 9ff7d22 | 2016-02-11 13:02:05 -0800 | [diff] [blame] | 1110 | return new ContextHubManager(ctx.getOuterContext(), |
| 1111 | ctx.mMainThread.getHandler().getLooper()); |
| 1112 | }}); |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 1113 | |
| 1114 | registerService(Context.INCIDENT_SERVICE, IncidentManager.class, |
| 1115 | new CachedServiceFetcher<IncidentManager>() { |
| 1116 | @Override |
| 1117 | public IncidentManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 1118 | return new IncidentManager(ctx); |
| 1119 | }}); |
Clara Bayarri | 04d72ab | 2017-01-10 09:31:51 -0800 | [diff] [blame] | 1120 | |
Nandana Dutt | d11850c | 2018-12-12 17:26:57 +0000 | [diff] [blame] | 1121 | registerService(Context.BUGREPORT_SERVICE, BugreportManager.class, |
| 1122 | new CachedServiceFetcher<BugreportManager>() { |
| 1123 | @Override |
| 1124 | public BugreportManager createService(ContextImpl ctx) |
| 1125 | throws ServiceNotFoundException { |
| 1126 | IBinder b = ServiceManager.getServiceOrThrow(Context.BUGREPORT_SERVICE); |
| 1127 | return new BugreportManager(ctx.getOuterContext(), |
| 1128 | IDumpstate.Stub.asInterface(b)); |
| 1129 | }}); |
| 1130 | |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 1131 | registerService(Context.AUTOFILL_MANAGER_SERVICE, AutofillManager.class, |
| 1132 | new CachedServiceFetcher<AutofillManager>() { |
Felipe Leme | 3461d3c | 2017-01-19 08:54:55 -0800 | [diff] [blame] | 1133 | @Override |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 1134 | public AutofillManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
Svet Ganov | 43574b0 | 2017-04-12 09:25:20 -0700 | [diff] [blame] | 1135 | // Get the services without throwing as this is an optional feature |
| 1136 | IBinder b = ServiceManager.getService(Context.AUTOFILL_MANAGER_SERVICE); |
Svet Ganov | 782043c | 2017-02-11 00:52:02 +0000 | [diff] [blame] | 1137 | IAutoFillManager service = IAutoFillManager.Stub.asInterface(b); |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 1138 | return new AutofillManager(ctx.getOuterContext(), service); |
Felipe Leme | 3461d3c | 2017-01-19 08:54:55 -0800 | [diff] [blame] | 1139 | }}); |
Zak Cohen | 56345f4 | 2017-01-26 13:54:28 -0800 | [diff] [blame] | 1140 | |
Felipe Leme | ecb08be | 2018-11-27 15:48:47 -0800 | [diff] [blame] | 1141 | registerService(Context.CONTENT_CAPTURE_MANAGER_SERVICE, ContentCaptureManager.class, |
| 1142 | new CachedServiceFetcher<ContentCaptureManager>() { |
Felipe Leme | e348dc3 | 2018-11-05 12:35:29 -0800 | [diff] [blame] | 1143 | @Override |
Felipe Leme | ecb08be | 2018-11-27 15:48:47 -0800 | [diff] [blame] | 1144 | public ContentCaptureManager createService(ContextImpl ctx) |
Felipe Leme | e348dc3 | 2018-11-05 12:35:29 -0800 | [diff] [blame] | 1145 | throws ServiceNotFoundException { |
| 1146 | // Get the services without throwing as this is an optional feature |
Felipe Leme | ecb08be | 2018-11-27 15:48:47 -0800 | [diff] [blame] | 1147 | Context outerContext = ctx.getOuterContext(); |
Felipe Leme | 326f15a | 2019-02-19 09:42:24 -0800 | [diff] [blame] | 1148 | ContentCaptureOptions options = outerContext.getContentCaptureOptions(); |
| 1149 | // Options is null when the service didn't whitelist the activity or package |
Felipe Leme | cbf7f26 | 2019-04-17 13:57:59 -0700 | [diff] [blame] | 1150 | if (options != null && (options.lite || options.isWhitelisted(outerContext))) { |
Felipe Leme | ecb08be | 2018-11-27 15:48:47 -0800 | [diff] [blame] | 1151 | IBinder b = ServiceManager |
| 1152 | .getService(Context.CONTENT_CAPTURE_MANAGER_SERVICE); |
Felipe Leme | 749b889 | 2018-12-03 16:30:30 -0800 | [diff] [blame] | 1153 | IContentCaptureManager service = IContentCaptureManager.Stub.asInterface(b); |
Felipe Leme | 326f15a | 2019-02-19 09:42:24 -0800 | [diff] [blame] | 1154 | // Service is null when not provided by OEM or disabled by kill-switch. |
Felipe Leme | d49d52c | 2019-02-15 09:48:20 -0800 | [diff] [blame] | 1155 | if (service != null) { |
Felipe Leme | 326f15a | 2019-02-19 09:42:24 -0800 | [diff] [blame] | 1156 | return new ContentCaptureManager(outerContext, service, options); |
Felipe Leme | d49d52c | 2019-02-15 09:48:20 -0800 | [diff] [blame] | 1157 | } |
Felipe Leme | ecb08be | 2018-11-27 15:48:47 -0800 | [diff] [blame] | 1158 | } |
Felipe Leme | 326f15a | 2019-02-19 09:42:24 -0800 | [diff] [blame] | 1159 | // When feature is disabled or app / package not whitelisted, we return a null |
| 1160 | // manager to apps so the performance impact is practically zero |
Felipe Leme | ecb08be | 2018-11-27 15:48:47 -0800 | [diff] [blame] | 1161 | return null; |
Felipe Leme | e348dc3 | 2018-11-05 12:35:29 -0800 | [diff] [blame] | 1162 | }}); |
| 1163 | |
Sunny Goyal | 54e9134 | 2018-11-14 11:59:02 -0800 | [diff] [blame] | 1164 | registerService(Context.APP_PREDICTION_SERVICE, AppPredictionManager.class, |
| 1165 | new CachedServiceFetcher<AppPredictionManager>() { |
| 1166 | @Override |
| 1167 | public AppPredictionManager createService(ContextImpl ctx) |
| 1168 | throws ServiceNotFoundException { |
Felipe Leme | 6378bd4 | 2019-08-14 18:14:55 -0700 | [diff] [blame] | 1169 | IBinder b = ServiceManager.getService(Context.APP_PREDICTION_SERVICE); |
| 1170 | return b == null ? null : new AppPredictionManager(ctx); |
Sunny Goyal | 54e9134 | 2018-11-14 11:59:02 -0800 | [diff] [blame] | 1171 | } |
| 1172 | }); |
| 1173 | |
Winson Chung | 3fb0f25 | 2019-01-08 17:41:55 -0800 | [diff] [blame] | 1174 | registerService(Context.CONTENT_SUGGESTIONS_SERVICE, |
| 1175 | ContentSuggestionsManager.class, |
| 1176 | new CachedServiceFetcher<ContentSuggestionsManager>() { |
| 1177 | @Override |
| 1178 | public ContentSuggestionsManager createService(ContextImpl ctx) { |
| 1179 | // No throw as this is an optional service |
| 1180 | IBinder b = ServiceManager.getService( |
| 1181 | Context.CONTENT_SUGGESTIONS_SERVICE); |
| 1182 | IContentSuggestionsManager service = |
| 1183 | IContentSuggestionsManager.Stub.asInterface(b); |
Zak Cohen | 4834e9f | 2019-03-08 12:59:01 -0800 | [diff] [blame] | 1184 | return new ContentSuggestionsManager(ctx.getUserId(), service); |
Winson Chung | 3fb0f25 | 2019-01-08 17:41:55 -0800 | [diff] [blame] | 1185 | } |
| 1186 | }); |
| 1187 | |
Zak Cohen | 56345f4 | 2017-01-26 13:54:28 -0800 | [diff] [blame] | 1188 | registerService(Context.VR_SERVICE, VrManager.class, new CachedServiceFetcher<VrManager>() { |
| 1189 | @Override |
| 1190 | public VrManager createService(ContextImpl ctx) throws ServiceNotFoundException { |
| 1191 | IBinder b = ServiceManager.getServiceOrThrow(Context.VR_SERVICE); |
| 1192 | return new VrManager(IVrManager.Stub.asInterface(b)); |
| 1193 | } |
| 1194 | }); |
Neil Fuller | 328532a | 2017-03-16 18:32:21 +0000 | [diff] [blame] | 1195 | |
| 1196 | registerService(Context.TIME_ZONE_RULES_MANAGER_SERVICE, RulesManager.class, |
| 1197 | new CachedServiceFetcher<RulesManager>() { |
| 1198 | @Override |
| 1199 | public RulesManager createService(ContextImpl ctx) { |
| 1200 | return new RulesManager(ctx.getOuterContext()); |
| 1201 | }}); |
Tony Mak | 1b708e6 | 2017-10-12 10:59:11 +0100 | [diff] [blame] | 1202 | |
| 1203 | registerService(Context.CROSS_PROFILE_APPS_SERVICE, CrossProfileApps.class, |
| 1204 | new CachedServiceFetcher<CrossProfileApps>() { |
| 1205 | @Override |
| 1206 | public CrossProfileApps createService(ContextImpl ctx) |
| 1207 | throws ServiceNotFoundException { |
| 1208 | IBinder b = ServiceManager.getServiceOrThrow( |
| 1209 | Context.CROSS_PROFILE_APPS_SERVICE); |
| 1210 | return new CrossProfileApps(ctx.getOuterContext(), |
| 1211 | ICrossProfileApps.Stub.asInterface(b)); |
| 1212 | } |
| 1213 | }); |
Jason Monk | 8f5f7ff | 2017-10-17 14:12:42 -0400 | [diff] [blame] | 1214 | |
| 1215 | registerService(Context.SLICE_SERVICE, SliceManager.class, |
| 1216 | new CachedServiceFetcher<SliceManager>() { |
| 1217 | @Override |
| 1218 | public SliceManager createService(ContextImpl ctx) |
| 1219 | throws ServiceNotFoundException { |
| 1220 | return new SliceManager(ctx.getOuterContext(), |
| 1221 | ctx.mMainThread.getHandler()); |
| 1222 | } |
| 1223 | }); |
Philip P. Moltmann | f80809f | 2018-04-04 11:20:44 -0700 | [diff] [blame] | 1224 | |
Neil Fuller | feeee68 | 2018-05-30 14:35:24 +0100 | [diff] [blame] | 1225 | registerService(Context.TIME_DETECTOR_SERVICE, TimeDetector.class, |
| 1226 | new CachedServiceFetcher<TimeDetector>() { |
| 1227 | @Override |
| 1228 | public TimeDetector createService(ContextImpl ctx) |
| 1229 | throws ServiceNotFoundException { |
| 1230 | return new TimeDetector(); |
| 1231 | }}); |
Philip P. Moltmann | 039678e | 2018-09-18 13:04:38 -0700 | [diff] [blame] | 1232 | |
| 1233 | registerService(Context.PERMISSION_SERVICE, PermissionManager.class, |
| 1234 | new CachedServiceFetcher<PermissionManager>() { |
| 1235 | @Override |
| 1236 | public PermissionManager createService(ContextImpl ctx) { |
Svet Ganov | d8eb8b2 | 2019-04-05 18:52:08 -0700 | [diff] [blame] | 1237 | IPackageManager packageManager = AppGlobals.getPackageManager(); |
| 1238 | return new PermissionManager(ctx.getOuterContext(), packageManager); |
Philip P. Moltmann | 039678e | 2018-09-18 13:04:38 -0700 | [diff] [blame] | 1239 | }}); |
Hai Zhang | 4ef21d0 | 2018-11-09 14:43:51 -0800 | [diff] [blame] | 1240 | |
Philip P. Moltmann | bc054d8 | 2018-12-21 09:41:58 -0800 | [diff] [blame] | 1241 | registerService(Context.PERMISSION_CONTROLLER_SERVICE, PermissionControllerManager.class, |
| 1242 | new CachedServiceFetcher<PermissionControllerManager>() { |
| 1243 | @Override |
| 1244 | public PermissionControllerManager createService(ContextImpl ctx) { |
Svet Ganov | d8eb8b2 | 2019-04-05 18:52:08 -0700 | [diff] [blame] | 1245 | return new PermissionControllerManager(ctx.getOuterContext(), |
| 1246 | ctx.getMainThreadHandler()); |
Philip P. Moltmann | bc054d8 | 2018-12-21 09:41:58 -0800 | [diff] [blame] | 1247 | }}); |
| 1248 | |
Hai Zhang | 4ef21d0 | 2018-11-09 14:43:51 -0800 | [diff] [blame] | 1249 | registerService(Context.ROLE_SERVICE, RoleManager.class, |
| 1250 | new CachedServiceFetcher<RoleManager>() { |
| 1251 | @Override |
| 1252 | public RoleManager createService(ContextImpl ctx) |
| 1253 | throws ServiceNotFoundException { |
| 1254 | return new RoleManager(ctx.getOuterContext()); |
| 1255 | }}); |
Richard Uhler | b29f145 | 2018-09-12 16:38:15 +0100 | [diff] [blame] | 1256 | |
Hai Zhang | a4959e5 | 2019-03-06 12:21:07 -0800 | [diff] [blame] | 1257 | registerService(Context.ROLE_CONTROLLER_SERVICE, RoleControllerManager.class, |
| 1258 | new CachedServiceFetcher<RoleControllerManager>() { |
| 1259 | @Override |
| 1260 | public RoleControllerManager createService(ContextImpl ctx) |
| 1261 | throws ServiceNotFoundException { |
| 1262 | return new RoleControllerManager(ctx.getOuterContext()); |
| 1263 | }}); |
| 1264 | |
Richard Uhler | b29f145 | 2018-09-12 16:38:15 +0100 | [diff] [blame] | 1265 | registerService(Context.ROLLBACK_SERVICE, RollbackManager.class, |
| 1266 | new CachedServiceFetcher<RollbackManager>() { |
| 1267 | @Override |
| 1268 | public RollbackManager createService(ContextImpl ctx) |
| 1269 | throws ServiceNotFoundException { |
| 1270 | IBinder b = ServiceManager.getServiceOrThrow(Context.ROLLBACK_SERVICE); |
| 1271 | return new RollbackManager(ctx.getOuterContext(), |
| 1272 | IRollbackManager.Stub.asInterface(b)); |
| 1273 | }}); |
Howard Chen | 0a94764 | 2019-01-07 14:10:44 +0800 | [diff] [blame] | 1274 | |
Po-Chien Hsueh | 4e908c2 | 2019-03-07 11:57:17 +0800 | [diff] [blame] | 1275 | registerService(Context.DYNAMIC_SYSTEM_SERVICE, DynamicSystemManager.class, |
| 1276 | new CachedServiceFetcher<DynamicSystemManager>() { |
Howard Chen | 0a94764 | 2019-01-07 14:10:44 +0800 | [diff] [blame] | 1277 | @Override |
Po-Chien Hsueh | 4e908c2 | 2019-03-07 11:57:17 +0800 | [diff] [blame] | 1278 | public DynamicSystemManager createService(ContextImpl ctx) |
Howard Chen | 0a94764 | 2019-01-07 14:10:44 +0800 | [diff] [blame] | 1279 | throws ServiceNotFoundException { |
| 1280 | IBinder b = ServiceManager.getServiceOrThrow( |
Po-Chien Hsueh | 4e908c2 | 2019-03-07 11:57:17 +0800 | [diff] [blame] | 1281 | Context.DYNAMIC_SYSTEM_SERVICE); |
| 1282 | return new DynamicSystemManager( |
| 1283 | IDynamicSystemService.Stub.asInterface(b)); |
Howard Chen | 0a94764 | 2019-01-07 14:10:44 +0800 | [diff] [blame] | 1284 | }}); |
Roshan Pius | 848513e | 2019-10-11 13:44:00 -0700 | [diff] [blame] | 1285 | registerService(Context.BATTERY_STATS_SERVICE, BatteryStatsManager.class, |
| 1286 | new CachedServiceFetcher<BatteryStatsManager>() { |
| 1287 | @Override |
| 1288 | public BatteryStatsManager createService(ContextImpl ctx) |
| 1289 | throws ServiceNotFoundException { |
| 1290 | IBinder b = ServiceManager.getServiceOrThrow( |
| 1291 | Context.BATTERY_STATS_SERVICE); |
| 1292 | return new BatteryStatsManager( |
| 1293 | IBatteryStats.Stub.asInterface(b)); |
| 1294 | }}); |
Felipe Leme | ecb08be | 2018-11-27 15:48:47 -0800 | [diff] [blame] | 1295 | //CHECKSTYLE:ON IndentationCheck |
Makoto Onuki | 54c4e03 | 2019-10-30 12:05:20 -0700 | [diff] [blame] | 1296 | |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1297 | sInitializing = true; |
| 1298 | try { |
| 1299 | // Note: the following functions need to be @SystemApis, once they become mainline |
| 1300 | // modules. |
Sudheer Shanka | f5b3696 | 2019-10-04 16:16:13 -0700 | [diff] [blame] | 1301 | |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1302 | JobSchedulerFrameworkInitializer.registerServiceWrappers(); |
| 1303 | BlobStoreManagerFrameworkInitializer.initialize(); |
| 1304 | } finally { |
| 1305 | // If any of the above code throws, we're in a pretty bad shape and the process |
| 1306 | // will likely crash, but we'll reset it just in case there's an exception handler... |
| 1307 | sInitializing = false; |
| 1308 | } |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1309 | } |
| 1310 | |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1311 | /** Throws {@link IllegalStateException} if not during a static initialization. */ |
| 1312 | private static void ensureInitializing(String methodName) { |
| 1313 | Preconditions.checkState(sInitializing, "Internal error: " + methodName |
| 1314 | + " can only be called during class initialization."); |
| 1315 | } |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1316 | /** |
| 1317 | * Creates an array which is used to cache per-Context service instances. |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1318 | * @hide |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1319 | */ |
| 1320 | public static Object[] createServiceCache() { |
| 1321 | return new Object[sServiceCacheSize]; |
| 1322 | } |
| 1323 | |
| 1324 | /** |
| 1325 | * Gets a system service from a given context. |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1326 | * @hide |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1327 | */ |
| 1328 | public static Object getSystemService(ContextImpl ctx, String name) { |
| 1329 | ServiceFetcher<?> fetcher = SYSTEM_SERVICE_FETCHERS.get(name); |
| 1330 | return fetcher != null ? fetcher.getService(ctx) : null; |
| 1331 | } |
| 1332 | |
| 1333 | /** |
Paul McLean | e3383cc | 2015-05-08 11:41:20 -0700 | [diff] [blame] | 1334 | * Gets the name of the system-level service that is represented by the specified class. |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1335 | * @hide |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1336 | */ |
| 1337 | public static String getSystemServiceName(Class<?> serviceClass) { |
| 1338 | return SYSTEM_SERVICE_NAMES.get(serviceClass); |
| 1339 | } |
| 1340 | |
| 1341 | /** |
| 1342 | * Statically registers a system service with the context. |
| 1343 | * This method must be called during static initialization only. |
| 1344 | */ |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1345 | private static <T> void registerService(@NonNull String serviceName, |
| 1346 | @NonNull Class<T> serviceClass, @NonNull ServiceFetcher<T> serviceFetcher) { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1347 | SYSTEM_SERVICE_NAMES.put(serviceClass, serviceName); |
| 1348 | SYSTEM_SERVICE_FETCHERS.put(serviceName, serviceFetcher); |
| 1349 | } |
| 1350 | |
| 1351 | /** |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1352 | * Callback interface used as a parameter to {@link #registerStaticService( |
| 1353 | * String, Class, StaticServiceProducerNoBinder)}, which generates a service wrapper instance |
| 1354 | * that's not tied to any context and does not take a service binder object in the constructor. |
| 1355 | * |
| 1356 | * @param <TServiceClass> type of the service wrapper class. |
Makoto Onuki | 792de8d | 2019-07-16 16:19:01 -0700 | [diff] [blame] | 1357 | * |
| 1358 | * @hide |
| 1359 | */ |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1360 | //@SystemApi TODO Make it a system API. |
| 1361 | public interface StaticServiceProducerNoBinder<TServiceClass> { |
| 1362 | /** |
| 1363 | * Return a new service wrapper of type {@code TServiceClass}. |
| 1364 | */ |
| 1365 | TServiceClass createService(); |
| 1366 | } |
| 1367 | |
| 1368 | /** |
| 1369 | * Callback interface used as a parameter to {@link #registerStaticService( |
| 1370 | * String, Class, StaticServiceProducerWithBinder)}, which generates a service wrapper instance |
| 1371 | * that's not tied to any context and takes a service binder object in the constructor. |
| 1372 | * |
| 1373 | * @param <TServiceClass> type of the service wrapper class. |
| 1374 | * |
| 1375 | * @hide |
| 1376 | */ |
| 1377 | //@SystemApi TODO Make it a system API. |
| 1378 | public interface StaticServiceProducerWithBinder<TServiceClass> { |
| 1379 | /** |
| 1380 | * Return a new service wrapper of type {@code TServiceClass} backed by a given |
| 1381 | * service binder object. |
| 1382 | */ |
| 1383 | TServiceClass createService(IBinder serviceBinder); |
| 1384 | } |
| 1385 | |
| 1386 | /** |
| 1387 | * Callback interface used as a parameter to {@link #registerContextAwareService( |
| 1388 | * String, Class, ContextAwareServiceProducerNoBinder)}, |
| 1389 | * which generates a service wrapper instance |
| 1390 | * that's tied to a specific context and does not take a service binder object in the |
| 1391 | * constructor. |
| 1392 | * |
| 1393 | * @param <TServiceClass> type of the service wrapper class. |
| 1394 | * |
| 1395 | * @hide |
| 1396 | */ |
| 1397 | //@SystemApi TODO Make it a system API. |
| 1398 | public interface ContextAwareServiceProducerNoBinder<TServiceClass> { |
| 1399 | /** |
| 1400 | * Return a new service wrapper of type {@code TServiceClass} tied to a given |
| 1401 | * {@code context}. |
| 1402 | * |
| 1403 | * TODO Do we need to pass the "base context" too? |
| 1404 | */ |
| 1405 | TServiceClass createService(Context context); |
| 1406 | } |
| 1407 | |
| 1408 | /** |
| 1409 | * Callback interface used as a parameter to {@link #registerContextAwareService( |
| 1410 | * String, Class, ContextAwareServiceProducerWithBinder)}, |
| 1411 | * which generates a service wrapper instance |
| 1412 | * that's tied to a specific context and takes a service binder object in the constructor. |
| 1413 | * |
| 1414 | * @param <TServiceClass> type of the service wrapper class. |
| 1415 | * |
| 1416 | * @hide |
| 1417 | */ |
| 1418 | //@SystemApi TODO Make it a system API. |
| 1419 | public interface ContextAwareServiceProducerWithBinder<TServiceClass> { |
| 1420 | /** |
| 1421 | * Return a new service wrapper of type {@code TServiceClass} backed by a given |
| 1422 | * service binder object that's tied to a given {@code context}. |
| 1423 | * |
| 1424 | * TODO Do we need to pass the "base context" too? |
| 1425 | */ |
| 1426 | TServiceClass createService(Context context, IBinder serviceBinder); |
| 1427 | } |
| 1428 | |
| 1429 | /** |
| 1430 | * Used by apex modules to register a "service wrapper" that is not tied to any {@link Context}. |
| 1431 | * |
| 1432 | * <p>This can only be called from the methods called by the static initializer of |
| 1433 | * {@link SystemServiceRegistry}. (Otherwise it throws a {@link IllegalStateException}.) |
| 1434 | * |
| 1435 | * @param serviceName the name of the binder object, such as |
| 1436 | * {@link Context#JOB_SCHEDULER_SERVICE}. |
| 1437 | * @param serviceWrapperClass the wrapper class, such as the class of |
| 1438 | * {@link android.app.job.JobScheduler}. |
| 1439 | * @param serviceProducer Callback that takes the service binder object with the name |
| 1440 | * {@code serviceName} and returns an actual service wrapper instance. |
| 1441 | * |
| 1442 | * @hide |
| 1443 | */ |
| 1444 | //@SystemApi TODO Make it a system API. |
| 1445 | public static <TServiceClass> void registerStaticService( |
| 1446 | @NonNull String serviceName, @NonNull Class<TServiceClass> serviceWrapperClass, |
| 1447 | @NonNull StaticServiceProducerWithBinder<TServiceClass> serviceProducer) { |
| 1448 | ensureInitializing("registerStaticService"); |
| 1449 | Preconditions.checkStringNotEmpty(serviceName); |
| 1450 | Preconditions.checkNotNull(serviceWrapperClass); |
| 1451 | Preconditions.checkNotNull(serviceProducer); |
| 1452 | |
Makoto Onuki | 7d6d9ca | 2019-08-13 11:45:45 -0700 | [diff] [blame] | 1453 | registerService(serviceName, serviceWrapperClass, |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1454 | new StaticServiceFetcher<TServiceClass>() { |
Makoto Onuki | 792de8d | 2019-07-16 16:19:01 -0700 | [diff] [blame] | 1455 | @Override |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1456 | public TServiceClass createService() throws ServiceNotFoundException { |
| 1457 | return serviceProducer.createService( |
| 1458 | ServiceManager.getServiceOrThrow(serviceName)); |
Makoto Onuki | 792de8d | 2019-07-16 16:19:01 -0700 | [diff] [blame] | 1459 | }}); |
| 1460 | } |
| 1461 | |
| 1462 | /** |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1463 | * Similar to {@link #registerStaticService(String, Class, StaticServiceProducerWithBinder)}, |
| 1464 | * but used for a "service wrapper" that doesn't take a service binder in its constructor. |
Makoto Onuki | 7d6d9ca | 2019-08-13 11:45:45 -0700 | [diff] [blame] | 1465 | * |
| 1466 | * @hide |
| 1467 | */ |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1468 | //@SystemApi TODO Make it a system API. |
| 1469 | public static <TServiceClass> void registerStaticService( |
| 1470 | @NonNull String serviceName, @NonNull Class<TServiceClass> serviceWrapperClass, |
| 1471 | @NonNull StaticServiceProducerNoBinder<TServiceClass> serviceProducer) { |
| 1472 | ensureInitializing("registerStaticService"); |
| 1473 | Preconditions.checkStringNotEmpty(serviceName); |
| 1474 | Preconditions.checkNotNull(serviceWrapperClass); |
| 1475 | Preconditions.checkNotNull(serviceProducer); |
| 1476 | |
Makoto Onuki | 7d6d9ca | 2019-08-13 11:45:45 -0700 | [diff] [blame] | 1477 | registerService(serviceName, serviceWrapperClass, |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1478 | new StaticServiceFetcher<TServiceClass>() { |
Makoto Onuki | 7d6d9ca | 2019-08-13 11:45:45 -0700 | [diff] [blame] | 1479 | @Override |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1480 | public TServiceClass createService() { |
| 1481 | return serviceProducer.createService(); |
| 1482 | }}); |
| 1483 | } |
| 1484 | |
| 1485 | /** |
| 1486 | * Used by apex modules to register a "service wrapper" that is tied to a specific |
| 1487 | * {@link Context}. |
| 1488 | * |
| 1489 | * <p>This can only be called from the methods called by the static initializer of |
| 1490 | * {@link SystemServiceRegistry}. (Otherwise it throws a {@link IllegalStateException}.) |
| 1491 | * |
| 1492 | * @param serviceName the name of the binder object, such as |
| 1493 | * {@link Context#JOB_SCHEDULER_SERVICE}. |
| 1494 | * @param serviceWrapperClass the wrapper class, such as the class of |
| 1495 | * {@link android.app.job.JobScheduler}. |
| 1496 | * @param serviceProducer lambda that takes the service binder object with the name |
| 1497 | * {@code serviceName}, a {@link Context} and returns an actual service wrapper instance. |
| 1498 | * |
| 1499 | * @hide |
| 1500 | */ |
| 1501 | //@SystemApi TODO Make it a system API. |
| 1502 | public static <TServiceClass> void registerContextAwareService( |
| 1503 | @NonNull String serviceName, @NonNull Class<TServiceClass> serviceWrapperClass, |
| 1504 | @NonNull ContextAwareServiceProducerWithBinder<TServiceClass> serviceProducer) { |
| 1505 | ensureInitializing("registerContextAwareService"); |
| 1506 | Preconditions.checkStringNotEmpty(serviceName); |
| 1507 | Preconditions.checkNotNull(serviceWrapperClass); |
| 1508 | Preconditions.checkNotNull(serviceProducer); |
| 1509 | |
| 1510 | registerService(serviceName, serviceWrapperClass, |
| 1511 | new CachedServiceFetcher<TServiceClass>() { |
| 1512 | @Override |
| 1513 | public TServiceClass createService(ContextImpl ctx) |
| 1514 | throws ServiceNotFoundException { |
| 1515 | return serviceProducer.createService( |
| 1516 | ctx.getOuterContext(), |
| 1517 | ServiceManager.getServiceOrThrow(serviceName)); |
| 1518 | }}); |
| 1519 | } |
| 1520 | |
| 1521 | |
| 1522 | /** |
| 1523 | * Similar to {@link #registerContextAwareService(String, Class, |
| 1524 | * ContextAwareServiceProducerWithBinder)}, |
| 1525 | * but used for a "service wrapper" that doesn't take a service binder in its constructor. |
| 1526 | * |
| 1527 | * @hide |
| 1528 | */ |
| 1529 | //@SystemApi TODO Make it a system API. |
| 1530 | public static <TServiceClass> void registerContextAwareService( |
| 1531 | @NonNull String serviceName, @NonNull Class<TServiceClass> serviceWrapperClass, |
| 1532 | @NonNull ContextAwareServiceProducerNoBinder<TServiceClass> serviceProducer) { |
| 1533 | ensureInitializing("registerContextAwareService"); |
| 1534 | Preconditions.checkStringNotEmpty(serviceName); |
| 1535 | Preconditions.checkNotNull(serviceWrapperClass); |
| 1536 | Preconditions.checkNotNull(serviceProducer); |
| 1537 | |
| 1538 | registerService(serviceName, serviceWrapperClass, |
| 1539 | new CachedServiceFetcher<TServiceClass>() { |
| 1540 | @Override |
| 1541 | public TServiceClass createService(ContextImpl ctx) { |
| 1542 | return serviceProducer.createService(ctx.getOuterContext()); |
Makoto Onuki | 7d6d9ca | 2019-08-13 11:45:45 -0700 | [diff] [blame] | 1543 | }}); |
| 1544 | } |
| 1545 | |
| 1546 | /** |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1547 | * Base interface for classes that fetch services. |
| 1548 | * These objects must only be created during static initialization. |
| 1549 | */ |
| 1550 | static abstract interface ServiceFetcher<T> { |
| 1551 | T getService(ContextImpl ctx); |
| 1552 | } |
| 1553 | |
| 1554 | /** |
| 1555 | * Override this class when the system service constructor needs a |
| 1556 | * ContextImpl and should be cached and retained by that context. |
| 1557 | */ |
| 1558 | static abstract class CachedServiceFetcher<T> implements ServiceFetcher<T> { |
| 1559 | private final int mCacheIndex; |
| 1560 | |
Makoto Onuki | d67070e | 2018-03-30 12:39:14 -0700 | [diff] [blame] | 1561 | CachedServiceFetcher() { |
| 1562 | // Note this class must be instantiated only by the static initializer of the |
| 1563 | // outer class (SystemServiceRegistry), which already does the synchronization, |
| 1564 | // so bare access to sServiceCacheSize is okay here. |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1565 | mCacheIndex = sServiceCacheSize++; |
| 1566 | } |
| 1567 | |
| 1568 | @Override |
| 1569 | @SuppressWarnings("unchecked") |
| 1570 | public final T getService(ContextImpl ctx) { |
| 1571 | final Object[] cache = ctx.mServiceCache; |
Makoto Onuki | d67070e | 2018-03-30 12:39:14 -0700 | [diff] [blame] | 1572 | final int[] gates = ctx.mServiceInitializationStateArray; |
Makoto Onuki | f896f12 | 2018-01-25 09:50:24 -0800 | [diff] [blame] | 1573 | |
Makoto Onuki | d67070e | 2018-03-30 12:39:14 -0700 | [diff] [blame] | 1574 | for (;;) { |
| 1575 | boolean doInitialize = false; |
| 1576 | synchronized (cache) { |
| 1577 | // Return it if we already have a cached instance. |
| 1578 | T service = (T) cache[mCacheIndex]; |
| 1579 | if (service != null || gates[mCacheIndex] == ContextImpl.STATE_NOT_FOUND) { |
| 1580 | return service; |
| 1581 | } |
Makoto Onuki | f896f12 | 2018-01-25 09:50:24 -0800 | [diff] [blame] | 1582 | |
Makoto Onuki | d67070e | 2018-03-30 12:39:14 -0700 | [diff] [blame] | 1583 | // If we get here, there's no cached instance. |
Makoto Onuki | f896f12 | 2018-01-25 09:50:24 -0800 | [diff] [blame] | 1584 | |
Makoto Onuki | d67070e | 2018-03-30 12:39:14 -0700 | [diff] [blame] | 1585 | // Grr... if gate is STATE_READY, then this means we initialized the service |
| 1586 | // once but someone cleared it. |
| 1587 | // We start over from STATE_UNINITIALIZED. |
| 1588 | if (gates[mCacheIndex] == ContextImpl.STATE_READY) { |
| 1589 | gates[mCacheIndex] = ContextImpl.STATE_UNINITIALIZED; |
| 1590 | } |
| 1591 | |
| 1592 | // It's possible for multiple threads to get here at the same time, so |
| 1593 | // use the "gate" to make sure only the first thread will call createService(). |
| 1594 | |
| 1595 | // At this point, the gate must be either UNINITIALIZED or INITIALIZING. |
| 1596 | if (gates[mCacheIndex] == ContextImpl.STATE_UNINITIALIZED) { |
| 1597 | doInitialize = true; |
| 1598 | gates[mCacheIndex] = ContextImpl.STATE_INITIALIZING; |
| 1599 | } |
Makoto Onuki | f896f12 | 2018-01-25 09:50:24 -0800 | [diff] [blame] | 1600 | } |
| 1601 | |
Makoto Onuki | d67070e | 2018-03-30 12:39:14 -0700 | [diff] [blame] | 1602 | if (doInitialize) { |
| 1603 | // Only the first thread gets here. |
Makoto Onuki | f896f12 | 2018-01-25 09:50:24 -0800 | [diff] [blame] | 1604 | |
Makoto Onuki | d67070e | 2018-03-30 12:39:14 -0700 | [diff] [blame] | 1605 | T service = null; |
| 1606 | @ServiceInitializationState int newState = ContextImpl.STATE_NOT_FOUND; |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1607 | try { |
Makoto Onuki | d67070e | 2018-03-30 12:39:14 -0700 | [diff] [blame] | 1608 | // This thread is the first one to get here. Instantiate the service |
| 1609 | // *without* the cache lock held. |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1610 | service = createService(ctx); |
Makoto Onuki | d67070e | 2018-03-30 12:39:14 -0700 | [diff] [blame] | 1611 | newState = ContextImpl.STATE_READY; |
Makoto Onuki | f896f12 | 2018-01-25 09:50:24 -0800 | [diff] [blame] | 1612 | |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1613 | } catch (ServiceNotFoundException e) { |
Jeff Sharkey | 589f309 | 2016-11-29 12:54:39 -0700 | [diff] [blame] | 1614 | onServiceNotFound(e); |
Makoto Onuki | f896f12 | 2018-01-25 09:50:24 -0800 | [diff] [blame] | 1615 | |
Makoto Onuki | d67070e | 2018-03-30 12:39:14 -0700 | [diff] [blame] | 1616 | } finally { |
| 1617 | synchronized (cache) { |
| 1618 | cache[mCacheIndex] = service; |
| 1619 | gates[mCacheIndex] = newState; |
| 1620 | cache.notifyAll(); |
| 1621 | } |
| 1622 | } |
| 1623 | return service; |
| 1624 | } |
| 1625 | // The other threads will wait for the first thread to call notifyAll(), |
| 1626 | // and go back to the top and retry. |
| 1627 | synchronized (cache) { |
| 1628 | while (gates[mCacheIndex] < ContextImpl.STATE_READY) { |
| 1629 | try { |
| 1630 | cache.wait(); |
| 1631 | } catch (InterruptedException e) { |
| 1632 | Log.w(TAG, "getService() interrupted"); |
| 1633 | Thread.currentThread().interrupt(); |
| 1634 | return null; |
| 1635 | } |
Makoto Onuki | f896f12 | 2018-01-25 09:50:24 -0800 | [diff] [blame] | 1636 | } |
| 1637 | } |
Makoto Onuki | f896f12 | 2018-01-25 09:50:24 -0800 | [diff] [blame] | 1638 | } |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1639 | } |
| 1640 | |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1641 | public abstract T createService(ContextImpl ctx) throws ServiceNotFoundException; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1642 | } |
| 1643 | |
| 1644 | /** |
| 1645 | * Override this class when the system service does not need a ContextImpl |
| 1646 | * and should be cached and retained process-wide. |
| 1647 | */ |
| 1648 | static abstract class StaticServiceFetcher<T> implements ServiceFetcher<T> { |
| 1649 | private T mCachedInstance; |
| 1650 | |
| 1651 | @Override |
Jeff Sharkey | 589f309 | 2016-11-29 12:54:39 -0700 | [diff] [blame] | 1652 | public final T getService(ContextImpl ctx) { |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1653 | synchronized (StaticServiceFetcher.this) { |
| 1654 | if (mCachedInstance == null) { |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1655 | try { |
| 1656 | mCachedInstance = createService(); |
| 1657 | } catch (ServiceNotFoundException e) { |
Jeff Sharkey | 589f309 | 2016-11-29 12:54:39 -0700 | [diff] [blame] | 1658 | onServiceNotFound(e); |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1659 | } |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1660 | } |
| 1661 | return mCachedInstance; |
| 1662 | } |
| 1663 | } |
| 1664 | |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1665 | public abstract T createService() throws ServiceNotFoundException; |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1666 | } |
Lorenzo Colitti | ffc42b0 | 2015-07-29 11:41:21 +0900 | [diff] [blame] | 1667 | |
| 1668 | /** |
Lorenzo Colitti | cf95977 | 2016-02-29 16:07:37 +0900 | [diff] [blame] | 1669 | * Like StaticServiceFetcher, creates only one instance of the service per application, but when |
| 1670 | * creating the service for the first time, passes it the application context of the creating |
| 1671 | * application. |
Lorenzo Colitti | ffc42b0 | 2015-07-29 11:41:21 +0900 | [diff] [blame] | 1672 | * |
Lorenzo Colitti | ffc42b0 | 2015-07-29 11:41:21 +0900 | [diff] [blame] | 1673 | * TODO: Delete this once its only user (ConnectivityManager) is known to work well in the |
| 1674 | * case where multiple application components each have their own ConnectivityManager object. |
| 1675 | */ |
Lorenzo Colitti | cf95977 | 2016-02-29 16:07:37 +0900 | [diff] [blame] | 1676 | static abstract class StaticApplicationContextServiceFetcher<T> implements ServiceFetcher<T> { |
Lorenzo Colitti | ffc42b0 | 2015-07-29 11:41:21 +0900 | [diff] [blame] | 1677 | private T mCachedInstance; |
| 1678 | |
| 1679 | @Override |
| 1680 | public final T getService(ContextImpl ctx) { |
Lorenzo Colitti | cf95977 | 2016-02-29 16:07:37 +0900 | [diff] [blame] | 1681 | synchronized (StaticApplicationContextServiceFetcher.this) { |
Lorenzo Colitti | ffc42b0 | 2015-07-29 11:41:21 +0900 | [diff] [blame] | 1682 | if (mCachedInstance == null) { |
Lorenzo Colitti | 0ad9ab0 | 2016-03-25 17:40:11 +0900 | [diff] [blame] | 1683 | Context appContext = ctx.getApplicationContext(); |
| 1684 | // If the application context is null, we're either in the system process or |
| 1685 | // it's the application context very early in app initialization. In both these |
| 1686 | // cases, the passed-in ContextImpl will not be freed, so it's safe to pass it |
| 1687 | // to the service. http://b/27532714 . |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1688 | try { |
| 1689 | mCachedInstance = createService(appContext != null ? appContext : ctx); |
| 1690 | } catch (ServiceNotFoundException e) { |
Jeff Sharkey | 589f309 | 2016-11-29 12:54:39 -0700 | [diff] [blame] | 1691 | onServiceNotFound(e); |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1692 | } |
Lorenzo Colitti | ffc42b0 | 2015-07-29 11:41:21 +0900 | [diff] [blame] | 1693 | } |
| 1694 | return mCachedInstance; |
| 1695 | } |
| 1696 | } |
| 1697 | |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 1698 | public abstract T createService(Context applicationContext) throws ServiceNotFoundException; |
Lorenzo Colitti | ffc42b0 | 2015-07-29 11:41:21 +0900 | [diff] [blame] | 1699 | } |
Jeff Sharkey | 589f309 | 2016-11-29 12:54:39 -0700 | [diff] [blame] | 1700 | |
Makoto Onuki | 05b14f5 | 2019-11-05 12:36:07 -0800 | [diff] [blame] | 1701 | /** @hide */ |
Jeff Sharkey | 589f309 | 2016-11-29 12:54:39 -0700 | [diff] [blame] | 1702 | public static void onServiceNotFound(ServiceNotFoundException e) { |
| 1703 | // We're mostly interested in tracking down long-lived core system |
| 1704 | // components that might stumble if they obtain bad references; just |
| 1705 | // emit a tidy log message for normal apps |
| 1706 | if (android.os.Process.myUid() < android.os.Process.FIRST_APPLICATION_UID) { |
| 1707 | Log.wtf(TAG, e.getMessage(), e); |
| 1708 | } else { |
| 1709 | Log.w(TAG, e.getMessage()); |
| 1710 | } |
| 1711 | } |
Jeff Brown | 6e53931 | 2015-02-24 18:53:21 -0800 | [diff] [blame] | 1712 | } |