Exemple #1
0
void DrmManager::onInfo(const DrmInfoEvent& event) {
    Mutex::Autolock _l(mLock);
    for (unsigned int index = 0; index < mServiceListeners.size(); index++) {
        int uniqueId = mServiceListeners.keyAt(index);

        if (uniqueId == event.getUniqueId()) {
            sp<IDrmServiceListener> serviceListener = mServiceListeners.valueFor(uniqueId);
            serviceListener->notify(event);
        }
    }
}
status_t BpDrmServiceListener::notify(const DrmInfoEvent& event) {
    Parcel data, reply;

    data.writeInterfaceToken(IDrmServiceListener::getInterfaceDescriptor());
    data.writeInt32(event.getUniqueId());
    data.writeInt32(event.getType());
    data.writeString8(event.getMessage());

    remote()->transact(NOTIFY, data, &reply);
    return reply.readInt32();
}
void JNIOnInfoListener::onInfo(const DrmInfoEvent& event) {
    jint uniqueId = event.getUniqueId();
    jint type = event.getType();
    JNIEnv *env = AndroidRuntime::getJNIEnv();
    jstring message = env->NewStringUTF(event.getMessage().string());
    ALOGV("JNIOnInfoListener::onInfo => %d | %d | %s", uniqueId, type, event.getMessage().string());

    env->CallStaticVoidMethod(
            mClass,
            env->GetStaticMethodID(mClass, "notify", "(Ljava/lang/Object;IILjava/lang/String;)V"),
            mObject, uniqueId, type, message);
}