FileDocCategorySizeDatePackage
ContentServiceNative.javaAPI DocAndroid 1.5 API6945Wed May 06 22:41:54 BST 2009android.content

ContentServiceNative

public abstract class ContentServiceNative extends android.os.Binder implements IContentService
{@hide}

Fields Summary
private static IContentService
gDefault
Constructors Summary
public ContentServiceNative()

        attachInterface(this, descriptor);
    
Methods Summary
public android.os.IBinderasBinder()

        return this;
    
public static IContentServiceasInterface(android.os.IBinder obj)
Cast a Binder object into a content resolver interface, generating a proxy if needed.

        if (obj == null) {
            return null;
        }
        IContentService in =
            (IContentService)obj.queryLocalInterface(descriptor);
        if (in != null) {
            return in;
        }

        return new ContentServiceProxy(obj);
    
public static IContentServicegetDefault()
Retrieve the system's default/global content service.

        if (gDefault != null) {
            return gDefault;
        }
        IBinder b = ServiceManager.getService("content");
        if (Config.LOGV) Log.v("ContentService", "default service binder = " + b);
        gDefault = asInterface(b);
        if (Config.LOGV) Log.v("ContentService", "default service = " + gDefault);
        return gDefault;
    
public booleanonTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags)

        try {
        switch (code) {
            case 5038: {
                data.readString(); // ignore the interface token that service generated
                Uri uri = Uri.parse(data.readString());
                notifyChange(uri, null, false, false);
                return true;
            }
            
            case REGISTER_CONTENT_OBSERVER_TRANSACTION: {
                Uri uri = Uri.CREATOR.createFromParcel(data);
                boolean notifyForDescendents = data.readInt() != 0;
                IContentObserver observer = IContentObserver.Stub.asInterface(data.readStrongBinder());
                registerContentObserver(uri, notifyForDescendents, observer);
                return true;
            }

            case UNREGISTER_CHANGE_OBSERVER_TRANSACTION: {
                IContentObserver observer = IContentObserver.Stub.asInterface(data.readStrongBinder());
                unregisterContentObserver(observer);
                return true;
            }

            case NOTIFY_CHANGE_TRANSACTION: {
                Uri uri = Uri.CREATOR.createFromParcel(data);
                IContentObserver observer = IContentObserver.Stub.asInterface(data.readStrongBinder());
                boolean observerWantsSelfNotifications = data.readInt() != 0;
                boolean syncToNetwork = data.readInt() != 0;
                notifyChange(uri, observer, observerWantsSelfNotifications, syncToNetwork);
                return true;
            }

            case START_SYNC_TRANSACTION: {
                Uri url = null;
                int hasUrl = data.readInt();
                if (hasUrl != 0) {
                    url = Uri.CREATOR.createFromParcel(data);
                }
                startSync(url, data.readBundle());
                return true;
            }

            case CANCEL_SYNC_TRANSACTION: {
                Uri url = null;
                int hasUrl = data.readInt();
                if (hasUrl != 0) {
                    url = Uri.CREATOR.createFromParcel(data);
                }
                cancelSync(url);
                return true;
            }

            default:
                return super.onTransact(code, data, reply, flags);
        }
        } catch (Exception e) {
            Log.e("ContentServiceNative", "Caught exception in transact", e);
        }

        return false;