summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--services/inputflinger/InputDispatcher.cpp4
-rw-r--r--services/sensorservice/SensorService.cpp2
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.cpp18
3 files changed, 15 insertions, 9 deletions
diff --git a/services/inputflinger/InputDispatcher.cpp b/services/inputflinger/InputDispatcher.cpp
index ce14f99..2b5e744 100644
--- a/services/inputflinger/InputDispatcher.cpp
+++ b/services/inputflinger/InputDispatcher.cpp
@@ -653,8 +653,8 @@ InputDispatcher::KeyEntry* InputDispatcher::synthesizeKeyRepeatLocked(nsecs_t cu
KeyEntry* entry = mKeyRepeatState.lastKeyEntry;
// Reuse the repeated key entry if it is otherwise unreferenced.
- uint32_t policyFlags = (entry->policyFlags & POLICY_FLAG_RAW_MASK)
- | POLICY_FLAG_PASS_TO_USER | POLICY_FLAG_TRUSTED;
+ uint32_t policyFlags = entry->policyFlags &
+ (POLICY_FLAG_RAW_MASK | POLICY_FLAG_PASS_TO_USER | POLICY_FLAG_TRUSTED);
if (entry->refCount == 1) {
entry->recycle();
entry->eventTime = currentTime;
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 4b50f6f..7c57957 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -667,7 +667,6 @@ void SensorService::cleanupConnection(SensorEventConnection* c)
i++;
}
}
- mLooper->removeFd(c->getSensorChannel()->getSendFd());
mActiveConnections.remove(connection);
BatteryService::cleanup(c->getUid());
if (c->needsWakeLock()) {
@@ -814,7 +813,6 @@ status_t SensorService::cleanupWithoutDisableLocked(
BatteryService::disableSensor(connection->getUid(), handle);
}
if (connection->hasAnySensor() == false) {
- mLooper->removeFd(connection->getSensorChannel()->getSendFd());
mActiveConnections.remove(connection);
}
// see if this sensor becomes inactive
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 6302053..edfed49 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -314,9 +314,17 @@ void HWComposer::hotplug(int disp, int connected) {
mEventHandler.onHotplugReceived(disp, bool(connected));
}
-static float getDefaultDensity(uint32_t height) {
- if (height >= 1080) return ACONFIGURATION_DENSITY_XHIGH;
- else return ACONFIGURATION_DENSITY_TV;
+static float getDefaultDensity(uint32_t width, uint32_t height) {
+ // Default density is based on TVs: 1080p displays get XHIGH density,
+ // lower-resolution displays get TV density. Maybe eventually we'll need
+ // to update it for 4K displays, though hopefully those just report
+ // accurate DPI information to begin with. This is also used for virtual
+ // displays and even primary displays with older hwcomposers, so be
+ // careful about orientation.
+
+ uint32_t h = width < height ? width : height;
+ if (h >= 1080) return ACONFIGURATION_DENSITY_XHIGH;
+ else return ACONFIGURATION_DENSITY_TV;
}
static const uint32_t DISPLAY_ATTRIBUTES[] = {
@@ -383,7 +391,7 @@ status_t HWComposer::queryDisplayProperties(int disp) {
}
if (config.xdpi == 0.0f || config.ydpi == 0.0f) {
- float dpi = getDefaultDensity(config.height);
+ float dpi = getDefaultDensity(config.width, config.height);
config.xdpi = dpi;
config.ydpi = dpi;
}
@@ -408,7 +416,7 @@ status_t HWComposer::setVirtualDisplayProperties(int32_t id,
DisplayConfig& config = mDisplayData[id].configs.editItemAt(configId);
config.width = w;
config.height = h;
- config.xdpi = config.ydpi = getDefaultDensity(h);
+ config.xdpi = config.ydpi = getDefaultDensity(w, h);
return NO_ERROR;
}