android.os.TransactionTooLargeException#android.app.IServiceConnection源码实例Demo

下面列出了android.os.TransactionTooLargeException#android.app.IServiceConnection 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: container   文件: VActivityManagerService.java
@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);
                }
            }
        }
    }
}
 
源代码2 项目: android_9.0.0_r45   文件: ConnectionRecord.java
ConnectionRecord(AppBindRecord _binding, ActivityRecord _activity,
           IServiceConnection _conn, int _flags,
           int _clientLabel, PendingIntent _clientIntent) {
    binding = _binding;
    activity = _activity;
    conn = _conn;
    flags = _flags;
    clientLabel = _clientLabel;
    clientIntent = _clientIntent;
}
 
源代码3 项目: GPT   文件: ActivityManagerNativeWorker.java
public int bindService(IApplicationThread caller, IBinder token,
                       Intent service, String resolvedType,
                       IServiceConnection connection, int flags, int userId) {

    token = getActivityToken(token);

    RemapingUtil.remapServiceIntent(mHostContext, service);

    if (userId == INVALID_USER_ID) {
        return mTarget.bindService(caller, token, service, resolvedType, connection, flags);
    } else {
        return mTarget.bindService(caller, token, service, resolvedType, connection, flags, userId);
    }
}
 
源代码4 项目: GPT   文件: ActivityManagerNativeWorker.java
/**
 * android 6.0
 */
public int bindService(IApplicationThread caller, IBinder token, Intent service,
                       String resolvedType, IServiceConnection connection, int flags,
                       String callingPackage, int userId) {

    RemapingUtil.remapServiceIntent(mHostContext, service);

    return mTarget.bindService(caller, token, service, resolvedType, connection, flags, callingPackage, userId);
}
 
源代码5 项目: prevent   文件: ActivityManagerService.java
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();
    }
}
 
源代码6 项目: prevent   文件: ActivityManagerService.java
public int bindService(IApplicationThread caller, IBinder token,
                       Intent service, String resolvedType,
                       IServiceConnection connection, int flags, int userId) {
    try {
        PreventRunningUtils.setSender(caller);
        if (PreventRunningUtils.hookBindService(caller, token, service)) {
            return bindService$Pr(caller, token, service,
                    resolvedType, connection, flags, userId);
        } else {
            return 0;
        }
    } finally {
        PreventRunningUtils.clearSender();
    }
}
 
源代码7 项目: container   文件: ServiceConnectionDelegate.java
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;
}
 
源代码8 项目: container   文件: UnbindService.java
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
	IServiceConnection conn = (IServiceConnection) args[0];
	ServiceConnectionDelegate delegate = ServiceConnectionDelegate.removeDelegate(conn);
	if (delegate == null) {
		return method.invoke(who, args);
	}
	return VActivityManager.get().unbindService(delegate);
}
 
源代码9 项目: container   文件: BindService.java
@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];
	if (!VirtualCore.get().getComponentDelegate().onStartService(service)) return 0;
	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);
}
 
源代码10 项目: container   文件: VActivityManager.java
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);
    }
}
 
源代码11 项目: container   文件: VActivityManager.java
public boolean unbindService(IServiceConnection connection) {
    try {
        return getService().unbindService(connection, VUserHandle.myUserId());
    } catch (RemoteException e) {
        return VirtualRuntime.crash(e);
    }
}
 
源代码12 项目: container   文件: VActivityManagerService.java
private ServiceRecord findRecordLocked(IServiceConnection connection) {
    synchronized (mHistory) {
        for (ServiceRecord r : mHistory) {
            if (r.containConnection(connection)) {
                return r;
            }
        }
        return null;
    }
}
 
源代码13 项目: container   文件: VActivityManagerService.java
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();
    }
}
 
源代码14 项目: container   文件: ServiceRecord.java
public boolean containConnection(IServiceConnection connection) {
	for (IntentBindRecord record : bindings) {
		if (record.containConnection(connection)) {
			return true;
		}
	}
	return false;
}
 
源代码15 项目: container   文件: ServiceRecord.java
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);
}
 
源代码16 项目: container   文件: ServiceRecord.java
public boolean containConnection(IServiceConnection connection) {
	for (IServiceConnection con : connections) {
		if (con.asBinder() == connection.asBinder()) {
			return true;
		}
	}
	return false;
}
 
源代码17 项目: container   文件: ServiceRecord.java
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();
		}
	}
}
 
源代码18 项目: container   文件: ServiceRecord.java
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();
			}
		}
	}
}
 
源代码19 项目: android_9.0.0_r45   文件: ActiveServices.java
boolean unbindServiceLocked(IServiceConnection connection) {
    IBinder binder = connection.asBinder();
    if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "unbindService: conn=" + binder);
    ArrayList<ConnectionRecord> clist = mServiceConnections.get(binder);
    if (clist == null) {
        Slog.w(TAG, "Unbind failed: could not find connection for "
              + connection.asBinder());
        return false;
    }

    final long origId = Binder.clearCallingIdentity();
    try {
        while (clist.size() > 0) {
            ConnectionRecord r = clist.get(0);
            removeConnectionLocked(r, null, null);
            if (clist.size() > 0 && clist.get(0) == r) {
                // In case it didn't get removed above, do it now.
                Slog.wtf(TAG, "Connection " + r + " not removed for binder " + binder);
                clist.remove(0);
            }

            if (r.binding.service.app != null) {
                if (r.binding.service.app.whitelistManager) {
                    updateWhitelistManagerLocked(r.binding.service.app);
                }
                // This could have made the service less important.
                if ((r.flags&Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
                    r.binding.service.app.treatLikeActivity = true;
                    mAm.updateLruProcessLocked(r.binding.service.app,
                            r.binding.service.app.hasClientActivities
                            || r.binding.service.app.treatLikeActivity, null);
                }
                mAm.updateOomAdjLocked(r.binding.service.app, false);
            }
        }

        mAm.updateOomAdjLocked();

    } finally {
        Binder.restoreCallingIdentity(origId);
    }

    return true;
}
 
源代码20 项目: android_9.0.0_r45   文件: ContextWrapper.java
/**
 * @hide
 */
@Override
public IServiceConnection getServiceDispatcher(ServiceConnection conn, Handler handler,
        int flags) {
    return mBase.getServiceDispatcher(conn, handler, flags);
}
 
源代码21 项目: GPT   文件: ActivityManagerNativeWorker.java
public int bindService(IApplicationThread caller, IBinder token,
                       Intent service, String resolvedType,
                       IServiceConnection connection, int flags) {

    return bindService(caller, token, service, resolvedType, connection, flags, INVALID_USER_ID);
}
 
源代码22 项目: GPT   文件: ActivityManagerNativeWorker.java
public boolean unbindService(IServiceConnection connection) {
    return mTarget.unbindService(connection);
}
 
源代码23 项目: prevent   文件: ActivityManagerService.java
public int bindService$Pr(IApplicationThread caller, IBinder token, Intent service,
                          String resolvedType, IServiceConnection connection, int flags, String callingPackage,
                          int userId) throws TransactionTooLargeException {
    throw new UnsupportedOperationException();
}
 
源代码24 项目: prevent   文件: ActivityManagerService.java
public int bindService$Pr(IApplicationThread caller, IBinder token,
                          Intent service, String resolvedType,
                          IServiceConnection connection, int flags, int userId) {
    throw new UnsupportedOperationException();
}
 
源代码25 项目: container   文件: ServiceConnectionDelegate.java
private ServiceConnectionDelegate(IServiceConnection mConn) {
    this.mConn = mConn;
}
 
源代码26 项目: container   文件: ServiceConnectionDelegate.java
public static ServiceConnectionDelegate removeDelegate(IServiceConnection conn) {
    return DELEGATE_MAP.remove(conn.asBinder());
}
 
源代码27 项目: container   文件: ServiceRecord.java
private DeathRecipient(IntentBindRecord bindRecord, IServiceConnection connection) {
	this.bindRecord = bindRecord;
	this.connection = connection;
}
 
源代码28 项目: android_9.0.0_r45   文件: AppWidgetManager.java
/**
 * Binds the RemoteViewsService for a given appWidgetId and intent.
 *
 * The appWidgetId specified must already be bound to the calling AppWidgetHost via
 * {@link android.appwidget.AppWidgetManager#bindAppWidgetId AppWidgetManager.bindAppWidgetId()}.
 *
 * @param appWidgetId   The AppWidget instance for which to bind the RemoteViewsService.
 * @param intent        The intent of the service which will be providing the data to the
 *                      RemoteViewsAdapter.
 * @param connection    The callback interface to be notified when a connection is made or lost.
 * @param flags         Flags used for binding to the service
 *
 * @see Context#getServiceDispatcher(ServiceConnection, Handler, int)
 * @hide
 */
public boolean bindRemoteViewsService(Context context, int appWidgetId, Intent intent,
        IServiceConnection connection, @Context.BindServiceFlags int flags) {
    if (mService == null) {
        return false;
    }
    try {
        return mService.bindRemoteViewsService(context.getOpPackageName(), appWidgetId, intent,
                context.getIApplicationThread(), context.getActivityToken(), connection, flags);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}