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,8 +1,8 @@
From 9ac09c1e3d8408ce08a6e99e6403fb75cccf20ba Mon Sep 17 00:00:00 2001
From ab92e063952b11ee1090cbf9c0ba0935325a54af Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Thu, 14 May 2020 19:54:55 +0200
Subject: [PATCH 10/14] Add persist.sys.phh.samsung.camera_ids property to
access hidden Samsung cameras
Subject: [PATCH] Add persist.sys.phh.samsung.camera_ids property to access
hidden Samsung cameras
Change-Id: I2c7bf535272acc28ed2277e96c78ddd28a0b4593
---
@ -11,10 +11,10 @@ Change-Id: I2c7bf535272acc28ed2277e96c78ddd28a0b4593
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp
index 501d92226f..be275e9346 100644
index 53fc1be7eb..99ca362bf3 100644
--- a/services/camera/libcameraservice/Android.bp
+++ b/services/camera/libcameraservice/Android.bp
@@ -127,7 +127,8 @@ cc_library_shared {
@@ -131,7 +131,8 @@ cc_library_shared {
"android.hardware.camera.device@3.3",
"android.hardware.camera.device@3.4",
"android.hardware.camera.device@3.5",
@ -25,7 +25,7 @@ index 501d92226f..be275e9346 100644
static_libs: [
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
index 32d118d6b0..eb27e055ac 100644
index 876d70d7cf..0bff3606df 100644
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
@@ -21,6 +21,7 @@
@ -44,8 +44,8 @@ index 32d118d6b0..eb27e055ac 100644
// We need to check again since cast2_6.isOk() succeeds even if the provider
// version isn't actually 2.6.
if (interface2_6 == nullptr){
@@ -1344,6 +1346,9 @@ status_t CameraProviderManager::ProviderInfo::initialize(
}
@@ -1358,6 +1360,9 @@ status_t CameraProviderManager::ProviderInfo::initialize(
return mapToStatusT(status);
}
+ auto samsungCast = vendor::samsung::hardware::camera::provider::V3_0::ISehCameraProvider::castFrom(interface);
@ -54,8 +54,8 @@ index 32d118d6b0..eb27e055ac 100644
hardware::Return<bool> linked = interface->linkToDeath(this, /*cookie*/ mId);
if (!linked.isOk()) {
ALOGE("%s: Transaction error in linking to camera provider '%s' death: %s",
@@ -1375,7 +1380,7 @@ status_t CameraProviderManager::ProviderInfo::initialize(
Status status;
@@ -1388,7 +1393,7 @@ status_t CameraProviderManager::ProviderInfo::initialize(
// Get initial list of camera devices, if any
std::vector<std::string> devices;
- hardware::Return<void> ret = interface->getCameraIdList([&status, this, &devices](
@ -63,7 +63,7 @@ index 32d118d6b0..eb27e055ac 100644
Status idStatus,
const hardware::hidl_vec<hardware::hidl_string>& cameraDeviceNames) {
status = idStatus;
@@ -1392,7 +1397,12 @@ status_t CameraProviderManager::ProviderInfo::initialize(
@@ -1405,7 +1410,12 @@ status_t CameraProviderManager::ProviderInfo::initialize(
mProviderPublicCameraIds.push_back(id);
}
}
@ -78,5 +78,5 @@ index 32d118d6b0..eb27e055ac 100644
ALOGE("%s: Transaction error in getting camera ID list from provider '%s': %s",
__FUNCTION__, mProviderName.c_str(), linked.description().c_str());
--
2.17.1
2.25.1

View File

@ -0,0 +1,40 @@
From 3c374cb65bd0e28c73fbd452e8201487dd1acb94 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 3 Dec 2019 14:04:17 +0100
Subject: [PATCH 15/15] Fix for some Huawei camera
---
services/camera/libcameraservice/CameraService.cpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 5d062a5fb3..97e9825c51 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -16,7 +16,7 @@
#define LOG_TAG "CameraService"
#define ATRACE_TAG ATRACE_TAG_CAMERA
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#include <algorithm>
#include <climits>
@@ -235,10 +235,11 @@ status_t CameraService::enumerateProviders() {
if (!cameraFound) {
addStates(id8);
}
- }
-
- if (getCameraState(id8) == nullptr) {
onDeviceStatusChanged(id8, CameraDeviceStatus::PRESENT);
+ } else {
+ if (getCameraState(id8) == nullptr) {
+ onDeviceStatusChanged(id8, CameraDeviceStatus::PRESENT);
+ }
}
}
--
2.25.1

View File

@ -0,0 +1,91 @@
From aaa019b5f93c3954441456259b30077bdd96d784 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 6 Dec 2020 12:20:08 +0100
Subject: [PATCH] Make rounded corners padding overridable with
persist.sys.phh.rounded_corners_padding
Change-Id: Id5d73b06b9a2cb2da95ff31f204c1984555872ff
---
.../src/com/android/systemui/qs/QuickStatusBarHeader.java | 6 +++++-
.../systemui/statusbar/phone/KeyguardStatusBarView.java | 6 +++++-
.../systemui/statusbar/phone/PhoneStatusBarView.java | 6 +++++-
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index 7533f2ac1db3..94fd996d0858 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -32,6 +32,7 @@ import android.graphics.Rect;
import android.media.AudioManager;
import android.os.Handler;
import android.os.Looper;
+import android.os.SystemProperties;
import android.provider.AlarmClock;
import android.provider.Settings;
import android.service.notification.ZenModeConfig;
@@ -447,8 +448,11 @@ public class QuickStatusBarHeader extends RelativeLayout implements
Resources resources = mContext.getResources();
updateMinimumHeight();
- mRoundedCornerPadding = resources.getDimensionPixelSize(
+ mRoundedCornerPadding = SystemProperties.getInt("persist.sys.phh.rounded_corners_padding", -1);
+ if (mRoundedCornerPadding == -1) {
+ mRoundedCornerPadding = resources.getDimensionPixelSize(
R.dimen.rounded_corner_content_padding);
+ }
mStatusBarPaddingTop = resources.getDimensionPixelSize(R.dimen.status_bar_padding_top);
// Update height for a few views, especially due to landscape mode restricting space.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
index 8a4ea21a11ca..a54269460e50 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
@@ -25,6 +25,7 @@ import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.os.SystemProperties;
import android.util.AttributeSet;
import android.util.Pair;
import android.util.TypedValue;
@@ -186,8 +187,11 @@ public class KeyguardStatusBarView extends RelativeLayout
R.dimen.system_icons_super_container_avatarless_margin_end);
mCutoutSideNudge = getResources().getDimensionPixelSize(
R.dimen.display_cutout_margin_consumption);
- mRoundedCornerPadding = res.getDimensionPixelSize(
+ mRoundedCornerPadding = SystemProperties.getInt("persist.sys.phh.rounded_corners_padding", -1);
+ if (mRoundedCornerPadding == -1) {
+ mRoundedCornerPadding = res.getDimensionPixelSize(
R.dimen.rounded_corner_content_padding);
+ }
}
private void updateVisibilities() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index 7c41bcd09b57..b0cf69b65f5d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -24,6 +24,7 @@ import android.annotation.Nullable;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Rect;
+import android.os.SystemProperties;
import android.util.AttributeSet;
import android.util.EventLog;
import android.util.Pair;
@@ -287,8 +288,11 @@ public class PhoneStatusBarView extends PanelBar {
public void updateResources() {
mCutoutSideNudge = getResources().getDimensionPixelSize(
R.dimen.display_cutout_margin_consumption);
- mRoundedCornerPadding = getResources().getDimensionPixelSize(
+ mRoundedCornerPadding = SystemProperties.getInt("persist.sys.phh.rounded_corners_padding", -1);
+ if (mRoundedCornerPadding == -1) {
+ mRoundedCornerPadding = getResources().getDimensionPixelSize(
R.dimen.rounded_corner_content_padding);
+ }
updateStatusBarHeight();
}
--
2.25.1

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