summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/batteryservice/BatteryService.h16
-rw-r--r--include/batteryservice/IBatteryPropertiesRegistrar.h2
-rw-r--r--include/binder/IBatteryStats.h55
-rw-r--r--include/binder/IBinder.h8
-rw-r--r--include/binder/Parcel.h10
-rw-r--r--include/gui/BufferItemConsumer.h3
-rw-r--r--include/gui/BufferQueue.h27
-rw-r--r--include/gui/IGraphicBufferConsumer.h90
-rw-r--r--include/gui/IGraphicBufferProducer.h193
-rw-r--r--include/input/IInputFlinger.h54
-rw-r--r--include/input/Input.h28
-rw-r--r--include/input/InputDevice.h5
-rw-r--r--include/input/KeyLayoutMap.h10
-rw-r--r--include/input/Keyboard.h10
-rw-r--r--include/input/KeycodeLabels.h22
-rw-r--r--include/media/hardware/HDCPAPI.h5
-rw-r--r--include/powermanager/PowerManager.h8
-rw-r--r--include/ui/PixelFormat.h16
-rw-r--r--include/ui/Region.h3
19 files changed, 501 insertions, 64 deletions
diff --git a/include/batteryservice/BatteryService.h b/include/batteryservice/BatteryService.h
index 829061a346..7ae13425ed 100644
--- a/include/batteryservice/BatteryService.h
+++ b/include/batteryservice/BatteryService.h
@@ -43,6 +43,13 @@ enum {
BATTERY_HEALTH_COLD = 7, // equals BatteryManager.BATTERY_HEALTH_COLD constant
};
+// must be kept in sync with definitions in BatteryProperty.java
+enum {
+ BATTERY_PROP_CHARGE_COUNTER = 1, // equals BatteryProperty.BATTERY_PROP_CHARGE_COUNTER constant
+ BATTERY_PROP_CURRENT_NOW = 2, // equals BatteryProperty.BATTERY_PROP_CURRENT_NOW constant
+ BATTERY_PROP_CURRENT_AVG = 3, // equals BatteryProperty.BATTERY_PROP_CURRENT_AVG constant
+};
+
struct BatteryProperties {
bool chargerAcOnline;
bool chargerUsbOnline;
@@ -52,8 +59,6 @@ struct BatteryProperties {
bool batteryPresent;
int batteryLevel;
int batteryVoltage;
- int batteryCurrentNow;
- int batteryChargeCounter;
int batteryTemperature;
String8 batteryTechnology;
@@ -61,6 +66,13 @@ struct BatteryProperties {
status_t readFromParcel(Parcel* parcel);
};
+struct BatteryProperty {
+ int valueInt;
+
+ status_t writeToParcel(Parcel* parcel) const;
+ status_t readFromParcel(Parcel* parcel);
+};
+
}; // namespace android
#endif // ANDROID_BATTERYSERVICE_H
diff --git a/include/batteryservice/IBatteryPropertiesRegistrar.h b/include/batteryservice/IBatteryPropertiesRegistrar.h
index 8d28b1d35f..eca075d7ef 100644
--- a/include/batteryservice/IBatteryPropertiesRegistrar.h
+++ b/include/batteryservice/IBatteryPropertiesRegistrar.h
@@ -26,6 +26,7 @@ namespace android {
enum {
REGISTER_LISTENER = IBinder::FIRST_CALL_TRANSACTION,
UNREGISTER_LISTENER,
+ GET_PROPERTY,
};
class IBatteryPropertiesRegistrar : public IInterface {
@@ -34,6 +35,7 @@ public:
virtual void registerListener(const sp<IBatteryPropertiesListener>& listener) = 0;
virtual void unregisterListener(const sp<IBatteryPropertiesListener>& listener) = 0;
+ virtual status_t getProperty(int id, struct BatteryProperty *val) = 0;
};
class BnBatteryPropertiesRegistrar : public BnInterface<IBatteryPropertiesRegistrar> {
diff --git a/include/binder/IBatteryStats.h b/include/binder/IBatteryStats.h
new file mode 100644
index 0000000000..f4a8aa33cb
--- /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 8b849513b0..43b654334b 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/Parcel.h b/include/binder/Parcel.h
index ed2e7df2c3..e9966fec64 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -128,6 +128,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.
@@ -187,6 +192,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;
diff --git a/include/gui/BufferItemConsumer.h b/include/gui/BufferItemConsumer.h
index 52edf17fe4..2c58ca5e2f 100644
--- a/include/gui/BufferItemConsumer.h
+++ b/include/gui/BufferItemConsumer.h
@@ -44,6 +44,7 @@ class BufferItemConsumer: public ConsumerBase
typedef BufferQueue::BufferItem BufferItem;
+ enum { MIN_UNDEQUEUED_BUFFERS = -1 };
enum { INVALID_BUFFER_SLOT = BufferQueue::INVALID_BUFFER_SLOT };
enum { NO_BUFFER_AVAILABLE = BufferQueue::NO_BUFFER_AVAILABLE };
@@ -54,7 +55,7 @@ class BufferItemConsumer: public ConsumerBase
// controlledByApp tells whether this consumer is controlled by the
// application.
BufferItemConsumer(const sp<BufferQueue>& bq, uint32_t consumerUsage,
- int bufferCount = BufferQueue::MIN_UNDEQUEUED_BUFFERS,
+ int bufferCount = MIN_UNDEQUEUED_BUFFERS,
bool controlledByApp = false);
virtual ~BufferItemConsumer();
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
index 408956b6e7..15dc64524d 100644
--- a/include/gui/BufferQueue.h
+++ b/include/gui/BufferQueue.h
@@ -41,11 +41,16 @@ class BufferQueue : public BnGraphicBufferProducer,
public BnGraphicBufferConsumer,
private IBinder::DeathRecipient {
public:
- enum { MIN_UNDEQUEUED_BUFFERS = 2 };
+ // BufferQueue will keep track of at most this value of buffers.
+ // Attempts at runtime to increase the number of buffers past this will fail.
enum { NUM_BUFFER_SLOTS = 32 };
- enum { NO_CONNECTED_API = 0 };
- enum { INVALID_BUFFER_SLOT = -1 };
- enum { STALE_BUFFER_SLOT = 1, NO_BUFFER_AVAILABLE, PRESENT_LATER };
+ // Used as a placeholder slot# when the value isn't pointing to an existing buffer.
+ enum { INVALID_BUFFER_SLOT = IGraphicBufferConsumer::BufferItem::INVALID_BUFFER_SLOT };
+ // Alias to <IGraphicBufferConsumer.h> -- please scope from there in future code!
+ enum {
+ NO_BUFFER_AVAILABLE = IGraphicBufferConsumer::NO_BUFFER_AVAILABLE,
+ PRESENT_LATER = IGraphicBufferConsumer::PRESENT_LATER,
+ };
// When in async mode we reserve two slots in order to guarantee that the
// producer and consumer can run asynchronously.
@@ -75,7 +80,6 @@ public:
wp<ConsumerListener> mConsumerListener;
};
-
// BufferQueue manages a pool of gralloc memory slots to be used by
// producers and consumers. allocator is used to allocate all the
// needed gralloc buffers.
@@ -103,7 +107,7 @@ public:
//
// This will fail if the producer has dequeued any buffers, or if
// bufferCount is invalid. bufferCount must generally be a value
- // between the minimum undequeued buffer count and NUM_BUFFER_SLOTS
+ // between the minimum undequeued buffer count (exclusive) and NUM_BUFFER_SLOTS
// (inclusive). It may also be set to zero (the default) to indicate
// that the producer does not wish to set a value. The minimum value
// can be obtained by calling query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS,
@@ -212,7 +216,7 @@ public:
*/
// acquireBuffer attempts to acquire ownership of the next pending buffer in
- // the BufferQueue. If no buffer is pending then it returns -EINVAL. If a
+ // the BufferQueue. If no buffer is pending then it returns NO_BUFFER_AVAILABLE. If a
// buffer is successfully acquired, the information about the buffer is
// returned in BufferItem. If the buffer returned had previously been
// acquired then the BufferItem::mGraphicBuffer field of buffer is set to
@@ -224,7 +228,7 @@ public:
// future, the buffer won't be acquired, and PRESENT_LATER will be
// returned. The presentation time is in nanoseconds, and the time base
// is CLOCK_MONOTONIC.
- virtual status_t acquireBuffer(BufferItem *buffer, nsecs_t presentWhen);
+ virtual status_t acquireBuffer(BufferItem* buffer, nsecs_t presentWhen);
// releaseBuffer releases a buffer slot from the consumer back to the
// BufferQueue. This may be done while the buffer's contents are still
@@ -312,8 +316,13 @@ public:
// dump our state in a String
virtual void dump(String8& result, const char* prefix) const;
-
private:
+ // The default API number used to indicate no producer client is connected.
+ enum { NO_CONNECTED_API = 0 };
+
+ // Aliases for using enums from <IGraphicBufferConsumer.h>
+ enum { STALE_BUFFER_SLOT = IGraphicBufferConsumer::STALE_BUFFER_SLOT };
+
// freeBufferLocked frees the GraphicBuffer and sync resources for the
// given slot.
void freeBufferLocked(int index);
diff --git a/include/gui/IGraphicBufferConsumer.h b/include/gui/IGraphicBufferConsumer.h
index 0e35f1371e..9a6645cf21 100644
--- a/include/gui/IGraphicBufferConsumer.h
+++ b/include/gui/IGraphicBufferConsumer.h
@@ -48,6 +48,7 @@ public:
status_t unflatten(void const*& buffer, size_t& size, int const*& fds, size_t& count);
public:
+ // The default value of mBuf, used to indicate this doesn't correspond to a slot.
enum { INVALID_BUFFER_SLOT = -1 };
BufferItem();
@@ -63,13 +64,17 @@ public:
Rect mCrop;
// mTransform is the current transform flags for this buffer slot.
+ // refer to NATIVE_WINDOW_TRANSFORM_* in <window.h>
uint32_t mTransform;
// mScalingMode is the current scaling mode for this buffer slot.
+ // refer to NATIVE_WINDOW_SCALING_* in <window.h>
uint32_t mScalingMode;
// mTimestamp is the current timestamp for this buffer slot. This gets
- // to set by queueBuffer each time this slot is queued.
+ // to set by queueBuffer each time this slot is queued. This value
+ // is guaranteed to be monotonically increasing for each newly
+ // acquired buffer.
int64_t mTimestamp;
// mIsAutoTimestamp indicates whether mTimestamp was generated
@@ -79,7 +84,7 @@ public:
// mFrameNumber is the number of the queued frame for this slot.
uint64_t mFrameNumber;
- // mBuf is the slot index of this buffer
+ // mBuf is the slot index of this buffer (default INVALID_BUFFER_SLOT).
int mBuf;
// mIsDroppable whether this buffer was queued with the
@@ -97,21 +102,42 @@ public:
bool mTransformToDisplayInverse;
};
+ enum {
+ // Returned by releaseBuffer, after which the consumer must
+ // free any references to the just-released buffer that it might have.
+ STALE_BUFFER_SLOT = 1,
+ // Returned by dequeueBuffer if there are no pending buffers available.
+ NO_BUFFER_AVAILABLE,
+ // Returned by dequeueBuffer if it's too early for the buffer to be acquired.
+ PRESENT_LATER,
+ };
// acquireBuffer attempts to acquire ownership of the next pending buffer in
- // the BufferQueue. If no buffer is pending then it returns -EINVAL. If a
- // buffer is successfully acquired, the information about the buffer is
- // returned in BufferItem. If the buffer returned had previously been
+ // the BufferQueue. If no buffer is pending then it returns
+ // NO_BUFFER_AVAILABLE. If a buffer is successfully acquired, the
+ // information about the buffer is returned in BufferItem.
+ //
+ // If the buffer returned had previously been
// acquired then the BufferItem::mGraphicBuffer field of buffer is set to
// NULL and it is assumed that the consumer still holds a reference to the
// buffer.
//
- // If presentWhen is nonzero, it indicates the time when the buffer will
+ // If presentWhen is non-zero, it indicates the time when the buffer will
// be displayed on screen. If the buffer's timestamp is farther in the
// future, the buffer won't be acquired, and PRESENT_LATER will be
// returned. The presentation time is in nanoseconds, and the time base
// is CLOCK_MONOTONIC.
- virtual status_t acquireBuffer(BufferItem *buffer, nsecs_t presentWhen) = 0;
+ //
+ // Return of NO_ERROR means the operation completed as normal.
+ //
+ // Return of a positive value means the operation could not be completed
+ // at this time, but the user should try again later:
+ // * NO_BUFFER_AVAILABLE - no buffer is pending (nothing queued by producer)
+ // * PRESENT_LATER - the buffer's timestamp is farther in the future
+ //
+ // Return of a negative value means an error has occurred:
+ // * INVALID_OPERATION - too many buffers have been acquired
+ virtual status_t acquireBuffer(BufferItem* buffer, nsecs_t presentWhen) = 0;
// releaseBuffer releases a buffer slot from the consumer back to the
// BufferQueue. This may be done while the buffer's contents are still
@@ -125,6 +151,18 @@ public:
//
// Note that the dependencies on EGL will be removed once we switch to using
// the Android HW Sync HAL.
+ //
+ // Return of NO_ERROR means the operation completed as normal.
+ //
+ // Return of a positive value means the operation could not be completed
+ // at this time, but the user should try again later:
+ // * STALE_BUFFER_SLOT - see above (second paragraph)
+ //
+ // Return of a negative value means an error has occurred:
+ // * BAD_VALUE - one of the following could've happened:
+ // * the buffer slot was invalid
+ // * the fence was NULL
+ // * the buffer slot specified is not in the acquired state
virtual status_t releaseBuffer(int buf, uint64_t frameNumber,
EGLDisplay display, EGLSyncKHR fence,
const sp<Fence>& releaseFence) = 0;
@@ -137,24 +175,38 @@ public:
// the application.
//
// consumer may not be NULL.
+ //
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * NO_INIT - the buffer queue has been abandoned
+ // * BAD_VALUE - a NULL consumer was provided
virtual status_t consumerConnect(const sp<IConsumerListener>& consumer, bool controlledByApp) = 0;
// consumerDisconnect disconnects a consumer from the BufferQueue. All
// buffers will be freed and the BufferQueue is placed in the "abandoned"
// state, causing most interactions with the BufferQueue by the producer to
// fail.
+ //
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * BAD_VALUE - no consumer is currently connected
virtual status_t consumerDisconnect() = 0;
- // getReleasedBuffers sets the value pointed to by slotMask to a bit mask
- // indicating which buffer slots have been released by the BufferQueue
- // but have not yet been released by the consumer.
+ // getReleasedBuffers sets the value pointed to by slotMask to a bit set.
+ // Each bit index with a 1 corresponds to a released buffer slot with that
+ // index value. In particular, a released buffer is one that has
+ // been released by the BufferQueue but have not yet been released by the consumer.
//
// This should be called from the onBuffersReleased() callback.
+ //
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * NO_INIT - the buffer queue has been abandoned.
virtual status_t getReleasedBuffers(uint32_t* slotMask) = 0;
// setDefaultBufferSize is used to set the size of buffers returned by
// dequeueBuffer when a width and height of zero is requested. Default
// is 1x1.
+ //
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * BAD_VALUE - either w or h was zero
virtual status_t setDefaultBufferSize(uint32_t w, uint32_t h) = 0;
// setDefaultMaxBufferCount sets the default value for the maximum buffer
@@ -163,6 +215,9 @@ public:
// take effect if the producer sets the count back to zero.
//
// The count must be between 2 and NUM_BUFFER_SLOTS, inclusive.
+ //
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * BAD_VALUE - bufferCount was out of range (see above).
virtual status_t setDefaultMaxBufferCount(int bufferCount) = 0;
// disableAsyncBuffer disables the extra buffer used in async mode
@@ -170,11 +225,20 @@ public:
// flag) and has dequeueBuffer() return WOULD_BLOCK instead.
//
// This can only be called before consumerConnect().
+ //
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * INVALID_OPERATION - attempting to call this after consumerConnect.
virtual status_t disableAsyncBuffer() = 0;
// setMaxAcquiredBufferCount sets the maximum number of buffers that can
// be acquired by the consumer at one time (default 1). This call will
// fail if a producer is connected to the BufferQueue.
+ //
+ // maxAcquiredBuffers must be (inclusive) between 1 and MAX_MAX_ACQUIRED_BUFFERS.
+ //
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * BAD_VALUE - maxAcquiredBuffers was out of range (see above).
+ // * INVALID_OPERATION - attempting to call this after a producer connected.
virtual status_t setMaxAcquiredBufferCount(int maxAcquiredBuffers) = 0;
// setConsumerName sets the name used in logging
@@ -184,16 +248,22 @@ public:
// GraphicBuffers of a defaultFormat if no format is specified
// in dequeueBuffer. Formats are enumerated in graphics.h; the
// initial default is HAL_PIXEL_FORMAT_RGBA_8888.
+ //
+ // Return of a value other than NO_ERROR means an unknown error has occurred.
virtual status_t setDefaultBufferFormat(uint32_t defaultFormat) = 0;
// setConsumerUsageBits will turn on additional usage bits for dequeueBuffer.
// These are merged with the bits passed to dequeueBuffer. The values are
// enumerated in gralloc.h, e.g. GRALLOC_USAGE_HW_RENDER; the default is 0.
+ //
+ // Return of a value other than NO_ERROR means an unknown error has occurred.
virtual status_t setConsumerUsageBits(uint32_t usage) = 0;
// setTransformHint bakes in rotation to buffers so overlays can be used.
// The values are enumerated in window.h, e.g.
// NATIVE_WINDOW_TRANSFORM_ROT_90. The default is 0 (no transform).
+ //
+ // Return of a value other than NO_ERROR means an unknown error has occurred.
virtual status_t setTransformHint(uint32_t hint) = 0;
// dump state into a string
diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h
index 342ba08111..70025308c5 100644
--- a/include/gui/IGraphicBufferProducer.h
+++ b/include/gui/IGraphicBufferProducer.h
@@ -54,7 +54,11 @@ public:
DECLARE_META_INTERFACE(GraphicBufferProducer);
enum {
+ // A flag returned by dequeueBuffer when the client needs to call
+ // requestBuffer immediately thereafter.
BUFFER_NEEDS_REALLOCATION = 0x1,
+ // A flag returned by dequeueBuffer when all mirrored slots should be
+ // released by the client. This flag should always be processed first.
RELEASE_ALL_BUFFERS = 0x2,
};
@@ -63,51 +67,144 @@ public:
// buffer to the given slot index, and the client is expected to mirror the
// slot->buffer mapping so that it's not necessary to transfer a
// GraphicBuffer for every dequeue operation.
+ //
+ // The slot must be in the range of [0, NUM_BUFFER_SLOTS).
+ //
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * NO_INIT - the buffer queue has been abandoned.
+ // * BAD_VALUE - one of the two conditions occurred:
+ // * slot was out of range (see above)
+ // * buffer specified by the slot is not dequeued
virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf) = 0;
// setBufferCount sets the number of buffer slots available. Calling this
// will also cause all buffer slots to be emptied. The caller should empty
// its mirrored copy of the buffer slots when calling this method.
+ //
+ // This function should not be called when there are any dequeued buffer
+ // slots, doing so will result in a BAD_VALUE error returned.
+ //
+ // The buffer count should be at most NUM_BUFFER_SLOTS (inclusive), but at least
+ // the minimum undequeued buffer count (exclusive). The minimum value
+ // can be obtained by calling query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS).
+ // In particular the range is (minUndequeudBuffers, NUM_BUFFER_SLOTS].
+ //
+ // The buffer count may also be set to 0 (the default), to indicate that
+ // the producer does not wish to set a value.
+ //
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * NO_INIT - the buffer queue has been abandoned.
+ // * BAD_VALUE - one of the below conditions occurred:
+ // * bufferCount was out of range (see above)
+ // * client has one or more buffers dequeued
virtual status_t setBufferCount(int bufferCount) = 0;
// dequeueBuffer requests a new buffer slot for the client to use. Ownership
// of the slot is transfered to the client, meaning that the server will not
- // use the contents of the buffer associated with that slot. The slot index
- // returned may or may not contain a buffer. If the slot is empty the client
- // should call requestBuffer to assign a new buffer to that slot. The client
- // is expected to either call cancelBuffer on the dequeued slot or to fill
- // in the contents of its associated buffer contents and call queueBuffer.
- // If dequeueBuffer return BUFFER_NEEDS_REALLOCATION, the client is
+ // use the contents of the buffer associated with that slot.
+ //
+ // The slot index returned may or may not contain a buffer (client-side).
+ // If the slot is empty the client should call requestBuffer to assign a new
+ // buffer to that slot.
+ //
+ // Once the client is done filling this buffer, it is expected to transfer
+ // buffer ownership back to the server with either cancelBuffer on
+ // the dequeued slot or to fill in the contents of its associated buffer
+ // contents and call queueBuffer.
+ //
+ // If dequeueBuffer returns the BUFFER_NEEDS_REALLOCATION flag, the client is
// expected to call requestBuffer immediately.
//
+ // If dequeueBuffer returns the RELEASE_ALL_BUFFERS flag, the client is
+ // expected to release all of the mirrored slot->buffer mappings.
+ //
// The fence parameter will be updated to hold the fence associated with
// the buffer. The contents of the buffer must not be overwritten until the
- // fence signals. If the fence is NULL, the buffer may be written
+ // fence signals. If the fence is Fence::NO_FENCE, the buffer may be written
// immediately.
//
- // The async parameter sets whether we're in asynchrnous mode for this
- // deququeBuffer() call.
- virtual status_t dequeueBuffer(int *slot, sp<Fence>* fence, bool async,
+ // The async parameter sets whether we're in asynchronous mode for this
+ // dequeueBuffer() call.
+ //
+ // The width and height parameters must be no greater than the minimum of
+ // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv).
+ // An error due to invalid dimensions might not be reported until
+ // updateTexImage() is called. If width and height are both zero, the
+ // default values specified by setDefaultBufferSize() are used instead.
+ //
+ // The pixel formats are enumerated in <graphics.h>, e.g.
+ // HAL_PIXEL_FORMAT_RGBA_8888. If the format is 0, the default format
+ // will be used.
+ //
+ // The usage argument specifies gralloc buffer usage flags. The values
+ // are enumerated in <gralloc.h>, e.g. GRALLOC_USAGE_HW_RENDER. These
+ // will be merged with the usage flags specified by
+ // IGraphicBufferConsumer::setConsumerUsageBits.
+ //
+ // This call will block until a buffer is available to be dequeued. If
+ // both the producer and consumer are controlled by the app, then this call
+ // can never block and will return WOULD_BLOCK if no buffer is available.
+ //
+ // A non-negative value with flags set (see above) will be returned upon
+ // success.
+ //
+ // Return of a negative means an error has occurred:
+ // * NO_INIT - the buffer queue has been abandoned.
+ // * BAD_VALUE - one of the below conditions occurred:
+ // * both in async mode and buffer count was less than the
+ // max numbers of buffers that can be allocated at once
+ // * attempting dequeue more than one buffer at a time
+ // without setting the buffer count with setBufferCount()
+ // * -EBUSY - attempting to dequeue too many buffers at a time
+ // * WOULD_BLOCK - no buffer is currently available, and blocking is disabled
+ // since both the producer/consumer are controlled by app
+ // * NO_MEMORY - out of memory, cannot allocate the graphics buffer.
+ //
+ // All other negative values are an unknown error returned downstream
+ // from the graphics allocator (typically errno).
+ virtual status_t dequeueBuffer(int* slot, sp<Fence>* fence, bool async,
uint32_t w, uint32_t h, uint32_t format, uint32_t usage) = 0;
// queueBuffer indicates that the client has finished filling in the
// contents of the buffer associated with slot and transfers ownership of
- // that slot back to the server. It is not valid to call queueBuffer on a
- // slot that is not owned by the client or one for which a buffer associated
- // via requestBuffer. In addition, a timestamp must be provided by the
- // client for this buffer. The timestamp is measured in nanoseconds, and
- // must be monotonically increasing. Its other properties (zero point, etc)
+ // that slot back to the server.
+ //
+ // It is not valid to call queueBuffer on a slot that is not owned
+ // by the client or one for which a buffer associated via requestBuffer
+ // (an attempt to do so will fail with a return value of BAD_VALUE).
+ //
+ // In addition, the input must be described by the client (as documented
+ // below). Any other properties (zero point, etc)
// are client-dependent, and should be documented by the client.
//
- // The async parameter sets whether we're queuing a buffer in asynchronous mode.
+ // The slot must be in the range of [0, NUM_BUFFER_SLOTS).
+ //
+ // Upon success, the output will be filled with meaningful values
+ // (refer to the documentation below).
//
- // outWidth, outHeight and outTransform are filled with the default width
- // and height of the window and current transform applied to buffers,
- // respectively.
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * NO_INIT - the buffer queue has been abandoned.
+ // * BAD_VALUE - one of the below conditions occurred:
+ // * fence was NULL
+ // * scaling mode was unknown
+ // * both in async mode and buffer count was less than the
+ // max numbers of buffers that can be allocated at once
+ // * slot index was out of range (see above).
+ // * the slot was not in the dequeued state
+ // * the slot was enqueued without requesting a buffer
+ // * crop rect is out of bounds of the buffer dimensions
struct QueueBufferInput : public Flattenable<QueueBufferInput> {
friend class Flattenable<QueueBufferInput>;
inline QueueBufferInput(const Parcel& parcel);
+ // timestamp - a monotonically increasing value in nanoseconds
+ // isAutoTimestamp - if the timestamp was synthesized at queue time
+ // crop - a crop rectangle that's used as a hint to the consumer
+ // scalingMode - a set of flags from NATIVE_WINDOW_SCALING_* in <window.h>
+ // transform - a set of flags from NATIVE_WINDOW_TRANSFORM_* in <window.h>
+ // async - if the buffer is queued in asynchronous mode
+ // fence - a fence that the consumer must wait on before reading the buffer,
+ // set this to Fence::NO_FENCE if the buffer is ready immediately
inline QueueBufferInput(int64_t timestamp, bool isAutoTimestamp,
const Rect& crop, int scalingMode, uint32_t transform, bool async,
const sp<Fence>& fence)
@@ -143,8 +240,13 @@ public:
};
// QueueBufferOutput must be a POD structure
- struct QueueBufferOutput {
+ struct __attribute__ ((__packed__)) QueueBufferOutput {
inline QueueBufferOutput() { }
+ // outWidth - filled with default width applied to the buffer
+ // outHeight - filled with default height applied to the buffer
+ // outTransformHint - filled with default transform applied to the buffer
+ // outNumPendingBuffers - num buffers queued that haven't yet been acquired
+ // (counting the currently queued buffer)
inline void deflate(uint32_t* outWidth,
uint32_t* outHeight,
uint32_t* outTransformHint,
@@ -174,24 +276,54 @@ public:
// cancelBuffer indicates that the client does not wish to fill in the
// buffer associated with slot and transfers ownership of the slot back to
// the server.
+ //
+ // The buffer is not queued for use by the consumer.
+ //
+ // The buffer will not be overwritten until the fence signals. The fence
+ // will usually be the one obtained from dequeueBuffer.
virtual void cancelBuffer(int slot, const sp<Fence>& fence) = 0;
// query retrieves some information for this surface
- // 'what' tokens allowed are that of android_natives.h
+ // 'what' tokens allowed are that of NATIVE_WINDOW_* in <window.h>
+ //
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * NO_INIT - the buffer queue has been abandoned.
+ // * BAD_VALUE - what was out of range
virtual int query(int what, int* value) = 0;
// connect attempts to connect a client API to the IGraphicBufferProducer.
// This must be called before any other IGraphicBufferProducer methods are
- // called except for getAllocator.
+ // called except for getAllocator. A consumer must be already connected.
//
// This method will fail if the connect was previously called on the
// IGraphicBufferProducer and no corresponding disconnect call was made.
//
- // outWidth, outHeight and outTransform are filled with the default width
- // and height of the window and current transform applied to buffers,
- // respectively. The token needs to be any binder object that lives in the
+ // The token needs to be any opaque binder object that lives in the
// producer process -- it is solely used for obtaining a death notification
// when the producer is killed.
+ //
+ // The api should be one of the NATIVE_WINDOW_API_* values in <window.h>
+ //
+ // The producerControlledByApp should be set to true if the producer is hosted
+ // by an untrusted process (typically app_process-forked processes). If both
+ // the producer and the consumer are app-controlled then all buffer queues
+ // will operate in async mode regardless of the async flag.
+ //
+ // Upon success, the output will be filled with meaningful data
+ // (refer to QueueBufferOutput documentation above).
+ //
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * NO_INIT - one of the following occurred:
+ // * the buffer queue was abandoned
+ // * no consumer has yet connected
+ // * BAD_VALUE - one of the following has occurred:
+ // * the producer is already connected
+ // * api was out of range (see above).
+ // * output was NULL.
+ // * DEAD_OBJECT - the token is hosted by an already-dead process
+ //
+ // Additional negative errors may be returned by the internals, they
+ // should be treated as opaque fatal unrecoverable errors.
virtual status_t connect(const sp<IBinder>& token,
int api, bool producerControlledByApp, QueueBufferOutput* output) = 0;
@@ -203,6 +335,17 @@ public:
//
// This method will fail if the the IGraphicBufferProducer is not currently
// connected to the specified client API.
+ //
+ // The api should be one of the NATIVE_WINDOW_API_* values in <window.h>
+ //
+ // Disconnecting from an abandoned IGraphicBufferProducer is legal and
+ // is considered a no-op.
+ //
+ // Return of a value other than NO_ERROR means an error has occurred:
+ // * BAD_VALUE - one of the following has occurred:
+ // * the api specified does not match the one that was connected
+ // * api was out of range (see above).
+ // * DEAD_OBJECT - the token is hosted by an already-dead process
virtual status_t disconnect(int api) = 0;
};
diff --git a/include/input/IInputFlinger.h b/include/input/IInputFlinger.h
new file mode 100644
index 0000000000..79ff12a664
--- /dev/null
+++ b/include/input/IInputFlinger.h
@@ -0,0 +1,54 @@
+/*
+ * 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 _LIBINPUT_IINPUT_FLINGER_H
+#define _LIBINPUT_IINPUT_FLINGER_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <binder/IInterface.h>
+
+namespace android {
+
+/*
+ * This class defines the Binder IPC interface for accessing various
+ * InputFlinger features.
+ */
+class IInputFlinger : public IInterface {
+public:
+ DECLARE_META_INTERFACE(InputFlinger);
+
+ virtual status_t doSomething() = 0;
+};
+
+
+/**
+ * Binder implementation.
+ */
+class BnInputFlinger : public BnInterface<IInputFlinger> {
+public:
+ enum {
+ DO_SOMETHING_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
+ };
+
+ virtual status_t onTransact(uint32_t code, const Parcel& data,
+ Parcel* reply, uint32_t flags = 0);
+};
+
+} // namespace android
+
+#endif // _LIBINPUT_IINPUT_FLINGER_H
diff --git a/include/input/Input.h b/include/input/Input.h
index be79c59207..ea9c4c284e 100644
--- a/include/input/Input.h
+++ b/include/input/Input.h
@@ -65,6 +65,34 @@ enum {
AINPUT_SOURCE_SWITCH = 0x80000000,
};
+enum {
+ /**
+ * Constants for LEDs. Hidden from the API since we don't actually expose a way to interact
+ * with LEDs to developers
+ *
+ * NOTE: If you add LEDs here, you must also add them to KeycodeLabels.h
+ */
+
+ ALED_NUM_LOCK = 0x00,
+ ALED_CAPS_LOCK = 0x01,
+ ALED_SCROLL_LOCK = 0x02,
+ ALED_COMPOSE = 0x03,
+ ALED_KANA = 0x04,
+ ALED_SLEEP = 0x05,
+ ALED_SUSPEND = 0x06,
+ ALED_MUTE = 0x07,
+ ALED_MISC = 0x08,
+ ALED_MAIL = 0x09,
+ ALED_CHARGING = 0x0a,
+ ALED_CONTROLLER_1 = 0x10,
+ ALED_CONTROLLER_2 = 0x11,
+ ALED_CONTROLLER_3 = 0x12,
+ ALED_CONTROLLER_4 = 0x13,
+};
+
+/* Maximum number of controller LEDs we support */
+#define MAX_CONTROLLER_LEDS 4
+
/*
* SystemUiVisibility constants from View.
*/
diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h
index 1419b451f8..adf9fb9170 100644
--- a/include/input/InputDevice.h
+++ b/include/input/InputDevice.h
@@ -46,6 +46,11 @@ struct InputDeviceIdentifier {
// Ideally, the way this value is computed should not change between Android releases
// because that would invalidate persistent settings that rely on it.
String8 descriptor;
+
+ // A value added to uniquely identify a device in the absence of a unique id. This
+ // is intended to be a minimum way to distinguish from other active devices and may
+ // reuse values that are not associated with an input anymore.
+ uint16_t nonce;
};
/*
diff --git a/include/input/KeyLayoutMap.h b/include/input/KeyLayoutMap.h
index eec11cf13a..1e8de7173b 100644
--- a/include/input/KeyLayoutMap.h
+++ b/include/input/KeyLayoutMap.h
@@ -67,6 +67,8 @@ public:
status_t mapKey(int32_t scanCode, int32_t usageCode,
int32_t* outKeyCode, uint32_t* outFlags) const;
status_t findScanCodesForKey(int32_t keyCode, Vector<int32_t>* outScanCodes) const;
+ status_t findScanCodeForLed(int32_t ledCode, int32_t* outScanCode) const;
+ status_t findUsageCodeForLed(int32_t ledCode, int32_t* outUsageCode) const;
status_t mapAxis(int32_t scanCode, AxisInfo* outAxisInfo) const;
@@ -79,9 +81,16 @@ private:
uint32_t flags;
};
+ struct Led {
+ int32_t ledCode;
+ };
+
+
KeyedVector<int32_t, Key> mKeysByScanCode;
KeyedVector<int32_t, Key> mKeysByUsageCode;
KeyedVector<int32_t, AxisInfo> mAxes;
+ KeyedVector<int32_t, Led> mLedsByScanCode;
+ KeyedVector<int32_t, Led> mLedsByUsageCode;
KeyLayoutMap();
@@ -99,6 +108,7 @@ private:
private:
status_t parseKey();
status_t parseAxis();
+ status_t parseLed();
};
};
diff --git a/include/input/Keyboard.h b/include/input/Keyboard.h
index 846cb0c831..25b2f07cff 100644
--- a/include/input/Keyboard.h
+++ b/include/input/Keyboard.h
@@ -94,18 +94,24 @@ extern int32_t getKeyCodeByLabel(const char* label);
extern uint32_t getKeyFlagByLabel(const char* label);
/**
- * Gets a axis by its short form label, eg. "X".
+ * Gets an axis by its short form label, eg. "X".
* Returns -1 if unknown.
*/
extern int32_t getAxisByLabel(const char* label);
/**
- * Gets a axis label by its id.
+ * Gets an axis label by its id.
* Returns NULL if unknown.
*/
extern const char* getAxisLabel(int32_t axisId);
/**
+ * Gets an LED by its short form label, eg. "CAPS_LOCK".
+ * Returns -1 if unknown.
+ */
+extern int32_t getLedByLabel(const char* label);
+
+/**
* Updates a meta state field when a key is pressed or released.
*/
extern int32_t updateMetaState(int32_t keyCode, bool down, int32_t oldMetaState);
diff --git a/include/input/KeycodeLabels.h b/include/input/KeycodeLabels.h
index c64c5d8daa..19582e9205 100644
--- a/include/input/KeycodeLabels.h
+++ b/include/input/KeycodeLabels.h
@@ -319,4 +319,26 @@ static const KeycodeLabel AXES[] = {
{ NULL, -1 }
};
+static const KeycodeLabel LEDS[] = {
+ { "NUM_LOCK", 0x00 },
+ { "CAPS_LOCK", 0x01 },
+ { "SCROLL_LOCK", 0x02 },
+ { "COMPOSE", 0x03 },
+ { "KANA", 0x04 },
+ { "SLEEP", 0x05 },
+ { "SUSPEND", 0x06 },
+ { "MUTE", 0x07 },
+ { "MISC", 0x08 },
+ { "MAIL", 0x09 },
+ { "CHARGING", 0x0a },
+ { "CONTROLLER_1", 0x10 },
+ { "CONTROLLER_2", 0x11 },
+ { "CONTROLLER_3", 0x12 },
+ { "CONTROLLER_4", 0x13 },
+
+ // NOTE: If you add new LEDs here, you must also add them to Input.h
+
+ { NULL, -1 }
+};
+
#endif // _LIBINPUT_KEYCODE_LABELS_H
diff --git a/include/media/hardware/HDCPAPI.h b/include/media/hardware/HDCPAPI.h
index d4abb3f883..3a53e9fc90 100644
--- a/include/media/hardware/HDCPAPI.h
+++ b/include/media/hardware/HDCPAPI.h
@@ -88,6 +88,11 @@ struct HDCPModule {
// Request to shutdown the active HDCP session.
virtual status_t shutdownAsync() = 0;
+ // Returns the capability bitmask of this HDCP session.
+ virtual uint32_t getCaps() {
+ return HDCP_CAPS_ENCRYPT;
+ }
+
// ENCRYPTION only:
// Encrypt data according to the HDCP spec. "size" bytes of data are
// available at "inData" (virtual address), "size" may not be a multiple
diff --git a/include/powermanager/PowerManager.h b/include/powermanager/PowerManager.h
index 45901747e8..cbddc11536 100644
--- a/include/powermanager/PowerManager.h
+++ b/include/powermanager/PowerManager.h
@@ -24,6 +24,14 @@ enum {
POWERMANAGER_PARTIAL_WAKE_LOCK = 1, // equals PowerManager.PARTIAL_WAKE_LOCK constant
};
+enum {
+ USER_ACTIVITY_EVENT_OTHER = 0,
+ USER_ACTIVITY_EVENT_BUTTON = 1,
+ USER_ACTIVITY_EVENT_TOUCH = 2,
+
+ USER_ACTIVITY_EVENT_LAST = USER_ACTIVITY_EVENT_TOUCH, // Last valid event code.
+};
+
}; // namespace android
#endif // ANDROID_POWERMANAGER_H
diff --git a/include/ui/PixelFormat.h b/include/ui/PixelFormat.h
index 627cfb695c..7e469453fd 100644
--- a/include/ui/PixelFormat.h
+++ b/include/ui/PixelFormat.h
@@ -56,13 +56,15 @@ enum {
// real pixel formats supported for rendering -----------------------------
- PIXEL_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA
- PIXEL_FORMAT_RGBX_8888 = HAL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0
- PIXEL_FORMAT_RGB_888 = HAL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB
- PIXEL_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565, // 16-bit RGB
- PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA
- PIXEL_FORMAT_RGBA_5551 = 6, // 16-bit ARGB
- PIXEL_FORMAT_RGBA_4444 = 7, // 16-bit ARGB
+ PIXEL_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA
+ PIXEL_FORMAT_RGBX_8888 = HAL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0
+ PIXEL_FORMAT_RGB_888 = HAL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB
+ PIXEL_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565, // 16-bit RGB
+ PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA
+ PIXEL_FORMAT_RGBA_5551 = 6, // 16-bit ARGB
+ PIXEL_FORMAT_RGBA_4444 = 7, // 16-bit ARGB
+ PIXEL_FORMAT_sRGB_A_8888 = HAL_PIXEL_FORMAT_sRGB_A_8888, // 4x8-bit sRGB + A
+ PIXEL_FORMAT_sRGB_X_8888 = HAL_PIXEL_FORMAT_sRGB_X_8888, // 4x8-bit sRGB, no A
};
typedef int32_t PixelFormat;
diff --git a/include/ui/Region.h b/include/ui/Region.h
index d906dbbb0d..0d1c68c951 100644
--- a/include/ui/Region.h
+++ b/include/ui/Region.h
@@ -50,6 +50,9 @@ public:
inline Rect getBounds() const { return mStorage[mStorage.size() - 1]; }
inline Rect bounds() const { return getBounds(); }
+ bool contains(const Point& point) const;
+ bool contains(int x, int y) const;
+
// the region becomes its bounds
Region& makeBoundsSelf();