Loading api/system-current.txt +16 −0 Original line number Diff line number Diff line Loading @@ -6463,6 +6463,21 @@ package android.os { field public static final int STATUS_WAITING_REBOOT = 5; // 0x5 } public class TelephonyServiceManager { method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getTelephonyServiceRegisterer(); } public static class TelephonyServiceManager.ServiceNotFoundException extends java.lang.Exception { ctor public TelephonyServiceManager.ServiceNotFoundException(@NonNull String); } public final class TelephonyServiceManager.ServiceRegisterer { method @Nullable public android.os.IBinder get(); method @NonNull public android.os.IBinder getOrThrow() throws android.os.TelephonyServiceManager.ServiceNotFoundException; method public void register(@NonNull android.os.IBinder); method @Nullable public android.os.IBinder tryGet(); } public class UpdateEngine { ctor public UpdateEngine(); method public void applyPayload(String, long, long, String[]); Loading Loading @@ -9398,6 +9413,7 @@ package android.telephony { public class TelephonyFrameworkInitializer { method public static void registerServiceWrappers(); method public static void setTelephonyServiceManager(@NonNull android.os.TelephonyServiceManager); } public final class TelephonyHistogram implements android.os.Parcelable { core/java/android/app/ActivityThread.java +13 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ import android.os.ServiceManager; import android.os.StrictMode; import android.os.SystemClock; import android.os.SystemProperties; import android.os.TelephonyServiceManager; import android.os.Trace; import android.os.UserHandle; import android.permission.IPermissionManager; Loading @@ -128,6 +129,7 @@ import android.security.net.config.NetworkSecurityConfigProvider; import android.system.ErrnoException; import android.system.OsConstants; import android.system.StructStat; import android.telephony.TelephonyFrameworkInitializer; import android.util.AndroidRuntimeException; import android.util.ArrayMap; import android.util.DisplayMetrics; Loading Loading @@ -7413,6 +7415,9 @@ public final class ActivityThread extends ClientTransactionHandler { final File configDir = Environment.getUserConfigDirectory(UserHandle.myUserId()); TrustedCertificateStore.setDefaultUserDirectory(configDir); // Call per-process mainline module initialization. initializeMainlineModules(); Process.setArgV0("<pre-initialized>"); Looper.prepareMainLooper(); Loading Loading @@ -7447,6 +7452,14 @@ public final class ActivityThread extends ClientTransactionHandler { throw new RuntimeException("Main thread loop unexpectedly exited"); } /** * Call various initializer APIs in mainline modules that need to be called when each process * starts. */ public static void initializeMainlineModules() { TelephonyFrameworkInitializer.setTelephonyServiceManager(new TelephonyServiceManager()); } private void purgePendingResources() { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "purgePendingResources"); nPurgePendingResources(); Loading core/java/android/os/ServiceManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,7 @@ public final class ServiceManager { /** * Returns a reference to a service with the given name, or throws * {@link NullPointerException} if none is found. * {@link ServiceNotFoundException} if none is found. * * @hide */ Loading core/java/android/os/TelephonyServiceManager.java 0 → 100644 +138 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.os; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; /** * Provides a way to register and obtain the system service binder objects managed by the telephony * service. * * <p>Only the telephony mainline module will be able to access an instance of this class. * * @hide */ @SystemApi public class TelephonyServiceManager { /** * @hide */ public TelephonyServiceManager() { } /** * A class that exposes the methods to register and obtain each system service. */ public final class ServiceRegisterer { private final String mServiceName; /** * @hide */ public ServiceRegisterer(String serviceName) { mServiceName = serviceName; } /** * Register a system server binding object for a service. */ public void register(@NonNull IBinder binder) { ServiceManager.addService(mServiceName, binder); } /** * Get the system server binding object for a service. * * <p>This blocks until the service instance is ready, * or a timeout happens, in which case it returns null. */ @Nullable public IBinder get() { return ServiceManager.getService(mServiceName); } /** * Get the system server binding object for a service. * * <p>This blocks until the service instance is ready, * or a timeout happens, in which case it throws {@link ServiceNotFoundException}. */ @NonNull public IBinder getOrThrow() throws ServiceNotFoundException { try { return ServiceManager.getServiceOrThrow(mServiceName); } catch (ServiceManager.ServiceNotFoundException e) { throw new ServiceNotFoundException(mServiceName); } } /** * Get the system server binding object for a service. If the specified service is * not available, it returns null. */ @Nullable public IBinder tryGet() { return ServiceManager.checkService(mServiceName); } } /** * See {@link ServiceRegisterer#getOrThrow}. * * @hide */ @SystemApi public static class ServiceNotFoundException extends ServiceManager.ServiceNotFoundException { /** * Constructor. * * @param name the name of the binder service that cannot be found. * */ public ServiceNotFoundException(@NonNull String name) { super(name); } } /** * Returns {@link ServiceRegisterer} for the "telephony" service. */ @NonNull public ServiceRegisterer getTelephonyServiceRegisterer() { return new ServiceRegisterer("phone"); } // TODO: Add more services... // // /** // * Returns {@link ServiceRegisterer} for the "subscription" service. // */ // @NonNull // public ServiceRegisterer getSubscriptionServiceRegisterer() { // return new ServiceRegisterer("isub"); // } // // /** // * Returns {@link ServiceRegisterer} for the "SMS" service. // */ // @NonNull // public ServiceRegisterer getSmsServiceRegisterer() { // return new ServiceRegisterer("isms"); // } } services/java/com/android/server/SystemServer.java +3 −0 Original line number Diff line number Diff line Loading @@ -496,6 +496,9 @@ public final class SystemServer { // Initialize the system context. createSystemContext(); // Call per-process mainline module initialization. ActivityThread.initializeMainlineModules(); // Create the system service manager. mSystemServiceManager = new SystemServiceManager(mSystemContext); mSystemServiceManager.setStartInfo(mRuntimeRestart, Loading Loading
api/system-current.txt +16 −0 Original line number Diff line number Diff line Loading @@ -6463,6 +6463,21 @@ package android.os { field public static final int STATUS_WAITING_REBOOT = 5; // 0x5 } public class TelephonyServiceManager { method @NonNull public android.os.TelephonyServiceManager.ServiceRegisterer getTelephonyServiceRegisterer(); } public static class TelephonyServiceManager.ServiceNotFoundException extends java.lang.Exception { ctor public TelephonyServiceManager.ServiceNotFoundException(@NonNull String); } public final class TelephonyServiceManager.ServiceRegisterer { method @Nullable public android.os.IBinder get(); method @NonNull public android.os.IBinder getOrThrow() throws android.os.TelephonyServiceManager.ServiceNotFoundException; method public void register(@NonNull android.os.IBinder); method @Nullable public android.os.IBinder tryGet(); } public class UpdateEngine { ctor public UpdateEngine(); method public void applyPayload(String, long, long, String[]); Loading Loading @@ -9398,6 +9413,7 @@ package android.telephony { public class TelephonyFrameworkInitializer { method public static void registerServiceWrappers(); method public static void setTelephonyServiceManager(@NonNull android.os.TelephonyServiceManager); } public final class TelephonyHistogram implements android.os.Parcelable {
core/java/android/app/ActivityThread.java +13 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ import android.os.ServiceManager; import android.os.StrictMode; import android.os.SystemClock; import android.os.SystemProperties; import android.os.TelephonyServiceManager; import android.os.Trace; import android.os.UserHandle; import android.permission.IPermissionManager; Loading @@ -128,6 +129,7 @@ import android.security.net.config.NetworkSecurityConfigProvider; import android.system.ErrnoException; import android.system.OsConstants; import android.system.StructStat; import android.telephony.TelephonyFrameworkInitializer; import android.util.AndroidRuntimeException; import android.util.ArrayMap; import android.util.DisplayMetrics; Loading Loading @@ -7413,6 +7415,9 @@ public final class ActivityThread extends ClientTransactionHandler { final File configDir = Environment.getUserConfigDirectory(UserHandle.myUserId()); TrustedCertificateStore.setDefaultUserDirectory(configDir); // Call per-process mainline module initialization. initializeMainlineModules(); Process.setArgV0("<pre-initialized>"); Looper.prepareMainLooper(); Loading Loading @@ -7447,6 +7452,14 @@ public final class ActivityThread extends ClientTransactionHandler { throw new RuntimeException("Main thread loop unexpectedly exited"); } /** * Call various initializer APIs in mainline modules that need to be called when each process * starts. */ public static void initializeMainlineModules() { TelephonyFrameworkInitializer.setTelephonyServiceManager(new TelephonyServiceManager()); } private void purgePendingResources() { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "purgePendingResources"); nPurgePendingResources(); Loading
core/java/android/os/ServiceManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,7 @@ public final class ServiceManager { /** * Returns a reference to a service with the given name, or throws * {@link NullPointerException} if none is found. * {@link ServiceNotFoundException} if none is found. * * @hide */ Loading
core/java/android/os/TelephonyServiceManager.java 0 → 100644 +138 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.os; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; /** * Provides a way to register and obtain the system service binder objects managed by the telephony * service. * * <p>Only the telephony mainline module will be able to access an instance of this class. * * @hide */ @SystemApi public class TelephonyServiceManager { /** * @hide */ public TelephonyServiceManager() { } /** * A class that exposes the methods to register and obtain each system service. */ public final class ServiceRegisterer { private final String mServiceName; /** * @hide */ public ServiceRegisterer(String serviceName) { mServiceName = serviceName; } /** * Register a system server binding object for a service. */ public void register(@NonNull IBinder binder) { ServiceManager.addService(mServiceName, binder); } /** * Get the system server binding object for a service. * * <p>This blocks until the service instance is ready, * or a timeout happens, in which case it returns null. */ @Nullable public IBinder get() { return ServiceManager.getService(mServiceName); } /** * Get the system server binding object for a service. * * <p>This blocks until the service instance is ready, * or a timeout happens, in which case it throws {@link ServiceNotFoundException}. */ @NonNull public IBinder getOrThrow() throws ServiceNotFoundException { try { return ServiceManager.getServiceOrThrow(mServiceName); } catch (ServiceManager.ServiceNotFoundException e) { throw new ServiceNotFoundException(mServiceName); } } /** * Get the system server binding object for a service. If the specified service is * not available, it returns null. */ @Nullable public IBinder tryGet() { return ServiceManager.checkService(mServiceName); } } /** * See {@link ServiceRegisterer#getOrThrow}. * * @hide */ @SystemApi public static class ServiceNotFoundException extends ServiceManager.ServiceNotFoundException { /** * Constructor. * * @param name the name of the binder service that cannot be found. * */ public ServiceNotFoundException(@NonNull String name) { super(name); } } /** * Returns {@link ServiceRegisterer} for the "telephony" service. */ @NonNull public ServiceRegisterer getTelephonyServiceRegisterer() { return new ServiceRegisterer("phone"); } // TODO: Add more services... // // /** // * Returns {@link ServiceRegisterer} for the "subscription" service. // */ // @NonNull // public ServiceRegisterer getSubscriptionServiceRegisterer() { // return new ServiceRegisterer("isub"); // } // // /** // * Returns {@link ServiceRegisterer} for the "SMS" service. // */ // @NonNull // public ServiceRegisterer getSmsServiceRegisterer() { // return new ServiceRegisterer("isms"); // } }
services/java/com/android/server/SystemServer.java +3 −0 Original line number Diff line number Diff line Loading @@ -496,6 +496,9 @@ public final class SystemServer { // Initialize the system context. createSystemContext(); // Call per-process mainline module initialization. ActivityThread.initializeMainlineModules(); // Create the system service manager. mSystemServiceManager = new SystemServiceManager(mSystemContext); mSystemServiceManager.setStartInfo(mRuntimeRestart, Loading