Sync up to v300.j

This commit is contained in:
Andy CrossGate Yan
2020-12-20 09:56:40 +00:00
parent 4048bfed3a
commit 2347b96190
7 changed files with 177 additions and 70 deletions

View File

@@ -1,52 +0,0 @@
From 251273e408c2090789f758c4f873df0cd044ee15 Mon Sep 17 00:00:00 2001
From: Anthony Stange <stange@google.com>
Date: Thu, 9 Jul 2020 09:35:29 -0400
Subject: [PATCH 8/8] Don't quantize max range with a resolution of 0
Sensors without a default resolution can be left with a resolution of 0
during initialization. Then, when the framework attempted to requantize
the max range using the resolution value, it would perform a
divide-by-zero operation. Encapsulate this logic with a check of the
resolution value to ensure this case doesn't occur.
Bug: 160862405
Test: Run on device and verify no crashes occur.
Merged-In: I6ab02072a11078f05f65b61310d5637743e258ff
Change-Id: I6ab02072a11078f05f65b61310d5637743e258ff
(cherry picked from commit ec5b4b1eebd9919ec54ff2d03d17fbf387012d1d)
---
services/sensorservice/SensorDevice.cpp | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
index 87899e2cd..eb5bfe281 100644
--- a/services/sensorservice/SensorDevice.cpp
+++ b/services/sensorservice/SensorDevice.cpp
@@ -162,12 +162,18 @@ void SensorDevice::initializeSensorList() {
SensorDeviceUtils::defaultResolutionForType(sensor.type);
}
- double promotedResolution = sensor.resolution;
- double promotedMaxRange = sensor.maxRange;
- if (fmod(promotedMaxRange, promotedResolution) != 0) {
- ALOGW("%s's max range %f is not a multiple of the resolution %f",
- sensor.name, sensor.maxRange, sensor.resolution);
- SensorDeviceUtils::quantizeValue(&sensor.maxRange, promotedResolution);
+ // Some sensors don't have a default resolution and will be left at 0.
+ // Don't crash in this case since CTS will verify that devices don't go to
+ // production with a resolution of 0.
+ if (sensor.resolution != 0) {
+ double promotedResolution = sensor.resolution;
+ double promotedMaxRange = sensor.maxRange;
+ if (fmod(promotedMaxRange, promotedResolution) != 0) {
+ ALOGW("%s's max range %f is not a multiple of the resolution %f",
+ sensor.name, sensor.maxRange, sensor.resolution);
+ SensorDeviceUtils::quantizeValue(
+ &sensor.maxRange, promotedResolution);
+ }
}
}
--
2.17.1

View File

@@ -1,7 +1,7 @@
From 06f3a285cd8f61a94df27fc1b062160aa73ec909 Mon Sep 17 00:00:00 2001
From f26a70a804a669d6379d80285c92520ecfa3942e Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Thu, 22 Oct 2020 23:22:46 +0200
Subject: [PATCH 09/10] Matching an input with a display uses uniqueId
Subject: [PATCH 08/10] Matching an input with a display uses uniqueId
Not all devices have a `location`, notably bluetooth devices.
However, we might still want to associate them with a screen,
@@ -31,5 +31,5 @@ index 4b19e5e35..8f2d3a685 100644
const std::unordered_map<std::string, uint8_t>& ports = config->portAssociations;
const auto& displayPort = ports.find(inputPort);
--
2.17.1
2.25.1

View File

@@ -1,7 +1,7 @@
From c8dc151cee2395313b510f07119696717b73f4ef Mon Sep 17 00:00:00 2001
From 5edeb168bf831aaca539aa8f063564f740676e16 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 26 Oct 2020 23:16:30 +0100
Subject: [PATCH 10/10] Apply associated display for joysticks
Subject: [PATCH 09/10] Apply associated display for joysticks
Change-Id: I5f6c237e6bf53312aff3dc02a46ce1c779063203
---
@@ -169,5 +169,5 @@ index c457a1525..c9b704993 100644
+}
} // namespace android
--
2.17.1
2.25.1

View File

@@ -0,0 +1,28 @@
From 6097954863cabad45d48672f56b878686e6be088 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 19 Aug 2018 23:07:24 +0200
Subject: [PATCH 10/10] Ignore usage bits verification
This didn't ignore as of 8.1, so we're ""safe""
Change-Id: I40c1d588c1fa104d844322b469f76e52bee1495a
---
libs/ui/Gralloc2.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/ui/Gralloc2.cpp b/libs/ui/Gralloc2.cpp
index 040a62b54..01dba7689 100644
--- a/libs/ui/Gralloc2.cpp
+++ b/libs/ui/Gralloc2.cpp
@@ -108,7 +108,7 @@ status_t Gralloc2Mapper::validateBufferDescriptorInfo(
if (descriptorInfo->usage & ~validUsageBits) {
ALOGE("buffer descriptor contains invalid usage bits 0x%" PRIx64,
descriptorInfo->usage & ~validUsageBits);
- return BAD_VALUE;
+ //return BAD_VALUE;
}
return NO_ERROR;
}
--
2.25.1