Java Code Examples for android.os.IBinder#queryLocalInterface()

The following examples show how to use android.os.IBinder#queryLocalInterface() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: springreplugin   File: ServiceWrapper.java    License: Apache License 2.0 6 votes vote down vote up
public static IBinder factory(Context context, String name, IBinder binder) {
    String descriptor = null;
    try {
        descriptor = binder.getInterfaceDescriptor();
    } catch (RemoteException e) {
        if (DEBUG) {
            Log.d(TAG, "getInterfaceDescriptor()", e);
        }
    }
    android.os.IInterface iin = binder.queryLocalInterface(descriptor);
    if (iin != null) {
        /**
         * If the requested interface has local implementation, meaning that
         * it's living in the same process as the one who requests for it,
         * return the binder directly since in such cases our wrapper does
         * not help in any way.
         */
        return binder;
    }
    return new ServiceWrapper(context, name, binder);
}
 
Example 2
/**
 * Cast a Binder object into a content resolver interface, generating
 * a proxy if needed.
 */
static public IBulkCursor asInterface(IBinder obj)
{
    if (obj == null) {
        return null;
    }
    IBulkCursor in = (IBulkCursor)obj.queryLocalInterface(descriptor);
    if (in != null) {
        return in;
    }

    return new BulkCursorProxy(obj);
}
 
Example 3
Source Project: unity-ads-android   File: AdvertisingId.java    License: Apache License 2.0 5 votes vote down vote up
public static GoogleAdvertisingInfo create(IBinder binder) {
	if (binder == null) {
		return null;
	}
	IInterface localIInterface = binder.queryLocalInterface(ADVERTISING_ID_SERVICE_NAME);
	if ((localIInterface != null) && ((localIInterface instanceof GoogleAdvertisingInfo))) {
		return (GoogleAdvertisingInfo) localIInterface;
	}
	return new GoogleAdvertisingInfoImplementation(binder);
}
 
Example 4
public static IXiaomiAuthService asInterface(IBinder ibinder)
{
    if (ibinder == null)
    {
        return null;
    }
    android.os.IInterface iinterface = ibinder.queryLocalInterface("miui.net.IXiaomiAuthService");
    if (iinterface != null && (iinterface instanceof IXiaomiAuthService))
    {
        return (IXiaomiAuthService)iinterface;
    } else
    {
        return new a(ibinder);
    }
}
 
Example 5
public static ICustomTabsService asInterface(IBinder obj) {
    if(obj == null) {
        return null;
    } else {
        IInterface iin = obj.queryLocalInterface("android.support.customtabs.ICustomTabsService");
        return (iin != null && iin instanceof ICustomTabsService?(ICustomTabsService)iin:new ICustomTabsService.Stub.Proxy(obj));
    }
}
 
Example 6
Source Project: android-art-res   File: BookManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Cast an IBinder object into an IBookManager interface, generating a proxy
 * if needed.
 */
public static IBookManager asInterface(IBinder obj) {
    if ((obj == null)) {
        return null;
    }
    android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
    if (((iin != null) && (iin instanceof IBookManager))) {
        return ((IBookManager) iin);
    }
    return new BookManagerImpl.Proxy(obj);
}
 
Example 7
public static ICustomTabsService asInterface(IBinder obj) {
    if(obj == null) {
        return null;
    } else {
        IInterface iin = obj.queryLocalInterface("android.support.customtabs.ICustomTabsService");
        return (iin != null && iin instanceof ICustomTabsService?(ICustomTabsService)iin:new ICustomTabsService.Stub.Proxy(obj));
    }
}
 
Example 8
public static IPostMessageService asInterface(IBinder obj) {
    if(obj == null) {
        return null;
    } else {
        IInterface iin = obj.queryLocalInterface("android.support.customtabs.IPostMessageService");
        return (iin != null && iin instanceof IPostMessageService?(IPostMessageService)iin:new IPostMessageService.Stub.Proxy(obj));
    }
}
 
Example 9
public static ICustomTabsService asInterface(IBinder obj) {
    if(obj == null) {
        return null;
    } else {
        IInterface iin = obj.queryLocalInterface("android.support.customtabs.ICustomTabsService");
        return (iin != null && iin instanceof ICustomTabsService?(ICustomTabsService)iin:new ICustomTabsService.Stub.Proxy(obj));
    }
}
 
Example 10
Source Project: letv   File: IDownloadService.java    License: Apache License 2.0 5 votes vote down vote up
public static IDownloadService asInterface(IBinder obj) {
    if (obj == null) {
        return null;
    }
    IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
    if (iin == null || !(iin instanceof IDownloadService)) {
        return new Proxy(obj);
    }
    return (IDownloadService) iin;
}
 
Example 11
Source Project: letv   File: RemoteDeviceManager.java    License: Apache License 2.0 5 votes vote down vote up
public static RemoteDeviceManager asInterface(IBinder obj) {
    if (obj == null) {
        return null;
    }
    IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
    if (iin == null || !(iin instanceof RemoteDeviceManager)) {
        return new Proxy(obj);
    }
    return (RemoteDeviceManager) iin;
}
 
Example 12
Source Project: letv   File: DeviceCallback.java    License: Apache License 2.0 5 votes vote down vote up
public static DeviceCallback asInterface(IBinder obj) {
    if (obj == null) {
        return null;
    }
    IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
    if (iin == null || !(iin instanceof DeviceCallback)) {
        return new Proxy(obj);
    }
    return (DeviceCallback) iin;
}
 
Example 13
public static IPostMessageService asInterface(IBinder obj) {
    if(obj == null) {
        return null;
    } else {
        IInterface iin = obj.queryLocalInterface("android.support.customtabs.IPostMessageService");
        return (iin != null && iin instanceof IPostMessageService?(IPostMessageService)iin:new IPostMessageService.Stub.Proxy(obj));
    }
}
 
Example 14
Source Project: letv   File: AIDLService.java    License: Apache License 2.0 5 votes vote down vote up
public static AIDLService asInterface(IBinder obj) {
    if (obj == null) {
        return null;
    }
    IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
    if (iin == null || !(iin instanceof AIDLService)) {
        return new Proxy(obj);
    }
    return (AIDLService) iin;
}
 
Example 15
Source Project: letv   File: AIDLActivity.java    License: Apache License 2.0 5 votes vote down vote up
public static AIDLActivity asInterface(IBinder obj) {
    if (obj == null) {
        return null;
    }
    IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
    if (iin == null || !(iin instanceof AIDLActivity)) {
        return new Proxy(obj);
    }
    return (AIDLActivity) iin;
}
 
Example 16
Source Project: VirtualAPK   File: BookManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Cast an IBinder object into an IBookManager interface, generating a proxy
 * if needed.
 */
public static IBookManager asInterface(IBinder obj) {
    if ((obj == null)) {
        return null;
    }
    android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
    if (((iin != null) && (iin instanceof IBookManager))) {
        return ((IBookManager) iin);
    }
    return new BookManagerImpl.Proxy(obj);
}
 
Example 17
Source Project: letv   File: RubbishScanListenerStub.java    License: Apache License 2.0 5 votes vote down vote up
public static IRubbishScanListener asInterface(IBinder binder) {
    if (binder == null) {
        return null;
    }
    IInterface iInterface = binder.queryLocalInterface(DESCRIPTOR);
    if (iInterface == null || !(iInterface instanceof IRubbishScanListener)) {
        return new RubbishScanListenerProxy(binder);
    }
    return (IRubbishScanListener) iInterface;
}
 
Example 18
Source Project: letv   File: IResultReceiver.java    License: Apache License 2.0 5 votes vote down vote up
public static IResultReceiver asInterface(IBinder obj) {
    if (obj == null) {
        return null;
    }
    IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
    if (iin == null || !(iin instanceof IResultReceiver)) {
        return new Proxy(obj);
    }
    return (IResultReceiver) iin;
}
 
Example 19
Source Project: letv   File: INotificationSideChannel.java    License: Apache License 2.0 5 votes vote down vote up
public static INotificationSideChannel asInterface(IBinder obj) {
    if (obj == null) {
        return null;
    }
    IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
    if (iin == null || !(iin instanceof INotificationSideChannel)) {
        return new Proxy(obj);
    }
    return (INotificationSideChannel) iin;
}
 
Example 20
public static ICustomTabsCallback asInterface(IBinder obj) {
    if(obj == null) {
        return null;
    } else {
        IInterface iin = obj.queryLocalInterface("android.support.customtabs.ICustomTabsCallback");
        return (iin != null && iin instanceof ICustomTabsCallback?(ICustomTabsCallback)iin:new ICustomTabsCallback.Stub.Proxy(obj));
    }
}