ContentServiceNativepublic abstract class ContentServiceNative extends android.os.Binder implements IContentService
Fields Summary |
---|
private static IContentService | gDefault |
Constructors Summary |
---|
public ContentServiceNative()
attachInterface(this, descriptor);
|
Methods Summary |
---|
public android.os.IBinder | asBinder()
return this;
| public static IContentService | asInterface(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 IContentService | getDefault()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 boolean | onTransact(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;
|
|