Skip to content

Commit

Permalink
Merge pull request #10 from sledges/hybris-sony-aosp-10
Browse files Browse the repository at this point in the history
hybris patches for Android 10
  • Loading branch information
sledges authored Dec 1, 2020
2 parents 990b967 + d3fc9f3 commit 25ce9ca
Show file tree
Hide file tree
Showing 64 changed files with 631 additions and 291 deletions.
37 changes: 20 additions & 17 deletions art/0001-hybris-Silence-some-build-errors-to-let-the-systemim.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From af58fcbb7a0c501a5cd06ae6c5eaed17204b065c Mon Sep 17 00:00:00 2001
From 1a27bd48255a96853e49d25c82a0fe47dd477f83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <[email protected]>
Date: Fri, 3 Jul 2020 22:15:49 +0200
Subject: [PATCH] (hybris) Silence some build errors to let the systemimage
Expand All @@ -16,9 +16,9 @@ Change-Id: Ide41188b6263a22c371ec28786bbc1ef1ee62df7
---
build/Android.gtest.mk | 20 ++++++++++----------
runtime/thread-current-inl.h | 2 +-
runtime/thread.cc | 4 ++--
runtime/thread_list.cc | 2 +-
4 files changed, 14 insertions(+), 14 deletions(-)
runtime/thread.cc | 4 ++++
runtime/thread_list.cc | 2 ++
4 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 03aae07587..20e38df7b2 100644
Expand Down Expand Up @@ -64,50 +64,53 @@ index 03aae07587..20e38df7b2 100644
ifdef ART_TEST_HOST_GTEST_Main_DEX
$(ART_TEST_HOST_GTEST_MainStripped_DEX): $(ART_TEST_HOST_GTEST_Main_DEX)
diff --git a/runtime/thread-current-inl.h b/runtime/thread-current-inl.h
index 9241b1f875..904a62ccff 100644
index 9241b1f875..a3e0520423 100644
--- a/runtime/thread-current-inl.h
+++ b/runtime/thread-current-inl.h
@@ -34,7 +34,7 @@ inline Thread* Thread::Current() {
return nullptr;
} else {
#ifdef ART_TARGET_ANDROID
- void* thread = __get_tls()[TLS_SLOT_ART_THREAD_SELF];
+ void* thread = __get_tls()[99];
+ void* thread = nullptr; //__get_tls()[TLS_SLOT_ART_THREAD_SELF];
#else
void* thread = pthread_getspecific(Thread::pthread_key_self_);
#endif
diff --git a/runtime/thread.cc b/runtime/thread.cc
index be0e30ad11..dd3d07d920 100644
index be0e30ad11..da112e19c9 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -933,7 +933,7 @@ bool Thread::Init(ThreadList* thread_list, JavaVMExt* java_vm, JNIEnvExt* jni_en
@@ -933,7 +933,9 @@ bool Thread::Init(ThreadList* thread_list, JavaVMExt* java_vm, JNIEnvExt* jni_en
}

#ifdef ART_TARGET_ANDROID
- __get_tls()[TLS_SLOT_ART_THREAD_SELF] = this;
+ __get_tls()[99] = this;
+#ifdef DISABLED_FOR_HYBRIS_SUPPORT
__get_tls()[TLS_SLOT_ART_THREAD_SELF] = this;
+#endif
#else
CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, this), "attach self");
#endif
@@ -2199,7 +2199,7 @@ void Thread::ThreadExitCallback(void* arg) {
@@ -2199,7 +2201,9 @@ void Thread::ThreadExitCallback(void* arg) {
"going to use a pthread_key_create destructor?): " << *self;
CHECK(is_started_);
#ifdef ART_TARGET_ANDROID
- __get_tls()[TLS_SLOT_ART_THREAD_SELF] = self;
+ __get_tls()[99] = self;
+#ifdef DISABLED_FOR_HYBRIS_SUPPORT
__get_tls()[TLS_SLOT_ART_THREAD_SELF] = self;
+#endif
#else
CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, self), "reattach self");
#endif
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index ed6b2c91e5..06e6f6585b 100644
index ed6b2c91e5..37a2bd6911 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -1482,7 +1482,7 @@ void ThreadList::Unregister(Thread* self) {
@@ -1482,7 +1482,9 @@ void ThreadList::Unregister(Thread* self) {
// Clear the TLS data, so that the underlying native thread is recognizably detached.
// (It may wish to reattach later.)
#ifdef ART_TARGET_ANDROID
- __get_tls()[TLS_SLOT_ART_THREAD_SELF] = nullptr;
+ __get_tls()[99] = nullptr;
+#ifdef DISABLED_FOR_HYBRIS_SUPPORT
__get_tls()[TLS_SLOT_ART_THREAD_SELF] = nullptr;
+#endif
#else
CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, nullptr), "detach self");
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 3c74a5052ea7eb73290fe34de4a8a05a2e0c9f11 Mon Sep 17 00:00:00 2001
From cd7b68932bccda2eac104c841254f90c50359cf7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matti=20Lehtim=C3=A4ki?= <[email protected]>
Date: Sun, 17 Dec 2017 00:16:16 +0200
Subject: [PATCH 2/6] (hybris) Add support for get and list of properties.
Subject: [PATCH 1/7] (hybris) Add support for get and list of properties.

Change-Id: I089a2a146c06d8ad0c234f0a9a4b5aa07beaeed5
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 90df3815d26d79b32d6a9cb05f6ded82054744e0 Mon Sep 17 00:00:00 2001
From 8da8433158fc287697bba8809218822781f386f5 Mon Sep 17 00:00:00 2001
From: Ricardo Salveti de Araujo <[email protected]>
Date: Thu, 9 Jan 2014 00:57:01 -0200
Subject: [PATCH 3/6] (hybris) bionic_tls.h: shifting TLS slots to avoid
Subject: [PATCH 2/7] (hybris) bionic_tls.h: shifting TLS slots to avoid
conflicts with libc/hybris

Change-Id: Idf503fe8fa0a24edf4dbbabaa8d3a1c2d1f60295
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From c2db77fdc026934f0c8198eab45608146dfb28dc Mon Sep 17 00:00:00 2001
From d5ca09b790c93dbf6f9522743a975fe2817dc03d Mon Sep 17 00:00:00 2001
From: Simonas Leleiva <[email protected]>
Date: Wed, 18 Apr 2018 18:37:09 +0200
Subject: [PATCH 4/6] (hybris) disable tls usage in locale.cpp, to avoid
Subject: [PATCH 3/7] (hybris) disable tls usage in locale.cpp, to avoid
problems with libhybris

Change-Id: I498a9749853e6a5a4aaa4ae93479aff083e02d4c
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From dcdf30cb95462a99f22a6b711dd193888809262d Mon Sep 17 00:00:00 2001
From 480a63cbf69884a8e274c305eccd3ac676e02a74 Mon Sep 17 00:00:00 2001
From: Ilya Bizyaev <[email protected]>
Date: Sat, 20 Jan 2018 17:48:27 +0300
Subject: [PATCH 5/6] (hybris) Fix TLS slots for x86 Aligns with this libhybris
Subject: [PATCH 4/7] (hybris) Fix TLS slots for x86 Aligns with this libhybris
patch: https://github.com/libhybris/libhybris/pull/370

Change-Id: Ibdbfa1c1672cbac5a687afdedbb1d8ff05861f4f
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From f6251489321b5e8b23f43a5c568c1a6a37aced92 Mon Sep 17 00:00:00 2001
From c806b95a09f6ca97c44025a97ca5bddb7cec6162 Mon Sep 17 00:00:00 2001
From: Franz-Josef Haider <[email protected]>
Date: Thu, 28 Mar 2019 13:10:48 -0400
Subject: [PATCH 6/6] (hybris) don't fail because of fsetxattr
Subject: [PATCH 5/7] (hybris) don't fail because of fsetxattr

Change-Id: I4d765ff401d6b4f12da0305416cb751eb0c9e96b
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
From d638f78bbaf290a38680261876fa456bff349fdc Mon Sep 17 00:00:00 2001
From: Franz-Josef Haider <franz.haider@jollamobile.com>
Date: Thu, 1 Feb 2018 00:57:52 +0000
Subject: [PATCH 1/6] (hybris) Fix __get_tls and related functions (>=Android
8)
From a52e2b68710dec02a46768b485ab50b0a193834c Mon Sep 17 00:00:00 2001
From: Franz-Josef Haider <franz.haider@jolla.com>
Date: Thu, 8 Oct 2020 14:43:42 +0000
Subject: [PATCH 6/7] (hybris) Fix __get_tls and related functions (>=Android
10)

Change-Id: If75e4ae739ec6c482a68b1b69c2130535add2279
Signed-off-by: Simonas Leleiva <[email protected]>
Signed-off-by: Simonas Leleiva <[email protected]>
Change-Id: I24486873be638a1a8cd123705ba2e51ec7414b94
---
libc/bionic/ndk_cruft.cpp | 18 +++++++----
libc/Android.bp | 1 +
libc/bionic/ndk_cruft.cpp | 13 ++++----
libc/hybris_support.c | 4 +++
libc/libc.map.txt | 1 +
libc/private/__get_tls.h | 31 +++++++-----------
libc/private/__get_tls_internal.h | 54 +++++++++++++++++++++++++++++++
4 files changed, 79 insertions(+), 25 deletions(-)
6 files changed, 79 insertions(+), 25 deletions(-)
create mode 100644 libc/hybris_support.c
create mode 100644 libc/private/__get_tls_internal.h

diff --git a/libc/Android.bp b/libc/Android.bp
index a5990288d..85e03f4a2 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -18,6 +18,7 @@ libc_common_src_files = [
"stdio/vfscanf.cpp",
"stdio/vfwscanf.c",
"stdlib/exit.c",
+ "hybris_support.c",
]

// Various kinds of cruft.
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index 2c3299f7b..637e3dfa1 100644
index 2c3299f7b..85626db4a 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -49,6 +49,18 @@
@@ -49,6 +49,13 @@

extern "C" {

+void** __get_tls_hooks(void) {
+#include "private/__get_tls_internal.h"
+ return __get_tls_internal();
+}
+
+// TODO: does anything still need this?
+// with hybris we need it, so thanks for keeping it.
+void** __get_tls() {
Expand All @@ -37,7 +47,7 @@ index 2c3299f7b..637e3dfa1 100644
// LP64 doesn't need to support any legacy cruft.
#if !defined(__LP64__)

@@ -70,12 +82,6 @@ int __open() {
@@ -70,12 +77,6 @@ int __open() {
abort();
}

Expand All @@ -50,18 +60,28 @@ index 2c3299f7b..637e3dfa1 100644
// This non-standard function was in our <string.h> for some reason.
void memswap(void* m1, void* m2, size_t n) {
char* p = reinterpret_cast<char*>(m1);
diff --git a/libc/hybris_support.c b/libc/hybris_support.c
new file mode 100644
index 000000000..925253021
--- /dev/null
+++ b/libc/hybris_support.c
@@ -0,0 +1,4 @@
+void** __get_tls_hooks(void) {
+#include "private/__get_tls_internal.h"
+ return __get_tls_internal();
+}
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index 88192239a..1bf0e307d 100644
index 88192239a..941faadf8 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1593,6 +1593,7 @@ LIBC_PRIVATE {
__gesf2; # arm
__get_thread; # arm x86 mips
__get_tls; # arm x86 mips
+ __get_tls_hooks; # # arm x86 mips hybris
__getdents64; # arm x86 mips
__gnu_ldivmod_helper; # arm
__gnu_uldivmod_helper; # arm
@@ -40,6 +40,7 @@ LIBC {
__fsetlocking; # introduced=23
__fstatfs64; # arm x86 mips
__fwritable; # introduced=23
+ __get_tls_hooks; # arm arm64 x86 mips introduced=21
__get_h_errno;
__getcpu; # arm x86 mips introduced-arm=12 introduced-mips=16 introduced-x86=12
__getcwd; # arm x86 mips
diff --git a/libc/private/__get_tls.h b/libc/private/__get_tls.h
index 04c5fdbbf..6a4b5728e 100644
--- a/libc/private/__get_tls.h
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 3b2cfa4a631f91910300badccf93a40749d43817 Mon Sep 17 00:00:00 2001
From: NeKit <[email protected]>
Date: Fri, 3 Jul 2020 20:10:20 +0200
Subject: [PATCH 7/7] (halium) libdl: neutralize cfi_slowpath_common as it
breaks libhybris

Change-Id: I90b4af9d9e6b23cccafb659931a8e85b8bae091a
---
libdl/libdl_cfi.cpp | 1 +
1 file changed, 1 insertion(+)

diff --git a/libdl/libdl_cfi.cpp b/libdl/libdl_cfi.cpp
index 1dd5b21cd..f48a3cfef 100644
--- a/libdl/libdl_cfi.cpp
+++ b/libdl/libdl_cfi.cpp
@@ -66,6 +66,7 @@ static uintptr_t cfi_check_addr(uint16_t v, void* Ptr) {
}

static inline void cfi_slowpath_common(uint64_t CallSiteTypeId, void* Ptr, void* DiagData) {
+ return;
uint16_t v = shadow_load(Ptr);
switch (v) {
case CFIShadow::kInvalidShadow:
--
2.27.0

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From aadb47d6bedbb0052b7dc2a62b8fa6df3f65d536 Mon Sep 17 00:00:00 2001
From b2644d4d8077015b2bdc0eb2bd21117875dffbfe Mon Sep 17 00:00:00 2001
From: Simonas Leleiva <[email protected]>
Date: Sun, 30 Oct 2016 14:07:11 +0000
Subject: [PATCH] (hybris) AudioService is disabled in hybris adaptations
Expand All @@ -9,38 +9,37 @@ Content-Transfer-Encoding: 8bit
Without this patch, camera is waiting for AudioService indefinitely

Change-Id: Id572746cc77c8d26e3a8e7fc1dc05b17ac282ed4
Signed-off-by: Simonas Leleiva <simonas.leleiva@jollamobile.com>
Signed-off-by: Simonas Leleiva <simonas.leleiva@jolla.com>
Signed-off-by: Björn Bidar <[email protected]>
---
services/camera/libcameraservice/CameraService.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
services/camera/libcameraservice/CameraService.cpp | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 3e6210294..5950c63ee 100644
index 670e026183..c8a4694722 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -2231,10 +2231,14 @@ void CameraService::increaseSoundRef() {
Mutex::Autolock lock(mSoundLock);
@@ -2275,9 +2275,15 @@ void CameraService::increaseSoundRef() {
mSoundRef++;
}
-
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-parameter"
+#endif
void CameraService::loadSoundLocked(sound_kind kind) {
ATRACE_CALL();
-
+#pragma clang diagnostic pop
+/*
+#ifdef DISABLED_FOR_HYBRIS_SUPPORT
LOG1("CameraService::loadSoundLocked ref=%d", mSoundRef);
if (SOUND_SHUTTER == kind && mSoundPlayer[SOUND_SHUTTER] == NULL) {
mSoundPlayer[SOUND_SHUTTER] = newMediaPlayer("/product/media/audio/ui/camera_click.ogg");
@@ -2253,6 +2257,7 @@ void CameraService::loadSoundLocked(sound_kind kind) {
@@ -2296,6 +2302,7 @@ void CameraService::loadSoundLocked(sound_kind kind) {
mSoundPlayer[SOUND_RECORDING_STOP] = newMediaPlayer("/system/media/audio/ui/VideoStop.ogg");
}
}
+ */
+#endif
}

void CameraService::decreaseSoundRef() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 2d948dadf24d983b57b2777349b801cd046e14c5 Mon Sep 17 00:00:00 2001
From c4beef9773e328f1533d65bf08677d189b2b85c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matti=20Lehtim=C3=A4ki?= <[email protected]>
Date: Thu, 13 Jul 2017 00:53:55 +0300
Subject: [PATCH 1/5] (hybris) Use mini services and disable starting unneeded
Subject: [PATCH 1/3] (hybris) Use mini services and disable starting unneeded
services.

Change-Id: I6e80eb3e2d92ddfbd83f1933971c3f24e9570d28
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 2270d2fdcae29295e47b5b4ae87688b14a29defd Mon Sep 17 00:00:00 2001
From c47e6721089fb0773f4cf93b880746b01bdf2ded Mon Sep 17 00:00:00 2001
From: Simonas Leleiva <[email protected]>
Date: Wed, 15 Jul 2015 08:29:08 +0000
Subject: [PATCH 2/5] (hybris) Pick GLES shared objects from appropriate paths
Subject: [PATCH 2/3] (hybris) Pick GLES shared objects from appropriate paths
(32-bit case)

Change-Id: I4c7739ba8a4d64fa115163d5700b0df3370b286b
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 5bc15a22820c54bc59f50209d189d28900846d54 Mon Sep 17 00:00:00 2001
From 7b53411f90d79f206d1a1a689b36f87f750fd301 Mon Sep 17 00:00:00 2001
From: David Greaves <[email protected]>
Date: Tue, 25 Nov 2014 14:55:27 +0100
Subject: [PATCH 3/5] (hybris) Use private __get_tls_hooks from bionic
Subject: [PATCH 3/3] (hybris) Use private __get_tls_hooks from bionic

Change-Id: I38a4ea6d8561ab7da5dfedeeba16b84ee493051e
Signed-off-by: David Greaves <[email protected]>
Expand Down
Loading

0 comments on commit 25ce9ca

Please sign in to comment.