| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.os; |
| 18 |
|
| 19 |
import android.compat.annotation.UnsupportedAppUsage; |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
public final class ServiceManagerNative { |
| 28 |
private ServiceManagerNative() {} |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
@UnsupportedAppUsage |
| 38 |
public static IServiceManager asInterface(IBinder obj) { |
| 39 |
if (obj == null) { |
| 40 |
return null; |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
return new ServiceManagerProxy(obj); |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
class ServiceManagerProxy implements IServiceManager { |
| 51 |
public ServiceManagerProxy(IBinder remote) { |
| 52 |
mRemote = remote; |
| 53 |
mServiceManager = IServiceManager.Stub.asInterface(remote); |
| 54 |
} |
| 55 |
|
| 56 |
public IBinder asBinder() { |
| 57 |
return mRemote; |
| 58 |
} |
| 59 |
|
| 60 |
@UnsupportedAppUsage |
| 61 |
public IBinder getService(String name) throws RemoteException { |
| 62 |
|
| 63 |
return mServiceManager.checkService(name); |
| 64 |
} |
| 65 |
|
| 66 |
public IBinder checkService(String name) throws RemoteException { |
| 67 |
return mServiceManager.checkService(name); |
| 68 |
} |
| 69 |
|
| 70 |
public void addService(String name, IBinder service, boolean allowIsolated, int dumpPriority) |
| 71 |
throws RemoteException { |
| 72 |
mServiceManager.addService(name, service, allowIsolated, dumpPriority); |
| 73 |
} |
| 74 |
|
| 75 |
public String[] listServices(int dumpPriority) throws RemoteException { |
| 76 |
return mServiceManager.listServices(dumpPriority); |
| 77 |
} |
| 78 |
|
| 79 |
public void registerForNotifications(String name, IServiceCallback cb) |
| 80 |
throws RemoteException { |
| 81 |
mServiceManager.registerForNotifications(name, cb); |
| 82 |
} |
| 83 |
|
| 84 |
public void unregisterForNotifications(String name, IServiceCallback cb) |
| 85 |
throws RemoteException { |
| 86 |
throw new RemoteException(); |
| 87 |
} |
| 88 |
|
| 89 |
public boolean isDeclared(String name) throws RemoteException { |
| 90 |
return mServiceManager.isDeclared(name); |
| 91 |
} |
| 92 |
|
| 93 |
public String[] getDeclaredInstances(String iface) throws RemoteException { |
| 94 |
return mServiceManager.getDeclaredInstances(iface); |
| 95 |
} |
| 96 |
|
| 97 |
public String updatableViaApex(String name) throws RemoteException { |
| 98 |
return mServiceManager.updatableViaApex(name); |
| 99 |
} |
| 100 |
|
| 101 |
public String[] getUpdatableNames(String apexName) throws RemoteException { |
| 102 |
return mServiceManager.getUpdatableNames(apexName); |
| 103 |
} |
| 104 |
|
| 105 |
public ConnectionInfo getConnectionInfo(String name) throws RemoteException { |
| 106 |
return mServiceManager.getConnectionInfo(name); |
| 107 |
} |
| 108 |
|
| 109 |
public void registerClientCallback(String name, IBinder service, IClientCallback cb) |
| 110 |
throws RemoteException { |
| 111 |
throw new RemoteException(); |
| 112 |
} |
| 113 |
|
| 114 |
public void tryUnregisterService(String name, IBinder service) throws RemoteException { |
| 115 |
throw new RemoteException(); |
| 116 |
} |
| 117 |
|
| 118 |
public ServiceDebugInfo[] getServiceDebugInfo() throws RemoteException { |
| 119 |
return mServiceManager.getServiceDebugInfo(); |
| 120 |
} |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
@UnsupportedAppUsage |
| 128 |
private IBinder mRemote; |
| 129 |
|
| 130 |
private IServiceManager mServiceManager; |
| 131 |
} |