Loading core/java/android/os/Binder.java +0 −9 Original line number Diff line number Diff line Loading @@ -1202,13 +1202,4 @@ public class Binder implements IBinder { StrictMode.clearGatheredViolations(); return res; } /** * Returns the specified service from servicemanager. If the service is not running, * servicemanager will attempt to start it, and this function will wait for it to be ready. * Returns nullptr only if there are permission problems or fatal errors. * @hide */ public static final native @Nullable IBinder waitForService(@NonNull String serviceName) throws RemoteException; } core/jni/android_util_Binder.cpp +0 −26 Original line number Diff line number Diff line Loading @@ -1036,31 +1036,6 @@ static void android_os_Binder_blockUntilThreadAvailable(JNIEnv* env, jobject cla return IPCThreadState::self()->blockUntilThreadAvailable(); } static jobject android_os_Binder_waitForService( JNIEnv *env, jclass /* clazzObj */, jstring serviceNameObj) { const jchar* serviceName = env->GetStringCritical(serviceNameObj, nullptr); if (!serviceName) { signalExceptionForError(env, nullptr, BAD_VALUE, true /*canThrowRemoteException*/); return nullptr; } String16 nameCopy = String16(reinterpret_cast<const char16_t *>(serviceName), env->GetStringLength(serviceNameObj)); env->ReleaseStringCritical(serviceNameObj, serviceName); auto sm = android::defaultServiceManager(); sp<IBinder> service = sm->waitForService(nameCopy); if (!service) { signalExceptionForError(env, nullptr, NAME_NOT_FOUND, true /*canThrowRemoteException*/); return nullptr; } return javaObjectForIBinder(env, service); } static jobject android_os_Binder_getExtension(JNIEnv* env, jobject obj) { JavaBBinderHolder* jbh = (JavaBBinderHolder*) env->GetLongField(obj, gBinderOffsets.mObject); return javaObjectForIBinder(env, jbh->getExtension()); Loading Loading @@ -1101,7 +1076,6 @@ static const JNINativeMethod gBinderMethods[] = { { "getNativeBBinderHolder", "()J", (void*)android_os_Binder_getNativeBBinderHolder }, { "getNativeFinalizer", "()J", (void*)android_os_Binder_getNativeFinalizer }, { "blockUntilThreadAvailable", "()V", (void*)android_os_Binder_blockUntilThreadAvailable }, { "waitForService", "(Ljava/lang/String;)Landroid/os/IBinder;", (void*)android_os_Binder_waitForService }, { "getExtension", "()Landroid/os/IBinder;", (void*)android_os_Binder_getExtension }, { "setExtension", "(Landroid/os/IBinder;)V", (void*)android_os_Binder_setExtension }, }; Loading services/core/java/com/android/server/DynamicSystemService.java +2 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.gsi.IGsiServiceCallback; import android.os.Environment; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.os.UserHandle; import android.os.image.IDynamicSystemService; Loading Loading @@ -55,7 +56,7 @@ public class DynamicSystemService extends IDynamicSystemService.Stub { if (mGsiService != null) { return mGsiService; } return IGsiService.Stub.asInterface(waitForService("gsiservice")); return IGsiService.Stub.asInterface(ServiceManager.waitForService("gsiservice")); } private void checkPermission() { Loading services/core/java/com/android/server/pm/ApexManager.java +4 −7 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.content.pm.parsing.PackageInfoWithoutStateUtils; import android.os.Binder; import android.os.Environment; import android.os.RemoteException; import android.os.ServiceManager; import android.os.Trace; import android.sysprop.ApexProperties; import android.util.ArrayMap; Loading Loading @@ -398,13 +399,9 @@ public abstract class ApexManager { */ @VisibleForTesting protected IApexService waitForApexService() { try { // Since apexd is a trusted platform component, synchronized calls are allowable return IApexService.Stub.asInterface( Binder.allowBlocking(Binder.waitForService("apexservice"))); } catch (RemoteException e) { throw new IllegalStateException("Required service apexservice not available"); } Binder.allowBlocking(ServiceManager.waitForService("apexservice"))); } @Override Loading Loading
core/java/android/os/Binder.java +0 −9 Original line number Diff line number Diff line Loading @@ -1202,13 +1202,4 @@ public class Binder implements IBinder { StrictMode.clearGatheredViolations(); return res; } /** * Returns the specified service from servicemanager. If the service is not running, * servicemanager will attempt to start it, and this function will wait for it to be ready. * Returns nullptr only if there are permission problems or fatal errors. * @hide */ public static final native @Nullable IBinder waitForService(@NonNull String serviceName) throws RemoteException; }
core/jni/android_util_Binder.cpp +0 −26 Original line number Diff line number Diff line Loading @@ -1036,31 +1036,6 @@ static void android_os_Binder_blockUntilThreadAvailable(JNIEnv* env, jobject cla return IPCThreadState::self()->blockUntilThreadAvailable(); } static jobject android_os_Binder_waitForService( JNIEnv *env, jclass /* clazzObj */, jstring serviceNameObj) { const jchar* serviceName = env->GetStringCritical(serviceNameObj, nullptr); if (!serviceName) { signalExceptionForError(env, nullptr, BAD_VALUE, true /*canThrowRemoteException*/); return nullptr; } String16 nameCopy = String16(reinterpret_cast<const char16_t *>(serviceName), env->GetStringLength(serviceNameObj)); env->ReleaseStringCritical(serviceNameObj, serviceName); auto sm = android::defaultServiceManager(); sp<IBinder> service = sm->waitForService(nameCopy); if (!service) { signalExceptionForError(env, nullptr, NAME_NOT_FOUND, true /*canThrowRemoteException*/); return nullptr; } return javaObjectForIBinder(env, service); } static jobject android_os_Binder_getExtension(JNIEnv* env, jobject obj) { JavaBBinderHolder* jbh = (JavaBBinderHolder*) env->GetLongField(obj, gBinderOffsets.mObject); return javaObjectForIBinder(env, jbh->getExtension()); Loading Loading @@ -1101,7 +1076,6 @@ static const JNINativeMethod gBinderMethods[] = { { "getNativeBBinderHolder", "()J", (void*)android_os_Binder_getNativeBBinderHolder }, { "getNativeFinalizer", "()J", (void*)android_os_Binder_getNativeFinalizer }, { "blockUntilThreadAvailable", "()V", (void*)android_os_Binder_blockUntilThreadAvailable }, { "waitForService", "(Ljava/lang/String;)Landroid/os/IBinder;", (void*)android_os_Binder_waitForService }, { "getExtension", "()Landroid/os/IBinder;", (void*)android_os_Binder_getExtension }, { "setExtension", "(Landroid/os/IBinder;)V", (void*)android_os_Binder_setExtension }, }; Loading
services/core/java/com/android/server/DynamicSystemService.java +2 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.gsi.IGsiServiceCallback; import android.os.Environment; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.os.UserHandle; import android.os.image.IDynamicSystemService; Loading Loading @@ -55,7 +56,7 @@ public class DynamicSystemService extends IDynamicSystemService.Stub { if (mGsiService != null) { return mGsiService; } return IGsiService.Stub.asInterface(waitForService("gsiservice")); return IGsiService.Stub.asInterface(ServiceManager.waitForService("gsiservice")); } private void checkPermission() { Loading
services/core/java/com/android/server/pm/ApexManager.java +4 −7 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.content.pm.parsing.PackageInfoWithoutStateUtils; import android.os.Binder; import android.os.Environment; import android.os.RemoteException; import android.os.ServiceManager; import android.os.Trace; import android.sysprop.ApexProperties; import android.util.ArrayMap; Loading Loading @@ -398,13 +399,9 @@ public abstract class ApexManager { */ @VisibleForTesting protected IApexService waitForApexService() { try { // Since apexd is a trusted platform component, synchronized calls are allowable return IApexService.Stub.asInterface( Binder.allowBlocking(Binder.waitForService("apexservice"))); } catch (RemoteException e) { throw new IllegalStateException("Required service apexservice not available"); } Binder.allowBlocking(ServiceManager.waitForService("apexservice"))); } @Override Loading