Sync up to v212

This commit is contained in:
Andy CrossGate Yan 2020-02-27 14:07:15 +00:00
parent 5a4c7737ee
commit 9fe4d8ccf3
9 changed files with 767 additions and 6 deletions

View File

@ -0,0 +1,327 @@
From 291ef6981994f98173d6a6505aa89a018d7bedd3 Mon Sep 17 00:00:00 2001
From: Stan Iliev <stani@google.com>
Date: Thu, 1 Aug 2019 14:22:34 -0400
Subject: [PATCH 2/2] Allow to rebind GL texture if AHB content has changed
Add an output function argument updateProc to MakeBackendTexture.
updateProc needs to be invoked, when AHB buffer content has
changed. OES_EGL_image_external spec requires to bind the
texture, when buffer content has changed.
glEGLImageTargetTexture2DOES is invoked too (spec is not clear,
but MTK devices require it).
Test: Built and ran android
Bug: b/138674291
Change-Id: I4e20885931d1446c45119eec1b992a85bcd97450
Merged-In: Ib5f15408e766c1e5344f18c287a202c1853ddd20
---
src/gpu/GrAHardwareBufferImageGenerator.cpp | 12 ++--
src/gpu/GrAHardwareBufferUtils.cpp | 70 +++++++++++++++++----
src/gpu/GrAHardwareBufferUtils.h | 39 +++++++++++-
src/image/SkImage_Gpu.cpp | 7 ++-
src/image/SkSurface_Gpu.cpp | 9 +--
5 files changed, 110 insertions(+), 27 deletions(-)
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 205595526f..2dcdeb5911 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -152,20 +152,22 @@ sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::makeProxy(GrRecordingCont
[direct, buffer = AutoAHBRelease(hardwareBuffer), width, height, pixelConfig,
isProtectedContent, backendFormat](GrResourceProvider* resourceProvider) {
GrAHardwareBufferUtils::DeleteImageProc deleteImageProc = nullptr;
- GrAHardwareBufferUtils::DeleteImageCtx deleteImageCtx = nullptr;
+ GrAHardwareBufferUtils::UpdateImageProc updateImageProc = nullptr;
+ GrAHardwareBufferUtils::TexImageCtx texImageCtx = nullptr;
GrBackendTexture backendTex =
GrAHardwareBufferUtils::MakeBackendTexture(direct, buffer.get(),
width, height,
&deleteImageProc,
- &deleteImageCtx,
+ &updateImageProc,
+ &texImageCtx,
isProtectedContent,
backendFormat,
false);
if (!backendTex.isValid()) {
return sk_sp<GrTexture>();
}
- SkASSERT(deleteImageProc && deleteImageCtx);
+ SkASSERT(deleteImageProc && texImageCtx);
backendTex.fConfig = pixelConfig;
// We make this texture cacheable to avoid recreating a GrTexture every time this
@@ -174,12 +176,12 @@ sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::makeProxy(GrRecordingCont
sk_sp<GrTexture> tex = resourceProvider->wrapBackendTexture(
backendTex, kBorrow_GrWrapOwnership, GrWrapCacheable::kYes, kRead_GrIOType);
if (!tex) {
- deleteImageProc(deleteImageCtx);
+ deleteImageProc(texImageCtx);
return sk_sp<GrTexture>();
}
if (deleteImageProc) {
- tex->setRelease(deleteImageProc, deleteImageCtx);
+ tex->setRelease(deleteImageProc, texImageCtx);
}
return tex;
diff --git a/src/gpu/GrAHardwareBufferUtils.cpp b/src/gpu/GrAHardwareBufferUtils.cpp
index 43272cea33..f22343a804 100644
--- a/src/gpu/GrAHardwareBufferUtils.cpp
+++ b/src/gpu/GrAHardwareBufferUtils.cpp
@@ -157,33 +157,59 @@ GrBackendFormat GetBackendFormat(GrContext* context, AHardwareBuffer* hardwareBu
return GrBackendFormat();
}
-class GLCleanupHelper {
+class GLTextureHelper {
public:
- GLCleanupHelper(GrGLuint texID, EGLImageKHR image, EGLDisplay display)
+ GLTextureHelper(GrGLuint texID, EGLImageKHR image, EGLDisplay display, GrGLuint texTarget)
: fTexID(texID)
, fImage(image)
- , fDisplay(display) { }
- ~GLCleanupHelper() {
+ , fDisplay(display)
+ , fTexTarget(texTarget) { }
+ ~GLTextureHelper() {
glDeleteTextures(1, &fTexID);
// eglDestroyImageKHR will remove a ref from the AHardwareBuffer
eglDestroyImageKHR(fDisplay, fImage);
}
+ void rebind(GrContext* grContext);
+
private:
GrGLuint fTexID;
EGLImageKHR fImage;
EGLDisplay fDisplay;
+ GrGLuint fTexTarget;
};
+void GLTextureHelper::rebind(GrContext* grContext) {
+ glBindTexture(fTexTarget, fTexID);
+ GLenum status = GL_NO_ERROR;
+ if ((status = glGetError()) != GL_NO_ERROR) {
+ SkDebugf("glBindTexture(%#x, %d) failed (%#x)", (int) fTexTarget,
+ (int) fTexID, (int) status);
+ return;
+ }
+ glEGLImageTargetTexture2DOES(fTexTarget, fImage);
+ if ((status = glGetError()) != GL_NO_ERROR) {
+ SkDebugf("glEGLImageTargetTexture2DOES failed (%#x)", (int) status);
+ return;
+ }
+ grContext->resetContext(kTextureBinding_GrGLBackendState);
+}
+
void delete_gl_texture(void* context) {
- GLCleanupHelper* cleanupHelper = static_cast<GLCleanupHelper*>(context);
+ GLTextureHelper* cleanupHelper = static_cast<GLTextureHelper*>(context);
delete cleanupHelper;
}
+void update_gl_texture(void* context, GrContext* grContext) {
+ GLTextureHelper* cleanupHelper = static_cast<GLTextureHelper*>(context);
+ cleanupHelper->rebind(grContext);
+}
+
static GrBackendTexture make_gl_backend_texture(
GrContext* context, AHardwareBuffer* hardwareBuffer,
int width, int height,
DeleteImageProc* deleteProc,
- DeleteImageCtx* deleteCtx,
+ UpdateImageProc* updateProc,
+ TexImageCtx* imageCtx,
bool isProtectedContent,
const GrBackendFormat& backendFormat,
bool isRenderable) {
@@ -236,7 +262,8 @@ static GrBackendTexture make_gl_backend_texture(
textureInfo.fFormat = *backendFormat.getGLFormat();
*deleteProc = delete_gl_texture;
- *deleteCtx = new GLCleanupHelper(texID, image, display);
+ *updateProc = update_gl_texture;
+ *imageCtx = new GLTextureHelper(texID, image, display, target);
return GrBackendTexture(width, height, GrMipMapped::kNo, textureInfo);
}
@@ -267,11 +294,16 @@ void delete_vk_image(void* context) {
delete cleanupHelper;
}
+void update_vk_image(void* context, GrContext* grContext) {
+ // no op
+}
+
static GrBackendTexture make_vk_backend_texture(
GrContext* context, AHardwareBuffer* hardwareBuffer,
int width, int height,
DeleteImageProc* deleteProc,
- DeleteImageCtx* deleteCtx,
+ UpdateImageProc* updateProc,
+ TexImageCtx* imageCtx,
bool isProtectedContent,
const GrBackendFormat& backendFormat,
bool isRenderable) {
@@ -456,7 +488,8 @@ static GrBackendTexture make_vk_backend_texture(
imageInfo.fYcbcrConversionInfo = *ycbcrConversion;
*deleteProc = delete_vk_image;
- *deleteCtx = new VulkanCleanupHelper(gpu, image, memory);
+ *updateProc = update_vk_image;
+ *imageCtx = new VulkanCleanupHelper(gpu, image, memory);
return GrBackendTexture(width, height, imageInfo);
}
@@ -489,7 +522,8 @@ static bool can_import_protected_content(GrContext* context) {
GrBackendTexture MakeBackendTexture(GrContext* context, AHardwareBuffer* hardwareBuffer,
int width, int height,
DeleteImageProc* deleteProc,
- DeleteImageCtx* deleteCtx,
+ UpdateImageProc* updateProc,
+ TexImageCtx* imageCtx,
bool isProtectedContent,
const GrBackendFormat& backendFormat,
bool isRenderable) {
@@ -500,7 +534,7 @@ GrBackendTexture MakeBackendTexture(GrContext* context, AHardwareBuffer* hardwar
if (GrBackendApi::kOpenGL == context->backend()) {
return make_gl_backend_texture(context, hardwareBuffer, width, height, deleteProc,
- deleteCtx, createProtectedImage, backendFormat,
+ updateProc, imageCtx, createProtectedImage, backendFormat,
isRenderable);
} else {
SkASSERT(GrBackendApi::kVulkan == context->backend());
@@ -508,7 +542,7 @@ GrBackendTexture MakeBackendTexture(GrContext* context, AHardwareBuffer* hardwar
// Currently we don't support protected images on vulkan
SkASSERT(!createProtectedImage);
return make_vk_backend_texture(context, hardwareBuffer, width, height, deleteProc,
- deleteCtx, createProtectedImage, backendFormat,
+ updateProc, imageCtx, createProtectedImage, backendFormat,
isRenderable);
#else
return GrBackendTexture();
@@ -516,6 +550,18 @@ GrBackendTexture MakeBackendTexture(GrContext* context, AHardwareBuffer* hardwar
}
}
+GrBackendTexture MakeBackendTexture(GrContext* context, AHardwareBuffer* hardwareBuffer,
+ int width, int height,
+ DeleteImageProc* deleteProc,
+ TexImageCtx* imageCtx,
+ bool isProtectedContent,
+ const GrBackendFormat& backendFormat,
+ bool isRenderable) {
+ UpdateImageProc updateProc;
+ return MakeBackendTexture(context, hardwareBuffer, width, height, deleteProc, &updateProc,
+ imageCtx, isProtectedContent, backendFormat, isRenderable);
+}
+
} // GrAHardwareBufferUtils
#endif
diff --git a/src/gpu/GrAHardwareBufferUtils.h b/src/gpu/GrAHardwareBufferUtils.h
index 31cb1407a5..8e637452df 100644
--- a/src/gpu/GrAHardwareBufferUtils.h
+++ b/src/gpu/GrAHardwareBufferUtils.h
@@ -27,13 +27,46 @@ SkColorType GetSkColorTypeFromBufferFormat(uint32_t bufferFormat);
GrBackendFormat GetBackendFormat(GrContext* context, AHardwareBuffer* hardwareBuffer,
uint32_t bufferFormat, bool requireKnownFormat);
-typedef void* DeleteImageCtx;
-typedef void (*DeleteImageProc)(DeleteImageCtx);
+typedef void* TexImageCtx;
+typedef void (*DeleteImageProc)(TexImageCtx);
+typedef void (*UpdateImageProc)(TexImageCtx, GrContext*);
+//TODO: delete this function after clients stop using it.
GrBackendTexture MakeBackendTexture(GrContext* context, AHardwareBuffer* hardwareBuffer,
int width, int height,
DeleteImageProc* deleteProc,
- DeleteImageCtx* deleteCtx,
+ TexImageCtx* imageCtx,
+ bool isProtectedContent,
+ const GrBackendFormat& backendFormat,
+ bool isRenderable);
+
+/**
+ * Create a GrBackendTexture from AHardwareBuffer
+ *
+ * @param context GPU context
+ * @param hardwareBuffer AHB
+ * @param width texture width
+ * @param height texture height
+ * @param deleteProc returns a function that deletes the texture and
+ * other GPU resources. Must be invoked on the same
+ * thread as MakeBackendTexture
+ * @param updateProc returns a function, that needs to be invoked, when
+ * AHB buffer content has changed. Must be invoked on
+ * the same thread as MakeBackendTexture
+ * @param imageCtx returns an opaque image context, that is passed as
+ * first argument to deleteProc and updateProc
+ * @param isProtectedContent if true, GL backend uses EXT_protected_content
+ * @param backendFormat backend format, usually created with helper
+ * function GetBackendFormat
+ * @param isRenderable true if GrBackendTexture can be used as a color
+ * attachment
+ * @return valid GrBackendTexture object on success
+ */
+GrBackendTexture MakeBackendTexture(GrContext* context, AHardwareBuffer* hardwareBuffer,
+ int width, int height,
+ DeleteImageProc* deleteProc,
+ UpdateImageProc* updateProc,
+ TexImageCtx* imageCtx,
bool isProtectedContent,
const GrBackendFormat& backendFormat,
bool isRenderable);
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index eb64b8cf19..708286eb43 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -613,13 +613,14 @@ sk_sp<SkImage> SkImage::MakeFromAHardwareBufferWithData(GrContext* context,
}
GrAHardwareBufferUtils::DeleteImageProc deleteImageProc = nullptr;
- GrAHardwareBufferUtils::DeleteImageCtx deleteImageCtx = nullptr;
+ GrAHardwareBufferUtils::UpdateImageProc updateImageProc = nullptr;
+ GrAHardwareBufferUtils::TexImageCtx deleteImageCtx = nullptr;
GrBackendTexture backendTexture =
GrAHardwareBufferUtils::MakeBackendTexture(context, hardwareBuffer,
bufferDesc.width, bufferDesc.height,
- &deleteImageProc, &deleteImageCtx,
- false, backendFormat, true);
+ &deleteImageProc, &updateImageProc,
+ &deleteImageCtx, false, backendFormat, true);
if (!backendTexture.isValid()) {
return nullptr;
}
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 5a2a12d485..cd340000ae 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -617,14 +617,15 @@ sk_sp<SkSurface> SkSurface::MakeFromAHardwareBuffer(GrContext* context,
if (isTextureable) {
GrAHardwareBufferUtils::DeleteImageProc deleteImageProc = nullptr;
- GrAHardwareBufferUtils::DeleteImageCtx deleteImageCtx = nullptr;
+ GrAHardwareBufferUtils::UpdateImageProc updateImageProc = nullptr;
+ GrAHardwareBufferUtils::TexImageCtx deleteImageCtx = nullptr;
GrBackendTexture backendTexture =
GrAHardwareBufferUtils::MakeBackendTexture(context, hardwareBuffer,
bufferDesc.width, bufferDesc.height,
- &deleteImageProc, &deleteImageCtx,
- isProtectedContent, backendFormat,
- true);
+ &deleteImageProc, &updateImageProc,
+ &deleteImageCtx, isProtectedContent,
+ backendFormat, true);
if (!backendTexture.isValid()) {
return nullptr;
}
--
2.17.1

View File

@ -1,19 +1,19 @@
From d76a1c23cb4a61bac8e1cdc33bca4201b5c1972f Mon Sep 17 00:00:00 2001
From accaf1aedd6520cc92dd33f6fb96c75e44fbd1a8 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 19 Aug 2018 23:05:26 +0200
Subject: [PATCH 04/11] We might not have a mFlashlight at this state, but
that's ok
Subject: [PATCH] We might not have a mFlashlight at this state, but that's ok
Change-Id: I0ae65c0be4931b4e3cbda2d0cc64acc4f5018a73
---
services/camera/libcameraservice/CameraService.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 3736a9e24..12ab2f47e 100644
index a380b49e0..2c7c5208b 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -279,7 +279,7 @@ void CameraService::addStates(const String8 id) {
conflicting));
@@ -297,7 +297,7 @@ void CameraService::addStates(const String8 id) {
isPublicallyHiddenSecureCamera));
}
- if (mFlashlight->hasFlashUnit(id)) {

View File

@ -0,0 +1,63 @@
From 1f986fdcdbf2788cc1df26c032a08bce89b1427d Mon Sep 17 00:00:00 2001
From: "Chris.CC Lee" <chriscclee@google.com>
Date: Mon, 3 Feb 2020 17:33:19 +0800
Subject: [PATCH 47/49] Fix AoD front scrim being opaque at DOZE_PULSING.
When doze state changed from DOZE to DOZE_PULSING on devices not
supporting doze_brightness_sensor_type sensor, there would be no
sensor events to update the AoD front scrim. And due to the scrim was
set to opaque at DOZE state, most views on the statusbar will be
invisible. This patch change the scrim to transparent again at leaving
DOZE state.
Bug: 148129743
Test: atest DozeScreenBrightnessTest
Change-Id: I2c079d081b04f00a929ae5c4475639685f9f7e69
---
.../systemui/doze/DozeScreenBrightness.java | 4 ++++
.../systemui/doze/DozeScreenBrightnessTest.java | 14 ++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeScreenBrightness.java b/packages/SystemUI/src/com/android/systemui/doze/DozeScreenBrightness.java
index bd6882c01bb..c27e633f2a9 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeScreenBrightness.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeScreenBrightness.java
@@ -161,6 +161,10 @@ public class DozeScreenBrightness extends BroadcastReceiver implements DozeMachi
// again, it will only show after the brightness sensor has stabilized,
// avoiding a potential flicker.
scrimOpacity = 255;
+ } else if (!mScreenOff && mLightSensor == null) {
+ // No light sensor but previous state turned the screen black. Make the scrim
+ // transparent and below views visible.
+ scrimOpacity = 0;
} else if (brightnessReady) {
// Only unblank scrim once brightness is ready.
scrimOpacity = computeScrimOpacity(sensorValue);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenBrightnessTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenBrightnessTest.java
index 392c677b982..1347175c7d3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenBrightnessTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenBrightnessTest.java
@@ -170,6 +170,20 @@ public class DozeScreenBrightnessTest extends SysuiTestCase {
assertEquals(DEFAULT_BRIGHTNESS, mServiceFake.screenBrightness);
}
+ @Test
+ public void testPulsing_withoutLightSensor_setsAoDDimmingScrimTransparent() throws Exception {
+ mScreen = new DozeScreenBrightness(mContext, mServiceFake, mSensorManager,
+ null /* sensor */, mHostFake, null /* handler */,
+ DEFAULT_BRIGHTNESS, SENSOR_TO_BRIGHTNESS, SENSOR_TO_OPACITY,
+ true /* debuggable */);
+ mScreen.transitionTo(UNINITIALIZED, INITIALIZED);
+ mScreen.transitionTo(INITIALIZED, DOZE);
+
+ mScreen.transitionTo(DOZE, DOZE_REQUEST_PULSE);
+
+ assertEquals(0f, mHostFake.aodDimmingScrimOpacity, 0.001f /* delta */);
+ }
+
@Test
public void testNullSensor() throws Exception {
mScreen = new DozeScreenBrightness(mContext, mServiceFake, mSensorManager,
--
2.17.1

View File

@ -0,0 +1,96 @@
From b13732f6a801d85390feb025d678e2b14effc915 Mon Sep 17 00:00:00 2001
From: Stan Iliev <stani@google.com>
Date: Thu, 1 Aug 2019 14:41:52 -0400
Subject: [PATCH 48/49] TextureVuew rebind GL texture, if AHB content has
changed
Bug: 138674291
Test: Ran apps with TextureView and CTS
Change-Id: Ieecf7daf160761de719356644ddaeda8f9c068e1
---
libs/hwui/surfacetexture/ImageConsumer.cpp | 18 +++++++++++++++---
libs/hwui/surfacetexture/ImageConsumer.h | 5 -----
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/libs/hwui/surfacetexture/ImageConsumer.cpp b/libs/hwui/surfacetexture/ImageConsumer.cpp
index bae616bbc63..17ee17d5cd1 100644
--- a/libs/hwui/surfacetexture/ImageConsumer.cpp
+++ b/libs/hwui/surfacetexture/ImageConsumer.cpp
@@ -71,13 +71,16 @@ public:
void makeImage(sp<GraphicBuffer>& graphicBuffer, android_dataspace dataspace,
GrContext* context);
+ void newBufferContent(GrContext* context);
+
private:
// The only way to invoke dtor is with unref, when mUsageCount is 0.
~AutoBackendTextureRelease() {}
GrBackendTexture mBackendTexture;
GrAHardwareBufferUtils::DeleteImageProc mDeleteProc;
- GrAHardwareBufferUtils::DeleteImageCtx mDeleteCtx;
+ GrAHardwareBufferUtils::UpdateImageProc mUpdateProc;
+ GrAHardwareBufferUtils::TexImageCtx mImageCtx;
// Starting with refcount 1, because the first ref is held by SurfaceTexture. Additional refs
// are held by SkImages.
@@ -101,7 +104,8 @@ AutoBackendTextureRelease::AutoBackendTextureRelease(GrContext* context, Graphic
buffer->getWidth(),
buffer->getHeight(),
&mDeleteProc,
- &mDeleteCtx,
+ &mUpdateProc,
+ &mImageCtx,
createProtectedImage,
backendFormat,
false);
@@ -123,7 +127,7 @@ void AutoBackendTextureRelease::unref(bool releaseImage) {
mUsageCount--;
if (mUsageCount <= 0) {
if (mBackendTexture.isValid()) {
- mDeleteProc(mDeleteCtx);
+ mDeleteProc(mImageCtx);
mBackendTexture = {};
}
delete this;
@@ -154,6 +158,12 @@ void AutoBackendTextureRelease::makeImage(sp<GraphicBuffer>& graphicBuffer,
}
}
+void AutoBackendTextureRelease::newBufferContent(GrContext* context) {
+ if (mBackendTexture.isValid()) {
+ mUpdateProc(mImageCtx, context);
+ }
+}
+
void ImageConsumer::ImageSlot::createIfNeeded(sp<GraphicBuffer> graphicBuffer,
android_dataspace dataspace, bool forceCreate,
GrContext* context) {
@@ -166,6 +176,8 @@ void ImageConsumer::ImageSlot::createIfNeeded(sp<GraphicBuffer> graphicBuffer,
if (!mTextureRelease) {
mTextureRelease = new AutoBackendTextureRelease(context, graphicBuffer.get());
+ } else {
+ mTextureRelease->newBufferContent(context);
}
mDataspace = dataspace;
diff --git a/libs/hwui/surfacetexture/ImageConsumer.h b/libs/hwui/surfacetexture/ImageConsumer.h
index 2fdece98987..3e2a91a251f 100644
--- a/libs/hwui/surfacetexture/ImageConsumer.h
+++ b/libs/hwui/surfacetexture/ImageConsumer.h
@@ -26,11 +26,6 @@
#include <gui/BufferItem.h>
#include <system/graphics.h>
-namespace GrAHardwareBufferUtils {
-typedef void* DeleteImageCtx;
-typedef void (*DeleteImageProc)(DeleteImageCtx);
-}
-
namespace android {
namespace uirenderer {
--
2.17.1

View File

@ -0,0 +1,29 @@
From 47af2ea4d5e850fc900a8f76682979325460a0e0 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sat, 22 Feb 2020 23:25:51 +0100
Subject: [PATCH 49/49] FacolaView] Allow system-side properties (vendor-side
works only with proper selinux)
---
.../com/android/server/biometrics/fingerprint/FacolaView.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java b/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java
index b8ca25a48d2..f77e8282689 100644
--- a/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java
+++ b/services/core/java/com/android/server/biometrics/fingerprint/FacolaView.java
@@ -73,7 +73,11 @@ public class FacolaView extends ImageView implements OnTouchListener {
noDim = android.os.SystemProperties.getBoolean("persist.sys.phh.nodim", false);
String[] location = android.os.SystemProperties.get("persist.vendor.sys.fp.fod.location.X_Y", "").split(",");
+ if(location.length == 0)
+ location = android.os.SystemProperties.get("persist.sys.fp.fod.location.X_Y", "").split(",");
String[] size = android.os.SystemProperties.get("persist.vendor.sys.fp.fod.size.width_height", "").split(",");
+ if(size.length == 0)
+ size = android.os.SystemProperties.get("persist.sys.fp.fod.size.width_height", "").split(",");
Slog.d("PHH-Enroll", "FacolaView hello");
if(size.length == 2 && location.length == 2) {
Slog.d("PHH-Enroll", "Got real values");
--
2.17.1

View File

@ -0,0 +1,30 @@
From 00bec8866bd675f39181051fb1e5c21d0a9d6de0 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 3 Feb 2020 23:35:23 +0100
Subject: [PATCH 8/8] [Hack] Catch spurious getModemStatus calls when enabling
CAF IMS
---
src/java/com/android/internal/telephony/RIL.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index 2fff03029..32ddd4e07 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -988,7 +988,11 @@ public class RIL extends BaseCommands implements CommandsInterface {
if (result != null) {
AsyncResult.forMessage(result, null,
CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ try {
+ result.sendToTarget();
+ } catch(IllegalStateException e) {
+ android.util.Log.d("PHH", "getModemStatus", e);
+ }
}
return;
}
--
2.17.1

View File

@ -0,0 +1,74 @@
From 03cfb2b7b10a4ff6040521bb974de6f1566ce0a0 Mon Sep 17 00:00:00 2001
From: Michael Cheah <michael@cheah.xyz>
Date: Sat, 11 Jan 2020 13:19:04 +0800
Subject: [PATCH 2/2] Fix operatorNumeric parsing in CellInfoUtil & support old
mnc format
---
.../network/telephony/CellInfoUtil.java | 26 ++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/com/android/settings/network/telephony/CellInfoUtil.java b/src/com/android/settings/network/telephony/CellInfoUtil.java
index def81a10c6..6e6586a4cb 100644
--- a/src/com/android/settings/network/telephony/CellInfoUtil.java
+++ b/src/com/android/settings/network/telephony/CellInfoUtil.java
@@ -16,6 +16,7 @@
package com.android.settings.network.telephony;
+import android.os.SystemProperties;
import android.telephony.CellIdentity;
import android.telephony.CellIdentityCdma;
import android.telephony.CellIdentityGsm;
@@ -34,6 +35,8 @@ import android.util.Log;
import com.android.internal.telephony.OperatorInfo;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
@@ -125,6 +128,16 @@ public final class CellInfoUtil {
Log.e(TAG, "Invalid CellInfo type");
oi = new OperatorInfo("", "", "");
}
+
+ // Fix manual network selection with old modem
+ // https://github.com/LineageOS/android_hardware_ril/commit/e3d006fa722c02fc26acdfcaa43a3f3a1378eba9
+ if (SystemProperties.getBoolean("persist.sys.phh.radio.use_old_mnc_format", false)
+ && !TextUtils.isEmpty(oi.getOperatorNumeric())) {
+ oi = new OperatorInfo(
+ oi.getOperatorAlphaLong(),
+ oi.getOperatorAlphaShort(),
+ oi.getOperatorNumeric() + "+");
+ }
return oi;
}
@@ -135,12 +148,19 @@ public final class CellInfoUtil {
* we only want to wrap the operator info and PLMN to a CellInfo object.
*/
public static CellInfo convertOperatorInfoToCellInfo(OperatorInfo operatorInfo) {
+ Pattern p = Pattern.compile("^([0-9]{5,6}).*");
String operatorNumeric = operatorInfo.getOperatorNumeric();
String mcc = null;
String mnc = null;
- if (operatorNumeric != null && operatorNumeric.matches("^[0-9]{5,6}$")) {
- mcc = operatorNumeric.substring(0, 3);
- mnc = operatorNumeric.substring(3);
+ Log.d(TAG, "operatorNumeric: " + operatorNumeric);
+ if (operatorNumeric != null) {
+ Matcher m = p.matcher(operatorNumeric);
+ if (m.matches()) {
+ mcc = m.group(1).substring(0, 3);
+ mnc = m.group(1).substring(3);
+ } else {
+ Log.e(TAG, "Failed to parse operatorNumeric!");
+ }
}
CellIdentityGsm cig = new CellIdentityGsm(
Integer.MAX_VALUE /* lac */,
--
2.17.1

View File

@ -0,0 +1,104 @@
From 348be3bd9a6e528232141b704af5b07eef5c2829 Mon Sep 17 00:00:00 2001
From: Michael Cheah <michael@cheah.xyz>
Date: Sat, 11 Jan 2020 19:23:57 +0800
Subject: [PATCH 4/4] Fix operatorNumeric parsing in CellInfoUtil & support old
mnc format
---
src/com/android/phone/CellInfoUtil.java | 26 ++++++++++++++++---
.../phone/NetworkSelectListPreference.java | 11 ++++++++
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/src/com/android/phone/CellInfoUtil.java b/src/com/android/phone/CellInfoUtil.java
index 82720291d..fe1959404 100644
--- a/src/com/android/phone/CellInfoUtil.java
+++ b/src/com/android/phone/CellInfoUtil.java
@@ -16,6 +16,7 @@
package com.android.phone;
+import android.os.SystemProperties;
import android.telephony.CellIdentity;
import android.telephony.CellIdentityCdma;
import android.telephony.CellIdentityGsm;
@@ -34,6 +35,8 @@ import android.util.Log;
import com.android.internal.telephony.OperatorInfo;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* Add static Utility functions to get information from the CellInfo object.
@@ -124,6 +127,16 @@ public final class CellInfoUtil {
Log.e(TAG, "Invalid CellInfo type");
oi = new OperatorInfo("", "", "");
}
+
+ // Fix manual network selection with old modem
+ // https://github.com/LineageOS/android_hardware_ril/commit/e3d006fa722c02fc26acdfcaa43a3f3a1378eba9
+ if (SystemProperties.getBoolean("persist.sys.phh.radio.use_old_mnc_format", false)
+ && !TextUtils.isEmpty(oi.getOperatorNumeric())) {
+ oi = new OperatorInfo(
+ oi.getOperatorAlphaLong(),
+ oi.getOperatorAlphaShort(),
+ oi.getOperatorNumeric() + "+");
+ }
return oi;
}
@@ -134,12 +147,19 @@ public final class CellInfoUtil {
* we only want to wrap the operator info and PLMN to a CellInfo object.
*/
public static CellInfo convertOperatorInfoToCellInfo(OperatorInfo operatorInfo) {
+ Pattern p = Pattern.compile("^([0-9]{5,6}).*");
String operatorNumeric = operatorInfo.getOperatorNumeric();
String mcc = null;
String mnc = null;
- if (operatorNumeric != null && operatorNumeric.matches("^[0-9]{5,6}$")) {
- mcc = operatorNumeric.substring(0, 3);
- mnc = operatorNumeric.substring(3);
+ Log.d(TAG, "operatorNumeric: " + operatorNumeric);
+ if (operatorNumeric != null) {
+ Matcher m = p.matcher(operatorNumeric);
+ if (m.matches()) {
+ mcc = m.group(1).substring(0, 3);
+ mnc = m.group(1).substring(3);
+ } else {
+ Log.e(TAG, "Failed to parse operatorNumeric!");
+ }
}
CellIdentityGsm cig = new CellIdentityGsm(
Integer.MAX_VALUE /* lac */,
diff --git a/src/com/android/phone/NetworkSelectListPreference.java b/src/com/android/phone/NetworkSelectListPreference.java
index df3f44a8d..9fc571500 100644
--- a/src/com/android/phone/NetworkSelectListPreference.java
+++ b/src/com/android/phone/NetworkSelectListPreference.java
@@ -24,6 +24,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.Parcel;
import android.os.Parcelable;
+import android.os.SystemProperties;
import android.preference.ListPreference;
import android.preference.Preference;
import android.telephony.CellInfo;
@@ -411,6 +412,16 @@ public class NetworkSelectListPreference extends ListPreference
} else {
oi = new OperatorInfo("", "", "");
}
+
+ // Fix manual network selection with old modem
+ // https://github.com/LineageOS/android_hardware_ril/commit/e3d006fa722c02fc26acdfcaa43a3f3a1378eba9
+ if (SystemProperties.getBoolean("persist.sys.phh.radio.use_old_mnc_format", false)
+ && !TextUtils.isEmpty(oi.getOperatorNumeric())) {
+ oi = new OperatorInfo(
+ oi.getOperatorAlphaLong(),
+ oi.getOperatorAlphaShort(),
+ oi.getOperatorNumeric() + "+");
+ }
return oi;
}
--
2.17.1

View File

@ -0,0 +1,38 @@
From a60d2da9137661584aa536a9b6fb80f87960d197 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 28 Jan 2020 00:27:17 +0100
Subject: [PATCH 7/7] Sony has `texfat` exfat fs
---
fs/Exfat.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp
index b9844a5..e6f8450 100644
--- a/fs/Exfat.cpp
+++ b/fs/Exfat.cpp
@@ -35,7 +35,11 @@ static const char* kFsckPath = "/system/bin/fsck.exfat";
bool IsSupported() {
return access(kMkfsPath, X_OK) == 0 && access(kFsckPath, X_OK) == 0 &&
- (IsFilesystemSupported("exfat") || IsFilesystemSupported("sdfat"));
+ (
+ IsFilesystemSupported("exfat") ||
+ IsFilesystemSupported("sdfat") ||
+ IsFilesystemSupported("texfat")
+ );
}
status_t Check(const std::string& source) {
@@ -63,6 +67,8 @@ status_t Mount(const std::string& source, const std::string& target, int ownerUi
const char *fs = "exfat";
if(IsFilesystemSupported("sdfat"))
fs = "sdfat";
+ if(IsFilesystemSupported("texfat"))
+ fs = "texfat";
if (mount(source.c_str(), target.c_str(), fs, mountFlags, mountData.c_str()) == 0) {
return 0;
}
--
2.17.1