本文整理汇总了Java中android.app.IServiceConnection类的典型用法代码示例。如果您正苦于以下问题:Java IServiceConnection类的具体用法?Java IServiceConnection怎么用?Java IServiceConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IServiceConnection类属于android.app包,在下文中一共展示了IServiceConnection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: unbindService
import android.app.IServiceConnection; //导入依赖的package包/类
public static boolean unbindService(final IServiceConnection conn) {
String tmp = null;
for (Map.Entry<String,AdditionalActivityManagerNative> entry : sBridges.entrySet()) {
if(entry.getValue().mActiveServiceInfo.containsValue(conn)){
tmp = entry.getKey();
}
}
final String processOfRemoteService = tmp;
if(processOfRemoteService!=null) {
sServicehandler.post(new Runnable() {
@Override
public void run() {
try {
AdditionalActivityManagerNative.obtain(processOfRemoteService).mRemoteDelegate.unbindService(conn);
} catch (RemoteException e) {
e.printStackTrace();
}
}
});
return true;
}else{
return false;
}
}
开发者ID:alibaba,项目名称:atlas,代码行数:25,代码来源:AdditionalActivityManagerNative.java
示例2: call
import android.app.IServiceConnection; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
IInterface caller = (IInterface) args[0];
IBinder token = (IBinder) args[1];
Intent service = (Intent) args[2];
String resolvedType = (String) args[3];
IServiceConnection conn = (IServiceConnection) args[4];
int flags = (int) args[5];
int userId = VUserHandle.myUserId();
if (isServerProcess()) {
userId = service.getIntExtra("_VA_|_user_id_", VUserHandle.USER_NULL);
}
if (userId == VUserHandle.USER_NULL) {
return method.invoke(who, args);
}
ServiceInfo serviceInfo = VirtualCore.get().resolveServiceInfo(service, userId);
if (serviceInfo != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
service.setComponent(new ComponentName(serviceInfo.packageName, serviceInfo.name));
}
conn = ServiceConnectionDelegate.getDelegate(conn);
return VActivityManager.get().bindService(caller.asBinder(), token, service, resolvedType,
conn, flags, userId);
}
return method.invoke(who, args);
}
开发者ID:7763sea,项目名称:VirtualHook,代码行数:27,代码来源:MethodProxies.java
示例3: publishService
import android.app.IServiceConnection; //导入依赖的package包/类
@Override
public void publishService(IBinder token, Intent intent, IBinder service, int userId) {
synchronized (this) {
ServiceRecord r = (ServiceRecord) token;
if (r != null) {
ServiceRecord.IntentBindRecord boundRecord = r.peekBinding(intent);
if (boundRecord != null) {
boundRecord.binder = service;
for (IServiceConnection conn : boundRecord.connections) {
ComponentName component = ComponentUtils.toComponentName(r.serviceInfo);
connectService(conn, component, boundRecord);
}
}
}
}
}
开发者ID:7763sea,项目名称:VirtualHook,代码行数:17,代码来源:VActivityManagerService.java
示例4: getDelegate
import android.app.IServiceConnection; //导入依赖的package包/类
public static IServiceConnection getDelegate(Context context, ServiceConnection connection,int flags) {
IServiceConnection sd = null;
if (connection == null) {
throw new IllegalArgumentException("connection is null");
}
try {
Object activityThread = ActivityThread.currentActivityThread.call();
Object loadApk = ContextImpl.mPackageInfo.get(VirtualCore.get().getContext());
Handler handler = ActivityThread.getHandler.call(activityThread);
sd = LoadedApk.getServiceDispatcher.call(loadApk, connection, context, handler, flags);
} catch (Exception e) {
Log.e("ConnectionDelegate", "getServiceDispatcher", e);
}
if (sd == null) {
throw new RuntimeException("Not supported in system context");
}
return getDelegate(sd);
}
开发者ID:coding-dream,项目名称:TPlayer,代码行数:19,代码来源:ServiceConnectionDelegate.java
示例5: publishService
import android.app.IServiceConnection; //导入依赖的package包/类
@Override
public void publishService(IBinder token, Intent intent, IBinder service, int userId) {
synchronized (this) {
ServiceRecord r = (ServiceRecord) token;
if (r != null) {
ServiceRecord.IntentBindRecord boundRecord = r.peekBinding(intent);
if (boundRecord != null) {
boundRecord.binder = service;
for (IServiceConnection conn : boundRecord.connections) {
ComponentName component = ComponentUtils.toComponentName(r.serviceInfo);
connectService(conn, component, boundRecord, false);
}
}
}
}
}
开发者ID:coding-dream,项目名称:TPlayer,代码行数:17,代码来源:VActivityManagerService.java
示例6: unbindService
import android.app.IServiceConnection; //导入依赖的package包/类
@Override
public boolean unbindService(IServiceConnection conn) throws RemoteException {
Log.e("BaseDelegateService","unbindService");
Iterator iter = mActivateServices.entrySet().iterator();
AdditionalServiceRecord record = null;
while (iter.hasNext()) {
Map.Entry<AdditionalServiceRecord,Service> entry = (Map.Entry<AdditionalServiceRecord,Service>) iter.next();
AdditionalServiceRecord tmpRecord = entry.getKey();
if(tmpRecord.activeConnections.contains(conn)){
//service has created
record = tmpRecord;
break;
}
}
if(record!=null){
record.activeConnections.remove(conn);
if(record.activeConnections.size()==0){
if(!record.calledStart || (record.calledStart && record.delayStop)){
//service can stop
Service service = mActivateServices.remove(record);
service.onDestroy();
return true;
}
}
}
return false;
}
开发者ID:alibaba,项目名称:atlas,代码行数:28,代码来源:BaseDelegateService.java
示例7: getDelegate
import android.app.IServiceConnection; //导入依赖的package包/类
public static ServiceConnectionDelegate getDelegate(IServiceConnection conn) {
if(conn instanceof ServiceConnectionDelegate){
return (ServiceConnectionDelegate)conn;
}
IBinder binder = conn.asBinder();
ServiceConnectionDelegate delegate = DELEGATE_MAP.get(binder);
if (delegate == null) {
delegate = new ServiceConnectionDelegate(conn);
DELEGATE_MAP.put(binder, delegate);
}
return delegate;
}
开发者ID:7763sea,项目名称:VirtualHook,代码行数:13,代码来源:ServiceConnectionDelegate.java
示例8: bindService
import android.app.IServiceConnection; //导入依赖的package包/类
public int bindService(IBinder caller, IBinder token, Intent service, String resolvedType, IServiceConnection connection, int flags, int userId) {
try {
return getService().bindService(caller, token, service, resolvedType, connection, flags, userId);
} catch (RemoteException e) {
return VirtualRuntime.crash(e);
}
}
开发者ID:7763sea,项目名称:VirtualHook,代码行数:8,代码来源:VActivityManager.java
示例9: unbindService
import android.app.IServiceConnection; //导入依赖的package包/类
public boolean unbindService(IServiceConnection connection) {
try {
return getService().unbindService(connection, VUserHandle.myUserId());
} catch (RemoteException e) {
return VirtualRuntime.crash(e);
}
}
开发者ID:7763sea,项目名称:VirtualHook,代码行数:8,代码来源:VActivityManager.java
示例10: findRecordLocked
import android.app.IServiceConnection; //导入依赖的package包/类
private ServiceRecord findRecordLocked(IServiceConnection connection) {
synchronized (mHistory) {
for (ServiceRecord r : mHistory) {
if (r.containConnection(connection)) {
return r;
}
}
return null;
}
}
开发者ID:7763sea,项目名称:VirtualHook,代码行数:11,代码来源:VActivityManagerService.java
示例11: connectService
import android.app.IServiceConnection; //导入依赖的package包/类
private void connectService(IServiceConnection conn, ComponentName component, ServiceRecord.IntentBindRecord r) {
try {
BinderDelegateService delegateService = new BinderDelegateService(component, r.binder);
conn.connected(component, delegateService);
} catch (RemoteException e) {
e.printStackTrace();
}
}
开发者ID:7763sea,项目名称:VirtualHook,代码行数:9,代码来源:VActivityManagerService.java
示例12: containConnection
import android.app.IServiceConnection; //导入依赖的package包/类
public boolean containConnection(IServiceConnection connection) {
for (IntentBindRecord record : bindings) {
if (record.containConnection(connection)) {
return true;
}
}
return false;
}
开发者ID:7763sea,项目名称:VirtualHook,代码行数:9,代码来源:ServiceRecord.java
示例13: addToBoundIntent
import android.app.IServiceConnection; //导入依赖的package包/类
void addToBoundIntent(Intent intent, IServiceConnection connection) {
IntentBindRecord record = peekBinding(intent);
if (record == null) {
record = new IntentBindRecord();
record.intent = intent;
synchronized (bindings) {
bindings.add(record);
}
}
record.addConnection(connection);
}
开发者ID:7763sea,项目名称:VirtualHook,代码行数:12,代码来源:ServiceRecord.java
示例14: addConnection
import android.app.IServiceConnection; //导入依赖的package包/类
public void addConnection(IServiceConnection connection) {
if (!containConnection(connection)) {
connections.add(connection);
try {
connection.asBinder().linkToDeath(new DeathRecipient(this, connection), 0);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
开发者ID:7763sea,项目名称:VirtualHook,代码行数:11,代码来源:ServiceRecord.java
示例15: removeConnection
import android.app.IServiceConnection; //导入依赖的package包/类
public void removeConnection(IServiceConnection connection) {
synchronized (connections) {
Iterator<IServiceConnection> iterator = connections.iterator();
while (iterator.hasNext()) {
IServiceConnection conn = iterator.next();
if (conn.asBinder() == connection.asBinder()) {
iterator.remove();
}
}
}
}
开发者ID:7763sea,项目名称:VirtualHook,代码行数:12,代码来源:ServiceRecord.java
示例16: bindService
import android.app.IServiceConnection; //导入依赖的package包/类
public int bindService(IApplicationThread caller, IBinder token, Intent service,
String resolvedType, IServiceConnection connection, int flags, String callingPackage,
int userId) throws TransactionTooLargeException {
try {
PreventRunningUtils.setSender(caller);
if (PreventRunningUtils.hookBindService(caller, token, service)) {
return bindService$Pr(caller, token, service,
resolvedType, connection, flags, callingPackage, userId);
} else {
return 0;
}
} finally {
PreventRunningUtils.clearSender();
}
}
开发者ID:brevent,项目名称:prevent,代码行数:16,代码来源:ActivityManagerService.java
示例17: removeDelegate
import android.app.IServiceConnection; //导入依赖的package包/类
public static IServiceConnection removeDelegate(Context context, ServiceConnection conn) {
IServiceConnection connection = null;
try{
Object loadApk = ContextImpl.mPackageInfo.get(VirtualCore.get().getContext());
connection = LoadedApk.forgetServiceDispatcher.call(loadApk, context, conn);
}catch (Exception e){
Log.e("ConnectionDelegate", "forgetServiceDispatcher", e);
}
if(connection == null){
return null;
}
return ServiceConnectionDelegate.removeDelegate(connection);
}
开发者ID:coding-dream,项目名称:TPlayer,代码行数:14,代码来源:ServiceConnectionDelegate.java
示例18: bindService
import android.app.IServiceConnection; //导入依赖的package包/类
public int bindService(Context context, Intent service, ServiceConnection connection, int flags) {
try {
IServiceConnection conn = ServiceConnectionDelegate.getDelegate(context, connection, flags);
return getService().bindService(null, null, service, null, conn, flags, 0);
} catch (RemoteException e) {
return VirtualRuntime.crash(e);
}
}
开发者ID:coding-dream,项目名称:TPlayer,代码行数:9,代码来源:VActivityManager.java
示例19: unbindService
import android.app.IServiceConnection; //导入依赖的package包/类
public boolean unbindService(Context context, ServiceConnection connection) {
try {
IServiceConnection conn = ServiceConnectionDelegate.removeDelegate(context, connection);
return getService().unbindService(conn, VUserHandle.myUserId());
} catch (RemoteException e) {
return VirtualRuntime.crash(e);
}
}
开发者ID:coding-dream,项目名称:TPlayer,代码行数:9,代码来源:VActivityManager.java
示例20: connectService
import android.app.IServiceConnection; //导入依赖的package包/类
private void connectService(IServiceConnection conn, ComponentName component, ServiceRecord.IntentBindRecord r,boolean dead) {
try {
BinderDelegateService delegateService = new BinderDelegateService(component, r.binder);
if (Build.VERSION.SDK_INT >= 26) {
IServiceConnectionO.connected.call(conn, component, delegateService, dead);
} else {
conn.connected(component, delegateService);
}
} catch (RemoteException e) {
e.printStackTrace();
}
}
开发者ID:coding-dream,项目名称:TPlayer,代码行数:13,代码来源:VActivityManagerService.java
注:本文中的android.app.IServiceConnection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论