diff options
Diffstat (limited to 'include/binder')
-rw-r--r-- | include/binder/IBatteryStats.h | 55 | ||||
-rw-r--r-- | include/binder/IBinder.h | 8 | ||||
-rw-r--r-- | include/binder/MemoryDealer.h | 3 | ||||
-rw-r--r-- | include/binder/Parcel.h | 10 |
4 files changed, 67 insertions, 9 deletions
diff --git a/include/binder/IBatteryStats.h b/include/binder/IBatteryStats.h new file mode 100644 index 0000000..f4a8aa3 --- /dev/null +++ b/include/binder/IBatteryStats.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_IBATTERYSTATS_H +#define ANDROID_IBATTERYSTATS_H + +#include <binder/IInterface.h> + +namespace android { + +// ---------------------------------------------------------------------- + +class IBatteryStats : public IInterface +{ +public: + DECLARE_META_INTERFACE(BatteryStats); + + virtual void noteStartSensor(int uid, int sensor) = 0; + virtual void noteStopSensor(int uid, int sensor) = 0; + + enum { + NOTE_START_SENSOR_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION, + NOTE_STOP_SENSOR_TRANSACTION, + }; +}; + +// ---------------------------------------------------------------------- + +class BnBatteryStats : public BnInterface<IBatteryStats> +{ +public: + virtual status_t onTransact( uint32_t code, + const Parcel& data, + Parcel* reply, + uint32_t flags = 0); +}; + +// ---------------------------------------------------------------------- + +}; // namespace android + +#endif // ANDROID_IBATTERYSTATS_H diff --git a/include/binder/IBinder.h b/include/binder/IBinder.h index 8b84951..43b6543 100644 --- a/include/binder/IBinder.h +++ b/include/binder/IBinder.h @@ -81,14 +81,6 @@ public: Parcel* reply, uint32_t flags = 0) = 0; - /** - * This method allows you to add data that is transported through - * IPC along with your IBinder pointer. When implementing a Binder - * object, override it to write your desired data in to @a outData. - * You can then call getConstantData() on your IBinder to retrieve - * that data, from any process. You MUST return the number of bytes - * written in to the parcel (including padding). - */ class DeathRecipient : public virtual RefBase { public: diff --git a/include/binder/MemoryDealer.h b/include/binder/MemoryDealer.h index 170f20d..aa415d5 100644 --- a/include/binder/MemoryDealer.h +++ b/include/binder/MemoryDealer.h @@ -34,7 +34,8 @@ class SimpleBestFitAllocator; class MemoryDealer : public RefBase { public: - MemoryDealer(size_t size, const char* name = 0); + MemoryDealer(size_t size, const char* name = 0, + uint32_t flags = 0 /* or bits such as MemoryHeapBase::READ_ONLY */ ); virtual sp<IMemory> allocate(size_t size); virtual void deallocate(size_t offset); diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h index ce630bd..548fbf8 100644 --- a/include/binder/Parcel.h +++ b/include/binder/Parcel.h @@ -129,6 +129,11 @@ public: // will be closed once the parcel is destroyed. status_t writeDupFileDescriptor(int fd); + // Writes a raw fd and optional comm channel fd to the parcel as a ParcelFileDescriptor. + // A dup's of the fds are made, which will be closed once the parcel is destroyed. + // Null values are passed as -1. + status_t writeParcelFileDescriptor(int fd, int commChannel = -1); + // Writes a blob to the parcel. // If the blob is small, then it is stored in-place, otherwise it is // transferred by way of an anonymous shared memory region. @@ -188,6 +193,11 @@ public: // in the parcel, which you do not own -- use dup() to get your own copy. int readFileDescriptor() const; + // Reads a ParcelFileDescriptor from the parcel. Returns the raw fd as + // the result, and the optional comm channel fd in outCommChannel. + // Null values are returned as -1. + int readParcelFileDescriptor(int& outCommChannel) const; + // Reads a blob from the parcel. // The caller should call release() on the blob after reading its contents. status_t readBlob(size_t len, ReadableBlob* outBlob) const; |