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

The following examples show how to use android.os.IBinder#queryLocalInterface() . 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 check out the related API usage on the sidebar.
Example 1
Source File: ServiceWrapper.java    From springreplugin with 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
Source File: RemoteDeviceManager.java    From letv with 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 3
Source File: ICustomTabsCallback.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
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));
    }
}
 
Example 4
Source File: INotificationSideChannel.java    From letv with 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 5
Source File: IResultReceiver.java    From letv with 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 6
Source File: RubbishScanListenerStub.java    From letv with 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 7
Source File: BookManagerImpl.java    From VirtualAPK with 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 8
Source File: AIDLActivity.java    From letv with 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 9
Source File: AIDLService.java    From letv with 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 10
Source File: IPostMessageService.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
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 11
Source File: DeviceCallback.java    From letv with 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 12
Source File: BulkCursorNative.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * 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 13
Source File: IDownloadService.java    From letv with 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 14
Source File: ICustomTabsService.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
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 15
Source File: IPostMessageService.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
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 16
Source File: ICustomTabsService.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
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 17
Source File: BookManagerImpl.java    From android-art-res with 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 18
Source File: ICustomTabsService.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
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 19
Source File: IXiaomiAuthService$Stub.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
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 20
Source File: AdvertisingId.java    From unity-ads-android with 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);
}