Search in sources :

Example 1 with IVClient

use of com.lody.virtual.client.IVClient in project VirtualApp by asLody.

the class VActivityManagerService method attachClient.

private void attachClient(int pid, final IBinder clientBinder) {
    final IVClient client = IVClient.Stub.asInterface(clientBinder);
    if (client == null) {
        killProcess(pid);
        return;
    }
    IInterface thread = null;
    try {
        thread = ApplicationThreadNative.asInterface.call(client.getAppThread());
    } catch (RemoteException e) {
    // process has dead
    }
    if (thread == null) {
        killProcess(pid);
        return;
    }
    ProcessRecord app = null;
    try {
        IBinder token = client.getToken();
        if (token instanceof ProcessRecord) {
            app = (ProcessRecord) token;
        }
    } catch (RemoteException e) {
    // process has dead
    }
    if (app == null) {
        killProcess(pid);
        return;
    }
    try {
        final ProcessRecord record = app;
        clientBinder.linkToDeath(new DeathRecipient() {

            @Override
            public void binderDied() {
                clientBinder.unlinkToDeath(this, 0);
                onProcessDead(record);
            }
        }, 0);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    app.client = client;
    app.appThread = thread;
    app.pid = pid;
    synchronized (mProcessNames) {
        mProcessNames.put(app.processName, app.vuid, app);
        mPidsSelfLocked.put(app.pid, app);
    }
}
Also used : IBinder(android.os.IBinder) IInterface(android.os.IInterface) RemoteException(android.os.RemoteException) IVClient(com.lody.virtual.client.IVClient)

Aggregations

IBinder (android.os.IBinder)1 IInterface (android.os.IInterface)1 RemoteException (android.os.RemoteException)1 IVClient (com.lody.virtual.client.IVClient)1