Initial commit for Android 11, syncing up to v300.f
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
From d8fbdb4092155a1c8f8e2b2ee77b4fcfb7102367 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 12 Aug 2019 23:48:37 +0200
|
||||
Subject: [PATCH 1/8] Some Samsung devices requires lying colorspace
|
||||
|
||||
Change-Id: I4153b8e7abc10c519565e4e4386c6388621477b2
|
||||
---
|
||||
opengl/libs/EGL/egl_platform_entries.cpp | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/opengl/libs/EGL/egl_platform_entries.cpp b/opengl/libs/EGL/egl_platform_entries.cpp
|
||||
index aa24e8ee6..1c6380f6f 100644
|
||||
--- a/opengl/libs/EGL/egl_platform_entries.cpp
|
||||
+++ b/opengl/libs/EGL/egl_platform_entries.cpp
|
||||
@@ -454,8 +454,14 @@ EGLBoolean eglGetConfigAttribImpl(EGLDisplay dpy, EGLConfig config,
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Translates EGL color spaces to Android data spaces.
|
||||
+static int samsungColorspace = -1;
|
||||
static android_dataspace dataSpaceFromEGLColorSpace(EGLint colorspace) {
|
||||
+ if(samsungColorspace == -1) {
|
||||
+ samsungColorspace = property_get_bool("persist.sys.phh.samsung_colorspace", false);
|
||||
+ }
|
||||
if (colorspace == EGL_GL_COLORSPACE_LINEAR_KHR) {
|
||||
+ if(samsungColorspace)
|
||||
+ return HAL_DATASPACE_UNKNOWN;
|
||||
return HAL_DATASPACE_UNKNOWN;
|
||||
} else if (colorspace == EGL_GL_COLORSPACE_SRGB_KHR) {
|
||||
return HAL_DATASPACE_V0_SRGB;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From 61f5f4b804e8e14f15b928630489f22a5e7df04e Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 14 Aug 2019 23:37:10 +0200
|
||||
Subject: [PATCH 2/8] On Samsung, we need to send a hack-message to HAL to get
|
||||
all Sensors
|
||||
|
||||
Change-Id: Id6a1fa48340de61c418493668e9abd22c2599376
|
||||
---
|
||||
opengl/libs/EGL/egl_platform_entries.cpp | 2 +-
|
||||
services/sensorservice/SensorDevice.cpp | 4 ++++
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/opengl/libs/EGL/egl_platform_entries.cpp b/opengl/libs/EGL/egl_platform_entries.cpp
|
||||
index 1c6380f6f..6e810e592 100644
|
||||
--- a/opengl/libs/EGL/egl_platform_entries.cpp
|
||||
+++ b/opengl/libs/EGL/egl_platform_entries.cpp
|
||||
@@ -457,7 +457,7 @@ EGLBoolean eglGetConfigAttribImpl(EGLDisplay dpy, EGLConfig config,
|
||||
static int samsungColorspace = -1;
|
||||
static android_dataspace dataSpaceFromEGLColorSpace(EGLint colorspace) {
|
||||
if(samsungColorspace == -1) {
|
||||
- samsungColorspace = property_get_bool("persist.sys.phh.samsung_colorspace", false);
|
||||
+ samsungColorspace = base::GetBoolProperty("persist.sys.phh.samsung_colorspace", false);
|
||||
}
|
||||
if (colorspace == EGL_GL_COLORSPACE_LINEAR_KHR) {
|
||||
if(samsungColorspace)
|
||||
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
|
||||
index 8a282e238..53b686870 100644
|
||||
--- a/services/sensorservice/SensorDevice.cpp
|
||||
+++ b/services/sensorservice/SensorDevice.cpp
|
||||
@@ -34,7 +34,9 @@
|
||||
#include <cinttypes>
|
||||
#include <thread>
|
||||
|
||||
+#include <android-base/properties.h>
|
||||
using namespace android::hardware::sensors;
|
||||
+
|
||||
using namespace android::hardware::sensors::V1_0;
|
||||
using namespace android::hardware::sensors::V1_0::implementation;
|
||||
using android::hardware::sensors::V2_0::EventQueueFlagBits;
|
||||
@@ -134,6 +136,8 @@ SensorDevice::SensorDevice()
|
||||
void SensorDevice::initializeSensorList() {
|
||||
float minPowerMa = 0.001; // 1 microAmp
|
||||
|
||||
+ if(::android::base::GetBoolProperty("persist.sys.phh.samsung_sensors", false))
|
||||
+ setMode(5555);
|
||||
checkReturn(mSensors->getSensorsList(
|
||||
[&](const auto &list) {
|
||||
const size_t count = list.size();
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From 113f48e1e25d168e16e6a6717c7ea70fbef033e3 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 10 Mar 2020 23:26:55 +0100
|
||||
Subject: [PATCH 3/8] Use BKK's hwcomposer hacks to properly display FOD layers
|
||||
|
||||
Insecure hack: Set FOD layers to magical Z values to trigger
|
||||
OPPO/Realme/Oneplus' whole blitter behaviours:
|
||||
- reports touch event to fingerprint driver
|
||||
- removes dim on touched layer
|
||||
|
||||
Change-Id: I1d924b1e5c2389c8df17174c079cee8ef2380112
|
||||
---
|
||||
.../CompositionEngine/src/OutputLayer.cpp | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
|
||||
index 1faf775ed..deb0b0923 100644
|
||||
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
|
||||
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
|
||||
@@ -370,7 +370,18 @@ void OutputLayer::writeOutputDependentGeometryStateToHWC(
|
||||
static_cast<int32_t>(error));
|
||||
}
|
||||
|
||||
- if (auto error = hwcLayer->setZOrder(outputDependentState.z); error != hal::Error::NONE) {
|
||||
+ uint32_t z = outputDependentState.z;
|
||||
+ if(strstr(getLayerFE().getDebugName(), "Fingerprint on display") != nullptr) {
|
||||
+ ALOGE("Found fingerprint on display!");
|
||||
+ z = 0x41000031;
|
||||
+ }
|
||||
+
|
||||
+ if(strstr(getLayerFE().getDebugName(), "Fingerprint on display.touched") != nullptr) {
|
||||
+ ALOGE("Found fingerprint on display touched!");
|
||||
+ z = 0x41000033;
|
||||
+ }
|
||||
+
|
||||
+ if (auto error = hwcLayer->setZOrder(z); error != hal::Error::NONE) {
|
||||
ALOGE("[%s] Failed to set Z %u: %s (%d)", getLayerFE().getDebugName(),
|
||||
outputDependentState.z, to_string(error).c_str(), static_cast<int32_t>(error));
|
||||
}
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
From 0c7b289c3d724f32f4d64e8972736f3aa8e3261f Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 20 May 2020 21:16:56 +0200
|
||||
Subject: [PATCH 4/8] Samsung + Xiaomi new FOD HBM controls
|
||||
|
||||
Change-Id: I5ab27fa70882efa85f0c917bf31bb32adaa09bb1
|
||||
---
|
||||
services/surfaceflinger/BufferQueueLayer.cpp | 19 ++++++++++++++++-
|
||||
.../CompositionEngine/src/OutputLayer.cpp | 21 +++++++++++++++++++
|
||||
2 files changed, 39 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp
|
||||
index 07be7916e..472ceda4d 100644
|
||||
--- a/services/surfaceflinger/BufferQueueLayer.cpp
|
||||
+++ b/services/surfaceflinger/BufferQueueLayer.cpp
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <compositionengine/LayerFECompositionState.h>
|
||||
#include <gui/BufferQueueConsumer.h>
|
||||
#include <system/window.h>
|
||||
+#include <cutils/properties.h>
|
||||
|
||||
#include "LayerRejecter.h"
|
||||
#include "SurfaceInterceptor.h"
|
||||
@@ -34,6 +35,14 @@
|
||||
#include "Scheduler/LayerHistory.h"
|
||||
#include "TimeStats/TimeStats.h"
|
||||
|
||||
+static bool sCheckedProps = false;
|
||||
+static bool sSamsungFod = false;
|
||||
+static void init_fod_props() {
|
||||
+ if(sCheckedProps) return;
|
||||
+ sCheckedProps = true;
|
||||
+ sSamsungFod = property_get_bool("persist.sys.phh.fod.samsung", false);
|
||||
+}
|
||||
+
|
||||
namespace android {
|
||||
|
||||
BufferQueueLayer::BufferQueueLayer(const LayerCreationArgs& args) : BufferLayer(args) {}
|
||||
@@ -486,6 +495,7 @@ void BufferQueueLayer::onFirstRef() {
|
||||
mConsumer =
|
||||
mFlinger->getFactory().createBufferLayerConsumer(consumer, mFlinger->getRenderEngine(),
|
||||
mTextureName, this);
|
||||
+ init_fod_props();
|
||||
mConsumer->setConsumerUsageBits(getEffectiveUsage(0));
|
||||
|
||||
mContentsChangedListener = new ContentsChangedListener(this);
|
||||
@@ -509,9 +519,16 @@ status_t BufferQueueLayer::setDefaultBufferProperties(uint32_t w, uint32_t h, Pi
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
||||
+ init_fod_props();
|
||||
+
|
||||
setDefaultBufferSize(w, h);
|
||||
mConsumer->setDefaultBufferFormat(format);
|
||||
- mConsumer->setConsumerUsageBits(getEffectiveUsage(0));
|
||||
+ uint64_t usageBits = getEffectiveUsage(0);
|
||||
+ if(sSamsungFod && strstr(mName.c_str(), "Fingerprint on display.touched") != nullptr) {
|
||||
+ ALOGE("Found on touched layer!");
|
||||
+ usageBits |= 0x400000000LL;
|
||||
+ }
|
||||
+ mConsumer->setConsumerUsageBits(usageBits);
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
|
||||
index deb0b0923..5f9620715 100644
|
||||
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
|
||||
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <compositionengine/impl/OutputCompositionState.h>
|
||||
#include <compositionengine/impl/OutputLayer.h>
|
||||
#include <compositionengine/impl/OutputLayerCompositionState.h>
|
||||
+#include <cutils/properties.h>
|
||||
|
||||
// TODO(b/129481165): remove the #pragma below and fix conversion issues
|
||||
#pragma clang diagnostic push
|
||||
@@ -32,6 +33,10 @@
|
||||
// TODO(b/129481165): remove the #pragma below and fix conversion issues
|
||||
#pragma clang diagnostic pop // ignored "-Wconversion"
|
||||
|
||||
+static bool sCheckedProps = false;
|
||||
+static bool sBBKFod = false;
|
||||
+static bool sXiaomiFod = false;
|
||||
+
|
||||
namespace android::compositionengine {
|
||||
|
||||
OutputLayer::~OutputLayer() = default;
|
||||
@@ -370,15 +375,31 @@ void OutputLayer::writeOutputDependentGeometryStateToHWC(
|
||||
static_cast<int32_t>(error));
|
||||
}
|
||||
|
||||
+ if(!sCheckedProps) {
|
||||
+ sCheckedProps = true;
|
||||
+ sBBKFod = property_get_bool("persist.sys.phh.fod.bbk", false);
|
||||
+ sXiaomiFod = property_get_bool("persist.sys.phh.fod.xiaomi", false);
|
||||
+ }
|
||||
+
|
||||
uint32_t z = outputDependentState.z;
|
||||
if(strstr(getLayerFE().getDebugName(), "Fingerprint on display") != nullptr) {
|
||||
ALOGE("Found fingerprint on display!");
|
||||
z = 0x41000031;
|
||||
+ if(sBBKFod) {
|
||||
+ z = 0x41000031;
|
||||
+ } else if(sXiaomiFod) {
|
||||
+ z |= 0x1000000;
|
||||
+ }
|
||||
}
|
||||
|
||||
if(strstr(getLayerFE().getDebugName(), "Fingerprint on display.touched") != nullptr) {
|
||||
ALOGE("Found fingerprint on display touched!");
|
||||
z = 0x41000033;
|
||||
+ if(sBBKFod) {
|
||||
+ z = 0x41000033;
|
||||
+ } else if(sXiaomiFod) {
|
||||
+ z |= 0x2000000;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (auto error = hwcLayer->setZOrder(z); error != hal::Error::NONE) {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 15125c6d89352f46742c0e575556e43720e1c03c Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 11 Sep 2020 21:33:05 +0200
|
||||
Subject: [PATCH 5/8] vr_hwc crashes because it registers a 2.3 hwc, while
|
||||
manifest says 2.1
|
||||
|
||||
Change-Id: Icfaea3e471209e5773f52f880ffbcf5de744737e
|
||||
---
|
||||
services/vr/hardware_composer/manifest_vr_hwc.xml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/vr/hardware_composer/manifest_vr_hwc.xml b/services/vr/hardware_composer/manifest_vr_hwc.xml
|
||||
index 1068cac33..6694ac086 100644
|
||||
--- a/services/vr/hardware_composer/manifest_vr_hwc.xml
|
||||
+++ b/services/vr/hardware_composer/manifest_vr_hwc.xml
|
||||
@@ -2,7 +2,7 @@
|
||||
<hal>
|
||||
<name>android.hardware.graphics.composer</name>
|
||||
<transport>hwbinder</transport>
|
||||
- <version>2.1</version>
|
||||
+ <version>2.3</version>
|
||||
<interface>
|
||||
<name>IComposer</name>
|
||||
<instance>vr</instance>
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
From 1003d0293dc372b8fc0bbefe160f7d6a770b184b Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 30 Sep 2020 22:41:39 +0200
|
||||
Subject: [PATCH 6/8] Add persist.sys.phh.no_present_or_validate property to
|
||||
disable presentOrValidate since on vndk 26/27 presentOrValidate can be broken
|
||||
|
||||
Change-Id: I5f0c6c5e129bc21348d6f279d3ba455a5a0f008b
|
||||
---
|
||||
.../surfaceflinger/DisplayHardware/HWComposer.cpp | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
|
||||
index 7a2f0f34e..1ea104521 100644
|
||||
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
|
||||
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <ui/GraphicBuffer.h>
|
||||
#include <utils/Errors.h>
|
||||
#include <utils/Trace.h>
|
||||
+#include <android-base/properties.h>
|
||||
|
||||
#include "../Layer.h" // needed only for debugging
|
||||
#include "../Promise.h"
|
||||
@@ -500,12 +501,22 @@ status_t HWComposer::getDeviceCompositionChanges(
|
||||
|
||||
hal::Error error = hal::Error::NONE;
|
||||
|
||||
+ static int forceNoPresentOrValidate = -1;
|
||||
+ if(forceNoPresentOrValidate == -1) {
|
||||
+ bool res = android::base::GetBoolProperty("persist.sys.phh.no_present_or_validate", false);
|
||||
+ if(res) {
|
||||
+ forceNoPresentOrValidate = 1;
|
||||
+ } else {
|
||||
+ forceNoPresentOrValidate = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
// First try to skip validate altogether when there is no client
|
||||
// composition. When there is client composition, since we haven't
|
||||
// rendered to the client target yet, we should not attempt to skip
|
||||
// validate.
|
||||
displayData.validateWasSkipped = false;
|
||||
- if (!frameUsesClientComposition) {
|
||||
+ if (forceNoPresentOrValidate == 0 && !frameUsesClientComposition) {
|
||||
sp<Fence> outPresentFence;
|
||||
uint32_t state = UINT32_MAX;
|
||||
error = hwcDisplay->presentOrValidate(&numTypes, &numRequests, &outPresentFence , &state);
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From dc47d76a49d2a2d8dc2bd6bf68098cd910fcb364 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 30 Sep 2020 22:51:37 +0200
|
||||
Subject: [PATCH 7/8] Add persist.sys.phh.disable_sensor_direct_report property
|
||||
to disable Sensors direct report (it seems to break Qin 2 Pro sensors HAL)
|
||||
|
||||
Change-Id: I0763324a4bd6a3ba6716c396c4cb3f0772b85d62
|
||||
---
|
||||
services/sensorservice/SensorDevice.cpp | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
|
||||
index 53b686870..87899e2cd 100644
|
||||
--- a/services/sensorservice/SensorDevice.cpp
|
||||
+++ b/services/sensorservice/SensorDevice.cpp
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "convertV2_1.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
+#include <android-base/properties.h>
|
||||
#include <android/util/ProtoOutputStream.h>
|
||||
#include <frameworks/base/core/proto/android/service/sensor_service.proto.h>
|
||||
#include <sensors/convert.h>
|
||||
@@ -129,8 +130,12 @@ SensorDevice::SensorDevice()
|
||||
|
||||
initializeSensorList();
|
||||
|
||||
- mIsDirectReportSupported =
|
||||
- (checkReturnAndGetStatus(mSensors->unregisterDirectChannel(-1)) != INVALID_OPERATION);
|
||||
+ if(::android::base::GetBoolProperty("persist.sys.phh.disable_sensor_direct_report", false)) {
|
||||
+ mIsDirectReportSupported = false;
|
||||
+ } else {
|
||||
+ mIsDirectReportSupported =
|
||||
+ (checkReturnAndGetStatus(mSensors->unregisterDirectChannel(-1)) != INVALID_OPERATION);
|
||||
+ }
|
||||
}
|
||||
|
||||
void SensorDevice::initializeSensorList() {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user