Merge "Fix typo for android.hardware.audio.output feature in handheld device config" into lmp-dev
diff --git a/data/etc/android.software.managed_profiles.xml b/data/etc/android.software.connectionservice.xml
similarity index 81%
copy from data/etc/android.software.managed_profiles.xml
copy to data/etc/android.software.connectionservice.xml
index 532a543..7aaf4c1 100644
--- a/data/etc/android.software.managed_profiles.xml
+++ b/data/etc/android.software.connectionservice.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
-<!-- This is the standard feature indicating that the device supports managed profiles. -->
+<!-- This is the standard set of features for devices that support the ConnectionService API. -->
<permissions>
- <feature name="android.software.managed_profiles" />
+ <feature name="android.software.connectionservice" />
</permissions>
diff --git a/data/etc/android.software.managed_profiles.xml b/data/etc/android.software.managed_users.xml
similarity index 89%
rename from data/etc/android.software.managed_profiles.xml
rename to data/etc/android.software.managed_users.xml
index 532a543..56affe9 100644
--- a/data/etc/android.software.managed_profiles.xml
+++ b/data/etc/android.software.managed_users.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
-<!-- This is the standard feature indicating that the device supports managed profiles. -->
+<!-- This is the standard feature indicating that the device supports managed users. -->
<permissions>
- <feature name="android.software.managed_profiles" />
+ <feature name="android.software.managed_users" />
</permissions>
diff --git a/data/etc/handheld_core_hardware.xml b/data/etc/handheld_core_hardware.xml
index 7119452..eaf93fd 100644
--- a/data/etc/handheld_core_hardware.xml
+++ b/data/etc/handheld_core_hardware.xml
@@ -37,6 +37,7 @@
<!-- basic system services -->
<feature name="android.software.app_widgets" />
+ <feature name="android.software.connectionservice" />
<feature name="android.software.voice_recognizers" />
<feature name="android.software.backup" />
<feature name="android.software.home_screen" />
@@ -46,8 +47,8 @@
<!-- Feature to specify if the device supports adding device admins. -->
<feature name="android.software.device_admin" />
- <!-- Feature to specify if the device support managed profiles. -->
- <feature name="android.software.managed_profiles" />
+ <!-- Feature to specify if the device support managed users. -->
+ <feature name="android.software.managed_users" />
<!-- devices with GPS must include android.hardware.location.gps.xml -->
<!-- devices with an autofocus camera and/or flash must include either
diff --git a/data/etc/tablet_core_hardware.xml b/data/etc/tablet_core_hardware.xml
index 321b2af..8128165 100644
--- a/data/etc/tablet_core_hardware.xml
+++ b/data/etc/tablet_core_hardware.xml
@@ -47,8 +47,8 @@
<!-- Feature to specify if the device supports adding device admins. -->
<feature name="android.software.device_admin" />
- <!-- Feature to specify if the device support managed profiles. -->
- <feature name="android.software.managed_profiles" />
+ <!-- Feature to specify if the device support managed users. -->
+ <feature name="android.software.managed_users" />
<!-- devices with GPS must include android.hardware.location.gps.xml -->
<!-- devices with a rear-facing camera must include one of these as appropriate:
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index b0695ba..f953a96 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -1002,32 +1002,27 @@
void SensorService::SensorEventConnection::dump(String8& result) {
Mutex::Autolock _l(mConnectionLock);
- result.appendFormat("\t %d WakeLockRefCount \n", mWakeLockRefCount);
+ result.appendFormat("\t WakeLockRefCount %d | uid %d | cache size %d | max cache size %d\n",
+ mWakeLockRefCount, mUid, mCacheSize, mMaxCacheSize);
for (size_t i = 0; i < mSensorInfo.size(); ++i) {
const FlushInfo& flushInfo = mSensorInfo.valueAt(i);
- result.appendFormat("\t %s 0x%08x | status: %s | pending flush events %d | uid %d|"
- "cache size: %d max cache size %d\n",
+ result.appendFormat("\t %s 0x%08x | status: %s | pending flush events %d \n",
mService->getSensorName(mSensorInfo.keyAt(i)).string(),
mSensorInfo.keyAt(i),
flushInfo.mFirstFlushPending ? "First flush pending" :
"active",
- flushInfo.mPendingFlushEventsToSend,
- mUid,
- mCacheSize,
- mMaxCacheSize);
-#if DEBUG_CONNECTIONS
- result.appendFormat("\t events recvd: %d | sent %d | cache %d | dropped %d |"
- " total_acks_needed %d | total_acks_recvd %d\n",
- mEventsReceived,
- mEventsSent,
- mEventsSentFromCache,
- mEventsReceived - (mEventsSentFromCache +
- mEventsSent + mCacheSize),
- mTotalAcksNeeded,
- mTotalAcksReceived);
-#endif
-
+ flushInfo.mPendingFlushEventsToSend);
}
+#if DEBUG_CONNECTIONS
+ result.appendFormat("\t events recvd: %d | sent %d | cache %d | dropped %d |"
+ " total_acks_needed %d | total_acks_recvd %d\n",
+ mEventsReceived,
+ mEventsSent,
+ mEventsSentFromCache,
+ mEventsReceived - (mEventsSentFromCache + mEventsSent + mCacheSize),
+ mTotalAcksNeeded,
+ mTotalAcksReceived);
+#endif
}
bool SensorService::SensorEventConnection::addSensor(int32_t handle) {
@@ -1082,7 +1077,7 @@
}
status_t SensorService::SensorEventConnection::sendEvents(
- sensors_event_t* buffer, size_t numEvents,
+ sensors_event_t const* buffer, size_t numEvents,
sensors_event_t* scratch,
SensorEventConnection const * const * mapFlushEventsToConnections) {
// filter out events not for this connection
@@ -1207,7 +1202,9 @@
if (index_wake_up_event >= 0) {
// If there was a wake_up sensor_event, reset the flag.
scratch[index_wake_up_event].flags &= ~WAKE_UP_SENSOR_EVENT_NEEDS_ACK;
- --mWakeLockRefCount;
+ if (mWakeLockRefCount > 0) {
+ --mWakeLockRefCount;
+ }
#if DEBUG_CONNECTIONS
--mTotalAcksNeeded;
#endif
@@ -1256,14 +1253,18 @@
void SensorService::SensorEventConnection::sendPendingFlushEventsLocked() {
ASensorEvent flushCompleteEvent;
+ memset(&flushCompleteEvent, 0, sizeof(flushCompleteEvent));
flushCompleteEvent.type = SENSOR_TYPE_META_DATA;
- flushCompleteEvent.sensor = 0;
// Loop through all the sensors for this connection and check if there are any pending
// flush complete events to be sent.
for (size_t i = 0; i < mSensorInfo.size(); ++i) {
FlushInfo& flushInfo = mSensorInfo.editValueAt(i);
while (flushInfo.mPendingFlushEventsToSend > 0) {
- flushCompleteEvent.meta_data.sensor = mSensorInfo.keyAt(i);
+ const int sensor_handle = mSensorInfo.keyAt(i);
+ flushCompleteEvent.meta_data.sensor = sensor_handle;
+ if (mService->getSensorFromHandle(sensor_handle).isWakeUpSensor()) {
+ flushCompleteEvent.flags |= WAKE_UP_SENSOR_EVENT_NEEDS_ACK;
+ }
ssize_t size = SensorEventQueue::write(mChannel, &flushCompleteEvent, 1);
if (size < 0) {
return;
@@ -1303,7 +1304,9 @@
// If there was a wake_up sensor_event, reset the flag.
mEventCache[index_wake_up_event + numEventsSent].flags &=
~WAKE_UP_SENSOR_EVENT_NEEDS_ACK;
- --mWakeLockRefCount;
+ if (mWakeLockRefCount > 0) {
+ --mWakeLockRefCount;
+ }
#if DEBUG_CONNECTIONS
--mTotalAcksNeeded;
#endif
@@ -1328,7 +1331,7 @@
}
void SensorService::SensorEventConnection::countFlushCompleteEventsLocked(
- sensors_event_t* scratch, const int numEventsDropped) {
+ sensors_event_t const* scratch, const int numEventsDropped) {
ALOGD_IF(DEBUG_CONNECTIONS, "dropping %d events ", numEventsDropped);
// Count flushComplete events in the events that are about to the dropped. These will be sent
// separately before the next batch of events.
@@ -1394,7 +1397,9 @@
{
Mutex::Autolock _l(mConnectionLock);
- --mWakeLockRefCount;
+ if (mWakeLockRefCount > 0) {
+ --mWakeLockRefCount;
+ }
#if DEBUG_CONNECTIONS
++mTotalAcksReceived;
#endif
diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h
index 9654f65..0fcafac 100644
--- a/services/sensorservice/SensorService.h
+++ b/services/sensorservice/SensorService.h
@@ -86,7 +86,7 @@
// Count the number of flush complete events which are about to be dropped in the buffer.
// Increment mPendingFlushEventsToSend in mSensorInfo. These flush complete events will be
// sent separately before the next batch of events.
- void countFlushCompleteEventsLocked(sensors_event_t* scratch, int numEventsDropped);
+ void countFlushCompleteEventsLocked(sensors_event_t const* scratch, int numEventsDropped);
// Check if there are any wake up events in the buffer. If yes, return the index of the
// first wake_up sensor event in the buffer else return -1. This wake_up sensor event will
@@ -148,7 +148,7 @@
public:
SensorEventConnection(const sp<SensorService>& service, uid_t uid);
- status_t sendEvents(sensors_event_t* buffer, size_t count,
+ status_t sendEvents(sensors_event_t const* buffer, size_t count,
sensors_event_t* scratch,
SensorEventConnection const * const * mapFlushEventsToConnections = NULL);
bool hasSensor(int32_t handle) const;
@@ -190,7 +190,7 @@
bool isVirtualSensor(int handle) const;
Sensor getSensorFromHandle(int handle) const;
bool isWakeUpSensor(int type) const;
- void recordLastValueLocked(const sensors_event_t* buffer, size_t count);
+ void recordLastValueLocked(sensors_event_t const* buffer, size_t count);
static void sortEventBuffer(sensors_event_t* buffer, size_t count);
Sensor registerSensor(SensorInterface* sensor);
Sensor registerVirtualSensor(SensorInterface* sensor);