virtual status_t acquireWakeLockWithUid(int flags, const sp<IBinder>& lock, const String16& tag,
                                            const String16& packageName, int uid, bool isOneWay)
    {
        Parcel data, reply;
        data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());

        data.writeStrongBinder(lock);
        data.writeInt32(flags);
        data.writeString16(tag);
        data.writeString16(packageName);
        data.writeInt32(uid); // uid to blame for the work
        return remote()->transact(ACQUIRE_WAKE_LOCK_UID, data, &reply,
                                  isOneWay ? IBinder::FLAG_ONEWAY : 0);
    }
 // generic data callback from camera service to app with image data
 void dataCallback(int32_t msgType, const sp<IMemory>& imageData,
                   camera_frame_metadata_t *metadata)
 {
     ALOGV("dataCallback");
     Parcel data, reply;
     data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
     data.writeInt32(msgType);
     data.writeStrongBinder(imageData->asBinder());
     if (metadata) {
         data.writeInt32(metadata->number_of_faces);
         data.write(metadata->faces, sizeof(camera_face_t) * metadata->number_of_faces);
     }
     remote()->transact(DATA_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY);
 }
    virtual status_t getStreamVolumeIndex(audio_stream_type_t stream,
                                          int *index,
                                          audio_devices_t device)
    {
        Parcel data, reply;
        data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
        data.writeInt32(static_cast <uint32_t>(stream));
        data.writeInt32(static_cast <uint32_t>(device));

        remote()->transact(GET_STREAM_VOLUME, data, &reply);
        int lIndex = reply.readInt32();
        if (index) *index = lIndex;
        return static_cast <status_t> (reply.readInt32());
    }
 int
 BpCloudManager::add(int a, int b) {
     printf("Client call server add method\n");
     Parcel data, reply;
     data.writeInterfaceToken(ICloudManager::getInterfaceDescriptor());
     data.writeInt32(a);
     data.writeInt32(b);
     remote()->transact(ADD, data, &reply);
     int code = reply.readExceptionCode();
     int result;
     reply.readInt32(&result);
     printf("Server exepction code: %d\n", code);
     return result;
 }
 virtual status_t acquireBuffer(BufferItem *buffer, nsecs_t presentWhen) {
     Parcel data, reply;
     data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
     data.writeInt64(presentWhen);
     status_t result = remote()->transact(ACQUIRE_BUFFER, data, &reply);
     if (result != NO_ERROR) {
         return result;
     }
     result = reply.read(*buffer);
     if (result != NO_ERROR) {
         return result;
     }
     return reply.readInt32();
 }
 virtual status_t setCrop(const Rect& reg) {
     Parcel data, reply;
     data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
     data.writeFloat(reg.left);
     data.writeFloat(reg.top);
     data.writeFloat(reg.right);
     data.writeFloat(reg.bottom);
     status_t result = remote()->transact(SET_CROP, data, &reply);
     if (result != NO_ERROR) {
         return result;
     }
     result = reply.readInt32();
     return result;
 }
Esempio n. 7
0
    status_t takePicture(int msgType)
#endif
    {
        ALOGV("takePicture: 0x%x", msgType);
        Parcel data, reply;
        data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
        data.writeInt32(msgType);
#ifdef OMAP_ENHANCEMENT_CPCAM
        data.writeString8(params);
#endif
        remote()->transact(TAKE_PICTURE, data, &reply);
        status_t ret = reply.readInt32();
        return ret;
    }
    virtual void addResource(
            int pid,
            int64_t clientId,
            const sp<IResourceManagerClient> client,
            const Vector<MediaResource> &resources) {
        Parcel data, reply;
        data.writeInterfaceToken(IResourceManagerService::getInterfaceDescriptor());
        data.writeInt32(pid);
        data.writeInt64(clientId);
        data.writeStrongBinder(IInterface::asBinder(client));
        writeToParcel(&data, resources);

        remote()->transact(ADD_RESOURCE, data, &reply);
    }
Esempio n. 9
0
void ResourceCache::LoadBombResources(const TiXmlHandle& hndl)
{
   const Size size = mAppConfig.GetCellSize();
   const auto len = mAppConfig.GetBombLifetime();

   BombResource countdown(BombType::Countdown);
   countdown.SetFrames(len, LoadTextures(hndl, "Countdown", size));

   BombResource remote(BombType::Remote);
   remote.SetFrames(len, LoadTextures(hndl, "Remote", size));

   mBombRes.insert({ countdown.GetType(), countdown });
   mBombRes.insert({ remote.GetType(), remote });
}
 virtual status_t releaseBuffer(int buf, uint64_t frameNumber,
         EGLDisplay display, EGLSyncKHR fence,
         const sp<Fence>& releaseFence) {
     Parcel data, reply;
     data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
     data.writeInt32(buf);
     data.writeInt64(frameNumber);
     data.write(*releaseFence);
     status_t result = remote()->transact(RELEASE_BUFFER, data, &reply);
     if (result != NO_ERROR) {
         return result;
     }
     return reply.readInt32();
 }
 virtual status_t queueBuffer(int buf,
         const QueueBufferInput& input, QueueBufferOutput* output) {
     Parcel data, reply;
     data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
     data.writeInt32(buf);
     memcpy(data.writeInplace(sizeof(input)), &input, sizeof(input));
     status_t result = remote()->transact(QUEUE_BUFFER, data, &reply);
     if (result != NO_ERROR) {
         return result;
     }
     memcpy(output, reply.readInplace(sizeof(*output)), sizeof(*output));
     result = reply.readInt32();
     return result;
 }
    sp<IMemory> extractAlbumArt()
    {
        Parcel data, reply;
        data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor());
#ifndef DISABLE_GROUP_SCHEDULE_HACK
        sendSchedPolicy(data);
#endif
        remote()->transact(EXTRACT_ALBUM_ART, data, &reply);
        status_t ret = reply.readInt32();
        if (ret != NO_ERROR) {
            return NULL;
        }
        return interface_cast<IMemory>(reply.readStrongBinder());
    }
 virtual status_t discardFreeBuffers() {
     Parcel data, reply;
     data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
     status_t error = remote()->transact(DISCARD_FREE_BUFFERS, data, &reply);
     if (error != NO_ERROR) {
         return error;
     }
     int32_t result = NO_ERROR;
     error = reply.readInt32(&result);
     if (error != NO_ERROR) {
         return error;
     }
     return result;
 }
 virtual status_t getReleasedBuffers(uint64_t* slotMask) {
     Parcel data, reply;
     if (slotMask == NULL) {
         ALOGE("getReleasedBuffers: slotMask must not be NULL");
         return BAD_VALUE;
     }
     data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
     status_t result = remote()->transact(GET_RELEASED_BUFFERS, data, &reply);
     if (result != NO_ERROR) {
         return result;
     }
     *slotMask = static_cast<uint64_t>(reply.readInt64());
     return reply.readInt32();
 }
 virtual status_t updateBuffersGeometry(int w, int h, int f) {
     Parcel data, reply;
     data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
     data.writeInt32(w);
     data.writeInt32(h);
     data.writeInt32(f);
     status_t result = remote()->transact(UPDATE_BUFFERS_GEOMETRY,
                                                       data, &reply);
     if (result != NO_ERROR) {
         return result;
     }
     result = reply.readInt32();
     return result;
 }
    void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& imageData)
#endif
    {
        LOGV("dataCallback");
        Parcel data, reply;
        data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
        data.writeInt64(timestamp);
        data.writeInt32(msgType);
#ifdef OMAP_ENHANCEMENT
        data.writeInt32(offset);
        data.writeInt32(stride);
#endif
        data.writeStrongBinder(imageData->asBinder());
        remote()->transact(DATA_CALLBACK_TIMESTAMP, data, &reply, IBinder::FLAG_ONEWAY);
    }
    virtual status_t createStream(const OutputConfiguration& outputConfiguration)
    {
        Parcel data, reply;
        data.writeInterfaceToken(ICameraDeviceUser::getInterfaceDescriptor());
        if (outputConfiguration.getGraphicBufferProducer() != NULL) {
            data.writeInt32(1); // marker that OutputConfiguration is not null. Mimic aidl behavior
            outputConfiguration.writeToParcel(data);
        } else {
            data.writeInt32(0);
        }
        remote()->transact(CREATE_STREAM, data, &reply);

        reply.readExceptionCode();
        return reply.readInt32();
    }
 virtual status_t connect(const sp<IBinder>& token,
         int api, bool producerControlledByApp, QueueBufferOutput* output) {
     Parcel data, reply;
     data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
     data.writeStrongBinder(token);
     data.writeInt32(api);
     data.writeInt32(producerControlledByApp);
     status_t result = remote()->transact(CONNECT, data, &reply);
     if (result != NO_ERROR) {
         return result;
     }
     memcpy(output, reply.readInplace(sizeof(*output)), sizeof(*output));
     result = reply.readInt32();
     return result;
 }
Esempio n. 19
0
    virtual status_t connectFeatureManager(sp<NSCam::IFeatureManager> & featureManager)
    {
        Parcel data, reply;
        data.writeInterfaceToken(IMMSdkService::getInterfaceDescriptor());
        remote()->transact(BnMMSdkService::GET_MMSDK_FEAUTRE_MANAGER, data, &reply);

        if (readExceptionCode(reply)) return -EPROTO;
        status_t status = reply.readInt32(); 
        if (reply.readInt32() != 0)
        {
            featureManager = interface_cast<NSCam::IFeatureManager>(reply.readStrongBinder());             
        }
 
        return status;
    }
Esempio n. 20
0
    virtual status_t connectEffect(String16 const &clientName, sp<NSEffect::IEffectUser>& client )
    {
        Parcel data, reply;
        data.writeInterfaceToken(IMMSdkService::getInterfaceDescriptor());
        data.writeString16(clientName); 
        remote()->transact(BnMMSdkService::CONNECT_EFFECT, data, &reply);

        if (readExceptionCode(reply)) return -EPROTO;
        status_t status = reply.readInt32();
        if (reply.readInt32() != 0)
        {
            client = interface_cast<NSEffect::IEffectUser>(reply.readStrongBinder()); 
        }
        return status;
    }
 virtual Vector<Sensor> getSensorList()
 {
     Parcel data, reply;
     data.writeInterfaceToken(ISensorServer::getInterfaceDescriptor());
     remote()->transact(GET_SENSOR_LIST, data, &reply);
     Sensor s;
     Vector<Sensor> v;
     int32_t n = reply.readInt32();
     v.setCapacity(n);
     while (n--) {
         reply.read(s);
         v.add(s);
     }
     return v;
 }
    // get information about a camera
    virtual status_t getCameraInfo(int cameraId,
                                   struct CameraInfo* cameraInfo) {
        Parcel data, reply;
        data.writeInterfaceToken(ICameraService::getInterfaceDescriptor());
        data.writeInt32(cameraId);
        remote()->transact(BnCameraService::GET_CAMERA_INFO, data, &reply);

        if (readExceptionCode(reply)) return -EPROTO;
        status_t result = reply.readInt32();
        if (reply.readInt32() != 0) {
            cameraInfo->facing = reply.readInt32();
            cameraInfo->orientation = reply.readInt32();
        }
        return result;
    }
Esempio n. 23
0
 // generic callback from camera service to app
 void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2)
 {
     ALOGV("notifyCallback");
     Parcel data, reply;
     data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
     data.writeInt32(msgType);
     data.writeInt32(ext1);
     if ((msgType == CAMERA_MSG_PREVIEW_FRAME) && (ext1 == CAMERA_FRAME_DATA_FD)) {
         ALOGD("notifyCallback: CAMERA_MSG_PREVIEW_FRAME fd = %d", ext2);
         data.writeFileDescriptor(ext2);
     } else {
         data.writeInt32(ext2);
     }
     remote()->transact(NOTIFY_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY);
 }
Esempio n. 24
0
    virtual void onKeyEvent(sp<KeyEvent> keyEvent)
    {
        Parcel _data;
        Parcel _reply;

        _data.writeInterfaceToken(this->getInterfaceDescriptor());
        keyEvent->writeToParcel(&_data, 0);
        remote()->transact(TRANSACTION_wmOnKeyEvent, _data, &_reply, 0);
        _reply.readExceptionCode();
        if ((0!=_reply.readInt32())) {
        }
        else {
            // ERROR
        }
    }
Esempio n. 25
0
    virtual status_t connectHeartrate(sp<NSHeartrate::IHeartrateUser>& client)
    {
        Parcel data, reply;
        data.writeInterfaceToken(IMMSdkService::getInterfaceDescriptor());
        remote()->transact(BnMMSdkService::CONNECT_HEARTRATE, data, &reply);

        if (readExceptionCode(reply)) return -EPROTO;
        status_t status = reply.readInt32(); 
        if (reply.readInt32() != 0)
        {
            client = interface_cast<NSHeartrate::IHeartrateUser>(reply.readStrongBinder());             
        }
 
        return status;
    }
 virtual status_t connect(int api,
         uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
     Parcel data, reply;
     data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
     data.writeInt32(api);
     status_t result = remote()->transact(CONNECT, data, &reply);
     if (result != NO_ERROR) {
         return result;
     }
     *outWidth = reply.readInt32();
     *outHeight = reply.readInt32();
     *outTransform = reply.readInt32();
     result = reply.readInt32();
     return result;
 }
 virtual void setTransactionState(const Vector<ComposerState>& state,
         int orientation, uint32_t flags)
 {
     Parcel data, reply;
     data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
     Vector<ComposerState>::const_iterator b(state.begin());
     Vector<ComposerState>::const_iterator e(state.end());
     data.writeInt32(state.size());
     for ( ; b != e ; ++b ) {
         b->write(data);
     }
     data.writeInt32(orientation);
     data.writeInt32(flags);
     remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply);
 }
    virtual ssize_t findCodecByType(
            const char *type, bool encoder, size_t startIndex = 0) const
    {
        if (startIndex > INT32_MAX) {
            return NAME_NOT_FOUND;
        }

        Parcel data, reply;
        data.writeInterfaceToken(IMediaCodecList::getInterfaceDescriptor());
        data.writeCString(type);
        data.writeInt32(encoder);
        data.writeInt32(startIndex);
        remote()->transact(FIND_CODEC_BY_TYPE, data, &reply);
        return static_cast<ssize_t>(reply.readInt32());
    }
Esempio n. 29
0
    virtual status_t createPlugin(
            const uint8_t uuid[16], const void *opaqueData, size_t opaqueSize) {
        Parcel data, reply;
        data.writeInterfaceToken(ICrypto::getInterfaceDescriptor());
        data.write(uuid, 16);
        data.writeInt32(opaqueSize);

        if (opaqueSize > 0) {
            data.write(opaqueData, opaqueSize);
        }

        remote()->transact(CREATE_PLUGIN, data, &reply);

        return reply.readInt32();
    }
 virtual void notify(int msg, const Parcel *obj)
 {
     Parcel data, reply;
     size_t objParcelSize = 0;
     data.writeInterfaceToken(IListenReceiver::getInterfaceDescriptor());
     data.writeInt32(msg);
     if (obj) {
        objParcelSize = obj->dataSize();
        if (obj->dataSize() > 0)
         data.appendFrom(const_cast<Parcel *>(obj), 0, objParcelSize);
     }
     ALOGD("BnListenReceiver::notify - type = %d, parcelSize = %d, should be payloadSize plus 4",
                  msg, objParcelSize);
     remote()->transact(NOTIFY, data, &reply, IBinder::FLAG_ONEWAY);
 }