380 changed files with 146029 additions and 6512 deletions
+1
View File
@@ -0,0 +1 @@
/patches_treble_personal/vendor_hardware_overlay
@@ -1,37 +0,0 @@
From 3809fd785286428028b76bc19e6ed6797b7ca81f Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Thu, 3 Jan 2019 17:50:03 +0100
Subject: [PATCH 4/4] Read SDK version override from property
Change-Id: I88ca5d0bde15ee4f2b2bd1255e98f9592973dbf9
---
linker/linker.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 0ce60dfb2..f8c692cf7 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3861,7 +3861,9 @@ std::vector<android_namespace_t*> init_default_namespaces(const char* executable
}
uint32_t target_sdk = config->target_sdk_version();
-#ifdef SDK_VERSION_OVERRIDES
+
+ std::string sdkVersionOverrides = android::base::GetProperty("persist.sys.phh.sdk_override", "");
+ static const char *SDK_VERSION_OVERRIDES = sdkVersionOverrides.c_str();
for (const auto& entry : android::base::Split(SDK_VERSION_OVERRIDES, " ")) {
auto splitted = android::base::Split(entry, "=");
if (splitted.size() == 2 && splitted[0] == executable_path) {
@@ -3870,7 +3872,7 @@ std::vector<android_namespace_t*> init_default_namespaces(const char* executable
}
}
DEBUG("Target SDK for %s = %d", executable_path, target_sdk);
-#endif
+
set_application_target_sdk_version(target_sdk);
std::vector<android_namespace_t*> created_namespaces;
--
2.17.1
@@ -1,53 +0,0 @@
From d7fa115dcb7aaf33a6a16b676742513e5539fd85 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 27 Mar 2018 23:26:49 +0200
Subject: [PATCH] Revert "Remove root folder bt_firmware in GSI"
This reverts commit 292b8433cb48ef4ceb2330e57e11b8f644d9d1ee.
Essential 8.1 firmware requires this
---
target/board/generic_arm64_ab/BoardConfig.mk | 2 +-
target/board/generic_arm64_ab/sepolicy/file.te | 1 +
target/board/generic_arm64_ab/sepolicy/file_contexts | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/board/generic_arm64_ab/BoardConfig.mk b/target/board/generic_arm64_ab/BoardConfig.mk
index 88b90a8fb..b67c3b31d 100644
--- a/target/board/generic_arm64_ab/BoardConfig.mk
+++ b/target/board/generic_arm64_ab/BoardConfig.mk
@@ -33,7 +33,7 @@ TARGET_NO_RECOVERY := true
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
# TODO(jiyong) These might be SoC specific.
-BOARD_ROOT_EXTRA_FOLDERS += firmware firmware/radio persist
+BOARD_ROOT_EXTRA_FOLDERS += bt_firmware firmware firmware/radio persist
BOARD_ROOT_EXTRA_SYMLINKS += /vendor/lib/dsp:/dsp
BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/image:/firmware/image
BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/verinfo:/firmware/verinfo
diff --git a/target/board/generic_arm64_ab/sepolicy/file.te b/target/board/generic_arm64_ab/sepolicy/file.te
index 7adfdfa4e..46455339a 100644
--- a/target/board/generic_arm64_ab/sepolicy/file.te
+++ b/target/board/generic_arm64_ab/sepolicy/file.te
@@ -1,5 +1,6 @@
# TODO(b/36764215): remove this file when the generic system image
# no longer has these directories
+type bt_firmware_file, file_type;
type persist_file, file_type;
# Default type for anything under /firmware.
diff --git a/target/board/generic_arm64_ab/sepolicy/file_contexts b/target/board/generic_arm64_ab/sepolicy/file_contexts
index 0a80559e1..92a4ff872 100644
--- a/target/board/generic_arm64_ab/sepolicy/file_contexts
+++ b/target/board/generic_arm64_ab/sepolicy/file_contexts
@@ -2,6 +2,7 @@
# no longer has these directories. They are specific to QCOM.
# /
+/bt_firmware(/.*)? u:object_r:bt_firmware_file:s0
/tombstones u:object_r:rootfs:s0
/dsp u:object_r:rootfs:s0
--
2.17.1
@@ -1,25 +0,0 @@
From 98915840a5635fcd2f319012861cf5da1df8f54a Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 5 Mar 2018 22:27:50 +0100
Subject: [PATCH 2/2] Set ro.build.fingerprint in system/etc/prop.default
Change-Id: Idceb2a160f70b36aa6806ae60cbfb325367f3b75
---
core/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/core/Makefile b/core/Makefile
index 0a2f6e39d..059aa98c2 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -176,6 +176,7 @@ $(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop)
$(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@
$(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
$(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
+ $(hide) echo ro.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
$(hide) build/make/tools/post_process_props.py $@
ifdef property_overrides_split_enabled
$(hide) mkdir -p $(TARGET_ROOT_OUT)
--
2.17.1
@@ -1,27 +0,0 @@
From f0fb4b89c52f3dc4971be0ddfc07ae2b51c40f4a Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Fri, 2 Mar 2018 22:49:55 +0100
Subject: [PATCH 1/4] Enable multipl_decls by default. This is needed because
8.0 init doesn't add -m
Change-Id: I43dc661d519f7b8576d72a828d8cbd444592bf5e
---
secilc/secilc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/secilc/secilc.c b/secilc/secilc.c
index 0be6975b..e30572e5 100644
--- a/secilc/secilc.c
+++ b/secilc/secilc.c
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
int target = SEPOL_TARGET_SELINUX;
int mls = -1;
int disable_dontaudit = 0;
- int multiple_decls = 0;
+ int multiple_decls = 1;
int disable_neverallow = 0;
int preserve_tunables = 0;
int handle_unknown = -1;
--
2.17.1
@@ -1,40 +0,0 @@
From e8790f87dd3498d95e82e091ab6929c0a89b2822 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 3 Dec 2018 20:54:54 +0100
Subject: [PATCH 3/4] ::Kirin:: Workaround some conflicting Kirin tether
SELinux context
Some Kirin devices declared some android.hardware.tetheroffload HALs,
but they didn't use AOSP contexts.
This leads to libselinux aborting when loading hwservice_contexts.
Workaround it the ugly way, by making them match.
This most likely kills tetheroffload for those devices.
---
libselinux/src/label_backends_android.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libselinux/src/label_backends_android.c b/libselinux/src/label_backends_android.c
index eaca5947..cf842188 100644
--- a/libselinux/src/label_backends_android.c
+++ b/libselinux/src/label_backends_android.c
@@ -62,6 +62,16 @@ static int nodups_specs(struct saved_data *data)
curr_spec->property_key)) {
if (strcmp(spec_arr[jj].lr.ctx_raw,
curr_spec->lr.ctx_raw)) {
+ if(strcmp(spec_arr[jj].lr.ctx_raw, "u:object_r:hal_ipacm_hwservice:s0") == 0) {
+ free(spec_arr[jj].lr.ctx_raw);
+ spec_arr[jj].lr.ctx_raw = "u:object_r:hal_tetheroffload_hwservice:s0";
+ continue;
+ }
+ if(strcmp(curr_spec->lr.ctx_raw, "u:object_r:hal_ipacm_hwservice:s0") == 0) {
+ free(curr_spec->lr.ctx_raw);
+ curr_spec->lr.ctx_raw = "u:object_r:hal_tetheroffload_hwservice:s0";
+ continue;
+ }
rc = -1;
errno = EINVAL;
selinux_log
--
2.17.1
@@ -1,31 +0,0 @@
From 34a2e6145c9264a25f6c8b8f9bd966fe662d3e10 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 9 Apr 2019 08:50:45 +0200
Subject: [PATCH 4/4] If we do a free() on it, it means it is heap-allocated
---
libselinux/src/label_backends_android.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libselinux/src/label_backends_android.c b/libselinux/src/label_backends_android.c
index cf842188..ab92985b 100644
--- a/libselinux/src/label_backends_android.c
+++ b/libselinux/src/label_backends_android.c
@@ -64,12 +64,12 @@ static int nodups_specs(struct saved_data *data)
curr_spec->lr.ctx_raw)) {
if(strcmp(spec_arr[jj].lr.ctx_raw, "u:object_r:hal_ipacm_hwservice:s0") == 0) {
free(spec_arr[jj].lr.ctx_raw);
- spec_arr[jj].lr.ctx_raw = "u:object_r:hal_tetheroffload_hwservice:s0";
+ spec_arr[jj].lr.ctx_raw = strdup("u:object_r:hal_tetheroffload_hwservice:s0");
continue;
}
if(strcmp(curr_spec->lr.ctx_raw, "u:object_r:hal_ipacm_hwservice:s0") == 0) {
free(curr_spec->lr.ctx_raw);
- curr_spec->lr.ctx_raw = "u:object_r:hal_tetheroffload_hwservice:s0";
+ curr_spec->lr.ctx_raw = strdup("u:object_r:hal_tetheroffload_hwservice:s0");
continue;
}
rc = -1;
--
2.17.1
@@ -1,78 +0,0 @@
From 59177bd162dbb442c5561ac128c83b111ea1112d Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 24 Apr 2018 00:14:28 +0200
Subject: [PATCH 1/8] FIH devices: Fix "Earpiece" audio output
On some FIH devices (confirmed on Razer, and probably on Aquos SS2),
Earpiece is not listed in attachedDevices, and devicePort's profile
mentions it is AUDIO_CHANNEL_IN_MONO, instead of AUDIO_CHANNEL_OUT_MONO.
Detect such cases (output device, but got only AUDIO_CHANNEL_IN_MONO),
and fix both channelMasks and attachedDevices
Change-Id: I4a88ba6d34d0fcd346eeea2ca903772f0271040a
---
.../managerdefinitions/src/Serializer.cpp | 25 ++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
index a2531131d..380e2f82b 100644
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
@@ -191,16 +191,25 @@ const char AudioProfileTraits::Attributes::name[] = "name";
const char AudioProfileTraits::Attributes::samplingRates[] = "samplingRates";
const char AudioProfileTraits::Attributes::format[] = "format";
const char AudioProfileTraits::Attributes::channelMasks[] = "channelMasks";
+static bool fixedEarpieceChannels = false;
status_t AudioProfileTraits::deserialize(_xmlDoc */*doc*/, const _xmlNode *root, PtrElement &profile,
- PtrSerializingCtx /*serializingContext*/)
+ PtrSerializingCtx serializingContext)
{
+ bool isOutput = serializingContext != nullptr;
string samplingRates = getXmlAttribute(root, Attributes::samplingRates);
string format = getXmlAttribute(root, Attributes::format);
string channels = getXmlAttribute(root, Attributes::channelMasks);
+ ChannelTraits::Collection channelsMask = channelMasksFromString(channels, ",");
+
+ //Some Foxconn devices have wrong earpiece channel mask, leading to no channel mask
+ if(channelsMask.size() == 1 && channelsMask[0] == AUDIO_CHANNEL_IN_MONO && isOutput) {
+ fixedEarpieceChannels = true;
+ channelsMask = channelMasksFromString("AUDIO_CHANNEL_OUT_MONO", ",");
+ }
profile = new Element(formatFromString(format, gDynamicFormat),
- channelMasksFromString(channels, ","),
+ channelsMask,
samplingRatesFromString(samplingRates, ","));
profile->setDynamicFormat(profile->getFormat() == gDynamicFormat);
@@ -326,7 +335,10 @@ status_t DevicePortTraits::deserialize(_xmlDoc *doc, const _xmlNode *root, PtrEl
}
AudioProfileTraits::Collection profiles;
- deserializeCollection<AudioProfileTraits>(doc, root, profiles, NULL);
+ if(audio_is_output_devices(type))
+ deserializeCollection<AudioProfileTraits>(doc, root, profiles, (PtrSerializingCtx)1);
+ else
+ deserializeCollection<AudioProfileTraits>(doc, root, profiles, NULL);
if (profiles.isEmpty()) {
sp <AudioProfile> dynamicProfile = new AudioProfile(gDynamicFormat,
ChannelsVector(), SampleRateVector());
@@ -491,6 +503,13 @@ status_t ModuleTraits::deserialize(xmlDocPtr doc, const xmlNode *root, PtrElemen
}
children = children->next;
}
+ if(fixedEarpieceChannels) {
+ sp<DeviceDescriptor> device =
+ module->getDeclaredDevices().getDeviceFromTagName(String8("Earpiece"));
+ if(device != 0)
+ ctx->addAvailableDevice(device);
+ fixedEarpieceChannels = false;
+ }
return NO_ERROR;
}
--
2.17.1
@@ -1,31 +0,0 @@
From e65aabfc0c18e3a113bcb4b720c50f5052c8f992 Mon Sep 17 00:00:00 2001
From: Alexander Pohl <pohl199885@gmail.com>
Date: Fri, 15 Jun 2018 19:58:07 +0200
Subject: [PATCH 2/8] Fix WiFi-Display on Huawei devices (EMUI 8.0)
Huaweis media stack doesn't handle intra-refresh-mode, so skip the error instead.
Thanks to Chris Vandomelen for pointing that out.
---
media/libstagefright/ACodec.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 7f39d109f..ed54fb58a 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -4279,9 +4279,8 @@ status_t ACodec::setupAVCEncoderParameters(const sp<AMessage> &msg) {
if (msg->findInt32("intra-refresh-mode", &intraRefreshMode)) {
err = setCyclicIntraMacroblockRefresh(msg, intraRefreshMode);
if (err != OK) {
- ALOGE("Setting intra macroblock refresh mode (%d) failed: 0x%x",
- err, intraRefreshMode);
- return err;
+ ALOGE("setupAVCEncoderParameters(): set intra-refresh-mode failed, ignoring..");
+ //return err;
}
}
--
2.17.1
@@ -1,34 +0,0 @@
From 561f52484b84d28b4b0140705f7e2b63a45e3968 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 19 Aug 2018 22:59:06 +0200
Subject: [PATCH 3/8] ::Kirin:: Remove lock to prevent self-lock
With Huawei Camera HAL, we get the following call order:
cameraserver CameraService::enumerateProviders (*)
=> HAL ICameraProvider::getVendorTags
=> HAL ICameraProviderCallback::cameraDeviceStatusChange
=> cameraserver CameraService::addState
=> cameraserver CameraService::updateCameraNumAndIds (*)
The two functions marked with (*) take mServiceLock
Hence the safe-lock
---
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 2bf42b638..d62a71ab9 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -218,7 +218,7 @@ void CameraService::onNewProviderRegistered() {
}
void CameraService::updateCameraNumAndIds() {
- Mutex::Autolock l(mServiceLock);
+ //Mutex::Autolock l(mServiceLock);
mNumberOfCameras = mCameraProviderManager->getCameraCount();
mNormalDeviceIds =
mCameraProviderManager->getAPI1CompatibleCameraDeviceIds();
--
2.17.1
@@ -1,26 +0,0 @@
From 9b0b84e101f0785ec40246dd43be9ac0ab239dad 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 4/8] We might not have a mFlashlight at this state, but that's
ok
---
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 d62a71ab9..5bc9087b4 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -243,7 +243,7 @@ void CameraService::addStates(const String8 id) {
conflicting));
}
- if (mFlashlight->hasFlashUnit(id)) {
+ if (mFlashlight != nullptr && mFlashlight->hasFlashUnit(id)) {
Mutex::Autolock al(mTorchStatusMutex);
mTorchStatusMap.add(id, TorchModeStatus::AVAILABLE_OFF);
}
--
2.17.1
@@ -1,63 +0,0 @@
From cfedf51d59df1471150afd71e3bce73199bf5c94 Mon Sep 17 00:00:00 2001
From: Artem Borisov <dedsa2002@gmail.com>
Date: Tue, 25 Sep 2018 12:39:22 +0300
Subject: [PATCH 5/8] CameraService: Support calling addStates in
enumerateProviders
Some pre-P camera HALs trigger onDeviceStatusChange callback during HAL init.
This is horribly wrong and causes a race condition between enumerateProviders
and onDeviceStatusChange. While it wasn't really harmful in O, in P call sequence
was changed and now this race condition leads to two problems: null pointer dereference
in addStates because mFlashlight is not initialized at a proper timing; mServiceLock
deadlock because updateCameraNumAndIds and enumerateProviders are called at the same time.
Moving addStates back to enumerateProviders makes the sequence more similar to O, and doesn't
let these two issues to happen.
Enable TARGET_CAMERA_NEEDS_ADD_STATES_IN_ENUMERATE when it is necessary.
@Dil3mm4 edit: Instead of TARGET_CAMERA_NEEDS_ADD_STATES_IN_ENUMERATE let's use a system property to make it more generic and suitable for GSI use.
Change-Id: Ife25b9753fdb679ab0c77f385e1b8527551a4711
---
.../camera/libcameraservice/CameraService.cpp | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 5bc9087b4..88f7be83b 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -181,6 +181,21 @@ status_t CameraService::enumerateProviders() {
for (auto& cameraId : deviceIds) {
String8 id8 = String8(cameraId.c_str());
+
+ if (property_get_bool("persist.sys.camera.huawei", false)) {
+ bool cameraFound = false;
+ {
+ Mutex::Autolock lock(mCameraStatesLock);
+ auto iter = mCameraStates.find(id8);
+ if (iter != mCameraStates.end()) {
+ cameraFound = true;
+ }
+ }
+ if (!cameraFound) {
+ addStates(id8);
+ }
+ }
+
onDeviceStatusChanged(id8, CameraDeviceStatus::PRESENT);
}
@@ -279,8 +294,10 @@ void CameraService::onDeviceStatusChanged(const String8& id,
ALOGI("%s: Unknown camera ID %s, a new camera is added",
__FUNCTION__, id.string());
+ if (!property_get_bool("persist.sys.camera.huawei", false)) {
// First add as absent to make sure clients are notified below
addStates(id);
+ }
updateStatus(newStatus, id);
} else {
--
2.17.1
@@ -1,25 +0,0 @@
From 144fcb870b15c1247a50894737b639581fd0b772 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 9 Dec 2018 15:56:59 +0100
Subject: [PATCH 6/8] Revert "Set rlimit rtprio for cameraserver"
This reverts commit 4ae244cab4fe715fc2729e906b7dda3075fbbac3.
We need to revert this because some init/systems (Moto E5, G6) doesn't
like this instruction at all (read: this prevents boot)
---
camera/cameraserver/cameraserver.rc | 1 -
1 file changed, 1 deletion(-)
diff --git a/camera/cameraserver/cameraserver.rc b/camera/cameraserver/cameraserver.rc
index a9aae0b15..fea5a1d5c 100644
--- a/camera/cameraserver/cameraserver.rc
+++ b/camera/cameraserver/cameraserver.rc
@@ -4,4 +4,3 @@ service cameraserver /system/bin/cameraserver
group audio camera input drmrpc
ioprio rt 4
writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
- rlimit rtprio 10 10
--
2.17.1
@@ -1,25 +0,0 @@
From 7e4a00ff86ca1be573a06e2f358d4783bc15d5bc Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 5 Aug 2019 17:27:18 +0200
Subject: [PATCH 09/11] Enable debug
---
.../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
index 380e2f82b..59385fb76 100644
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
@@ -15,7 +15,7 @@
*/
#define LOG_TAG "APM::Serializer"
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#include "Serializer.h"
#include <media/convert.h>
--
2.17.1
@@ -1,25 +0,0 @@
From ded09326e6e4aa9ca3c6f7a7dfbdd36b22bc4af6 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 5 Aug 2019 17:27:47 +0200
Subject: [PATCH 10/11] Fix use-after-free (object on stack)
---
.../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
index 59385fb76..1c5967141 100644
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
@@ -326,7 +326,7 @@ status_t DevicePortTraits::deserialize(_xmlDoc *doc, const _xmlNode *root, PtrEl
ALOGW("%s: bad type %08x", __FUNCTION__, type);
return BAD_VALUE;
}
- deviceDesc = new Element(type, String8(name.c_str()));
+ deviceDesc = new Element(type, String8(strdup(name.c_str())));
string address = getXmlAttribute(root, Attributes::address);
if (!address.empty()) {
--
2.17.1
@@ -1,37 +0,0 @@
From 7369d2c37720cc88bbb28c6487b0209732ac52fa Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sat, 24 Mar 2018 08:01:48 +0100
Subject: [PATCH] Fix backlight control on Galaxy S9(+)
---
.../core/java/com/android/server/lights/LightsService.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index 9dee0171683..378e7c367b1 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -23,6 +23,7 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Message;
+import android.os.SystemProperties;
import android.os.Trace;
import android.provider.Settings;
import android.util.Slog;
@@ -54,6 +55,12 @@ public class LightsService extends SystemService {
return;
}
+ String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello");
+ if(fp.contains("starlte") || fp.contains("star2lte")) {
+ setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
+ return;
+ }
+
int color = brightness & 0x000000ff;
color = 0xff000000 | (color << 16) | (color << 8) | color;
setLightLocked(color, LIGHT_FLASH_NONE, 0, 0, brightnessMode);
--
2.17.1
@@ -1,52 +0,0 @@
From 02189ad3927cb5a76cfc61e1a1ddcc254f649efe Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 1 May 2018 17:47:36 +0200
Subject: [PATCH 03/31] Also scan /system/overlay
Change-Id: Ib0223560606b80cdaaa986b159b34b4db0154589
---
core/jni/android_util_AssetManager.cpp | 6 +++++-
core/jni/fd_utils.cpp | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index fa9f44557d3..1d3bf73eebb 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -149,7 +149,7 @@ static void NativeVerifySystemIdmaps(JNIEnv* /*env*/, jclass /*clazz*/) {
}
// Generic idmap parameters
- const char* argv[8];
+ const char* argv[9];
int argc = 0;
struct stat st;
@@ -179,6 +179,10 @@ static void NativeVerifySystemIdmaps(JNIEnv* /*env*/, jclass /*clazz*/) {
argv[argc++] = AssetManager::PRODUCT_OVERLAY_DIR;
}
+ if(stat("/system/overlay", &st) == 0) {
+ argv[argc++] = "/system/overlay";
+ }
+
// Finally, invoke idmap (if any overlay directory exists)
if (argc > 5) {
execv(AssetManager::IDMAP_BIN, (char* const*)argv);
diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
index c5904e0e9e5..6548215772a 100644
--- a/core/jni/fd_utils.cpp
+++ b/core/jni/fd_utils.cpp
@@ -93,7 +93,8 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
|| android::base::StartsWith(path, kOverlaySubdir)
|| android::base::StartsWith(path, kVendorOverlayDir)
|| android::base::StartsWith(path, kSystemProductOverlayDir)
- || android::base::StartsWith(path, kProductOverlayDir))
+ || android::base::StartsWith(path, kProductOverlayDir)
+ || android::base::StartsWith(path, "/system/overlay"))
&& android::base::EndsWith(path, kApkSuffix)
&& path.find("/../") == std::string::npos) {
return true;
--
2.17.1
@@ -1,25 +0,0 @@
From 3add0283fffb44feaee5251f76f985895f67adfe Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Thu, 17 May 2018 20:28:35 +0200
Subject: [PATCH] Don't crash if there is IR HAL is not declared
---
services/core/java/com/android/server/ConsumerIrService.java | 2 --
1 file changed, 2 deletions(-)
diff --git a/services/core/java/com/android/server/ConsumerIrService.java b/services/core/java/com/android/server/ConsumerIrService.java
index 53b9e913959..fcfb45659e5 100644
--- a/services/core/java/com/android/server/ConsumerIrService.java
+++ b/services/core/java/com/android/server/ConsumerIrService.java
@@ -52,8 +52,6 @@ public class ConsumerIrService extends IConsumerIrService.Stub {
if (!mHasNativeHal) {
throw new RuntimeException("FEATURE_CONSUMER_IR present, but no IR HAL loaded!");
}
- } else if (mHasNativeHal) {
- throw new RuntimeException("IR HAL present, but FEATURE_CONSUMER_IR is not set!");
}
mParameter = AudioSystem.getParameters("audio_capability#irda_support");
}
--
2.17.1
@@ -1,28 +0,0 @@
From 103cb5d951a8f0bddf37d195aae16ed6761628c6 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 30 May 2018 14:05:30 +0200
Subject: [PATCH 05/31] Fix(?) #62
---
.../src/com/android/keyguard/KeyguardUpdateMonitor.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 8b48130297e..c704269c351 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -899,7 +899,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
@Override
public void onAuthenticationError(int errMsgId, CharSequence errString) {
- handleFingerprintError(errMsgId, errString.toString());
+ if(errString != null)
+ handleFingerprintError(errMsgId, errString.toString());
+ else
+ handleFingerprintError(errMsgId, "unknown error");
}
@Override
--
2.17.1
@@ -1,35 +0,0 @@
From 28861679c6a9a4e89ea82e6b27c6092b5c49ce5c Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <pierre-hugues.husson@softathome.com>
Date: Thu, 7 Jun 2018 13:36:51 +0200
Subject: [PATCH 06/31] S9 brightness override only for screen
---
.../com/android/server/lights/LightsService.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index 762b0ae4037..eb25943fa6b 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -53,11 +53,13 @@ public class LightsService extends SystemService {
return;
}
- String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello");
- if(fp.contains("starlte") || fp.contains("star2lte")) {
- setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
- return;
- }
+ if(mId == 0) {
+ String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello");
+ if(fp.contains("starlte") || fp.contains("star2lte")) {
+ setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
+ return;
+ }
+ }
int color = brightness & 0x000000ff;
color = 0xff000000 | (color << 16) | (color << 8) | color;
--
2.17.1
@@ -1,35 +0,0 @@
From b5722e3a8dcf58269bf681c991839d3a710dc8c2 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <pierre-hugues.husson@softathome.com>
Date: Thu, 7 Jun 2018 13:42:02 +0200
Subject: [PATCH 07/31] [WIP] Fix OP6 brightness
---
.../com/android/server/lights/LightsService.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index eb25943fa6b..a77af445ba6 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -59,6 +59,18 @@ public class LightsService extends SystemService {
setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
return;
}
+
+ boolean qcomExtendBrightness = SystemProperties.getBoolean("persist.extend.brightness", false);
+ int scale = SystemProperties.getInt("persist.display.max_brightness", 1023);
+ if(fp.contains("OnePlus6")) {
+ qcomExtendBrightness = true;
+ scale = 1023;
+ }
+
+ if(qcomExtendBrightness) {
+ setLightLocked(brightness * scale / 255, LIGHT_FLASH_NONE, 0, 0, brightnessMode);
+ return;
+ }
}
int color = brightness & 0x000000ff;
--
2.17.1
@@ -1,31 +0,0 @@
From 93cce81e547a60374bceae91731f6e00f963f914 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 10 Jun 2018 22:54:55 +0200
Subject: [PATCH 08/31] Try to make brightness more generic using property set
by rw-system
---
.../core/java/com/android/server/lights/LightsService.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index a77af445ba6..4dc44de37cd 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -62,9 +62,11 @@ public class LightsService extends SystemService {
boolean qcomExtendBrightness = SystemProperties.getBoolean("persist.extend.brightness", false);
int scale = SystemProperties.getInt("persist.display.max_brightness", 1023);
- if(fp.contains("OnePlus6")) {
+ //This is set by vndk-detect
+ int qcomScale = SystemProperties.getInt("persist.sys.qcom-brightness", -1);
+ if(qcomScale != -1) {
qcomExtendBrightness = true;
- scale = 1023;
+ scale = qcomScale;
}
if(qcomExtendBrightness) {
--
2.17.1
@@ -1,35 +0,0 @@
From 10426a980185c4e9a73130c08ecfe22a9d83b0b6 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 12 Jun 2018 22:55:32 +0200
Subject: [PATCH 09/31] property-matching RROs: allow to prefix the value with
+ to do glob match instead of exact match
---
cmds/idmap/scan.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/cmds/idmap/scan.cpp b/cmds/idmap/scan.cpp
index d69dd79555a..2be6d23ac78 100644
--- a/cmds/idmap/scan.cpp
+++ b/cmds/idmap/scan.cpp
@@ -1,5 +1,6 @@
#include <dirent.h>
#include <inttypes.h>
+#include <fnmatch.h>
#include <sys/file.h>
#include <sys/stat.h>
@@ -92,6 +93,10 @@ namespace {
property_get(prop, propBuf, NULL);
val = strndup16to8(value.string(), value.size());
+ if(val[0]=='+') {
+ return fnmatch(val+1, propBuf, 0) != 0;
+ }
+
return (strcmp(propBuf, val) == 0);
}
--
2.17.1
@@ -1,25 +0,0 @@
From 2965fa2adb9cbd2ae3688097d9cf12aa73164379 Mon Sep 17 00:00:00 2001
From: Song Fuchang <song.fc@gmail.com>
Date: Sun, 17 Jun 2018 22:39:37 +0800
Subject: [PATCH 10/31] Fix typo on fnmatch return value check
---
cmds/idmap/scan.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmds/idmap/scan.cpp b/cmds/idmap/scan.cpp
index 2be6d23ac78..0acff23d031 100644
--- a/cmds/idmap/scan.cpp
+++ b/cmds/idmap/scan.cpp
@@ -94,7 +94,7 @@ namespace {
val = strndup16to8(value.string(), value.size());
if(val[0]=='+') {
- return fnmatch(val+1, propBuf, 0) != 0;
+ return fnmatch(val+1, propBuf, 0) == 0;
}
return (strcmp(propBuf, val) == 0);
--
2.17.1
@@ -1,27 +0,0 @@
From 9e13de340e0d3a2a755f382ea3410ac488461236 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 25 Jun 2018 22:43:32 +0200
Subject: [PATCH 11/31] Add Qualcomm starlte
---
.../core/java/com/android/server/lights/LightsService.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index 4dc44de37cd..2886f2900d9 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -55,7 +55,9 @@ public class LightsService extends SystemService {
if(mId == 0) {
String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello");
- if(fp.contains("starlte") || fp.contains("star2lte")) {
+ if(
+ fp.contains("starlte") || fp.contains("star2lte") ||
+ fp.contains("starqlte") || fp.contains("star2qlte")) {
setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
return;
}
--
2.17.1
@@ -1,30 +0,0 @@
From 362f97b36ce15e8196caeff6c3e12f2e66e72c66 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 2 Jul 2018 23:36:39 +0200
Subject: [PATCH 12/31] [Galaxy S9] "remaining" of HAL onEnroll is actually a
percent of progress
---
.../com/android/server/fingerprint/FingerprintService.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java
index 06329e571b4..6f09433c002 100644
--- a/services/core/java/com/android/server/fingerprint/FingerprintService.java
+++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java
@@ -1046,7 +1046,11 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
mHandler.post(new Runnable() {
@Override
public void run() {
- handleEnrollResult(deviceId, fingerId, groupId, remaining);
+ int remaining2 = remaining;
+ String fp = android.os.SystemProperties.get("ro.vendor.build.fingerprint");
+ if(fp != null && (fp.contains("starlte") || fp.contains("star2lte") || fp.contains("starqlte") || fp.contains("star2qlte")))
+ remaining2 = 100 - remaining2;
+ handleEnrollResult(deviceId, fingerId, groupId, remaining2);
}
});
}
--
2.17.1
@@ -1,78 +0,0 @@
From 6fbb0fb1f4215e15531924b36e217710a7cb39e2 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 6 Aug 2018 20:01:44 +0200
Subject: [PATCH 14/31] Change SignalStrentgh to change behaviour based on
property
Change-Id: I940ed724047567ec5195ac93ea04574c3d92f70b
---
.../android/telephony/SignalStrength.java | 39 +++++++++++++------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java
index 4e5639683a7..ff906d330d4 100644
--- a/telephony/java/android/telephony/SignalStrength.java
+++ b/telephony/java/android/telephony/SignalStrength.java
@@ -854,6 +854,7 @@ public class SignalStrength implements Parcelable {
* RSRQ = quality of signal dB = Number of Resource blocks*RSRP/RSSI
* SNR = gain = signal/noise ratio = -10log P1/P2 dB
*/
+ String method = android.os.SystemProperties.get("persist.sys.signal.level", "default");
int rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, rsrpIconLevel = -1, snrIconLevel = -1;
if (mLteRsrp > MAX_LTE_RSRP || mLteRsrp < MIN_LTE_RSRP) {
@@ -897,6 +898,32 @@ public class SignalStrength implements Parcelable {
+ rsrpIconLevel + " snrIconLevel:" + snrIconLevel
+ " lteRsrpBoost:" + mLteRsrpBoost);
+ /* Valid values are (0-63, 99) as defined in TS 36.331 */
+ // TODO the range here is probably supposed to be (0..31, 99). It's unclear if anyone relies
+ // on the current incorrect range check, so this will be fixed in a future release with more
+ // soak time
+ if (mLteSignalStrength > 63) rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+ else if (mLteSignalStrength >= 12) rssiIconLevel = SIGNAL_STRENGTH_GREAT;
+ else if (mLteSignalStrength >= 8) rssiIconLevel = SIGNAL_STRENGTH_GOOD;
+ else if (mLteSignalStrength >= 5) rssiIconLevel = SIGNAL_STRENGTH_MODERATE;
+ else if (mLteSignalStrength >= 0) rssiIconLevel = SIGNAL_STRENGTH_POOR;
+
+ if (DBG) log("getLTELevel - rssi:" + mLteSignalStrength + " rssiIconLevel:"
+ + rssiIconLevel);
+
+ if("rsrp".equals(method)) {
+ if(rsrpIconLevel == -1) rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+ return rsrpIconLevel;
+ }
+ if("rssnr".equals(method)) {
+ if(snrIconLevel == -1) snrIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+ return snrIconLevel;
+ }
+ if("rssi".equals(method)) {
+ if(rssiIconLevel == -1) rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+ return rssiIconLevel;
+ }
+
/* Choose a measurement type to use for notification */
if (snrIconLevel != -1 && rsrpIconLevel != -1) {
/*
@@ -911,18 +938,6 @@ public class SignalStrength implements Parcelable {
if (rsrpIconLevel != -1) return rsrpIconLevel;
- /* Valid values are (0-63, 99) as defined in TS 36.331 */
- // TODO the range here is probably supposed to be (0..31, 99). It's unclear if anyone relies
- // on the current incorrect range check, so this will be fixed in a future release with more
- // soak time
- if (mLteSignalStrength > 63) rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
- else if (mLteSignalStrength >= 12) rssiIconLevel = SIGNAL_STRENGTH_GREAT;
- else if (mLteSignalStrength >= 8) rssiIconLevel = SIGNAL_STRENGTH_GOOD;
- else if (mLteSignalStrength >= 5) rssiIconLevel = SIGNAL_STRENGTH_MODERATE;
- else if (mLteSignalStrength >= 0) rssiIconLevel = SIGNAL_STRENGTH_POOR;
-
- if (DBG) log("getLteLevel - rssi:" + mLteSignalStrength + " rssiIconLevel:"
- + rssiIconLevel);
return rssiIconLevel;
}
--
2.17.1
@@ -1,26 +0,0 @@
From fd9fd2e3c375308730c9de9319b01aa00383df2c Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 19 Aug 2018 10:51:06 +0200
Subject: [PATCH 15/31] idmap: Don't silently ignore RROs with same priority
Change-Id: I64a6899f1b30e0cd9e9a872b7ca83d831f038cbe
---
cmds/idmap/scan.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cmds/idmap/scan.cpp b/cmds/idmap/scan.cpp
index 0acff23d031..d1dde52732f 100644
--- a/cmds/idmap/scan.cpp
+++ b/cmds/idmap/scan.cpp
@@ -29,6 +29,8 @@ namespace {
bool operator<(Overlay const& rhs) const
{
+ if(rhs.priority == priority)
+ return rhs.apk_path > apk_path;
return rhs.priority > priority;
}
--
2.17.1
@@ -1,24 +0,0 @@
From 49e0279b8336c231788a44d97dc598224f87ead8 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 19 Aug 2018 10:57:21 +0200
Subject: [PATCH 16/31] Move SysuiDarkThemeOverlay to /system
Change-Id: I31b3edc5d1abcc1163a13e63c909fee9d27ff432
---
packages/overlays/SysuiDarkThemeOverlay/Android.mk | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/packages/overlays/SysuiDarkThemeOverlay/Android.mk b/packages/overlays/SysuiDarkThemeOverlay/Android.mk
index 7b277bcf035..89cfcf819c2 100644
--- a/packages/overlays/SysuiDarkThemeOverlay/Android.mk
+++ b/packages/overlays/SysuiDarkThemeOverlay/Android.mk
@@ -11,4 +11,5 @@ LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_PACKAGE_NAME := SysuiDarkThemeOverlay
LOCAL_SDK_VERSION := current
-include $(BUILD_RRO_PACKAGE)
+LOCAL_IS_RUNTIME_RESOURCE_OVERLAY := true
+include $(BUILD_PACKAGE)
--
2.17.1
@@ -1,31 +0,0 @@
From 3ddb2daf5dc7ea8f6c14407b29db9b8ac3785d43 Mon Sep 17 00:00:00 2001
From: Steve Kondik <steve@cyngn.com>
Date: Sat, 3 Jan 2015 05:13:26 -0800
Subject: [PATCH 18/31] power: Disable keyboard/button lights while
dozing/dreaming
* With hardkeys and doze mode enabled, entering suspend results in
an epic battle over the lights. It's a bad situation. Disable
them when we're sleepy.
Change-Id: I7f1fc35a1573717d1ea101a07c4171d6f66d1553
---
.../core/java/com/android/server/power/PowerManagerService.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index 9b8584e055f..0620f2ecec0 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -1965,7 +1965,7 @@ public final class PowerManagerService extends SystemService
final long nextProfileTimeout = getNextProfileTimeoutLocked(now);
mUserActivitySummary = 0;
- if (mLastUserActivityTime >= mLastWakeTime) {
+ if (mWakefulness == WAKEFULNESS_AWAKE && mLastUserActivityTime >= mLastWakeTime) {
nextTimeout = mLastUserActivityTime
+ screenOffTimeout - screenDimDuration;
if (now < nextTimeout) {
--
2.17.1
@@ -1,28 +0,0 @@
From c4e45f5f94e47109a6f65b4ea07b25626efbba34 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Thu, 23 Aug 2018 23:39:16 +0200
Subject: [PATCH 21/31] Switch samsung light fingerprint match to regexp, to
include Note9
---
.../core/java/com/android/server/lights/LightsService.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index 2886f2900d9..2ad38774b9d 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -55,9 +55,7 @@ public class LightsService extends SystemService {
if(mId == 0) {
String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello");
- if(
- fp.contains("starlte") || fp.contains("star2lte") ||
- fp.contains("starqlte") || fp.contains("star2qlte")) {
+ if(fp.matches(".*(crown|star)[q2]*lte.*")) {
setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
return;
}
--
2.17.1
@@ -1,30 +0,0 @@
From aac8a05b691bff6cb9081ea76d8e5c6f1e4fe70d Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 27 Aug 2018 00:47:13 +0200
Subject: [PATCH 22/31] Add a property toggle to enable high brightness range
on samsung device
---
.../core/java/com/android/server/lights/LightsService.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index 2ad38774b9d..89008ea3134 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -56,7 +56,11 @@ public class LightsService extends SystemService {
if(mId == 0) {
String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello");
if(fp.matches(".*(crown|star)[q2]*lte.*")) {
- setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
+ int newBrightness = brightness * 100;
+ if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) {
+ newBrightness = (int) (brightness * 40960.0 / 255.0);
+ }
+ setLightLocked(newBrightness, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
return;
}
--
2.17.1
@@ -1,46 +0,0 @@
From 491b9ace3db2e132949d7579ef5819f0f789a971 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 29 Aug 2018 11:05:54 +0200
Subject: [PATCH 23/31] Add a property to override pre-o max aspect ratio
---
.../core/java/com/android/server/am/ActivityRecord.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 97ae3772ca3..5718c5ee8d0 100644
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -161,6 +161,7 @@ import android.os.PersistableBundle;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
+import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.storage.StorageManager;
import android.service.voice.IVoiceInteractionSession;
@@ -2354,7 +2355,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
// TODO(b/36505427): Consider moving this method and similar ones to ConfigurationContainer.
private void computeBounds(Rect outBounds) {
outBounds.setEmpty();
- final float maxAspectRatio = info.maxAspectRatio;
+ float maxAspectRatio = info.maxAspectRatio;
final ActivityStack stack = getStack();
if (task == null || stack == null || task.inMultiWindowMode() || maxAspectRatio == 0
|| isInVrUiMode(getConfiguration())) {
@@ -2365,6 +2366,12 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
return;
}
+ if(info.applicationInfo.targetSdkVersion < O) {
+ try {
+ maxAspectRatio = Float.parseFloat(SystemProperties.get("persist.sys.max_aspect_ratio.pre_o", ""));
+ } catch (Throwable t) {}
+ Log.d("PHH", "Overrode aspect ratio because pre-o to " + maxAspectRatio);
+ }
// We must base this on the parent configuration, because we set our override
// configuration's appBounds based on the result of this method. If we used our own
// configuration, it would be influenced by past invocations.
--
2.17.1
@@ -1,26 +0,0 @@
From 8d199eba0c2e55725d0677ff4c949e48737af7e9 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 28 Aug 2018 20:39:26 +0200
Subject: [PATCH 24/31] Add japanese S9
---
.../core/java/com/android/server/lights/LightsService.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index 89008ea3134..47c1d9297fe 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -55,7 +55,8 @@ public class LightsService extends SystemService {
if(mId == 0) {
String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello");
- if(fp.matches(".*(crown|star)[q2]*lte.*")) {
+ if(fp.matches(".*(crown|star)[q2]*lte.*") ||
+ fp.matches(".*(SC-0[23]K|SCV3[89]).*")) {
int newBrightness = brightness * 100;
if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) {
newBrightness = (int) (brightness * 40960.0 / 255.0);
--
2.17.1
@@ -1,26 +0,0 @@
From e17a61b9abe4c8df29379b01f841c1be482bc9e7 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 9 Dec 2018 16:31:44 +0100
Subject: [PATCH 26/31] Use Samsung fingerprint percent thingy on all Samsung
devices
---
.../java/com/android/server/fingerprint/FingerprintService.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java
index 6f09433c002..8c2990b1999 100644
--- a/services/core/java/com/android/server/fingerprint/FingerprintService.java
+++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java
@@ -1048,7 +1048,7 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
public void run() {
int remaining2 = remaining;
String fp = android.os.SystemProperties.get("ro.vendor.build.fingerprint");
- if(fp != null && (fp.contains("starlte") || fp.contains("star2lte") || fp.contains("starqlte") || fp.contains("star2qlte")))
+ if(fp != null && (fp.startsWith("samsung/")))
remaining2 = 100 - remaining2;
handleEnrollResult(deviceId, fingerId, groupId, remaining2);
}
--
2.17.1
@@ -1,33 +0,0 @@
From 92d27ce6dc2a0b7c25ba154ed839a506cb7bbfa0 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 10 Mar 2019 19:35:06 +0100
Subject: [PATCH 27/31] Different value for astarqlte. Probably more devices to
add later
---
.../java/com/android/server/lights/LightsService.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index 47c1d9297fe..e5299e456f5 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -55,6 +55,15 @@ public class LightsService extends SystemService {
if(mId == 0) {
String fp = SystemProperties.get("ro.vendor.build.fingerprint", "hello");
+ if(fp.matches(".*astarqlte.*")) {
+ int newBrightness = brightness;
+ if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) {
+ newBrightness = (int) (brightness * 365.0 / 255.0);
+ }
+ setLightLocked(newBrightness, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
+ return;
+ }
+
if(fp.matches(".*(crown|star)[q2]*lte.*") ||
fp.matches(".*(SC-0[23]K|SCV3[89]).*")) {
int newBrightness = brightness * 100;
--
2.17.1
@@ -1,329 +0,0 @@
From 97bb347025b15447834a6ada3779f9795098efbe Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 24 Mar 2019 22:48:39 +0100
Subject: [PATCH] Initial support of in-display fingerprint sensor
Tested on Mi 9.
Here are the list of things that are device-specific:
- touchscreen control (possibly not needed for all devices)
- how to get position and size of green circle?
- fingerprint control (tell the fingerprint sensor the green circle is
ready, and what is its brightness)
---
services/core/Android.bp | 1 +
.../fingerprint/AuthenticationClient.java | 6 +
.../server/fingerprint/EnrollClient.java | 9 +
.../server/fingerprint/FacolaView.java | 192 ++++++++++++++++++
4 files changed, 208 insertions(+)
create mode 100644 services/core/java/com/android/server/fingerprint/FacolaView.java
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 48be3c4921c..ab3d941bd26 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -45,6 +45,7 @@ java_library_static {
"android.hardware.configstore-V1.0-java",
"android.hardware.contexthub-V1.0-java",
"vendor.lineage.trust-V1.0-java",
+ "vendor.xiaomi.hardware.fingerprintextension-V1.0-java",
],
}
diff --git a/services/core/java/com/android/server/fingerprint/AuthenticationClient.java b/services/core/java/com/android/server/fingerprint/AuthenticationClient.java
index afd1a94bf50..f36ed9b38c6 100644
--- a/services/core/java/com/android/server/fingerprint/AuthenticationClient.java
+++ b/services/core/java/com/android/server/fingerprint/AuthenticationClient.java
@@ -54,6 +54,8 @@ public abstract class AuthenticationClient extends ClientMonitor {
private final FingerprintManager mFingerprintManager;
protected boolean mDialogDismissed;
+ private FacolaView mFacola;
+
// Receives events from SystemUI and handles them before forwarding them to FingerprintDialog
protected IBiometricPromptReceiver mDialogReceiver = new IBiometricPromptReceiver.Stub() {
@Override // binder call
@@ -96,6 +98,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
mStatusBarService = statusBarService;
mFingerprintManager = (FingerprintManager) getContext()
.getSystemService(Context.FINGERPRINT_SERVICE);
+ mFacola = new FacolaView(context);
}
@Override
@@ -233,6 +236,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
resetFailedAttempts();
onStop();
}
+ if(result == true) mFacola.hide();
return result;
}
@@ -246,6 +250,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
Slog.w(TAG, "start authentication: no fingerprint HAL!");
return ERROR_ESRCH;
}
+ mFacola.show();
onStart();
try {
final int result = daemon.authenticate(mOpId, getGroupId());
@@ -279,6 +284,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
return 0;
}
+ mFacola.hide();
onStop();
IBiometricsFingerprint daemon = getFingerprintDaemon();
if (daemon == null) {
diff --git a/services/core/java/com/android/server/fingerprint/EnrollClient.java b/services/core/java/com/android/server/fingerprint/EnrollClient.java
index c9efcf2fd68..4ce4ba0cfc8 100644
--- a/services/core/java/com/android/server/fingerprint/EnrollClient.java
+++ b/services/core/java/com/android/server/fingerprint/EnrollClient.java
@@ -29,10 +29,12 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import java.util.Arrays;
+
/**
* A class to keep track of the enrollment state for a given client.
*/
public abstract class EnrollClient extends ClientMonitor {
+ private final FacolaView mFacola;
private static final long MS_PER_SEC = 1000;
private static final int ENROLLMENT_TIMEOUT_MS = 60 * 1000; // 1 minute
private byte[] mCryptoToken;
@@ -42,6 +44,7 @@ public abstract class EnrollClient extends ClientMonitor {
boolean restricted, String owner) {
super(context, halDeviceId, token, receiver, userId, groupId, restricted, owner);
mCryptoToken = Arrays.copyOf(cryptoToken, cryptoToken.length);
+ mFacola = new FacolaView(context);
}
@Override
@@ -69,6 +72,7 @@ public abstract class EnrollClient extends ClientMonitor {
MetricsLogger.action(getContext(), MetricsEvent.ACTION_FINGERPRINT_ENROLL);
try {
receiver.onEnrollResult(getHalDeviceId(), fpId, groupId, remaining);
+ if(remaining == 0) mFacola.hide();
return remaining == 0;
} catch (RemoteException e) {
Slog.w(TAG, "Failed to notify EnrollResult:", e);
@@ -83,6 +87,10 @@ public abstract class EnrollClient extends ClientMonitor {
Slog.w(TAG, "enroll: no fingerprint HAL!");
return ERROR_ESRCH;
}
+ Slog.w(TAG, "Starting enroll");
+
+ mFacola.show();
+
final int timeout = (int) (ENROLLMENT_TIMEOUT_MS / MS_PER_SEC);
try {
final int result = daemon.enroll(mCryptoToken, getGroupId(), timeout);
@@ -104,6 +112,7 @@ public abstract class EnrollClient extends ClientMonitor {
Slog.w(TAG, "stopEnroll: already cancelled!");
return 0;
}
+ mFacola.hide();
IBiometricsFingerprint daemon = getFingerprintDaemon();
if (daemon == null) {
Slog.w(TAG, "stopEnrollment: no fingerprint HAL!");
diff --git a/services/core/java/com/android/server/fingerprint/FacolaView.java b/services/core/java/com/android/server/fingerprint/FacolaView.java
new file mode 100644
index 00000000000..ec336fe337c
--- /dev/null
+++ b/services/core/java/com/android/server/fingerprint/FacolaView.java
@@ -0,0 +1,192 @@
+/**
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.fingerprint;
+
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.content.Context;
+import android.view.View.OnTouchListener;
+import android.view.View;
+import android.widget.ImageView;
+import android.view.MotionEvent;
+import android.util.Slog;
+
+import android.view.WindowManager;
+import android.graphics.PixelFormat;
+import android.view.Gravity;
+
+import java.io.PrintWriter;
+
+import vendor.xiaomi.hardware.fingerprintextension.V1_0.IXiaomiFingerprint;
+
+import android.os.ServiceManager;
+
+public class FacolaView extends ImageView implements OnTouchListener {
+ private final int mX, mY, mW, mH;
+ private final Paint mPaintFingerprint = new Paint();
+ private final Paint mPaintShow = new Paint();
+ private IXiaomiFingerprint mXiaomiFingerprint = null;
+ private boolean mInsideCircle = false;
+ private final WindowManager.LayoutParams mParams = new WindowManager.LayoutParams();
+
+ private final static float UNTOUCHED_DIM = .1f;
+ private final static float TOUCHED_DIM = .9f;
+
+ private final WindowManager mWM;
+ FacolaView(Context context) {
+ super(context);
+
+ String[] location = android.os.SystemProperties.get("persist.vendor.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 == 2 && location.length == 2) {
+ mX = Integer.parseInt(location[0]);
+ mY = Integer.parseInt(location[1]);
+ mW = Integer.parseInt(size[0]);
+ mH = Integer.parseInt(size[1]);
+ } else {
+ mX = -1;
+ mY = -1;
+ mW = -1;
+ mH = -1;
+ }
+
+ mPaintFingerprint.setAntiAlias(true);
+ mPaintFingerprint.setColor(Color.GREEN);
+
+ mPaintShow.setAntiAlias(true);
+ mPaintShow.setColor(Color.argb(0x18, 0x00, 0xff, 0x00));
+ setOnTouchListener(this);
+ mWM = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
+ Slog.d("PHH-Enroll", "Created facola...");
+ try {
+ if(mW != -1)
+ mXiaomiFingerprint = IXiaomiFingerprint.getService();
+ } catch(Exception e) {
+ Slog.d("PHH-Enroll", "Failed getting xiaomi fingerprint service", e);
+ }
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ Slog.d("PHH-Enroll", "Drawing at " + mX + ", " + mY + ", " + mW + ", " + mH);
+ //TODO w!=h?
+ if(mInsideCircle) {
+ try {
+ int nitValue = 3;
+ if(mXiaomiFingerprint != null)
+ mXiaomiFingerprint.extCmd(0xa, nitValue);
+ } catch(Exception e) {
+ Slog.d("PHH-Enroll", "Failed calling xiaomi fp extcmd");
+ }
+
+ canvas.drawCircle(mW/2, mH/2, (float) (mW/2.0f), this.mPaintFingerprint);
+ } else {
+ try {
+ if(mXiaomiFingerprint != null)
+ mXiaomiFingerprint.extCmd(0xa, 0);
+ } catch(Exception e) {
+ Slog.d("PHH-Enroll", "Failed calling xiaomi fp extcmd");
+ }
+ canvas.drawCircle(mW/2, mH/2, (float) (mW/2.0f), this.mPaintShow);
+ }
+ }
+
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ float x = event.getAxisValue(MotionEvent.AXIS_X);
+ float y = event.getAxisValue(MotionEvent.AXIS_Y);
+
+ boolean newInside = (x > 0 && x < mW) && (y > 0 && y < mW);
+ if(event.getAction() == MotionEvent.ACTION_UP)
+ newInside = false;
+
+ Slog.d("PHH-Enroll", "Got action " + event.getAction() + ", x = " + x + ", y = " + y + ", inside = " + mInsideCircle + "/" + newInside);
+ if(newInside == mInsideCircle) return mInsideCircle;
+ mInsideCircle = newInside;
+
+ invalidate();
+
+ if(!mInsideCircle) {
+ mParams.screenBrightness = .0f;
+ mParams.dimAmount = UNTOUCHED_DIM;
+ mWM.updateViewLayout(this, mParams);
+ return false;
+ }
+
+ mParams.dimAmount = TOUCHED_DIM;
+ mParams.screenBrightness = 1.0f;
+ mWM.updateViewLayout(this, mParams);
+
+ return true;
+ }
+
+ public void show() {
+ if(mX == -1 || mY == -1 || mW == -1 || mH == -1) return;
+
+ try {
+ PrintWriter writer = new PrintWriter("/sys/devices/virtual/touch/tp_dev/fod_status", "UTF-8");
+ writer.println("1");
+ writer.close();
+ } catch(Exception e) {
+ Slog.d("PHH-Enroll", "Failed setting fod status for touchscreen");
+ }
+
+ mParams.x = mX;
+ mParams.y = mY;
+
+ mParams.height = mW;
+ mParams.width = mH;
+ mParams.format = PixelFormat.TRANSLUCENT;
+
+ mParams.type = WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY;
+ mParams.setTitle("Fingerprint on display");
+ mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
+ WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH |
+ WindowManager.LayoutParams.FLAG_DIM_BEHIND |
+ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
+ mParams.dimAmount = UNTOUCHED_DIM;
+
+ mParams.packageName = "android";
+
+ mParams.gravity = Gravity.TOP | Gravity.LEFT;
+ mWM.addView(this, mParams);
+
+ }
+
+ public void hide() {
+ if(mX == -1 || mY == -1 || mW == -1 || mH == -1) return;
+
+ try {
+ if(mXiaomiFingerprint != null)
+ mXiaomiFingerprint.extCmd(0xa, 0);
+ } catch(Exception e) {
+ Slog.d("PHH-Enroll", "Failed calling xiaomi fp extcmd");
+ }
+ try {
+ PrintWriter writer = new PrintWriter("/sys/devices/virtual/touch/tp_dev/fod_status", "UTF-8");
+ writer.println("0");
+ writer.close();
+ } catch(Exception e) {
+ Slog.d("PHH-Enroll", "Failed setting fod status for touchscreen");
+ }
+
+ Slog.d("PHH-Enroll", "Removed facola");
+ mWM.removeView(this);
+ }
+}
--
2.17.1
@@ -1,97 +0,0 @@
From 1f08e24e33895eb7f56ff5540e07fc0759872c23 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 24 Mar 2019 23:05:14 +0100
Subject: [PATCH] Support new samsung light hal
---
services/core/jni/Android.bp | 1 +
...om_android_server_lights_LightsService.cpp | 27 +++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
index 5fd9496a5f8..ba6bccc2806 100644
--- a/services/core/jni/Android.bp
+++ b/services/core/jni/Android.bp
@@ -131,6 +131,7 @@ cc_defaults {
"android.frameworks.schedulerservice@1.0",
"android.frameworks.sensorservice@1.0",
"vendor.lineage.power@1.0",
+ "vendor.samsung.hardware.light@2.0",
],
static_libs: [
diff --git a/services/core/jni/com_android_server_lights_LightsService.cpp b/services/core/jni/com_android_server_lights_LightsService.cpp
index 01ddecaeff5..f42c49afaa6 100644
--- a/services/core/jni/com_android_server_lights_LightsService.cpp
+++ b/services/core/jni/com_android_server_lights_LightsService.cpp
@@ -23,6 +23,8 @@
#include <android/hardware/light/2.0/ILight.h>
#include <android/hardware/light/2.0/types.h>
+#include <vendor/samsung/hardware/light/2.0/ISecLight.h>
+#include <vendor/samsung/hardware/light/2.0/types.h>
#include <android-base/chrono_utils.h>
#include <utils/misc.h>
#include <utils/Log.h>
@@ -40,9 +42,13 @@ using Type = ::android::hardware::light::V2_0::Type;
template<typename T>
using Return = ::android::hardware::Return<T>;
+using ISecLight = ::vendor::samsung::hardware::light::V2_0::ISecLight;
+using SecType = ::vendor::samsung::hardware::light::V2_0::SecType;
+
class LightHal {
private:
static sp<ILight> sLight;
+ static sp<ISecLight> sSecLight;
static bool sLightInit;
LightHal() {}
@@ -58,6 +64,7 @@ public:
(sLight != nullptr && !sLight->ping().isOk())) {
// will return the hal if it exists the first time.
sLight = ILight::getService();
+ sSecLight = ISecLight::getService();
sLightInit = true;
if (sLight == nullptr) {
@@ -67,9 +74,14 @@ public:
return sLight;
}
+
+ static sp<ISecLight> getSecLight() {
+ return sSecLight;
+ }
};
sp<ILight> LightHal::sLight = nullptr;
+sp<ISecLight> LightHal::sSecLight = nullptr;
bool LightHal::sLightInit = false;
static bool validate(jint light, jint flash, jint brightness) {
@@ -183,6 +195,21 @@ static void setLight_native(
}
colorAlpha = (colorAlpha * brightnessLevel) / 0xFF;
colorARGB = (colorAlpha << 24) + (colorARGB & 0x00FFFFFF);
+ }
+
+ sp<ISecLight> secHal = LightHal::getSecLight();
+
+ if(secHal != nullptr) {
+ SecType type = static_cast<SecType>(light);
+ LightState state = constructState(
+ colorARGB, flashMode, onMS, offMS, brightnessMode);
+
+ {
+ android::base::Timer t;
+ Return<Status> ret = secHal->setLightSec(type, state);
+ processReturn(ret, static_cast<Type>(light), state);
+ if (t.duration() > 50ms) ALOGD("Excessive delay setting light");
+ }
}
Type type = static_cast<Type>(light);
--
2.17.1
@@ -1,28 +0,0 @@
From ab2af70136a6846a00cd6dab2a0fec3633921517 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 24 Apr 2019 20:09:53 +0200
Subject: [PATCH 30/31] Fix backlight on S10*. Add an additional property to
check, so testers can try it more easily
---
.../core/java/com/android/server/lights/LightsService.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index e5299e456f5..cd709880e11 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -64,7 +64,9 @@ public class LightsService extends SystemService {
return;
}
- if(fp.matches(".*(crown|star)[q2]*lte.*") ||
+ if(SystemProperties.getInt("persist.sys.phh.samsung_backlight", 0) == 1 ||
+ fp.matches(".*beyond.*lte.*") ||
+ fp.matches(".*(crown|star)[q2]*lte.*") ||
fp.matches(".*(SC-0[23]K|SCV3[89]).*")) {
int newBrightness = brightness * 100;
if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) {
--
2.17.1
@@ -1,97 +0,0 @@
From d5ce6564e36fe4291e42f091b322f23c346d1215 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 6 May 2019 23:16:43 +0200
Subject: [PATCH 31/31] Delay brightness changes, so that dim adjusted
---
.../server/fingerprint/FacolaView.java | 28 +++++++++++++++++--
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/services/core/java/com/android/server/fingerprint/FacolaView.java b/services/core/java/com/android/server/fingerprint/FacolaView.java
index ec336fe337c..86f03360ad0 100644
--- a/services/core/java/com/android/server/fingerprint/FacolaView.java
+++ b/services/core/java/com/android/server/fingerprint/FacolaView.java
@@ -29,6 +29,8 @@ import android.util.Slog;
import android.view.WindowManager;
import android.graphics.PixelFormat;
import android.view.Gravity;
+import android.os.Handler;
+import android.os.Looper;
import java.io.PrintWriter;
@@ -47,10 +49,15 @@ public class FacolaView extends ImageView implements OnTouchListener {
private final static float UNTOUCHED_DIM = .1f;
private final static float TOUCHED_DIM = .9f;
+ private final Handler mMainHandler;
+ private boolean visible = false;
+
private final WindowManager mWM;
FacolaView(Context context) {
super(context);
+ mMainHandler = new Handler(Looper.getMainLooper());
+
String[] location = android.os.SystemProperties.get("persist.vendor.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 == 2 && location.length == 2) {
@@ -89,8 +96,13 @@ public class FacolaView extends ImageView implements OnTouchListener {
if(mInsideCircle) {
try {
int nitValue = 3;
- if(mXiaomiFingerprint != null)
- mXiaomiFingerprint.extCmd(0xa, nitValue);
+ if(mXiaomiFingerprint != null) {
+ mMainHandler.postDelayed(() -> {
+ try {
+ mXiaomiFingerprint.extCmd(0xa, nitValue);
+ } catch(Exception e) {}
+ }, 60);
+ }
} catch(Exception e) {
Slog.d("PHH-Enroll", "Failed calling xiaomi fp extcmd");
}
@@ -123,8 +135,15 @@ public class FacolaView extends ImageView implements OnTouchListener {
invalidate();
if(!mInsideCircle) {
- mParams.screenBrightness = .0f;
mParams.dimAmount = UNTOUCHED_DIM;
+ //Changing Dim is instant, changing brightness isn't.
+ //Have a little pity of users' eyes and wait a bit
+ mMainHandler.postDelayed(() -> {
+ if(visible) {
+ mParams.screenBrightness = .0f;
+ mWM.updateViewLayout(this, mParams);
+ }
+ }, 100);
mWM.updateViewLayout(this, mParams);
return false;
}
@@ -133,6 +152,7 @@ public class FacolaView extends ImageView implements OnTouchListener {
mParams.screenBrightness = 1.0f;
mWM.updateViewLayout(this, mParams);
+
return true;
}
@@ -166,6 +186,7 @@ public class FacolaView extends ImageView implements OnTouchListener {
mParams.gravity = Gravity.TOP | Gravity.LEFT;
mWM.addView(this, mParams);
+ visible = true;
}
@@ -188,5 +209,6 @@ public class FacolaView extends ImageView implements OnTouchListener {
Slog.d("PHH-Enroll", "Removed facola");
mWM.removeView(this);
+ visible = false;
}
}
--
2.17.1
@@ -1,48 +0,0 @@
From 820e3cf51eaa918cee5c3c7bfe2fb240492eb7f8 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 2 Jul 2019 21:15:07 +0200
Subject: [PATCH 33/34] Make samsung light HAL more overridable
---
.../android/server/lights/LightsService.java | 24 ++++++++++++-------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
index cd709880e11..ef1f3c17b1c 100644
--- a/services/core/java/com/android/server/lights/LightsService.java
+++ b/services/core/java/com/android/server/lights/LightsService.java
@@ -64,16 +64,22 @@ public class LightsService extends SystemService {
return;
}
- if(SystemProperties.getInt("persist.sys.phh.samsung_backlight", 0) == 1 ||
- fp.matches(".*beyond.*lte.*") ||
- fp.matches(".*(crown|star)[q2]*lte.*") ||
- fp.matches(".*(SC-0[23]K|SCV3[89]).*")) {
- int newBrightness = brightness * 100;
- if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) {
- newBrightness = (int) (brightness * 40960.0 / 255.0);
+ int useSamsungBacklight = SystemProperties.getInt("persist.sys.phh.samsung_backlight", -1);
+ if(useSamsungBacklight != 0) {
+ if(useSamsungBacklight > 0 ||
+ fp.matches(".*beyond.*lte.*") ||
+ fp.matches(".*(crown|star)[q2]*lte.*") ||
+ fp.matches(".*(SC-0[23]K|SCV3[89]).*")) {
+ int ratio = 100;
+ if(useSamsungBacklight > 1)
+ ratio = useSamsungBacklight;
+ int newBrightness = brightness * ratio;
+ if(SystemProperties.getBoolean("persist.sys.samsung.full_brightness", false)) {
+ newBrightness = (int) (brightness * 40960.0 / 255.0);
+ }
+ setLightLocked(newBrightness, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
+ return;
}
- setLightLocked(newBrightness, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
- return;
}
boolean qcomExtendBrightness = SystemProperties.getBoolean("persist.extend.brightness", false);
--
2.17.1
@@ -1,27 +0,0 @@
From 91ea029c2c9686490d6c011708c4a298d236fa2b Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 2 Jul 2019 21:19:29 +0200
Subject: [PATCH 34/34] Make Samsung fingerprint broken HAL overridable
---
.../com/android/server/fingerprint/FingerprintService.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java
index 8c2990b1999..461fac50975 100644
--- a/services/core/java/com/android/server/fingerprint/FingerprintService.java
+++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java
@@ -1047,8 +1047,9 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
@Override
public void run() {
int remaining2 = remaining;
+ int overrideSamsung = android.os.SystemProperties.getInt("persist.sys.phh.samsung_fingerprint", -1);
String fp = android.os.SystemProperties.get("ro.vendor.build.fingerprint");
- if(fp != null && (fp.startsWith("samsung/")))
+ if(overrideSamsung == 1 || (overrideSamsung != 0 && fp != null && fp.startsWith("samsung/")))
remaining2 = 100 - remaining2;
handleEnrollResult(deviceId, fingerId, groupId, remaining2);
}
--
2.17.1
@@ -1,37 +0,0 @@
From 2dcdcc26c6f48915fc9b036f7c72adc29b110901 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 11 Aug 2019 10:30:37 +0200
Subject: [PATCH 36/40] Add property to use linear brightness slider
---
.../com/android/settingslib/display/BrightnessUtils.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java b/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java
index 55723f9d8ed..da8ce4a67e9 100644
--- a/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java
@@ -50,7 +50,12 @@ public class BrightnessUtils {
* @param max The maximum acceptable value for the setting.
* @return The corresponding setting value.
*/
+ private static final boolean useLinearBrightness = android.os.SystemProperties.getBoolean("persist.sys.phh.linear_brightness", false);
public static final int convertGammaToLinear(int val, int min, int max) {
+ if(useLinearBrightness) {
+ if(val < 4) return 1;
+ return val/4;
+ }
final float normalizedVal = MathUtils.norm(0, GAMMA_SPACE_MAX, val);
final float ret;
if (normalizedVal <= R) {
@@ -87,6 +92,7 @@ public class BrightnessUtils {
* @return The corresponding slider value
*/
public static final int convertLinearToGamma(int val, int min, int max) {
+ if(useLinearBrightness) return val*4;
// For some reason, HLG normalizes to the range [0, 12] rather than [0, 1]
final float normalizedVal = MathUtils.norm(min, max, val) * 12;
final float ret;
--
2.17.1
@@ -1,53 +0,0 @@
From 2b3f995ecdc7c8c8c066d698f66d2ea4f9f6cb56 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 12 Aug 2019 23:08:26 +0200
Subject: [PATCH 37/40] Add support for samsung touch proximity sensor as
fallback to real proximity sensor
---
.../server/display/DisplayPowerController.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
index 6f0a51bf107..32cece6f893 100644
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
@@ -62,6 +62,7 @@ import com.android.server.am.BatteryStatsService;
import com.android.server.policy.WindowManagerPolicy;
import java.io.PrintWriter;
+import java.util.List;
/**
* Controls the power state of the display.
@@ -501,6 +502,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
if (!DEBUG_PRETEND_PROXIMITY_SENSOR_ABSENT) {
mProximitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
+ if(mProximitySensor == null) {
+ List<Sensor> sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
+ for(Sensor sensor: sensors) {
+ if("com.samsung.sensor.touch_proximity".equals(sensor.getStringType()))
+ mProximitySensor = sensor;
+ }
+ }
if (mProximitySensor != null) {
mProximityThreshold = Math.min(mProximitySensor.getMaximumRange(),
TYPICAL_PROXIMITY_THRESHOLD);
@@ -1816,6 +1824,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
public void onSensorChanged(SensorEvent event) {
if (mProximitySensorEnabled) {
final long time = SystemClock.uptimeMillis();
+ if("com.samsung.sensor.touch_proximity".equals(mProximitySensor.getStringType())) {
+ int v = (int)event.values[0];
+ boolean positive = (v <= 4);
+ android.util.Log.d("PHH", "Samsung sensor changed " + positive + ":" + v);
+ handleProximitySensorEvent(time, positive);
+ return;
+ }
final float distance = event.values[0];
boolean positive = distance >= 0.0f && distance < mProximityThreshold;
handleProximitySensorEvent(time, positive);
--
2.17.1
@@ -1,107 +0,0 @@
From 400520d763e99653b8ebf81ed38e178bea2443b5 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 12 Aug 2019 23:10:21 +0200
Subject: [PATCH 38/40] Add Samsung `fod_enable` for under-display fingerprint.
For the moment only ultra-sonic works
---
.../server/fingerprint/FacolaView.java | 54 +++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/services/core/java/com/android/server/fingerprint/FacolaView.java b/services/core/java/com/android/server/fingerprint/FacolaView.java
index 86f03360ad0..254c1f99b44 100644
--- a/services/core/java/com/android/server/fingerprint/FacolaView.java
+++ b/services/core/java/com/android/server/fingerprint/FacolaView.java
@@ -32,6 +32,9 @@ import android.view.Gravity;
import android.os.Handler;
import android.os.Looper;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
import java.io.PrintWriter;
import vendor.xiaomi.hardware.fingerprintextension.V1_0.IXiaomiFingerprint;
@@ -53,9 +56,12 @@ public class FacolaView extends ImageView implements OnTouchListener {
private boolean visible = false;
private final WindowManager mWM;
+ private final boolean samsungFod = samsungHasCmd("fod_enable");
FacolaView(Context context) {
super(context);
+ android.util.Log.d("PHH", "Samsung FOD " + samsungFod);
+
mMainHandler = new Handler(Looper.getMainLooper());
String[] location = android.os.SystemProperties.get("persist.vendor.sys.fp.fod.location.X_Y", "").split(",");
@@ -157,6 +163,9 @@ public class FacolaView extends ImageView implements OnTouchListener {
}
public void show() {
+ if(samsungFod) {
+ samsungCmd("fod_enable,1,1");
+ }
if(mX == -1 || mY == -1 || mW == -1 || mH == -1) return;
try {
@@ -191,6 +200,9 @@ public class FacolaView extends ImageView implements OnTouchListener {
}
public void hide() {
+ if(samsungFod) {
+ samsungCmd("fod_enable,0");
+ }
if(mX == -1 || mY == -1 || mW == -1 || mH == -1) return;
try {
@@ -211,4 +223,46 @@ public class FacolaView extends ImageView implements OnTouchListener {
mWM.removeView(this);
visible = false;
}
+
+ private static boolean samsungHasCmd(String cmd) {
+ try {
+ File f = new File("/sys/devices/virtual/sec/tsp/cmd_list");
+ if(!f.exists()) return false;
+
+ BufferedReader b = new BufferedReader(new FileReader(f));
+ String line = null;
+ while( (line = b.readLine()) != null) {
+ if(line.equals(cmd)) return true;
+ }
+ return false;
+ } catch(Exception e) {
+ return false;
+ }
+ }
+
+ private static String readFile(String path) {
+ try {
+ File f = new File(path);
+
+ BufferedReader b = new BufferedReader(new FileReader(f));
+ return b.readLine();
+ } catch(Exception e) {
+ return null;
+ }
+ }
+
+ private static void samsungCmd(String cmd) {
+ try {
+ PrintWriter writer = new PrintWriter("/sys/devices/virtual/sec/tsp/cmd", "UTF-8");
+ writer.println(cmd);
+ writer.close();
+
+ String status = readFile("/sys/devices/virtual/sec/tsp/cmd_status");
+ String ret = readFile("/sys/devices/virtual/sec/tsp/cmd_result");
+
+ android.util.Log.d("PHH", "Sending command " + cmd + " returned " + ret + ":" + status);
+ } catch(Exception e) {
+ android.util.Log.d("PHH", "Failed sending command " + cmd, e);
+ }
+ }
}
--
2.17.1
@@ -1,30 +0,0 @@
From 2699dc1cb20a07e8bccf60b47d556d10289bb3b3 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 14 Aug 2019 08:50:47 +0200
Subject: [PATCH 39/40] Use Samsung power HAL
Samsung likes to have two android.hardware.power@1.0 implementation
side-by-side, one that works, one that doesn't.
Pick the one that works.
---
.../core/jni/com_android_server_power_PowerManagerService.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/services/core/jni/com_android_server_power_PowerManagerService.cpp b/services/core/jni/com_android_server_power_PowerManagerService.cpp
index b2d35d4153a..3cac85139c5 100644
--- a/services/core/jni/com_android_server_power_PowerManagerService.cpp
+++ b/services/core/jni/com_android_server_power_PowerManagerService.cpp
@@ -84,7 +84,9 @@ static bool checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodNa
// The caller must be holding gPowerHalMutex.
static void connectPowerHalLocked() {
if (gPowerHalExists && gPowerHalV1_0_ == nullptr) {
- gPowerHalV1_0_ = IPowerV1_0::getService();
+ gPowerHalV1_0_ = IPowerV1_0::getService("miscpower");
+ if(gPowerHalV1_0_ == nullptr)
+ gPowerHalV1_0_ = IPowerV1_0::getService();
if (gPowerHalV1_0_ != nullptr) {
ALOGI("Loaded power HAL 1.0 service");
// Try cast to powerHAL V1_1
--
2.17.1
@@ -1,31 +0,0 @@
From ad4d27e4be4048fa178d4755be4e2063e3204246 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 14 Aug 2019 23:36:45 +0200
Subject: [PATCH 40/40] Also add com.samsung.sensor.physical_proximity (if
available, it is more a true proximity sensor than touch proximity sensor)
---
.../com/android/server/display/DisplayPowerController.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
index 32cece6f893..9ffc8a817e2 100644
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
@@ -502,6 +502,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
if (!DEBUG_PRETEND_PROXIMITY_SENSOR_ABSENT) {
mProximitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
+ if(mProximitySensor == null) {
+ List<Sensor> sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
+ for(Sensor sensor: sensors) {
+ if("com.samsung.sensor.physical_proximity".equals(sensor.getStringType()))
+ mProximitySensor = sensor;
+ }
+ }
if(mProximitySensor == null) {
List<Sensor> sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
for(Sensor sensor: sensors) {
--
2.17.1
@@ -1,26 +0,0 @@
From edeb825839b1c1e315b0194fa91a6c8c47f3331f Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 14 Aug 2018 21:01:35 +0200
Subject: [PATCH 1/4] AOSP 8.0/8.1 didn't use presentOrValidate, so it's
broken. Don't use it
---
services/surfaceflinger/DisplayHardware/HWComposer.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index f5f7a821f..3c269ea1f 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -435,7 +435,7 @@ status_t HWComposer::prepare(DisplayDevice& displayDevice) {
// The check below is incorrect. We actually rely on HWC here to fall
// back to validate when there is any client layer.
displayData.validateWasSkipped = false;
- if (!displayData.hasClientComposition) {
+ if ((false)) { //!displayData.hasClientComposition) {
sp<android::Fence> outPresentFence;
uint32_t state = UINT32_MAX;
error = hwcDisplay->presentOrValidate(&numTypes, &numRequests, &outPresentFence , &state);
--
2.17.1
@@ -1,26 +0,0 @@
From 12169a1da2a3ed976027784496035655aa5a5545 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 2/4] Ignore usage bits verification
This didn't ignore as of 8.1, so we're ""safe""
---
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 b92cbf351..1c0e5d5ea 100644
--- a/libs/ui/Gralloc2.cpp
+++ b/libs/ui/Gralloc2.cpp
@@ -92,7 +92,7 @@ Gralloc2::Error Mapper::validateBufferDescriptorInfo(
if (descriptorInfo.usage & ~validUsageBits) {
ALOGE("buffer descriptor contains invalid usage bits 0x%" PRIx64,
descriptorInfo.usage & ~validUsageBits);
- return Error::BAD_VALUE;
+ //return Error::BAD_VALUE;
}
return Error::NONE;
}
--
2.17.1
@@ -1,42 +0,0 @@
From bdded5a601c39eb445128bd6c5085970ffd6d4e5 Mon Sep 17 00:00:00 2001
From: phh <phh@phh.me>
Date: Wed, 22 Aug 2018 08:57:52 +0000
Subject: [PATCH] Enable fallback to old ro.sf.hwrotation property
---
services/surfaceflinger/SurfaceFlinger.cpp | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index dfeabc059..22d161b65 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -316,6 +316,25 @@ SurfaceFlinger::SurfaceFlinger() : SurfaceFlinger(SkipInitialization) {
}
ALOGV("Primary Display Orientation is set to %2d.", SurfaceFlinger::primaryDisplayOrientation);
+ if(primaryDisplayOrientation == V1_1::DisplayOrientation::ORIENTATION_0) {
+ int sfRotation = property_get_int32("ro.sf.hwrotation", -1);
+ switch(sfRotation) {
+ case 0:
+ SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientationDefault;
+ break;
+ case 90:
+ SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientation90;
+ break;
+ case 180:
+ SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientation180;
+ break;
+ case 270:
+ SurfaceFlinger::primaryDisplayOrientation = DisplayState::eOrientation270;
+ break;
+ }
+ }
+ ALOGV("Primary Display Orientation is set to %2d.", SurfaceFlinger::primaryDisplayOrientation);
+
mPrimaryDispSync.init(SurfaceFlinger::hasSyncFramework, SurfaceFlinger::dispSyncPresentTimeOffset);
// debugging stuff...
--
2.17.1
@@ -1,74 +0,0 @@
From 399d13fc183a7fbd3118425c7cfecbb9a72ba9ce Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Fri, 5 Jan 2018 00:26:38 +0100
Subject: [PATCH 4/4] [device] ::Huawei:: HWC doesn't understand 0,0,0,0 ==
fullscreen damage. Set it to the whole visible surface
::Huawei:: Fix damage for Huawei compositor
For Huawei compositor, the damage area is a region on the screen.
But for SurfaceFlinger, this is a region on the source surface.
On Huawei devices, do the plane conversion.
This fixes several UI glitches, most notably GBoard.
---
services/surfaceflinger/BufferLayer.cpp | 8 +++++++-
services/surfaceflinger/SurfaceFlinger.cpp | 8 ++++++++
services/surfaceflinger/SurfaceFlinger.h | 3 +++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index 7ac143219..2646af0c9 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -631,7 +631,13 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice)
visible.dump(LOG_TAG);
}
- error = hwcLayer->setSurfaceDamage(surfaceDamageRegion);
+ if(mFlinger->mDamageUsesScreenReference) {
+ const auto& frame = hwcInfo.displayFrame;
+ auto fullSource = Region(Rect(frame.left, frame.top, frame.right, frame.bottom));
+ error = hwcLayer->setSurfaceDamage(fullSource);
+ } else {
+ error = hwcLayer->setSurfaceDamage(surfaceDamageRegion);
+ }
if (error != HWC2::Error::None) {
ALOGE("[%s] Failed to set surface damage: %s (%d)", mName.string(),
to_string(error).c_str(), static_cast<int32_t>(error));
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 860625525..2c6dc7f21 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -384,6 +384,14 @@ SurfaceFlinger::SurfaceFlinger() : SurfaceFlinger(SkipInitialization) {
// for production purposes later on.
setenv("TREBLE_TESTING_OVERRIDE", "true", true);
}
+
+ property_get("ro.hardware", value, "");
+ if(strstr(value, "hi3660")||
+ strstr(value, "hi6250") ||
+ strstr(value, "hi3670") ||
+ strstr(value, "kirin970")) {
+ mDamageUsesScreenReference = true;
+ }
}
void SurfaceFlinger::onFirstRef()
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 0148ab675..367ea555a 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -852,6 +852,9 @@ private:
// Restrict layers to use two buffers in their bufferqueues.
bool mLayerTripleBufferingDisabled = false;
+ bool mDamageUsesScreenReference;
+
+
// these are thread safe
mutable std::unique_ptr<MessageQueue> mEventQueue{std::make_unique<impl::MessageQueue>()};
FrameTracker mAnimFrameTracker;
--
2.17.1
@@ -1,31 +0,0 @@
From 725b2c6c7b45072c96531656711b89bf9b6b502a 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 5/6] Some Samsung devices requires lying colorspace
---
opengl/libs/EGL/eglApi.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index c65bddfbb..3cde19af1 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -454,8 +454,14 @@ EGLBoolean eglGetConfigAttrib(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_SRGB_LINEAR;
} else if (colorspace == EGL_GL_COLORSPACE_SRGB_KHR) {
return HAL_DATASPACE_SRGB;
--
2.17.1
@@ -1,35 +0,0 @@
From 663f83cdb9628315a8501a24d85eee6df707e1ae 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 6/6] On Samsung, we need to send a hack-message to HAL to get
all Sensors
---
services/sensorservice/SensorDevice.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
index 115a983bc..7fe05190e 100644
--- a/services/sensorservice/SensorDevice.cpp
+++ b/services/sensorservice/SensorDevice.cpp
@@ -26,6 +26,8 @@
#include <cinttypes>
#include <thread>
+#include <android-base/properties.h>
+
using namespace android::hardware::sensors::V1_0;
using namespace android::hardware::sensors::V1_0::implementation;
using android::hardware::hidl_vec;
@@ -59,6 +61,8 @@ SensorDevice::SensorDevice()
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
@@ -1,130 +0,0 @@
From 3f9d4b49279b6ef9dbef40ab2403b5fb238db5e3 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 14 Aug 2018 16:59:12 +0200
Subject: [PATCH 1/3] Revert "SupplicantManager: Remove
|ensure_config_file_exists|"
This reverts commit f61dc8cd7dadda5741d6e4a1bb6b576ba89cc24b.
---
libwifi_system/supplicant_manager.cpp | 97 +++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
diff --git a/libwifi_system/supplicant_manager.cpp b/libwifi_system/supplicant_manager.cpp
index 5667648b3..be0c33a8a 100644
--- a/libwifi_system/supplicant_manager.cpp
+++ b/libwifi_system/supplicant_manager.cpp
@@ -33,7 +33,89 @@ namespace wifi_system {
namespace {
const char kSupplicantInitProperty[] = "init.svc.wpa_supplicant";
+const char kSupplicantConfigTemplatePath[] =
+ "/etc/wifi/wpa_supplicant.conf";
+const char kSupplicantConfigFile[] = "/data/misc/wifi/wpa_supplicant.conf";
+const char kP2pConfigFile[] = "/data/misc/wifi/p2p_supplicant.conf";
const char kSupplicantServiceName[] = "wpa_supplicant";
+constexpr mode_t kConfigFileMode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
+
+int ensure_config_file_exists(const char* config_file) {
+ char buf[2048];
+ int srcfd, destfd;
+ int nread;
+ int ret;
+ std::string templatePath;
+
+ ret = access(config_file, R_OK | W_OK);
+ if ((ret == 0) || (errno == EACCES)) {
+ if ((ret != 0) && (chmod(config_file, kConfigFileMode) != 0)) {
+ LOG(ERROR) << "Cannot set RW to \"" << config_file << "\": "
+ << strerror(errno);
+ return false;
+ }
+ return true;
+ } else if (errno != ENOENT) {
+ LOG(ERROR) << "Cannot access \"" << config_file << "\": "
+ << strerror(errno);
+ return false;
+ }
+
+ std::string configPathSystem =
+ std::string("/system") + std::string(kSupplicantConfigTemplatePath);
+ std::string configPathVendor =
+ std::string("/vendor") + std::string(kSupplicantConfigTemplatePath);
+ srcfd = TEMP_FAILURE_RETRY(open(configPathSystem.c_str(), O_RDONLY));
+ templatePath = configPathSystem;
+ if (srcfd < 0) {
+ int errnoSystem = errno;
+ srcfd = TEMP_FAILURE_RETRY(open(configPathVendor.c_str(), O_RDONLY));
+ templatePath = configPathVendor;
+ if (srcfd < 0) {
+ int errnoVendor = errno;
+ LOG(ERROR) << "Cannot open \"" << configPathSystem << "\": "
+ << strerror(errnoSystem);
+ LOG(ERROR) << "Cannot open \"" << configPathVendor << "\": "
+ << strerror(errnoVendor);
+ return false;
+ }
+ }
+
+ destfd = TEMP_FAILURE_RETRY(open(config_file,
+ O_CREAT | O_RDWR,
+ kConfigFileMode));
+ if (destfd < 0) {
+ close(srcfd);
+ LOG(ERROR) << "Cannot create \"" << config_file << "\": "
+ << strerror(errno);
+ return false;
+ }
+
+ while ((nread = TEMP_FAILURE_RETRY(read(srcfd, buf, sizeof(buf)))) != 0) {
+ if (nread < 0) {
+ LOG(ERROR) << "Error reading \"" << templatePath
+ << "\": " << strerror(errno);
+ close(srcfd);
+ close(destfd);
+ unlink(config_file);
+ return false;
+ }
+ TEMP_FAILURE_RETRY(write(destfd, buf, nread));
+ }
+
+ close(destfd);
+ close(srcfd);
+
+ /* chmod is needed because open() didn't set permisions properly */
+ if (chmod(config_file, kConfigFileMode) < 0) {
+ LOG(ERROR) << "Error changing permissions of " << config_file
+ << " to 0660: " << strerror(errno);
+ unlink(config_file);
+ return false;
+ }
+
+ return true;
+}
} // namespace
@@ -49,6 +131,21 @@ bool SupplicantManager::StartSupplicant() {
return true;
}
+ /* Before starting the daemon, make sure its config file exists */
+ if (ensure_config_file_exists(kSupplicantConfigFile) < 0) {
+ LOG(ERROR) << "Wi-Fi will not be enabled";
+ return false;
+ }
+
+ /*
+ * Some devices have another configuration file for the p2p interface.
+ * However, not all devices have this, and we'll let it slide if it
+ * is missing. For devices that do expect this file to exist,
+ * supplicant will refuse to start and emit a good error message.
+ * No need to check for it here.
+ */
+ (void)ensure_config_file_exists(kP2pConfigFile);
+
/*
* Get a reference to the status property, so we can distinguish
* the case where it goes stopped => running => stopped (i.e.,
--
2.17.1
@@ -1,67 +0,0 @@
From c1cec4b4be592192cd8731048eeb0bc4dc4f8337 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 15 Aug 2018 00:04:45 +0200
Subject: [PATCH 2/3] Start supplicant later
Change-Id: I6a67baad486162415840006711fb6d8dbf96a66a
---
.../java/com/android/server/wifi/WifiNative.java | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index bc599c141..eb5e11aca 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -332,13 +332,15 @@ public class WifiNative {
}
/** Helper method invoked to start supplicant if there were no STA ifaces */
+ private boolean supplicantOn = false;
private boolean startSupplicant() {
synchronized (mLock) {
- if (!mIfaceMgr.hasAnyStaIface()) {
+ if (!mIfaceMgr.hasAnyStaIface() || !supplicantOn) {
if (!mWificondControl.enableSupplicant()) {
Log.e(TAG, "Failed to enable supplicant");
return false;
}
+ supplicantOn = true;
if (!waitForSupplicantConnection()) {
Log.e(TAG, "Failed to connect to supplicant");
return false;
@@ -363,6 +365,7 @@ public class WifiNative {
if (!mWificondControl.disableSupplicant()) {
Log.e(TAG, "Failed to disable supplicant");
}
+ supplicantOn = false;
}
}
}
@@ -852,11 +855,6 @@ public class WifiNative {
mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToHal();
return null;
}
- if (!startSupplicant()) {
- Log.e(TAG, "Failed to start supplicant");
- mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToSupplicant();
- return null;
- }
Iface iface = mIfaceMgr.allocateIface(Iface.IFACE_TYPE_STA);
if (iface == null) {
Log.e(TAG, "Failed to allocate new STA iface");
@@ -870,6 +868,12 @@ public class WifiNative {
mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToHal();
return null;
}
+ Log.e(TAG, "Starting supplicant");
+ if (!startSupplicant()) {
+ Log.e(TAG, "Failed to start supplicant");
+ mWifiMetrics.incrementNumSetupClientInterfaceFailureDueToSupplicant();
+ return null;
+ }
if (mWificondControl.setupInterfaceForClientMode(iface.name) == null) {
Log.e(TAG, "Failed to setup iface in wificond on " + iface);
teardownInterface(iface.name);
--
2.17.1
@@ -1,94 +0,0 @@
From a1f7086dc8ee1d379006c42eebbc88504c4cbeee Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <pierre-hugues.husson@softathome.com>
Date: Tue, 18 Sep 2018 17:05:07 +0200
Subject: [PATCH 3/3] Support hostap on O/O-MR1 vendors
Two issues are fixed here:
- some vendor HALs lied (because of Android behaviour) about ap interface name.
O/O-MR1 behaviour meant hostap/sta had same interface. So "wlan0" sound
quite a good guess
- doing multiple configureChip in one IWifi session wasn't allowed.
Now, it is a requirement to be supported, so most(all?) HALs don't
support it. force stop/start for every reconfiguration
---
.../android/server/wifi/HalDeviceManager.java | 22 +++++++++++++++++--
.../com/android/server/wifi/WifiNative.java | 15 ++++++++++++-
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/service/java/com/android/server/wifi/HalDeviceManager.java b/service/java/com/android/server/wifi/HalDeviceManager.java
index 3c61217d7..68fc9ccfa 100644
--- a/service/java/com/android/server/wifi/HalDeviceManager.java
+++ b/service/java/com/android/server/wifi/HalDeviceManager.java
@@ -63,8 +63,8 @@ import java.util.Set;
*/
public class HalDeviceManager {
private static final String TAG = "HalDevMgr";
- private static final boolean VDBG = false;
- private boolean mDbg = false;
+ private static final boolean VDBG = true;
+ private boolean mDbg = true;
private static final int START_HAL_RETRY_INTERVAL_MS = 20;
// Number of attempts a start() is re-tried. A value of 0 means no retries after a single
@@ -224,6 +224,16 @@ public class HalDeviceManager {
*/
public IWifiStaIface createStaIface(boolean lowPrioritySta,
@Nullable InterfaceDestroyedListener destroyedListener, @Nullable Handler handler) {
+ //As of O and O-MR1, configureChip MUST BE after a startWifi
+ //Pie changed this to allow dynamic configureChip
+ //No O/O-MR1 HAL support that, so restart wifi HAL when we do that
+ if(android.os.SystemProperties.getInt("persist.sys.vndk", 28) < 28) {
+ Log.e(TAG, "createStaIface: Stopping wifi");
+ stopWifi();
+ Log.e(TAG, "createStaIface: Starting wifi");
+ startWifi();
+ Log.e(TAG, "createStaIface: Creating iface");
+ }
return (IWifiStaIface) createIface(IfaceType.STA, lowPrioritySta, destroyedListener,
handler);
}
@@ -233,6 +243,14 @@ public class HalDeviceManager {
*/
public IWifiApIface createApIface(@Nullable InterfaceDestroyedListener destroyedListener,
@Nullable Handler handler) {
+ //cf createStaIface
+ if(android.os.SystemProperties.getInt("persist.sys.vndk", 28) < 28) {
+ Log.e(TAG, "createApIface: Stopping wifi");
+ stopWifi();
+ Log.e(TAG, "createApIface: Starting wifi");
+ startWifi();
+ Log.e(TAG, "createApIface: Creating iface");
+ }
return (IWifiApIface) createIface(IfaceType.AP, false, destroyedListener, handler);
}
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index eb5e11aca..af8ccc8d9 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -692,8 +692,21 @@ public class WifiNative {
private String createApIface(@NonNull Iface iface) {
synchronized (mLock) {
if (mWifiVendorHal.isVendorHalSupported()) {
- return mWifiVendorHal.createApIface(
+ String ret = mWifiVendorHal.createApIface(
new InterfaceDestoyedListenerInternal(iface.id));
+ //In O and O-MR1, there was only ONE wifi interface for everything (sta and ap)
+ //Most vendors used "wlan0" for those interfaces, but there is no guarantee
+ //This override exists here, because most OEMs return "ap0" when doing createApIface,
+ //even when the iface is actually called "wlan0"
+ //
+ //To be perfectly clean, we should check what value createStaIface (would have) returned
+ //and use the same one.
+ //That's overly complicated, so let's assume this is wlan0 for the moment
+ if(android.os.SystemProperties.getInt("persist.sys.vndk", 28) < 28) {
+ ret = "wlan0";
+ }
+
+ return ret;
} else {
Log.i(TAG, "Vendor Hal not supported, ignoring createApIface.");
return handleIfaceCreationWhenVendorHalNotSupported(iface);
--
2.17.1
@@ -1,50 +0,0 @@
From 875a58806b9cd6f815f78872baefb8565725209d Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Thu, 16 Aug 2018 22:12:46 +0200
Subject: [PATCH 1/7] Add route to gateway on null netmask
Galaxy S9 returns empty prefix
Change-Id: I8133da8e8f5203666684100009ba658528a02e94
---
.../dataconnection/DataConnection.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/java/com/android/internal/telephony/dataconnection/DataConnection.java b/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
index dafab121c..643f488c8 100644
--- a/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
@@ -24,6 +24,7 @@ import android.content.Context;
import android.net.ConnectivityManager;
import android.net.ConnectivityManager.PacketKeepalive;
import android.net.KeepalivePacketData;
+import android.net.IpPrefix;
import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.NetworkAgent;
@@ -1127,6 +1128,22 @@ public class DataConnection extends StateMachine {
}
for (InetAddress gateway : response.getGateways()) {
+ if(response.getAddresses().size()>0) {
+ //TODO:
+ // - IPv6
+ // - Multiple addresses
+ // - Check for non-trivial prefix length
+ LinkAddress la = response.getAddresses().get(0);
+ if(la.getNetworkPrefixLength() == 32 &&
+ gateway instanceof java.net.Inet4Address) {
+ if(!gateway.isAnyLocalAddress()) {
+ linkProperties.addRoute(new RouteInfo(
+ new IpPrefix(gateway, 32),
+ InetAddress.getByName("0.0.0.0"),
+ response.getIfname()));
+ }
+ }
+ }
// Allow 0.0.0.0 or :: as a gateway;
// this indicates a point-to-point interface.
linkProperties.addRoute(new RouteInfo(gateway));
--
2.17.1
@@ -1,28 +0,0 @@
From 83f2875338c58d190645eedd42c8a33628f7692a Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Fri, 28 Dec 2018 13:06:32 +0100
Subject: [PATCH 4/7] Make MAX_CONNECTIONS_GSM settable from property
cf https://github.com/phhusson/treble_experimentations/issues/110
Change-Id: I5df755535aa5ded704d4c33122d63ac2481bd5f6
---
src/java/com/android/internal/telephony/GsmCdmaCallTracker.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/java/com/android/internal/telephony/GsmCdmaCallTracker.java b/src/java/com/android/internal/telephony/GsmCdmaCallTracker.java
index f4c561c29..b42caf47c 100755
--- a/src/java/com/android/internal/telephony/GsmCdmaCallTracker.java
+++ b/src/java/com/android/internal/telephony/GsmCdmaCallTracker.java
@@ -62,7 +62,7 @@ public class GsmCdmaCallTracker extends CallTracker {
//***** Constants
- public static final int MAX_CONNECTIONS_GSM = 19; //7 allowed in GSM + 12 from IMS for SRVCC
+ public static final int MAX_CONNECTIONS_GSM = android.os.SystemProperties.getInt("persist.sys.phh.radio.max_connections_gsm", 19); //7 allowed in GSM + 12 from IMS for SRVCC
private static final int MAX_CONNECTIONS_PER_CALL_GSM = 5; //only 5 connections allowed per call
private static final int MAX_CONNECTIONS_CDMA = 8;
--
2.17.1
@@ -1,28 +0,0 @@
From 0bf94164b4a3d537cc0b1225eb3399010c4f25e5 Mon Sep 17 00:00:00 2001
From: Dil3mm4 <dil3mm4.dev@gmail.com>
Date: Sat, 17 Nov 2018 18:18:42 +0000
Subject: [PATCH 5/7] Choose a more generic prop.
Since USSD it's a problem over MTK too and not only on Kirin, let's be more generic.
Change-Id: Icf1700f55be40915f9c64059019287f300d81405
---
src/java/com/android/internal/telephony/GsmCdmaPhone.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
index 726fca9bc..e54daa102 100644
--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java
+++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
@@ -2164,7 +2164,7 @@ public class GsmCdmaPhone extends Phone {
// Complete pending USSD
if (isUssdRelease) {
- if (SystemProperties.getBoolean("persist.sys.radio.huawei", false)) {
+ if (SystemProperties.getBoolean("persist.sys.radio.ussd.fix", false)) {
found.onUssdFinished(ussdMessage, isUssdRequest);
} else {
found.onUssdRelease();
--
2.17.1
@@ -1,33 +0,0 @@
From 07a474ec22ecfde83a4cfb6b74f962a905c18e65 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 26 Feb 2019 23:13:21 +0100
Subject: [PATCH 6/7] Add a property to force all APNs to be modemCognitive.
Needed on some MTK modems
Change-Id: I111f1375f3f11e81251eaf782c84a0bef345366c
---
.../android/internal/telephony/dataconnection/DcTracker.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
index ea6fa81d0..53388df26 100644
--- a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
@@ -3308,11 +3308,13 @@ public class DcTracker extends Handler {
}
private void setDataProfilesAsNeeded() {
+ boolean forceCognitive = SystemProperties.getBoolean("persist.sys.phh.radio.force_cognitive", false);
+
if (DBG) log("setDataProfilesAsNeeded");
if (mAllApnSettings != null && !mAllApnSettings.isEmpty()) {
ArrayList<DataProfile> dps = new ArrayList<DataProfile>();
for (ApnSetting apn : mAllApnSettings) {
- if (apn.modemCognitive) {
+ if (apn.modemCognitive || forceCognitive) {
DataProfile dp = createDataProfile(apn);
if (!dps.contains(dp)) {
dps.add(dp);
--
2.17.1
@@ -1,40 +0,0 @@
From 6af1a1cbc2d2f446777aa0b20deb333be25ead7d Mon Sep 17 00:00:00 2001
From: Artem Borisov <dedsa2002@gmail.com>
Date: Wed, 19 Sep 2018 17:02:06 +0300
Subject: [PATCH] Telephony: Support muting by RIL command
While almost everyone already moved to AudioManager years ago,
some OEMs (cough Huawei) still use RIL for muting and don't
promote the necessary calls in their audio HAL.
Let's handle these odd cases too when it's necessary.
Change-Id: Id916dec2574d6e57b6f809fbaf2b0959c0cc7256
---
src/com/android/services/telephony/TelephonyConnection.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index ba0e565a5..29f473be7 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -25,6 +25,7 @@ import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.PersistableBundle;
+import android.os.SystemProperties;
import android.telecom.CallAudioState;
import android.telecom.ConferenceParticipant;
import android.telecom.Connection;
@@ -707,6 +708,9 @@ abstract class TelephonyConnection extends Connection implements Holdable {
getPhone().setEchoSuppressionEnabled();
if (!mSendMicMuteToAudioManager) {
getPhone().setMute(audioState.isMuted());
+ }
+ if (SystemProperties.getBoolean("persist.sys.radio.huawei", false)) {
+ getPhone().setMute(audioState.isMuted());
}
}
}
--
2.17.1
@@ -1,50 +0,0 @@
From 30fcd6290899005b0345b63ed406257def314880 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 6 May 2019 20:25:34 +0200
Subject: [PATCH 2/2] Fixes crash when selecting network
Cf https://github.com/phhusson/treble_experimentations/issues/486
---
src/com/android/phone/NetworkQueryService.java | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/com/android/phone/NetworkQueryService.java b/src/com/android/phone/NetworkQueryService.java
index 22b55091e..de1c796ef 100644
--- a/src/com/android/phone/NetworkQueryService.java
+++ b/src/com/android/phone/NetworkQueryService.java
@@ -43,6 +43,8 @@ import com.android.internal.telephony.PhoneFactory;
import java.util.ArrayList;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* Service code used to assist in querying the network for service
@@ -371,14 +373,20 @@ public class NetworkQueryService extends Service {
*/
private List<CellInfo> getCellInfoList(List<OperatorInfo> operatorInfoList) {
List<CellInfo> cellInfoList = new ArrayList<>();
+ Pattern p = Pattern.compile("^([0-9]{5,6}).*");
for (OperatorInfo oi: operatorInfoList) {
String operatorNumeric = oi.getOperatorNumeric();
String mcc = null;
String mnc = null;
log("operatorNumeric: " + operatorNumeric);
- if (operatorNumeric != null && operatorNumeric.matches("^[0-9]{5,6}$")) {
- mcc = operatorNumeric.substring(0, 3);
- mnc = operatorNumeric.substring(3);
+ 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(LOG_TAG, "Failed to parse operatorNumeric!");
+ }
}
CellIdentityGsm cig = new CellIdentityGsm(
Integer.MAX_VALUE /* lac */,
--
2.17.1
@@ -1,31 +0,0 @@
From 723d296437691cc91b63140d8d6c95525e571218 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 20 May 2019 23:45:56 +0200
Subject: [PATCH 3/3] Fail gracefully in mobile settings
---
src/com/android/phone/DataUsagePreference.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/com/android/phone/DataUsagePreference.java b/src/com/android/phone/DataUsagePreference.java
index 85e77001f..b32d85154 100644
--- a/src/com/android/phone/DataUsagePreference.java
+++ b/src/com/android/phone/DataUsagePreference.java
@@ -55,8 +55,12 @@ public class DataUsagePreference extends Preference {
DataUsageController controller = new DataUsageController(activity);
DataUsageController.DataUsageInfo usageInfo = controller.getDataUsageInfo(mTemplate);
- setSummary(activity.getString(R.string.data_usage_template,
- Formatter.formatFileSize(activity, usageInfo.usageLevel), usageInfo.period));
+ if(usageInfo != null) {
+ setSummary(activity.getString(R.string.data_usage_template,
+ Formatter.formatFileSize(activity, usageInfo.usageLevel), usageInfo.period));
+ } else {
+ setSummary(activity.getString(R.string.data_usage_title));
+ }
setIntent(getIntent());
}
--
2.17.1
@@ -1,105 +0,0 @@
From 7cd888e8393f7e03bab257e3506e58d307dfef8a Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 20 Feb 2018 23:04:50 +0100
Subject: [PATCH 1/2] Make BTM_BYPASS_EXTRA_ACL_SETUP dynamic
Change-Id: Icb0868566b29b053ed7e83c9fd32e225af3f2e46
---
hci/include/bt_hci_bdroid.h | 3 +++
internal_include/bt_target.h | 3 +++
stack/btm/btm_acl.cc | 20 ++++++++++----------
stack/btm/btm_sec.cc | 18 +++++++++---------
4 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/hci/include/bt_hci_bdroid.h b/hci/include/bt_hci_bdroid.h
index cf2c1136f..e2844db82 100644
--- a/hci/include/bt_hci_bdroid.h
+++ b/hci/include/bt_hci_bdroid.h
@@ -32,6 +32,9 @@
#ifdef HAS_BDROID_BUILDCFG
#include "bdroid_buildcfg.h"
#endif
+#ifndef BTM_BYPASS_EXTRA_ACL_SETUP
+#define BTM_BYPASS_EXTRA_ACL_SETUP TRUE
+#endif
/******************************************************************************
* Constants & Macros
diff --git a/internal_include/bt_target.h b/internal_include/bt_target.h
index cf09b15da..396114faf 100644
--- a/internal_include/bt_target.h
+++ b/internal_include/bt_target.h
@@ -32,6 +32,9 @@
#ifdef HAS_BDROID_BUILDCFG
#include "bdroid_buildcfg.h"
#endif
+#ifndef BTM_BYPASS_EXTRA_ACL_SETUP
+#define BTM_BYPASS_EXTRA_ACL_SETUP TRUE
+#endif
#include "bt_types.h" /* This must be defined AFTER buildcfg.h */
diff --git a/stack/btm/btm_acl.cc b/stack/btm/btm_acl.cc
index ee2530ac2..389a998c6 100644
--- a/stack/btm/btm_acl.cc
+++ b/stack/btm/btm_acl.cc
@@ -1184,17 +1184,17 @@ void btm_read_remote_ext_features_failed(uint8_t status, uint16_t handle) {
void btm_establish_continue(tACL_CONN* p_acl_cb) {
tBTM_BL_EVENT_DATA evt_data;
BTM_TRACE_DEBUG("btm_establish_continue");
-#if (BTM_BYPASS_EXTRA_ACL_SETUP == FALSE)
- if (p_acl_cb->transport == BT_TRANSPORT_BR_EDR) {
- /* For now there are a some devices that do not like sending */
- /* commands events and data at the same time. */
- /* Set the packet types to the default allowed by the device */
- btm_set_packet_types(p_acl_cb, btm_cb.btm_acl_pkt_types_supported);
-
- if (btm_cb.btm_def_link_policy)
- BTM_SetLinkPolicy(p_acl_cb->remote_addr, &btm_cb.btm_def_link_policy);
+ if (!BTM_BYPASS_EXTRA_ACL_SETUP) {
+ if (p_acl_cb->transport == BT_TRANSPORT_BR_EDR) {
+ /* For now there are a some devices that do not like sending */
+ /* commands events and data at the same time. */
+ /* Set the packet types to the default allowed by the device */
+ btm_set_packet_types(p_acl_cb, btm_cb.btm_acl_pkt_types_supported);
+
+ if (btm_cb.btm_def_link_policy)
+ BTM_SetLinkPolicy(p_acl_cb->remote_addr, &btm_cb.btm_def_link_policy);
+ }
}
-#endif
if (p_acl_cb->link_up_issued) {
BTM_TRACE_ERROR("%s: Already link is up ", __func__);
return;
diff --git a/stack/btm/btm_sec.cc b/stack/btm/btm_sec.cc
index b0809010f..4cc1e39ab 100644
--- a/stack/btm/btm_sec.cc
+++ b/stack/btm/btm_sec.cc
@@ -4356,15 +4356,15 @@ void btm_sec_connected(const RawAddress& bda, uint16_t handle, uint8_t status,
if (p_acl_cb) {
/* whatever is in btm_establish_continue() without reporting the BTM_BL_CONN_EVT
* event */
-#if (BTM_BYPASS_EXTRA_ACL_SETUP == FALSE)
- /* For now there are a some devices that do not like sending */
- /* commands events and data at the same time. */
- /* Set the packet types to the default allowed by the device */
- btm_set_packet_types(p_acl_cb, btm_cb.btm_acl_pkt_types_supported);
-
- if (btm_cb.btm_def_link_policy)
- BTM_SetLinkPolicy(p_acl_cb->remote_addr, &btm_cb.btm_def_link_policy);
-#endif
+ if(!BTM_BYPASS_EXTRA_ACL_SETUP) {
+ /* For now there are a some devices that do not like sending */
+ /* commands events and data at the same time. */
+ /* Set the packet types to the default allowed by the device */
+ btm_set_packet_types(p_acl_cb, btm_cb.btm_acl_pkt_types_supported);
+
+ if (btm_cb.btm_def_link_policy)
+ BTM_SetLinkPolicy(p_acl_cb->remote_addr, &btm_cb.btm_def_link_policy);
+ }
}
btm_acl_created(bda, p_dev_rec->dev_class, p_dev_rec->sec_bd_name, handle,
HCI_ROLE_SLAVE, BT_TRANSPORT_BR_EDR);
--
2.17.1
@@ -1,153 +0,0 @@
From 726ea538e933b77daa86537ca7b376bbb78aa9f8 Mon Sep 17 00:00:00 2001
From: penn5 <penn5@users.noreply.github.com>
Date: Mon, 4 Mar 2019 22:21:07 +0000
Subject: [PATCH 2/2] Add props to control supported features and states (#1)
* Add bitmask for supported fields
Use persist.sys.bt.unsupport.states, defaults to 0, left-aligned.
Huawei suggest to use 000000000000000000000011111
* Add bitmask to LOCAL_SUPPORTED_FEATURES
For Huawei, suggest to use 00000001
Documentation:
- persist.sys.bt.unsupport.features matches the values:
HCI_3_SLOT_PACKETS..HCI_LMP_EXTENDED_SUPPORTED (max 8bits * 8 bytes =
64 bits)
- persist.sys.bt.unsupport.states matches the values:
BTM_BLE_STATE_INVALID..BTM_BLE_STATE_SCAN_ADV (max = 0x3ff, 11 bits)
- persist.sys.bt.unsupport.stdfeatures ( max: 16 bits)
HCI_LE_ENCRYPTION..HCI_LE_PERIODIC_ADVERTISING
---
hci/src/hci_packet_parser.cc | 77 ++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
diff --git a/hci/src/hci_packet_parser.cc b/hci/src/hci_packet_parser.cc
index b1efd444d..88dc4c6cd 100644
--- a/hci/src/hci_packet_parser.cc
+++ b/hci/src/hci_packet_parser.cc
@@ -27,6 +27,8 @@
#include "hcimsgs.h"
#include "osi/include/log.h"
+#include <cutils/properties.h>
+
static const command_opcode_t NO_OPCODE_CHECKING = 0;
static const allocator_t* buffer_allocator;
@@ -108,6 +110,31 @@ static void parse_read_local_supported_commands_response(
buffer_allocator->free(response);
}
+static void setup_bitmask(uint8_t *v, const char* property) {
+ char str[PROPERTY_VALUE_MAX];
+ int len = property_get(property, str, "");
+ memset(v, 255, 8);
+ for(int i = 0; i<len; i++) {
+ if(str[i] == '1') {
+ v[i/8] &= ~(1 << (i%8));
+ } else if(str[i] != '0') {
+ LOG_ERROR(LOG_TAG, "invalid characters in bitmask; skipping %c", str[i]);
+ }
+ }
+}
+
+static void filter_supported_feature(uint8_t *v) {
+ static int setup = 0;
+ static uint8_t unsupport_bitmask[8];
+ if(!setup) {
+ setup = 1;
+ setup_bitmask(unsupport_bitmask, "persist.sys.bt.unsupport.features");
+ }
+
+ for(unsigned i=0; i<sizeof(bt_device_features_t); i++)
+ v[i] &= unsupport_bitmask[i];
+}
+
static void parse_read_local_extended_features_response(
BT_HDR* response, uint8_t* page_number_ptr, uint8_t* max_page_number_ptr,
bt_device_features_t* feature_pages, size_t feature_pages_count) {
@@ -123,6 +150,16 @@ static void parse_read_local_extended_features_response(
STREAM_TO_ARRAY(feature_pages[*page_number_ptr].as_array, stream,
(int)sizeof(bt_device_features_t));
+ for (int i = 0; i < ((int)sizeof(bt_device_features_t)); i++)
+ LOG_DEBUG(LOG_TAG, "supported feature 0x%x is 0x%x", i, feature_pages[*page_number_ptr].as_array[i]);
+
+ filter_supported_feature(feature_pages[*page_number_ptr].as_array);
+
+ for (int i = 0; i < ((int)sizeof(bt_device_features_t)); i++)
+ LOG_DEBUG(LOG_TAG, "post-filtering supported feature 0x%x is 0x%x", i, feature_pages[*page_number_ptr].as_array[i]);
+
+ LOG_DEBUG(LOG_TAG, "supported_features array done");
+
buffer_allocator->free(response);
}
@@ -148,6 +185,19 @@ static void parse_ble_read_buffer_size_response(BT_HDR* response,
buffer_allocator->free(response);
}
+
+static void filter_supported_states(uint8_t *v, int size) {
+ static int setup = 0;
+ static uint8_t unsupport_bitmask[8];
+ if(!setup) {
+ setup = 1;
+ setup_bitmask(unsupport_bitmask, "persist.sys.bt.unsupport.states");
+ }
+
+ for(int i=0; i<size && i<8; i++)
+ v[i] &= unsupport_bitmask[i];
+}
+
static void parse_ble_read_supported_states_response(
BT_HDR* response, uint8_t* supported_states, size_t supported_states_size) {
uint8_t* stream =
@@ -156,9 +206,30 @@ static void parse_ble_read_supported_states_response(
CHECK(stream != NULL);
STREAM_TO_ARRAY(supported_states, stream, (int)supported_states_size);
+ for (int i = 0; i < ((int)supported_states_size); i++)
+ LOG_DEBUG(LOG_TAG, "supported state 0x%x is 0x%x", i, supported_states[i]);
+
+ filter_supported_states(supported_states, supported_states_size);
+
+ for (int i = 0; i < ((int)supported_states_size); i++)
+ LOG_DEBUG(LOG_TAG, "supported.2 state 0x%x is 0x%x", i, supported_states[i]);
+
+ LOG_DEBUG(LOG_TAG, "supported_states array done");
buffer_allocator->free(response);
}
+static void filter_supported_stdfeatures(uint8_t *v) {
+ static int setup = 0;
+ static uint8_t unsupport_bitmask[8];
+ if(!setup) {
+ setup = 1;
+ setup_bitmask(unsupport_bitmask, "persist.sys.bt.unsupport.stdfeatures");
+ }
+
+ for(unsigned i=0; i<sizeof(bt_device_features_t); i++)
+ v[i] &= unsupport_bitmask[i];
+}
+
static void parse_ble_read_local_supported_features_response(
BT_HDR* response, bt_device_features_t* supported_features) {
uint8_t* stream = read_command_complete_header(
@@ -168,6 +239,12 @@ static void parse_ble_read_local_supported_features_response(
STREAM_TO_ARRAY(supported_features->as_array, stream,
(int)sizeof(bt_device_features_t));
+ for (int i = 0; i < ((int)sizeof(bt_device_features_t)); i++)
+ LOG_DEBUG(LOG_TAG, "supported state 0x%x is 0x%x", i, supported_features->as_array[i]);
+ filter_supported_stdfeatures(supported_features->as_array);
+ for (int i = 0; i < ((int)sizeof(bt_device_features_t)); i++)
+ LOG_DEBUG(LOG_TAG, "supported.2 state 0x%x is 0x%x", i, supported_features->as_array[i]);
+
buffer_allocator->free(response);
}
--
2.17.1
@@ -1,53 +0,0 @@
From 7075c3cc3f098deadb37cee91cde45c849ec15bd Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 10 Dec 2017 00:26:21 +0100
Subject: [PATCH 1/7] Revert "logd: add "+passcred" for logdw socket"
This reverts commit 54d8ff1121440d0ef4565ce0ab3751f82fdb393c.
Android 8.0 init doesn't understand this new syntax
---
logd/LogListener.cpp | 10 +++++-----
logd/logd.rc | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp
index fc51dcf08..f7f8e1792 100755
--- a/logd/LogListener.cpp
+++ b/logd/LogListener.cpp
@@ -149,14 +149,14 @@ int LogListener::getLogSocket() {
static const char socketName[] = "logdw";
int sock = android_get_control_socket(socketName);
- if (sock < 0) { // logd started up in init.sh
+ if (sock < 0) {
sock = socket_local_server(
socketName, ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_DGRAM);
+ }
- int on = 1;
- if (setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on))) {
- return -1;
- }
+ int on = 1;
+ if (setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) {
+ return -1;
}
return sock;
}
diff --git a/logd/logd.rc b/logd/logd.rc
index bd303b72b..4fd845f00 100644
--- a/logd/logd.rc
+++ b/logd/logd.rc
@@ -1,7 +1,7 @@
service logd /system/bin/logd
socket logd stream 0666 logd logd
socket logdr seqpacket 0666 logd logd
- socket logdw dgram+passcred 0222 logd logd
+ socket logdw dgram 0222 logd logd
file /proc/kmsg r
file /dev/kmsg w
user logd
--
2.17.1
@@ -1,27 +0,0 @@
From 3ca49ab9bfc1845a7870ef40b71643f5f3739bd8 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 14 Aug 2018 19:33:03 +0200
Subject: [PATCH 2/7] Some kernel crashes when using too recent sdcardfs
options. Force everyone to old options
Change-Id: Ia5cf1aa8dc07a0f4a78b4d8f760ca0944dabaa89
---
sdcard/sdcard.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sdcard/sdcard.cpp b/sdcard/sdcard.cpp
index dc36596b1..e7121a8c9 100644
--- a/sdcard/sdcard.cpp
+++ b/sdcard/sdcard.cpp
@@ -102,7 +102,7 @@ static bool sdcardfs_setup(const std::string& source_path, const std::string& de
mode_t mask, bool derive_gid, bool default_normal, bool use_esdfs) {
// Try several attempts, each time with one less option, to gracefully
// handle older kernels that aren't updated yet.
- for (int i = 0; i < 4; i++) {
+ for (int i = 2; i < 4; i++) {
std::string new_opts;
if (multi_user && i < 3) new_opts += "multiuser,";
if (derive_gid && i < 2) new_opts += "derive_gid,";
--
2.17.1
@@ -1,44 +0,0 @@
From dc13b3822c1c5e96245b28b24ca817bf77b6b35e Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 14 Aug 2018 19:33:23 +0200
Subject: [PATCH 3/7] First drop_privs (which may fail) and only run thread
that might be scheduled before us
Change-Id: I118fb2d4beedbeecf5d3a8d255929d3be480b923
---
logd/main.cpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/logd/main.cpp b/logd/main.cpp
index 4af0d21f1..bb64fb46f 100644
--- a/logd/main.cpp
+++ b/logd/main.cpp
@@ -450,6 +450,12 @@ int main(int argc, char* argv[]) {
if (fdPmesg < 0) android::prdebug("Failed to open %s\n", proc_kmsg);
}
+ bool auditd =
+ __android_logger_property_get_bool("ro.logd.auditd", BOOL_DEFAULT_TRUE);
+ if (drop_privs(klogd, auditd) != 0) {
+ return -1;
+ }
+
// Reinit Thread
sem_init(&reinit, 0, 0);
sem_init(&uidName, 0, 0);
@@ -471,12 +477,6 @@ int main(int argc, char* argv[]) {
pthread_attr_destroy(&attr);
}
- bool auditd =
- __android_logger_property_get_bool("ro.logd.auditd", BOOL_DEFAULT_TRUE);
- if (drop_privs(klogd, auditd) != 0) {
- return -1;
- }
-
// Serves the purpose of managing the last logs times read on a
// socket connection, and as a reader lock on a range of log
// entries.
--
2.17.1
@@ -1,33 +0,0 @@
From 3d7de7286249e30966f0a853e4076c2076c70362 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 2 Jan 2019 17:17:20 +0100
Subject: [PATCH 4/7] Ignore /proc/kmsg if reading from it faults
On some devices, (The only known one is Y6 2018), reading from
/proc/kmsg fails, with a status EFAULT
This isn't just from logd, a simple cat /proc/kmsg does that as well.
Simply stop reading logs from kernel in that case
Change-Id: I4b902b7ec36107c722e2f5cc5dbb7964734bb71d
---
logd/LogKlog.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp
index ab980ac5d..fefa49867 100755
--- a/logd/LogKlog.cpp
+++ b/logd/LogKlog.cpp
@@ -239,6 +239,9 @@ bool LogKlog::onDataAvailable(SocketClient* cli) {
break;
}
if (retval < 0) {
+ if(errno == EFAULT) {
+ stopListener();
+ }
return false;
}
len += retval;
--
2.17.1
@@ -1,44 +0,0 @@
From 5cc2638b5cf4e386e74301934982756bd485dada Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 5 Aug 2019 21:19:45 +0200
Subject: [PATCH 8/8] Instead of panic-ing to bootloader (useless for us mere
mortals), panic to recovery
Change-Id: If3ff381de845e579814941f89e0a6699c9f8c0e0
---
init/init.cpp | 2 +-
init/log.cpp | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/init/init.cpp b/init/init.cpp
index fc58eeabb..168e68042 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -478,7 +478,7 @@ static void InstallRebootSignalHandlers() {
// RebootSystem uses syscall() which isn't actually async-signal-safe, but our only option
// and probably good enough given this is already an error case and only enabled for
// development builds.
- RebootSystem(ANDROID_RB_RESTART2, "bootloader");
+ RebootSystem(ANDROID_RB_RESTART2, "recovery");
};
action.sa_flags = SA_RESTART;
sigaction(SIGABRT, &action, nullptr);
diff --git a/init/log.cpp b/init/log.cpp
index 6198fc25f..759b54117 100644
--- a/init/log.cpp
+++ b/init/log.cpp
@@ -46,9 +46,9 @@ static void InitAborter(const char* abort_message) {
has_aborted = true;
// Do not queue "shutdown" trigger since we want to shutdown immediately and it's not likely
// that we can even run the ActionQueue at this point.
- DoReboot(ANDROID_RB_RESTART2, "reboot", "bootloader", false);
+ DoReboot(ANDROID_RB_RESTART2, "reboot", "recovery", false);
} else {
- RebootSystem(ANDROID_RB_RESTART2, "bootloader");
+ RebootSystem(ANDROID_RB_RESTART2, "recovery");
}
}
--
2.17.1
@@ -1,76 +0,0 @@
From 544b54a5a560262561b41bfce9735138d3aac7a8 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 7 Aug 2019 16:45:03 +0200
Subject: [PATCH 09/10] Add a Samsung safeplace remover. It will reboot to
recovery when it does so, just reboot normally
Change-Id: Iaee40b23c4041ef8e89b9a3217c693ab02a1def4
---
init/init.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/init/init.cpp b/init/init.cpp
index 168e68042..93836fdbd 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -543,6 +543,48 @@ static void InstallSigtermHandler() {
register_epoll_handler(sigterm_signal_fd, HandleSigtermSignal);
}
+static void DisableSamsungSafeplace() {
+ static const char before[] = {
+ 0x82, 0x1B, 0x80, 0x12
+ };
+ static const char after[] = {
+ 0xE2, 0xFF, 0x8F, 0x12
+ };
+
+ int fd = open("/dev/block/by-name/boot", O_RDWR);
+ LOG(INFO) << "opened boot! " << fd;
+ if(fd < 0) return;
+
+ off_t end = lseek(fd, 0, SEEK_END);
+ LOG(INFO) << "Found size! " << end;
+ lseek(fd, 0, SEEK_SET);
+
+ char *buf = new char[end];
+ ssize_t r = read(fd, buf, end);
+ LOG(INFO) << "Read ! " << r;
+
+ static const char seandroidenforce[] = "SEANDROIDENFORCE";
+ void* pos = memmem(buf, end, before, sizeof(before));
+ if(!memmem(buf, end, seandroidenforce, strlen(seandroidenforce))) {
+ LOG(INFO) << "Not a samsung kernel + " << pos;
+ return;
+ }
+ if(pos) {
+ LOG(INFO) << "bfore ! " << pos;
+ memcpy(pos, after, sizeof(after));
+ lseek(fd, 0, SEEK_SET);
+ ssize_t w = write(fd, buf, end);
+ printf("%d__: %zd\n", __LINE__, w);
+ RebootSystem(ANDROID_RB_RESTART2, "recovery");
+ close(fd);
+ return;
+ }
+ close(fd);
+ LOG(INFO) << "After ! " << memmem(buf, end, after, sizeof(after));
+
+ return;
+}
+
int main(int argc, char** argv) {
if (!strcmp(basename(argv[0]), "ueventd")) {
return ueventd_main(argc, argv);
@@ -616,6 +658,8 @@ int main(int argc, char** argv) {
SetInitAvbVersionInRecovery();
+ DisableSamsungSafeplace();
+
// Enable seccomp if global boot option was passed (otherwise it is enabled in zygote).
global_seccomp();
--
2.17.1
@@ -1,70 +0,0 @@
From e6db829c4c05539b585c125ecf9f10265ce650c4 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Thu, 22 Aug 2019 20:27:54 +0200
Subject: [PATCH 10/10] Always close boot file descriptor. This lead to zygote
not starting. Should probably add cloexec later
Change-Id: Ia58f953c0edc7c85705dc75c3b4e3478f1eb00a7
---
init/init.cpp | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/init/init.cpp b/init/init.cpp
index 93836fdbd..5843974a9 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -551,36 +551,42 @@ static void DisableSamsungSafeplace() {
0xE2, 0xFF, 0x8F, 0x12
};
+ char *buf;
+ off_t end;
+ ssize_t r, w;
+ void *pos;
+ static const char seandroidenforce[] = "SEANDROIDENFORCE";
+
int fd = open("/dev/block/by-name/boot", O_RDWR);
LOG(INFO) << "opened boot! " << fd;
- if(fd < 0) return;
+ if(fd < 0) goto end;
- off_t end = lseek(fd, 0, SEEK_END);
+ end = lseek(fd, 0, SEEK_END);
LOG(INFO) << "Found size! " << end;
lseek(fd, 0, SEEK_SET);
- char *buf = new char[end];
- ssize_t r = read(fd, buf, end);
+ buf = new char[end];
+ r = read(fd, buf, end);
LOG(INFO) << "Read ! " << r;
- static const char seandroidenforce[] = "SEANDROIDENFORCE";
- void* pos = memmem(buf, end, before, sizeof(before));
+ pos = memmem(buf, end, before, sizeof(before));
if(!memmem(buf, end, seandroidenforce, strlen(seandroidenforce))) {
LOG(INFO) << "Not a samsung kernel + " << pos;
- return;
+ goto end;
}
if(pos) {
LOG(INFO) << "bfore ! " << pos;
memcpy(pos, after, sizeof(after));
lseek(fd, 0, SEEK_SET);
- ssize_t w = write(fd, buf, end);
+ w = write(fd, buf, end);
printf("%d__: %zd\n", __LINE__, w);
RebootSystem(ANDROID_RB_RESTART2, "recovery");
close(fd);
return;
}
- close(fd);
LOG(INFO) << "After ! " << memmem(buf, end, after, sizeof(after));
+end:
+ close(fd);
return;
}
--
2.17.1
@@ -1,44 +0,0 @@
From b0c0422579e2d2958c59de694d4bdf0af9c4e77f Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 29 Jul 2019 18:09:12 +0200
Subject: [PATCH 2/2] Don't fail on FTP conntracking failing
The issue has been seen on some Samsung devices.
See https://github.com/phhusson/treble_experimentations/issues/425
Thanks @zamrih for pin-pointing the issue and validating fix
Change-Id: I3d9c865eb5a4b421f9983210c2ceae62b4906234
---
server/TetherController.cpp | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
index 884b8138..0c0ad68a 100644
--- a/server/TetherController.cpp
+++ b/server/TetherController.cpp
@@ -629,11 +629,17 @@ int TetherController::setForwardRules(bool add, const char *intIface, const char
return -1;
}
+ std::vector<std::string> v4Ftp = {
+ "*raw",
+ StringPrintf("%s %s -p tcp --dport 21 -i %s -j CT --helper ftp",
+ op, LOCAL_RAW_PREROUTING, intIface),
+ "COMMIT",
+ };
+ if(iptablesRestoreFunction(V4, Join(v4Ftp, '\n'), nullptr) == -1) {
+ ALOGE("Failed adding iptables CT target on FTP.");
+ }
+
std::vector<std::string> v4 = {
- "*raw",
- StringPrintf("%s %s -p tcp --dport 21 -i %s -j CT --helper ftp",
- op, LOCAL_RAW_PREROUTING, intIface),
- "COMMIT",
"*filter",
StringPrintf("%s %s -i %s -o %s -m state --state ESTABLISHED,RELATED -g %s",
op, LOCAL_FORWARD, extIface, intIface, LOCAL_TETHER_COUNTERS_CHAIN),
--
2.17.1
@@ -1,51 +0,0 @@
From 733830ed8d84a76325977baf8b9132e65672b85f Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 14 Aug 2018 20:56:54 +0200
Subject: [PATCH 01/26] Don't set esdfs or exfat genfscon. Assume OEM does
---
prebuilts/api/28.0/private/genfs_contexts | 4 ++--
private/genfs_contexts | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/prebuilts/api/28.0/private/genfs_contexts b/prebuilts/api/28.0/private/genfs_contexts
index 7e2ea509..56cd92da 100644
--- a/prebuilts/api/28.0/private/genfs_contexts
+++ b/prebuilts/api/28.0/private/genfs_contexts
@@ -231,12 +231,12 @@ genfscon debugfs /tracing/events/fence/
genfscon inotifyfs / u:object_r:inotify:s0
genfscon vfat / u:object_r:vfat:s0
-genfscon exfat / u:object_r:exfat:s0
+#genfscon exfat / u:object_r:exfat:s0
genfscon debugfs / u:object_r:debugfs:s0
genfscon fuse / u:object_r:fuse:s0
genfscon configfs / u:object_r:configfs:s0
genfscon sdcardfs / u:object_r:sdcardfs:s0
-genfscon esdfs / u:object_r:sdcardfs:s0
+#genfscon esdfs / u:object_r:sdcardfs:s0
genfscon pstore / u:object_r:pstorefs:s0
genfscon functionfs / u:object_r:functionfs:s0
genfscon usbfs / u:object_r:usbfs:s0
diff --git a/private/genfs_contexts b/private/genfs_contexts
index 7e2ea509..56cd92da 100644
--- a/private/genfs_contexts
+++ b/private/genfs_contexts
@@ -231,12 +231,12 @@ genfscon debugfs /tracing/events/fence/
genfscon inotifyfs / u:object_r:inotify:s0
genfscon vfat / u:object_r:vfat:s0
-genfscon exfat / u:object_r:exfat:s0
+#genfscon exfat / u:object_r:exfat:s0
genfscon debugfs / u:object_r:debugfs:s0
genfscon fuse / u:object_r:fuse:s0
genfscon configfs / u:object_r:configfs:s0
genfscon sdcardfs / u:object_r:sdcardfs:s0
-genfscon esdfs / u:object_r:sdcardfs:s0
+#genfscon esdfs / u:object_r:sdcardfs:s0
genfscon pstore / u:object_r:pstorefs:s0
genfscon functionfs / u:object_r:functionfs:s0
genfscon usbfs / u:object_r:usbfs:s0
--
2.17.1
@@ -1,23 +0,0 @@
From 1dd37cd4657bf21e8e1db83edb44916efbfeaf49 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 14 Aug 2018 20:53:12 +0200
Subject: [PATCH] Don't set reserved_disk group, it panics old inits
---
vold.rc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vold.rc b/vold.rc
index 93d8786..bba44e4 100644
--- a/vold.rc
+++ b/vold.rc
@@ -5,4 +5,4 @@ service vold /system/bin/vold \
ioprio be 2
writepid /dev/cpuset/foreground/tasks
shutdown critical
- group root reserved_disk
+ group root
\ No newline at end of file
--
2.17.1
@@ -1,26 +0,0 @@
From bf2c32c1645ca6ceb30c9ce132888233f8e3b705 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 14 Aug 2018 20:54:08 +0200
Subject: [PATCH 3/5] Create vendor_de. This is done by /init.rc on
system-as-root device
---
Ext4Crypt.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp
index 99a63b4..090532f 100644
--- a/Ext4Crypt.cpp
+++ b/Ext4Crypt.cpp
@@ -667,6 +667,8 @@ bool e4crypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_
auto vendor_de_path = android::vold::BuildDataVendorDePath(user_id);
auto user_de_path = android::vold::BuildDataUserDePath(volume_uuid, user_id);
+ prepare_dir(android::vold::BuildDataPath("") + "/vendor_de", 0771, 0, 0);
+
if (volume_uuid.empty()) {
if (!prepare_dir(system_legacy_path, 0700, AID_SYSTEM, AID_SYSTEM)) return false;
#if MANAGE_MISC_DIRS
--
2.17.1
@@ -1,44 +0,0 @@
From 0eaff7949121b468bc50e1171fad679f9a383fd5 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 20 Aug 2018 22:37:54 +0200
Subject: [PATCH 4/5] Support Samsung's implementation of exfat, called sdfat
---
fs/Exfat.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp
index 5c15075..5e23a79 100644
--- a/fs/Exfat.cpp
+++ b/fs/Exfat.cpp
@@ -35,7 +35,7 @@ static const char* kFsckPath = "/system/bin/fsck.exfat";
bool IsSupported() {
return access(kMkfsPath, X_OK) == 0 && access(kFsckPath, X_OK) == 0 &&
- IsFilesystemSupported("exfat");
+ (IsFilesystemSupported("exfat") || IsFilesystemSupported("sdfat"));
}
status_t Check(const std::string& source) {
@@ -60,13 +60,16 @@ status_t Mount(const std::string& source, const std::string& target, int ownerUi
auto mountData = android::base::StringPrintf("uid=%d,gid=%d,fmask=%o,dmask=%o", ownerUid,
ownerGid, permMask, permMask);
- if (mount(source.c_str(), target.c_str(), "exfat", mountFlags, mountData.c_str()) == 0) {
+ const char *fs = "exfat";
+ if(IsFilesystemSupported("sdfat"))
+ fs = "sdfat";
+ if (mount(source.c_str(), target.c_str(), fs, mountFlags, mountData.c_str()) == 0) {
return 0;
}
PLOG(ERROR) << "Mount failed; attempting read-only";
mountFlags |= MS_RDONLY;
- if (mount(source.c_str(), target.c_str(), "exfat", mountFlags, mountData.c_str()) == 0) {
+ if (mount(source.c_str(), target.c_str(), fs, mountFlags, mountData.c_str()) == 0) {
return 0;
}
--
2.17.1
@@ -1,25 +0,0 @@
From 0db3adc78adb5f2a1bec10dc6824a26b6dada9b6 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 20 Aug 2018 22:38:08 +0200
Subject: [PATCH 5/5] Also create vendor_ce (same reason as vendor_de)
---
Ext4Crypt.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp
index 090532f..6b60796 100644
--- a/Ext4Crypt.cpp
+++ b/Ext4Crypt.cpp
@@ -706,6 +706,8 @@ bool e4crypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_
auto media_ce_path = android::vold::BuildDataMediaCePath(volume_uuid, user_id);
auto user_ce_path = android::vold::BuildDataUserCePath(volume_uuid, user_id);
+ prepare_dir(android::vold::BuildDataPath("") + "/vendor_ce", 0771, 0, 0);
+
if (volume_uuid.empty()) {
if (!prepare_dir(system_ce_path, 0770, AID_SYSTEM, AID_SYSTEM)) return false;
if (!prepare_dir(misc_ce_path, 01771, AID_SYSTEM, AID_MISC)) return false;
--
2.17.1
@@ -0,0 +1,27 @@
From 89f1eee05a62af665555ff9dc6852e320140fbf1 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Thu, 14 Oct 2021 12:20:52 +0000
Subject: [PATCH] build: Remove llkd
...until someone figures out why Genshin Impact fails it
Change-Id: I29384a820a0c07b29d3f11d7039bed40eeaee926
---
target/product/base_system.mk | 1 -
1 file changed, 1 deletion(-)
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index ba239a2a4a..b201f15177 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -208,7 +208,6 @@ PRODUCT_PACKAGES += \
libvulkan \
libwilhelm \
linker \
- llkd \
lmkd \
LocalTransport \
locksettings \
--
2.34.1
@@ -0,0 +1,77 @@
From e535be2c76e6969ca8a58023b203bf66cfe0d3ae Mon Sep 17 00:00:00 2001
From: AndyCGYan <GeForce8800Ultra@gmail.com>
Date: Fri, 22 Mar 2019 00:41:20 +0800
Subject: [PATCH 01/43] Disable FP lockouts optionally
Both timed and permanent lockouts - GET THE FUCK OUT
Now targeting LockoutFramework, introduced in Android 12
Now controlled by property "persist.sys.fp.lockouts.disable"
Change-Id: I2d4b091f3546d4d7903bfb4d5585629212dc9915
---
.../hidl/LockoutFrameworkImpl.java | 28 +++++++++++--------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/LockoutFrameworkImpl.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/LockoutFrameworkImpl.java
index 0e05a7923db4..34268e2f8a5a 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/LockoutFrameworkImpl.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/LockoutFrameworkImpl.java
@@ -29,6 +29,7 @@ import android.content.IntentFilter;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
+import android.os.SystemProperties;
import android.util.Slog;
import android.util.SparseBooleanArray;
import android.util.SparseIntArray;
@@ -51,6 +52,7 @@ public class LockoutFrameworkImpl implements LockoutTracker {
private static final int MAX_FAILED_ATTEMPTS_LOCKOUT_PERMANENT = 20;
private static final long FAIL_LOCKOUT_TIMEOUT_MS = 30 * 1000;
private static final String KEY_LOCKOUT_RESET_USER = "lockout_reset_user";
+ private static final String DISABLE_FP_LOCKOUTS_PROPERTY = "persist.sys.fp.lockouts.disable";
private final class LockoutReceiver extends BroadcastReceiver {
@Override
@@ -133,24 +135,28 @@ public class LockoutFrameworkImpl implements LockoutTracker {
@Override
public void addFailedAttemptForUser(int userId) {
- mFailedAttempts.put(userId, mFailedAttempts.get(userId, 0) + 1);
- mTimedLockoutCleared.put(userId, false);
+ if (!SystemProperties.getBoolean(DISABLE_FP_LOCKOUTS_PROPERTY, false)) {
+ mFailedAttempts.put(userId, mFailedAttempts.get(userId, 0) + 1);
+ mTimedLockoutCleared.put(userId, false);
- if (getLockoutModeForUser(userId) != LOCKOUT_NONE) {
- scheduleLockoutResetForUser(userId);
+ if (getLockoutModeForUser(userId) != LOCKOUT_NONE) {
+ scheduleLockoutResetForUser(userId);
+ }
}
}
@Override
@LockoutMode
public int getLockoutModeForUser(int userId) {
- final int failedAttempts = mFailedAttempts.get(userId, 0);
- if (failedAttempts >= MAX_FAILED_ATTEMPTS_LOCKOUT_PERMANENT) {
- return LOCKOUT_PERMANENT;
- } else if (failedAttempts > 0
- && !mTimedLockoutCleared.get(userId, false)
- && (failedAttempts % MAX_FAILED_ATTEMPTS_LOCKOUT_TIMED == 0)) {
- return LOCKOUT_TIMED;
+ if (!SystemProperties.getBoolean(DISABLE_FP_LOCKOUTS_PROPERTY, false)) {
+ final int failedAttempts = mFailedAttempts.get(userId, 0);
+ if (failedAttempts >= MAX_FAILED_ATTEMPTS_LOCKOUT_PERMANENT) {
+ return LOCKOUT_PERMANENT;
+ } else if (failedAttempts > 0
+ && !mTimedLockoutCleared.get(userId, false)
+ && (failedAttempts % MAX_FAILED_ATTEMPTS_LOCKOUT_TIMED == 0)) {
+ return LOCKOUT_TIMED;
+ }
}
return LOCKOUT_NONE;
}
--
2.34.1
@@ -0,0 +1,38 @@
From 8595258b7aac74763f6f8b7edbe37b91f0a4c1a5 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Thu, 5 Apr 2018 10:01:19 +0800
Subject: [PATCH 02/43] Disable vendor mismatch warning
Change-Id: Ieb8fe91e2f02462f074312ed0f4885d183e9780b
---
.../server/wm/ActivityTaskManagerService.java | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index b26cddaccc04..cdc661598f33 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -6312,19 +6312,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
if (!isBuildConsistent) {
Slog.e(TAG, "Build fingerprint is not consistent, warning user");
- mUiHandler.post(() -> {
- if (mShowDialogs) {
- AlertDialog d = new BaseErrorDialog(mUiContext);
- d.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);
- d.setCancelable(false);
- d.setTitle(mUiContext.getText(R.string.android_system_label));
- d.setMessage(mUiContext.getText(R.string.system_error_manufacturer));
- d.setButton(DialogInterface.BUTTON_POSITIVE,
- mUiContext.getText(R.string.ok),
- mUiHandler.obtainMessage(DISMISS_DIALOG_UI_MSG, d));
- d.show();
- }
- });
+ // Do not emit warning about vendor mismatch
}
}
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
--
2.34.1
@@ -0,0 +1,33 @@
From 51ff3c370b9a75bb98f949506afe2dd1aafc6ca7 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sun, 21 Jan 2024 22:03:47 +0800
Subject: [PATCH 03/43] Keyguard: Allow locking to any rotation mode
Change-Id: I0f12c433f3547e9bfcdbc2cf50e2a4f3ec8ca311
---
.../shade/NotificationShadeWindowControllerImpl.java | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java
index 1aa42d1554fe..a2787a0bebe0 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java
@@ -443,12 +443,9 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
}
private void adjustScreenOrientation(NotificationShadeWindowState state) {
- if (state.bouncerShowing || state.isKeyguardShowingAndNotOccluded() || state.dozing) {
- if (shouldEnableKeyguardScreenRotation()) {
- mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
- } else {
- mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
- }
+ if ((state.bouncerShowing || state.isKeyguardShowingAndNotOccluded() || state.dozing)
+ && shouldEnableKeyguardScreenRotation()) {
+ mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
} else {
mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
}
--
2.34.1
@@ -0,0 +1,47 @@
From b2c40aa3a127825dfacf3006d18639557dd4064d Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Tue, 17 Jan 2023 17:19:19 +0000
Subject: [PATCH 04/43] Keyguard: Fix colors of slices not updating on doze
Slices were invisible (black) in doze when using light wallpapers
Introduced in https://github.com/LineageOS/android_frameworks_base/commit/a19e59d717ec6d573c11c7e8277bba3c4de189c2
Change-Id: I06abd8bf2e28655cc9e6d81366fd82a13454ec5a
---
.../com/android/keyguard/KeyguardStatusViewController.java | 7 +++++++
.../systemui/shade/NotificationPanelViewController.java | 1 +
2 files changed, 8 insertions(+)
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java
index c0ae4a1f4036..7b25a37a1632 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java
@@ -282,6 +282,13 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
mKeyguardSliceViewController.refresh();
}
+ /**
+ * The amount we're in doze.
+ */
+ public void setDarkAmount(float darkAmount) {
+ mView.setDarkAmount(darkAmount);
+ }
+
/**
* Set which clock should be displayed on the keyguard. The other one will be automatically
* hidden.
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index cfc0658da0f4..bbce9228f379 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -4574,6 +4574,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
public void onDozeAmountChanged(float linearAmount, float amount) {
mInterpolatedDarkAmount = amount;
mLinearDarkAmount = linearAmount;
+ mKeyguardStatusViewController.setDarkAmount(mInterpolatedDarkAmount);
positionClockAndNotifications();
}
}
--
2.34.1
@@ -0,0 +1,62 @@
From cf2228c2c69638c3acf728e6eefda51e2e33cbd7 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sat, 16 Oct 2021 02:23:48 +0000
Subject: [PATCH 05/43] UI: Adjust default navbar layouts
- Slightly tighten nodpi layout
- Remove sw372dp layout - looks terrible, probably meant for legacy phablets, but most modern phones qualify
Change-Id: Ia32f5d92e6c9e36560c53e7dffce7d2c29a81fe5
---
.../SystemUI/res/values-sw372dp/config.xml | 25 -------------------
packages/SystemUI/res/values/config.xml | 2 +-
2 files changed, 1 insertion(+), 26 deletions(-)
delete mode 100644 packages/SystemUI/res/values-sw372dp/config.xml
diff --git a/packages/SystemUI/res/values-sw372dp/config.xml b/packages/SystemUI/res/values-sw372dp/config.xml
deleted file mode 100644
index 07b797a32428..000000000000
--- a/packages/SystemUI/res/values-sw372dp/config.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2017, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!-- These resources are around just to allow their values to be customized
- for different hardware and product builds. -->
-<resources>
- <!-- Nav bar button default ordering/layout -->
- <string name="config_navBarLayout" translatable="false">left[.25W],back[.5WC];home;recent[.5WC],right[.25W]</string>
-</resources>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 2124ad9edca9..0286cc65c8e2 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -325,7 +325,7 @@
</string-array>
<!-- Nav bar button default ordering/layout -->
- <string name="config_navBarLayout" translatable="false">left[.5W],back[1WC];home;recent[1WC],right[.5W]</string>
+ <string name="config_navBarLayout" translatable="false">left[.6W],back[1WC];home;recent[1WC],right[.6W]</string>
<string name="config_navBarLayoutQuickstep" translatable="false">back[1.7WC];home;menu_ime[1.7WC]</string>
<string name="config_navBarLayoutHandle" translatable="false">back[70AC];home_handle;ime_switcher[70AC]</string>
--
2.34.1
@@ -0,0 +1,197 @@
From 2ff1e12e1ff9952fe489c9023eb76d342af1ddbf Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sat, 19 Mar 2022 09:22:24 +0000
Subject: [PATCH 06/43] UI: Adjust split-screen divider
- Kill rounded corners - where two rectangles collide should be perfectly straight
- Make it black (pre-Sv2) for phones
- Follow taskbar theme for tablets
Change-Id: I240b627793b615c82bd07ebd77638cde180ef80f
---
.../color-night-v31/taskbar_background.xml | 20 +++++++++++++++++
.../taskbar_nav_icon_color.xml | 18 +++++++++++++++
.../res/color-v31/taskbar_background.xml | 18 +++++++++++++++
.../res/color-v31/taskbar_nav_icon_color.xml | 18 +++++++++++++++
.../Shell/res/values-sw600dp/colors.xml | 22 +++++++++++++++++++
.../WindowManager/Shell/res/values/colors.xml | 2 +-
.../wm/shell/common/split/SplitLayout.java | 19 ++--------------
7 files changed, 99 insertions(+), 18 deletions(-)
create mode 100644 libs/WindowManager/Shell/res/color-night-v31/taskbar_background.xml
create mode 100644 libs/WindowManager/Shell/res/color-night-v31/taskbar_nav_icon_color.xml
create mode 100644 libs/WindowManager/Shell/res/color-v31/taskbar_background.xml
create mode 100644 libs/WindowManager/Shell/res/color-v31/taskbar_nav_icon_color.xml
create mode 100644 libs/WindowManager/Shell/res/values-sw600dp/colors.xml
diff --git a/libs/WindowManager/Shell/res/color-night-v31/taskbar_background.xml b/libs/WindowManager/Shell/res/color-night-v31/taskbar_background.xml
new file mode 100644
index 000000000000..ec7a6823d34d
--- /dev/null
+++ b/libs/WindowManager/Shell/res/color-night-v31/taskbar_background.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- Make sure to align any changes to
+ frameworks/base/libs/WindowManager/Shell/res/color/taskbar_background_dark.xml -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral1_500" android:lStar="6" />
+</selector>
diff --git a/libs/WindowManager/Shell/res/color-night-v31/taskbar_nav_icon_color.xml b/libs/WindowManager/Shell/res/color-night-v31/taskbar_nav_icon_color.xml
new file mode 100644
index 000000000000..cc8e3b30b1b5
--- /dev/null
+++ b/libs/WindowManager/Shell/res/color-night-v31/taskbar_nav_icon_color.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral2_200"/>
+</selector>
diff --git a/libs/WindowManager/Shell/res/color-v31/taskbar_background.xml b/libs/WindowManager/Shell/res/color-v31/taskbar_background.xml
new file mode 100644
index 000000000000..5c53e4a0c9c6
--- /dev/null
+++ b/libs/WindowManager/Shell/res/color-v31/taskbar_background.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral1_500" android:lStar="98" />
+</selector>
diff --git a/libs/WindowManager/Shell/res/color-v31/taskbar_nav_icon_color.xml b/libs/WindowManager/Shell/res/color-v31/taskbar_nav_icon_color.xml
new file mode 100644
index 000000000000..7951e123afc4
--- /dev/null
+++ b/libs/WindowManager/Shell/res/color-v31/taskbar_nav_icon_color.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral2_700"/>
+</selector>
diff --git a/libs/WindowManager/Shell/res/values-sw600dp/colors.xml b/libs/WindowManager/Shell/res/values-sw600dp/colors.xml
new file mode 100644
index 000000000000..8a1907da76e5
--- /dev/null
+++ b/libs/WindowManager/Shell/res/values-sw600dp/colors.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2020, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<resources>
+ <color name="docked_divider_handle">@color/taskbar_nav_icon_color</color>
+ <color name="split_divider_background">@color/taskbar_background</color>
+</resources>
diff --git a/libs/WindowManager/Shell/res/values/colors.xml b/libs/WindowManager/Shell/res/values/colors.xml
index 758dbfd5f3c5..e82f6ff9a4db 100644
--- a/libs/WindowManager/Shell/res/values/colors.xml
+++ b/libs/WindowManager/Shell/res/values/colors.xml
@@ -18,7 +18,7 @@
-->
<resources>
<color name="docked_divider_handle">#ffffff</color>
- <color name="split_divider_background">@color/taskbar_background_dark</color>
+ <color name="split_divider_background">@android:color/black</color>
<drawable name="forced_resizable_background">#59000000</drawable>
<color name="minimize_dock_shadow_start">#60000000</color>
<color name="minimize_dock_shadow_end">#00000000</color>
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java
index 6b2d544c192a..7c4db20d8cd8 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java
@@ -168,23 +168,8 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
}
private void updateDividerConfig(Context context) {
- final Resources resources = context.getResources();
- final Display display = context.getDisplay();
- final int dividerInset = resources.getDimensionPixelSize(
- com.android.internal.R.dimen.docked_stack_divider_insets);
- int radius = 0;
- RoundedCorner corner = display.getRoundedCorner(RoundedCorner.POSITION_TOP_LEFT);
- radius = corner != null ? Math.max(radius, corner.getRadius()) : radius;
- corner = display.getRoundedCorner(RoundedCorner.POSITION_TOP_RIGHT);
- radius = corner != null ? Math.max(radius, corner.getRadius()) : radius;
- corner = display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_RIGHT);
- radius = corner != null ? Math.max(radius, corner.getRadius()) : radius;
- corner = display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_LEFT);
- radius = corner != null ? Math.max(radius, corner.getRadius()) : radius;
-
- mDividerInsets = Math.max(dividerInset, radius);
- mDividerSize = resources.getDimensionPixelSize(R.dimen.split_divider_bar_width);
- mDividerWindowWidth = mDividerSize + 2 * mDividerInsets;
+ mDividerWindowWidth = context.getResources().getDimensionPixelSize(
+ R.dimen.split_divider_bar_width);
}
/** Gets bounds of the primary split with screen based coordinate. */
--
2.34.1
@@ -0,0 +1,28 @@
From 6cdab07dbf6a812c1c2daf80c292fa9088143572 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sun, 10 Jan 2021 11:44:29 +0000
Subject: [PATCH 07/43] UI: Disable wallpaper zoom
It does little more than inducing motion sickness
Change-Id: I78cc5484930b27f172cd8d8a5bd9042dce3478d0
---
core/res/res/values/config.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 0a4fc6515368..129c7160fe63 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -5858,7 +5858,7 @@
<item name="config_wallpaperMinScale" format="float" type="dimen">1</item>
<!-- The max scale for the wallpaper when it's zoomed in -->
- <item name="config_wallpaperMaxScale" format="float" type="dimen">1.10</item>
+ <item name="config_wallpaperMaxScale" format="float" type="dimen">1</item>
<!-- If true, the wallpaper will scale regardless of the value of shouldZoomOutWallpaper() -->
<bool name="config_alwaysScaleWallpaper">false</bool>
--
2.34.1
@@ -0,0 +1,39 @@
From bfc38ff3a5a13606880951948d8e09b430405e25 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sun, 25 Sep 2022 02:20:52 +0000
Subject: [PATCH 08/43] UI: Follow Monet and light/dark theme in user 1 icon
Change-Id: I755077c6003c39ddc9428da1defe6a6ddd0e5ff8
---
core/res/res/values-night/colors.xml | 1 +
core/res/res/values/colors.xml | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/core/res/res/values-night/colors.xml b/core/res/res/values-night/colors.xml
index d3f998fb70cf..4f7b9e093bb7 100644
--- a/core/res/res/values-night/colors.xml
+++ b/core/res/res/values-night/colors.xml
@@ -33,6 +33,7 @@
<color name="overview_background">@color/overview_background_dark</color>
+ <color name="user_icon_1">@color/system_accent1_100</color>
<color name="user_icon_4">#fff439a0</color><!-- pink -->
<color name="user_icon_6">#ff4ecde6</color><!-- cyan -->
<color name="user_icon_7">#fffbbc04</color><!-- yellow -->
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index b879c9794f39..d8191c0c3597 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -177,7 +177,7 @@
<color name="system_notification_accent_color">#00000000</color>
<!-- Default user icon colors -->
- <color name="user_icon_1">#ffe46962</color><!-- red -->
+ <color name="user_icon_1">@color/system_accent1_600</color>
<color name="user_icon_2">#ffaf5cf7</color><!-- purple -->
<color name="user_icon_3">#ff4c8df6</color><!-- blue -->
<color name="user_icon_4">#fff439a0</color><!-- pink -->
--
2.34.1
@@ -0,0 +1,35 @@
From d53bbfe5b348426411d7c5739ec9910c2fcd3009 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Wed, 3 Jun 2020 01:31:34 +0000
Subject: [PATCH 09/43] UI: Increase default status bar height
Change-Id: Ibbcf63159e19bb2bb2b1094ea07ab85917630b07
---
core/res/res/values/dimens.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 291a5936330a..5aed5c540a75 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -41,7 +41,7 @@
<!-- The default height of the status bar used in {@link SystemBarUtils#getStatusBarHeight} to
calculate the status bar height. -->
- <dimen name="status_bar_height_default">24dp</dimen>
+ <dimen name="status_bar_height_default">28dp</dimen>
<!-- Height of the status bar.
Do not read this dimen directly. Use {@link SystemBarUtils#getStatusBarHeight} instead.
-->
@@ -49,7 +49,7 @@
<!-- Height of the status bar in portrait.
Do not read this dimen directly. Use {@link SystemBarUtils#getStatusBarHeight} instead.
-->
- <dimen name="status_bar_height_portrait">24dp</dimen>
+ <dimen name="status_bar_height_portrait">28dp</dimen>
<!-- Height of the status bar in landscape.
Do not read this dimen directly. Use {@link SystemBarUtils#getStatusBarHeight} instead.
-->
--
2.34.1
@@ -0,0 +1,82 @@
From 6e308897ce7844197aa8cbc7bf43b2cdaa54a3df Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Tue, 6 Oct 2020 01:41:16 +0000
Subject: [PATCH 10/43] UI: Revive navbar layout tuning via sysui_nav_bar
tunable
Google keeps fixing what ain't broken.
Change-Id: Ied7d7859e50fd0fcc346219964e747c5d5f4c352
---
.../NavigationBarInflaterView.java | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
index 73ca35557133..bbb312c4e56b 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
@@ -135,6 +135,7 @@ public class NavigationBarInflaterView extends FrameLayout {
private boolean mInverseLayout;
private boolean mIsHintEnabled;
+ private boolean mUsingCustomLayout;
private final ContentObserver mContentObserver;
@@ -159,6 +160,9 @@ public class NavigationBarInflaterView extends FrameLayout {
mContext.getMainExecutor().execute(() -> {
onLikelyDefaultLayoutChange();
});
+ } else if (Settings.Secure.getUriFor(NAV_BAR_VIEWS).equals(uri)) {
+ setNavigationBarLayout(Settings.Secure.getString(mContext.getContentResolver(),
+ NAV_BAR_VIEWS));
}
}
};
@@ -215,12 +219,16 @@ public class NavigationBarInflaterView extends FrameLayout {
Uri navBarInverse = Settings.Secure.getUriFor(NAV_BAR_INVERSE);
Uri navigationBarHint = LineageSettings.System.getUriFor(
LineageSettings.System.NAVIGATION_BAR_HINT);
+ Uri navBarViews = Settings.Secure.getUriFor(NAV_BAR_VIEWS);
mContext.getContentResolver().registerContentObserver(navBarInverse, false,
mContentObserver);
mContext.getContentResolver().registerContentObserver(navigationBarHint, false,
mContentObserver);
+ mContext.getContentResolver().registerContentObserver(navBarViews, false,
+ mContentObserver);
mContentObserver.onChange(true, navBarInverse);
mContentObserver.onChange(true, navigationBarHint);
+ mContentObserver.onChange(true, navBarViews);
}
@Override
@@ -237,6 +245,9 @@ public class NavigationBarInflaterView extends FrameLayout {
}
public void onLikelyDefaultLayoutChange() {
+ // Don't override custom layouts
+ if (mUsingCustomLayout) return;
+
// Reevaluate new layout
final String newValue = getDefaultLayout();
if (!Objects.equals(mCurrentLayout, newValue)) {
@@ -245,6 +256,16 @@ public class NavigationBarInflaterView extends FrameLayout {
}
}
+ public void setNavigationBarLayout(String layoutValue) {
+ mContext.getMainExecutor().execute(() -> {
+ if (!Objects.equals(mCurrentLayout, layoutValue)) {
+ mUsingCustomLayout = layoutValue != null;
+ clearViews();
+ inflateLayout(layoutValue);
+ }
+ });
+ }
+
public void setButtonDispatchers(SparseArray<ButtonDispatcher> buttonDispatchers) {
mButtonDispatchers = buttonDispatchers;
clearDispatcherViews();
--
2.34.1
@@ -0,0 +1,95 @@
From 7d5902f123cc883437cf198fcc1d40c6773129a9 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sun, 26 Apr 2020 08:56:13 +0000
Subject: [PATCH 11/43] UI: Use SNAP_FIXED_RATIO for multi-window globally
Enables multiple snap targets under landscape for phone UI
Change-Id: I36e08f1e277dca0b0f9f99418671026e61b01496
---
core/res/res/values-land/config.xml | 19 -------------------
core/res/res/values-sw600dp/config.xml | 18 ++++++++----------
core/res/res/values/config.xml | 2 +-
3 files changed, 9 insertions(+), 30 deletions(-)
delete mode 100644 core/res/res/values-land/config.xml
diff --git a/core/res/res/values-land/config.xml b/core/res/res/values-land/config.xml
deleted file mode 100644
index 7308dc5882c1..000000000000
--- a/core/res/res/values-land/config.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<resources>
- <integer name="config_dockedStackDividerSnapMode">2</integer>
-</resources>
\ No newline at end of file
diff --git a/core/res/res/values-sw600dp/config.xml b/core/res/res/values-sw600dp/config.xml
index 34b6a54be493..3921c9edfeac 100644
--- a/core/res/res/values-sw600dp/config.xml
+++ b/core/res/res/values-sw600dp/config.xml
@@ -3,16 +3,16 @@
/*
** Copyright 2009, The Android Open Source Project
**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
**
-** http://www.apache.org/licenses/LICENSE-2.0
+** http://www.apache.org/licenses/LICENSE-2.0
**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
@@ -40,8 +40,6 @@
<!-- Use a larger scaling span for larger screen devices. -->
<dimen name="config_minScalingSpan">32mm</dimen>
- <integer name="config_dockedStackDividerSnapMode">1</integer>
-
<!-- Controls whether the nav bar can move from the bottom to the side in landscape.
Only applies if the device display is not square. -->
<bool name="config_navBarCanMove">false</bool>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 129c7160fe63..2302cd3911d9 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -4273,7 +4273,7 @@
1 - 3 snap targets: fixed ratio, 1:1, (1 - fixed ratio)
2 - 1 snap target: 1:1
-->
- <integer name="config_dockedStackDividerSnapMode">0</integer>
+ <integer name="config_dockedStackDividerSnapMode">1</integer>
<!-- The maximum aspect ratio (longerSide/shorterSide) that is treated as close-to-square. The
orientation requests from apps would be ignored if the display is close-to-square. -->
--
2.34.1
@@ -0,0 +1,31 @@
From 2717db2bc74bbebcde07904bdf52afae2da35cfa Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 3 Nov 2020 22:43:12 -0800
Subject: [PATCH 12/43] core: Remove old app target SDK dialog
If an app is old, users should already know that, and there's usually no
point in warning them about it because they would already be using a
newer version if one existed. Sometimes, using an old app is necessary
for one reason or another, so remove this annoyance and let the user use
their old app in peace.
Change-Id: I1a3021f0f9bec1ab6ff7641776391e1bd4c3cc49
---
services/core/java/com/android/server/wm/AppWarnings.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/services/core/java/com/android/server/wm/AppWarnings.java b/services/core/java/com/android/server/wm/AppWarnings.java
index ad5f4427fbc4..94ccee7b4771 100644
--- a/services/core/java/com/android/server/wm/AppWarnings.java
+++ b/services/core/java/com/android/server/wm/AppWarnings.java
@@ -210,7 +210,6 @@ class AppWarnings {
public void onStartActivity(ActivityRecord r) {
showUnsupportedCompileSdkDialogIfNeeded(r);
showUnsupportedDisplaySizeDialogIfNeeded(r);
- showDeprecatedTargetDialogIfNeeded(r);
showDeprecatedAbiDialogIfNeeded(r);
}
--
2.34.1
@@ -0,0 +1,41 @@
From 38fbb12c2b6ce42d78e05248410c1de666d46700 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 5 Oct 2021 21:01:50 -0700
Subject: [PATCH 13/43] Paint: Enable subpixel text positioning by default
On desktop Linux, subpixel text positioning is necessary to avoid
kerning issues, and Android is no different. Even though most phone
displays have relatively high DPIs, the lack of subpixel text
positioning is only unnoticeable on high-end devices such as the Pixel 4
XL (1440x3040 @ 6.3 in => 537 dpi).
For example, on the Pixel 5 (1080 x 2340 @ 6.0 in => 432 dpi),
horizontally-scrolling labels in QS tiles can be seen "jittering"
slightly upon close observation. This was tested with the Google Sans
font on Google's stock OS. At this lower DPI, there is still a need for
subpixel text positioning (at least in some cases).
Enable subpixel text positioning by default to fix occasional kerning
issues and jittering when text is in motion.
Change-Id: I8d71e5848a745c5a2d457a28c68458920928ee09
---
graphics/java/android/graphics/Paint.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index df95a91d72d7..6cbae8b67815 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -329,7 +329,7 @@ public class Paint {
// These flags are always set on a new/reset paint, even if flags 0 is passed.
static final int HIDDEN_DEFAULT_PAINT_FLAGS = DEV_KERN_TEXT_FLAG | EMBEDDED_BITMAP_TEXT_FLAG
- | FILTER_BITMAP_FLAG;
+ | FILTER_BITMAP_FLAG | SUBPIXEL_TEXT_FLAG;
/**
* Font hinter option that disables font hinting.
--
2.34.1
@@ -0,0 +1,28 @@
From 76893bd08d5c89685320342db2a3bcec2bc981f5 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sun, 17 Mar 2024 17:10:38 +0800
Subject: [PATCH 14/43] Remove debuggable requirement for signature spoofing
Change-Id: I8d637ddbbd117a9c5b1d9c5e462b0f4b30d98333
---
services/core/java/com/android/server/pm/ComputerEngine.java | 4 ----
1 file changed, 4 deletions(-)
diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java
index 7d00436857a5..10a221eb8b9f 100644
--- a/services/core/java/com/android/server/pm/ComputerEngine.java
+++ b/services/core/java/com/android/server/pm/ComputerEngine.java
@@ -1474,10 +1474,6 @@ public class ComputerEngine implements Computer {
private static native boolean isDebuggable();
public static boolean isMicrogSigned(AndroidPackage p) {
- if (!isDebuggable()) {
- return false;
- }
-
// Allowlist the following apps:
// * com.android.vending - microG Companion
// * com.google.android.gms - microG Services
--
2.34.1
@@ -0,0 +1,54 @@
From 2f0cb797274c27772f923c7a07ef830c12ddbfd4 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sun, 30 Jun 2024 16:49:47 +0800
Subject: [PATCH 16/43] Revert "Change color of track"
This reverts commit 9ba91db9836625e5f45367b38b76cf08615cce00.
---
.../res/color/brightness_slider_track.xml | 19 -------------------
.../drawable/brightness_progress_drawable.xml | 2 +-
2 files changed, 1 insertion(+), 20 deletions(-)
delete mode 100644 packages/SystemUI/res/color/brightness_slider_track.xml
diff --git a/packages/SystemUI/res/color/brightness_slider_track.xml b/packages/SystemUI/res/color/brightness_slider_track.xml
deleted file mode 100644
index 6028769f3789..000000000000
--- a/packages/SystemUI/res/color/brightness_slider_track.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright (C) 2024 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="@android:color/system_neutral2_500" android:lStar="40" />
-</selector>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/brightness_progress_drawable.xml b/packages/SystemUI/res/drawable/brightness_progress_drawable.xml
index cae9d6b0513e..95c7778c0e76 100644
--- a/packages/SystemUI/res/drawable/brightness_progress_drawable.xml
+++ b/packages/SystemUI/res/drawable/brightness_progress_drawable.xml
@@ -24,7 +24,7 @@
<shape>
<size android:height="@dimen/rounded_slider_track_width" />
<corners android:radius="@dimen/rounded_slider_track_corner_radius" />
- <solid android:color="@color/brightness_slider_track" />
+ <solid android:color="?attr/shadeInactive" />
</shape>
</inset>
</item>
--
2.34.1
@@ -0,0 +1,27 @@
From 587d8c7b04046a1a52c6dba36dbafaf95911b30e Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sun, 30 Jun 2024 16:13:51 +0800
Subject: [PATCH 17/43] Revert "Fix the text color used on the notification
unread indicator."
This reverts commit aee60c49308a81125587ea0c53f40c9d5d60707e.
---
core/java/android/app/Notification.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 1129f9dbdfeb..baecf785a8af 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -5721,7 +5721,7 @@ public class Notification implements Parcelable
pillColor = Colors.flattenAlpha(
getColors(p).getTertiaryFixedDimAccentColor(), bgColor);
textColor = Colors.flattenAlpha(
- getColors(p).getOnTertiaryFixedAccentTextColor(), pillColor);
+ getColors(p).getOnTertiaryAccentTextColor(), pillColor);
}
contentView.setInt(R.id.expand_button, "setHighlightTextColor", textColor);
contentView.setInt(R.id.expand_button, "setHighlightPillColor", pillColor);
--
2.34.1
@@ -0,0 +1,882 @@
From 912eb2ce819f09cf4e4592833547ea94b8ee3d80 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Thu, 4 Apr 2024 18:26:02 +0800
Subject: [PATCH 18/43] Revert "Update SystemUI to new notification color spec"
This reverts commit db2c5554ac653567d1433d3ff99328c5d855c233.
Change-Id: Iddbe46f4d01d05d6579c1e8b9dab266dd605e199
---
...ication_guts_priority_button_bg_stroke.xml | 5 ++--
.../notification_guts_priority_contents.xml | 5 ++--
.../SystemUI/res/color/remote_input_hint.xml | 5 ++--
.../SystemUI/res/color/remote_input_send.xml | 7 ++---
.../SystemUI/res/color/remote_input_text.xml | 7 ++---
.../drawable/notif_footer_btn_background.xml | 2 +-
.../res/drawable/notification_guts_bg.xml | 2 +-
.../res/drawable/notification_material_bg.xml | 2 +-
.../drawable/remote_input_view_text_bg.xml | 5 ++--
..._notification_section_header_clear_btn.xml | 3 +-
.../SystemUI/res/layout/notif_half_shelf.xml | 3 +-
.../res/layout/notif_half_shelf_row.xml | 5 ++--
.../layout/notification_children_divider.xml | 3 +-
.../layout/notification_conversation_info.xml | 3 +-
.../SystemUI/res/layout/notification_info.xml | 5 ++--
.../res/layout/notification_snooze.xml | 4 +--
.../res/layout/notification_snooze_option.xml | 3 +-
.../layout/status_bar_notification_footer.xml | 6 ++--
...status_bar_notification_section_header.xml | 2 +-
packages/SystemUI/res/values-night/colors.xml | 2 +-
packages/SystemUI/res/values/colors.xml | 2 +-
packages/SystemUI/res/values/styles.xml | 30 ++++---------------
.../systemui/statusbar/EmptyShadeView.java | 8 ++---
.../footer/ui/view/FooterView.java | 29 +++++++++---------
.../row/ActivatableNotificationView.java | 2 +-
.../row/HybridNotificationView.java | 5 ++--
.../row/NotificationConversationInfo.java | 9 +++---
.../row/wrapper/NotificationViewWrapper.java | 3 +-
.../stack/NotificationChildrenContainer.java | 2 +-
.../stack/NotificationSectionsManager.kt | 8 ++---
.../stack/NotificationStackScrollLayout.java | 23 +++++++-------
.../notification/stack/SectionHeaderView.java | 6 ++--
.../statusbar/phone/ScrimController.java | 5 ++--
.../statusbar/phone/TapAgainView.java | 7 ++---
.../statusbar/policy/RemoteInputView.java | 15 +++++-----
.../row/ActivatableNotificationViewTest.kt | 5 ++--
36 files changed, 101 insertions(+), 137 deletions(-)
diff --git a/packages/SystemUI/res/color/notification_guts_priority_button_bg_stroke.xml b/packages/SystemUI/res/color/notification_guts_priority_button_bg_stroke.xml
index d1b8a064724d..015e9f99212d 100644
--- a/packages/SystemUI/res/color/notification_guts_priority_button_bg_stroke.xml
+++ b/packages/SystemUI/res/color/notification_guts_priority_button_bg_stroke.xml
@@ -14,9 +14,8 @@
~ limitations under the License
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true"
- android:color="?androidprv:attr/materialColorOnSurfaceVariant" />
+ android:color="?android:attr/colorAccent" />
<item android:color="@color/notification_guts_priority_button_bg_stroke_color" />
</selector>
diff --git a/packages/SystemUI/res/color/notification_guts_priority_contents.xml b/packages/SystemUI/res/color/notification_guts_priority_contents.xml
index cc8c25a2d1ec..42f01896d7a1 100644
--- a/packages/SystemUI/res/color/notification_guts_priority_contents.xml
+++ b/packages/SystemUI/res/color/notification_guts_priority_contents.xml
@@ -14,9 +14,8 @@
~ limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true"
- android:color="?androidprv:attr/materialColorOnSurfaceVariant" />
+ android:color="?android:attr/colorAccent" />
<item android:color="@color/notification_guts_priority_button_content_color" />
</selector>
diff --git a/packages/SystemUI/res/color/remote_input_hint.xml b/packages/SystemUI/res/color/remote_input_hint.xml
index 0d90ee6b47c6..7fe58dbcf822 100644
--- a/packages/SystemUI/res/color/remote_input_hint.xml
+++ b/packages/SystemUI/res/color/remote_input_hint.xml
@@ -14,7 +14,6 @@
~ limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="?androidprv:attr/materialColorOnSurfaceVariant" android:alpha=".6" />
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="?android:attr/textColorPrimary" android:alpha=".6" />
</selector>
\ No newline at end of file
diff --git a/packages/SystemUI/res/color/remote_input_send.xml b/packages/SystemUI/res/color/remote_input_send.xml
index 0acc66b9050f..4dcd3dd229fb 100644
--- a/packages/SystemUI/res/color/remote_input_send.xml
+++ b/packages/SystemUI/res/color/remote_input_send.xml
@@ -15,8 +15,7 @@
~ limitations under the License
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:state_enabled="false" android:color="?androidprv:attr/materialColorPrimary" android:alpha=".3" />
- <item android:color="?androidprv:attr/materialColorPrimary" />
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_enabled="false" android:color="?android:attr/colorAccent" android:alpha=".3" />
+ <item android:color="?android:attr/colorAccent" />
</selector>
\ No newline at end of file
diff --git a/packages/SystemUI/res/color/remote_input_text.xml b/packages/SystemUI/res/color/remote_input_text.xml
index bf2c198fe540..13bb1d7cbe7d 100644
--- a/packages/SystemUI/res/color/remote_input_text.xml
+++ b/packages/SystemUI/res/color/remote_input_text.xml
@@ -15,8 +15,7 @@
~ limitations under the License
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:state_enabled="false" android:color="?androidprv:attr/materialColorOnSurfaceVariant" android:alpha=".6" />
- <item android:color="?androidprv:attr/materialColorOnSurfaceVariant" />
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_enabled="false" android:color="?android:attr/textColorPrimary" android:alpha=".6" />
+ <item android:color="?android:attr/textColorPrimary" />
</selector>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/notif_footer_btn_background.xml b/packages/SystemUI/res/drawable/notif_footer_btn_background.xml
index b9597375c3df..e6266754c0af 100644
--- a/packages/SystemUI/res/drawable/notif_footer_btn_background.xml
+++ b/packages/SystemUI/res/drawable/notif_footer_btn_background.xml
@@ -26,7 +26,7 @@
<padding
android:left="20dp"
android:right="20dp" />
- <solid android:color="?androidprv:attr/materialColorSurfaceContainerHigh" />
+ <solid android:color="?androidprv:attr/colorSurface" />
</shape>
</inset>
</item>
diff --git a/packages/SystemUI/res/drawable/notification_guts_bg.xml b/packages/SystemUI/res/drawable/notification_guts_bg.xml
index 84e2231738d4..bd9394bf9f8a 100644
--- a/packages/SystemUI/res/drawable/notification_guts_bg.xml
+++ b/packages/SystemUI/res/drawable/notification_guts_bg.xml
@@ -17,7 +17,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <solid android:color="?androidprv:attr/materialColorSurfaceContainerHigh" />
+ <solid android:color="?androidprv:attr/colorSurface" />
<!--The radius is 1dp smaller than the notification one, to avoid aliasing bugs on the corners -->
<corners android:radius="1dp" />
</shape>
diff --git a/packages/SystemUI/res/drawable/notification_material_bg.xml b/packages/SystemUI/res/drawable/notification_material_bg.xml
index 3f903aece0b5..40b9238b5e87 100644
--- a/packages/SystemUI/res/drawable/notification_material_bg.xml
+++ b/packages/SystemUI/res/drawable/notification_material_bg.xml
@@ -20,7 +20,7 @@
android:color="?android:attr/colorControlHighlight">
<item>
<shape>
- <solid android:color="?androidprv:attr/materialColorSurfaceContainerHigh" />
+ <solid android:color="?androidprv:attr/colorSurface" />
</shape>
</item>
<item>
diff --git a/packages/SystemUI/res/drawable/remote_input_view_text_bg.xml b/packages/SystemUI/res/drawable/remote_input_view_text_bg.xml
index 45d1a530cd20..535b35497b5c 100644
--- a/packages/SystemUI/res/drawable/remote_input_view_text_bg.xml
+++ b/packages/SystemUI/res/drawable/remote_input_view_text_bg.xml
@@ -14,13 +14,12 @@
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:shape="rectangle">
- <solid android:color="?androidprv:attr/materialColorSurfaceDim" />
+ <solid android:color="?android:attr/colorBackgroundFloating" />
<stroke
android:width="@dimen/remote_input_view_text_stroke"
- android:color="?androidprv:attr/materialColorPrimary"/>
+ android:color="?android:attr/colorAccent"/>
<padding
android:bottom="0dp"
android:left="12dp"
diff --git a/packages/SystemUI/res/drawable/status_bar_notification_section_header_clear_btn.xml b/packages/SystemUI/res/drawable/status_bar_notification_section_header_clear_btn.xml
index 06bed001ae1a..8b3408048848 100644
--- a/packages/SystemUI/res/drawable/status_bar_notification_section_header_clear_btn.xml
+++ b/packages/SystemUI/res/drawable/status_bar_notification_section_header_clear_btn.xml
@@ -15,12 +15,11 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:width="40dp"
android:height="40dp"
android:viewportWidth="40"
android:viewportHeight="40">
<path
- android:fillColor="?androidprv:attr/materialColorOnSurfaceVariant"
+ android:fillColor="@color/notification_section_clear_all_btn_color"
android:pathData="M24.6667 16.2733L23.7267 15.3333L20 19.06L16.2734 15.3333L15.3334 16.2733L19.06 20L15.3334 23.7267L16.2734 24.6667L20 20.94L23.7267 24.6667L24.6667 23.7267L20.94 20L24.6667 16.2733Z"/>
</vector>
diff --git a/packages/SystemUI/res/layout/notif_half_shelf.xml b/packages/SystemUI/res/layout/notif_half_shelf.xml
index 68c8dd96d188..c70f8e2b1c07 100644
--- a/packages/SystemUI/res/layout/notif_half_shelf.xml
+++ b/packages/SystemUI/res/layout/notif_half_shelf.xml
@@ -16,7 +16,6 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:id="@+id/half_shelf_dialog"
android:orientation="vertical"
android:layout_width="wrap_content"
@@ -66,7 +65,7 @@
android:gravity="center_vertical|start"
android:ellipsize="end"
android:maxLines="2"
- android:textColor="?androidprv:attr/materialColorOnSurface"
+ android:textColor="?android:attr/textColorPrimary"
android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
android:textSize="16sp"
/>
diff --git a/packages/SystemUI/res/layout/notif_half_shelf_row.xml b/packages/SystemUI/res/layout/notif_half_shelf_row.xml
index 9ef342ce5220..190f9994b1dc 100644
--- a/packages/SystemUI/res/layout/notif_half_shelf_row.xml
+++ b/packages/SystemUI/res/layout/notif_half_shelf_row.xml
@@ -16,7 +16,6 @@
<com.android.systemui.statusbar.notification.row.ChannelRow
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:id="@+id/half_shelf_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -60,7 +59,7 @@
android:ellipsize="end"
android:maxLines="1"
android:fontFamily="@*android:string/config_headlineFontFamily"
- android:textColor="?androidprv:attr/materialColorOnSurface"
+ android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"
/>
@@ -75,7 +74,7 @@
android:maxLines="1"
android:layout_below="@id/channel_name"
android:fontFamily="@*android:string/config_bodyFontFamily"
- android:textColor="?androidprv:attr/materialColorOnSurfaceVariant"
+ android:textColor="?android:attr/textColorSecondary"
android:textSize="14sp"
/>
</RelativeLayout>
diff --git a/packages/SystemUI/res/layout/notification_children_divider.xml b/packages/SystemUI/res/layout/notification_children_divider.xml
index 13e24a9ea277..eb743067933d 100644
--- a/packages/SystemUI/res/layout/notification_children_divider.xml
+++ b/packages/SystemUI/res/layout/notification_children_divider.xml
@@ -17,8 +17,7 @@
<com.android.systemui.statusbar.AlphaOptimizedView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:id="@+id/notification_more_divider"
android:layout_width="match_parent"
android:layout_height="@dimen/notification_divider_height"
- android:background="?androidprv:attr/materialColorOnSurfaceVariant" />
+ android:background="@color/notification_divider_color" />
diff --git a/packages/SystemUI/res/layout/notification_conversation_info.xml b/packages/SystemUI/res/layout/notification_conversation_info.xml
index 3a752c81b95a..4f6e88c2266f 100644
--- a/packages/SystemUI/res/layout/notification_conversation_info.xml
+++ b/packages/SystemUI/res/layout/notification_conversation_info.xml
@@ -17,7 +17,6 @@
<com.android.systemui.statusbar.notification.row.NotificationConversationInfo
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:id="@+id/notification_guts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -174,7 +173,7 @@
android:contentDescription="@string/notification_more_settings"
android:background="@drawable/ripple_drawable_20dp"
android:src="@drawable/ic_settings"
- android:tint="?androidprv:attr/materialColorPrimary"
+ android:tint="?android:attr/colorAccent"
android:layout_alignParentEnd="true" />
</LinearLayout>
diff --git a/packages/SystemUI/res/layout/notification_info.xml b/packages/SystemUI/res/layout/notification_info.xml
index 19a3f2fd521c..852db1b8fb91 100644
--- a/packages/SystemUI/res/layout/notification_info.xml
+++ b/packages/SystemUI/res/layout/notification_info.xml
@@ -17,7 +17,6 @@
<com.android.systemui.statusbar.notification.row.NotificationInfo
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:id="@+id/notification_guts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -103,7 +102,7 @@ asked for it -->
android:contentDescription="@string/notification_app_settings"
android:src="@drawable/ic_info"
android:layout_toStartOf="@id/info"
- android:tint="?androidprv:attr/materialColorPrimary"/>
+ android:tint="@color/notification_guts_link_icon_tint"/>
<ImageButton
android:id="@+id/info"
android:layout_width="@dimen/notification_importance_toggle_size"
@@ -112,7 +111,7 @@ asked for it -->
android:contentDescription="@string/notification_more_settings"
android:background="@drawable/ripple_drawable_20dp"
android:src="@drawable/ic_settings"
- android:tint="?androidprv:attr/materialColorPrimary"
+ android:tint="?android:attr/colorAccent"
android:layout_alignParentEnd="true" />
</LinearLayout>
diff --git a/packages/SystemUI/res/layout/notification_snooze.xml b/packages/SystemUI/res/layout/notification_snooze.xml
index ce09385eaf45..6608d8620f86 100644
--- a/packages/SystemUI/res/layout/notification_snooze.xml
+++ b/packages/SystemUI/res/layout/notification_snooze.xml
@@ -23,7 +23,7 @@
android:orientation="vertical"
android:paddingTop="2dp"
android:paddingBottom="2dp"
- android:background="?androidprv:attr/materialColorSurfaceContainerHigh"
+ android:background="?androidprv:attr/colorSurface"
android:theme="@style/Theme.SystemUI">
<RelativeLayout
@@ -38,7 +38,7 @@
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:paddingStart="@*android:dimen/notification_content_margin_end"
- android:textColor="?androidprv:attr/materialColorOnSurface"
+ android:textColor="?android:attr/textColorPrimary"
android:paddingEnd="4dp"/>
<ImageView
diff --git a/packages/SystemUI/res/layout/notification_snooze_option.xml b/packages/SystemUI/res/layout/notification_snooze_option.xml
index fa6f965198d4..d42cc0212fd8 100644
--- a/packages/SystemUI/res/layout/notification_snooze_option.xml
+++ b/packages/SystemUI/res/layout/notification_snooze_option.xml
@@ -16,11 +16,10 @@
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:layout_width="match_parent"
android:layout_height="@*android:dimen/notification_headerless_min_height"
android:layout_marginStart="@*android:dimen/notification_content_margin_end"
android:layout_marginEnd="@*android:dimen/notification_content_margin_end"
android:gravity="center_vertical"
android:textSize="14sp"
- android:textColor="?androidprv:attr/materialColorOnSurfaceVariant"/>
\ No newline at end of file
+ android:textColor="?android:attr/textColorSecondary"/>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/status_bar_notification_footer.xml b/packages/SystemUI/res/layout/status_bar_notification_footer.xml
index 72424a13d0f1..c1bac3151049 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_footer.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_footer.xml
@@ -41,7 +41,7 @@
android:layout_height="wrap_content"
>
<com.android.systemui.statusbar.notification.row.FooterViewButton
- style="@style/TextAppearance.NotificationFooterButton"
+ style="@style/TextAppearance.NotificationSectionHeaderButton"
android:id="@+id/manage_text"
android:layout_width="wrap_content"
android:layout_height="48dp"
@@ -54,11 +54,12 @@
app:layout_constraintEnd_toStartOf="@id/dismiss_text"
android:background="@drawable/notif_footer_btn_background"
android:focusable="true"
+ android:textColor="@color/notif_pill_text"
android:contentDescription="@string/manage_notifications_history_text"
android:text="@string/manage_notifications_history_text"
/>
<com.android.systemui.statusbar.notification.row.FooterViewButton
- style="@style/TextAppearance.NotificationFooterButton"
+ style="@style/TextAppearance.NotificationSectionHeaderButton"
android:id="@+id/dismiss_text"
android:layout_width="wrap_content"
android:layout_height="48dp"
@@ -69,6 +70,7 @@
app:layout_constraintStart_toEndOf="@id/manage_text"
android:background="@drawable/notif_footer_btn_background"
android:focusable="true"
+ android:textColor="@color/notif_pill_text"
android:contentDescription="@string/accessibility_clear_all"
android:text="@string/clear_all_notifications_text"
/>
diff --git a/packages/SystemUI/res/layout/status_bar_notification_section_header.xml b/packages/SystemUI/res/layout/status_bar_notification_section_header.xml
index 53abe87e7c12..c4d8d55f74e2 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_section_header.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_section_header.xml
@@ -40,7 +40,7 @@
android:layout_weight="1">
<TextView
- style="@style/TextAppearance.NotificationSectionHeaderLabel"
+ style="@style/TextAppearance.NotificationSectionHeaderButton"
android:id="@+id/header_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/packages/SystemUI/res/values-night/colors.xml b/packages/SystemUI/res/values-night/colors.xml
index 61a323d44dfc..ddf188e3f1d3 100644
--- a/packages/SystemUI/res/values-night/colors.xml
+++ b/packages/SystemUI/res/values-night/colors.xml
@@ -33,7 +33,7 @@
<!-- The color of the text inside a notification -->
<color name="notification_primary_text_color">@*android:color/notification_primary_text_color_dark</color>
- <color name="notif_pill_text">@android:color/system_on_surface_dark</color>
+ <color name="notif_pill_text">@color/material_dynamic_neutral95</color>
<color name="notification_guts_link_icon_tint">@color/GM2_grey_500</color>
<color name="notification_guts_sub_text_color">@color/GM2_grey_300</color>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 46364820c5d5..846fd5736590 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -121,7 +121,7 @@
<!-- Chosen so fill over background matches single tone -->
<color name="dark_mode_qs_icon_color_dual_tone_fill">#99000000</color>
- <color name="notif_pill_text">@android:color/system_on_surface_light</color>
+ <color name="notif_pill_text">@color/material_dynamic_neutral10</color>
<!-- Keyboard shortcuts colors -->
<color name="ksh_application_group_color">#fff44336</color>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index ce08ca3e43af..ae354d634f67 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -625,34 +625,34 @@
<style name="TextAppearance.NotificationImportanceChannel">
<item name="android:textSize">@dimen/notification_importance_channel_text</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
- <item name="android:textColor">?androidprv:attr/materialColorOnSurface</item>
+ <item name="android:textColor">@color/notification_guts_header_text_color</item>
<item name="android:textSize">@dimen/notification_importance_channel_text</item>
</style>
<style name="TextAppearance.NotificationImportanceChannelGroup">
<item name="android:textSize">@dimen/notification_importance_channel_group_text</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
- <item name="android:textColor">?androidprv:attr/materialColorOnSurface</item>
+ <item name="android:textColor">@color/notification_guts_header_text_color</item>
<item name="android:textSize">@dimen/notification_importance_channel_group_text</item>
</style>
<style name="TextAppearance.NotificationImportanceApp">
<item name="android:textSize">@dimen/notification_importance_channel_group_text</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
- <item name="android:textColor">?androidprv:attr/materialColorOnSurfaceVariant</item>
+ <item name="android:textColor">@color/notification_guts_sub_text_color</item>
<item name="android:textSize">@dimen/notification_importance_channel_group_text</item>
</style>
<style name="TextAppearance.NotificationImportanceHeader">
<item name="android:textSize">@dimen/notification_importance_header_text</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
- <item name="android:textColor">?androidprv:attr/materialColorOnSurface</item>
+ <item name="android:textColor">@color/notification_guts_header_text_color</item>
</style>
<style name="TextAppearance.NotificationImportanceDetail">
<item name="android:textSize">@dimen/notification_importance_description_text</item>
<item name="android:fontFamily">@*android:string/config_bodyFontFamily</item>
- <item name="android:textColor">?androidprv:attr/materialColorOnSurfaceVariant</item>
+ <item name="android:textColor">@color/notification_guts_sub_text_color</item>
<item name="android:gravity">center</item>
</style>
@@ -663,28 +663,10 @@
<item name="android:gravity">center</item>
</style>
- <style
- name="TextAppearance.NotificationSectionHeaderLabel"
- parent="@android:style/Widget.DeviceDefault.Button.Borderless">
- <item name="android:textColor">?androidprv:attr/materialColorOnSurface</item>
- <item name="android:textAllCaps">false</item>
- <item name="android:textSize">14sp</item>
- <item name="android:minWidth">0dp</item>
- </style>
-
<style
name="TextAppearance.NotificationSectionHeaderButton"
parent="@android:style/Widget.DeviceDefault.Button.Borderless">
- <item name="android:textColor">?androidprv:attr/materialColorOnSurface</item>
- <item name="android:textAllCaps">false</item>
- <item name="android:textSize">14sp</item>
- <item name="android:minWidth">0dp</item>
- </style>
-
- <style
- name="TextAppearance.NotificationFooterButton"
- parent="@android:style/Widget.DeviceDefault.Button.Borderless">
- <item name="android:textColor">?androidprv:attr/materialColorOnSurface</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textAllCaps">false</item>
<item name="android:textSize">14sp</item>
<item name="android:minWidth">0dp</item>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/EmptyShadeView.java b/packages/SystemUI/src/com/android/systemui/statusbar/EmptyShadeView.java
index 2338be28d32c..c9758471a30e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/EmptyShadeView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/EmptyShadeView.java
@@ -72,10 +72,10 @@ public class EmptyShadeView extends StackScrollerDecorView {
return findViewById(R.id.no_notifications_footer);
}
- public void setTextColors(@ColorInt int onSurface, @ColorInt int onSurfaceVariant) {
- mEmptyText.setTextColor(onSurfaceVariant);
- mEmptyFooterText.setTextColor(onSurface);
- mEmptyFooterText.setCompoundDrawableTintList(ColorStateList.valueOf(onSurface));
+ public void setTextColor(@ColorInt int color) {
+ mEmptyText.setTextColor(color);
+ mEmptyFooterText.setTextColor(color);
+ mEmptyFooterText.setCompoundDrawableTintList(ColorStateList.valueOf(color));
}
public void setText(@StringRes int text) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java
index 16f18a3c3fb6..17dc2a6ad815 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java
@@ -361,25 +361,26 @@ public class FooterView extends StackScrollerDecorView {
*/
public void updateColors() {
Resources.Theme theme = mContext.getTheme();
- final @ColorInt int onSurface = Utils.getColorAttrDefaultColor(mContext,
- com.android.internal.R.attr.materialColorOnSurface);
+ final @ColorInt int textColor = getResources().getColor(R.color.notif_pill_text, theme);
final Drawable clearAllBg = theme.getDrawable(R.drawable.notif_footer_btn_background);
final Drawable manageBg = theme.getDrawable(R.drawable.notif_footer_btn_background);
- if (!notificationBackgroundTintOptimization()) {
- final @ColorInt int scHigh = Utils.getColorAttrDefaultColor(mContext,
- com.android.internal.R.attr.materialColorSurfaceContainerHigh);
- if (scHigh != 0) {
- final ColorFilter bgColorFilter = new PorterDuffColorFilter(scHigh, SRC_ATOP);
- clearAllBg.setColorFilter(bgColorFilter);
- manageBg.setColorFilter(bgColorFilter);
- }
+ // TODO(b/282173943): Remove redundant tinting once Resources are thread-safe
+ final @ColorInt int buttonBgColor =
+ Utils.getColorAttrDefaultColor(mContext, com.android.internal.R.attr.colorSurface);
+ final ColorFilter bgColorFilter = new PorterDuffColorFilter(buttonBgColor, SRC_ATOP);
+ if (buttonBgColor != 0) {
+ clearAllBg.setColorFilter(bgColorFilter);
+ manageBg.setColorFilter(bgColorFilter);
}
mClearAllButton.setBackground(clearAllBg);
- mClearAllButton.setTextColor(onSurface);
+ mClearAllButton.setTextColor(textColor);
mManageOrHistoryButton.setBackground(manageBg);
- mManageOrHistoryButton.setTextColor(onSurface);
- mSeenNotifsFooterTextView.setTextColor(onSurface);
- mSeenNotifsFooterTextView.setCompoundDrawableTintList(ColorStateList.valueOf(onSurface));
+ mManageOrHistoryButton.setTextColor(textColor);
+ final @ColorInt int labelTextColor =
+ Utils.getColorAttrDefaultColor(mContext, android.R.attr.textColorPrimary);
+ mSeenNotifsFooterTextView.setTextColor(labelTextColor);
+ mSeenNotifsFooterTextView.setCompoundDrawableTintList(
+ ColorStateList.valueOf(labelTextColor));
}
private void updateResources() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java
index 83c50f52af6f..455a286346e6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java
@@ -122,7 +122,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
private void updateColors() {
mNormalColor = Utils.getColorAttrDefaultColor(mContext,
- com.android.internal.R.attr.materialColorSurfaceContainerHigh);
+ com.android.internal.R.attr.colorSurface);
mTintedRippleColor = mContext.getColor(
R.color.notification_ripple_tinted_color);
mNormalRippleColor = mContext.getColor(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridNotificationView.java
index da8c4dc08bf0..892a63505a71 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridNotificationView.java
@@ -28,6 +28,7 @@ import android.widget.TextView;
import androidx.annotation.ColorInt;
+import com.android.internal.util.ContrastColorUtil;
import com.android.keyguard.AlphaOptimizedLinearLayout;
import com.android.systemui.res.R;
import com.android.systemui.statusbar.CrossFadeHelper;
@@ -97,8 +98,8 @@ public class HybridNotificationView extends AlphaOptimizedLinearLayout
private void resolveThemeTextColors() {
try (TypedArray ta = mContext.getTheme().obtainStyledAttributes(
android.R.style.Theme_DeviceDefault_DayNight, new int[]{
- com.android.internal.R.attr.materialColorOnSurface,
- com.android.internal.R.attr.materialColorOnSurfaceVariant
+ android.R.attr.textColorPrimary,
+ android.R.attr.textColorSecondary
})) {
if (ta != null) {
mPrimaryTextColor = ta.getColor(0, mPrimaryTextColor);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
index 14593cb1b381..62b268b90cf3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
@@ -65,10 +65,10 @@ import android.widget.TextView;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settingslib.notification.ConversationIconFactory;
+import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.people.widget.PeopleSpaceWidgetManager;
-import com.android.systemui.res.R;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.statusbar.notification.NotificationChannelHelper;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -336,11 +336,10 @@ public class NotificationConversationInfo extends LinearLayout implements
Drawable person = mIconFactory.getBaseIconDrawable(mShortcutInfo);
if (person == null) {
person = mContext.getDrawable(R.drawable.ic_person).mutate();
- TypedArray ta = mContext.obtainStyledAttributes(
- new int[]{com.android.internal.R.attr.materialColorPrimary});
- int colorPrimary = ta.getColor(0, 0);
+ TypedArray ta = mContext.obtainStyledAttributes(new int[]{android.R.attr.colorAccent});
+ int colorAccent = ta.getColor(0, 0);
ta.recycle();
- person.setTint(colorPrimary);
+ person.setTint(colorAccent);
}
ImageView image = findViewById(R.id.conversation_icon);
image.setImageDrawable(person);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java
index 50f3e7896442..6f602ff437eb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java
@@ -337,8 +337,7 @@ public abstract class NotificationViewWrapper implements TransformableView {
if (customBackgroundColor != 0) {
return customBackgroundColor;
}
- return Utils.getColorAttr(mView.getContext(),
- com.android.internal.R.attr.materialColorSurfaceContainerHigh)
+ return Utils.getColorAttr(mView.getContext(), android.R.attr.colorBackground)
.getDefaultColor();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
index fa973001cec7..3ac14fc39065 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
@@ -1504,7 +1504,7 @@ public class NotificationChildrenContainer extends ViewGroup
Resources.Theme theme = new ContextThemeWrapper(mContext,
com.android.internal.R.style.Theme_DeviceDefault_DayNight).getTheme();
try (TypedArray ta = theme.obtainStyledAttributes(
- new int[]{com.android.internal.R.attr.materialColorPrimary})) {
+ new int[]{com.android.internal.R.attr.colorAccent})) {
color = ta.getColor(0, color);
}
mHybridGroupManager.setOverflowNumberColor(mOverflowNumber, color);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.kt
index d269eda6795a..5cd0c0d08d3b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.kt
@@ -244,10 +244,10 @@ class NotificationSectionsManager @Inject internal constructor(
}
}
- fun setHeaderForegroundColors(@ColorInt onSurface: Int, @ColorInt onSurfaceVariant: Int) {
- peopleHeaderView?.setForegroundColors(onSurface, onSurfaceVariant)
- silentHeaderView?.setForegroundColors(onSurface, onSurfaceVariant)
- alertingHeaderView?.setForegroundColors(onSurface, onSurfaceVariant)
+ fun setHeaderForegroundColor(@ColorInt color: Int) {
+ peopleHeaderView?.setForegroundColor(color)
+ silentHeaderView?.setForegroundColor(color)
+ alertingHeaderView?.setForegroundColor(color)
}
companion object {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index fb8bc7a34a9c..d8363fa54427 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -351,7 +351,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private boolean mAnimateNextBackgroundTop;
private boolean mAnimateNextBackgroundBottom;
private boolean mAnimateNextSectionBoundsChange;
- private @ColorInt int mBgColor;
+ private int mBgColor;
private float mDimAmount;
private ValueAnimator mDimAnimator;
private final ArrayList<ExpandableView> mTmpSortedChildren = new ArrayList<>();
@@ -665,8 +665,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mSections = mSectionsManager.createSectionsForBuckets();
mAmbientState = Dependency.get(AmbientState.class);
- mBgColor = Utils.getColorAttr(mContext,
- com.android.internal.R.attr.materialColorSurfaceContainerHigh).getDefaultColor();
+ mBgColor = Utils.getColorAttr(mContext, android.R.attr.colorBackgroundFloating)
+ .getDefaultColor();
int minHeight = res.getDimensionPixelSize(R.dimen.notification_min_height);
int maxHeight = res.getDimensionPixelSize(R.dimen.notification_max_height);
mSplitShadeMinContentHeight = res.getDimensionPixelSize(
@@ -810,8 +810,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
void updateBgColor() {
- mBgColor = Utils.getColorAttr(mContext,
- com.android.internal.R.attr.materialColorSurfaceContainerHigh).getDefaultColor();
+ mBgColor = Utils.getColorAttr(mContext, android.R.attr.colorBackgroundFloating)
+ .getDefaultColor();
updateBackgroundDimming();
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
@@ -4622,22 +4622,19 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
/**
- * Update colors of section headers, shade footer, and empty shade views.
+ * Update colors of "dismiss" and "empty shade" views.
*/
void updateDecorViews() {
- final @ColorInt int onSurface = Utils.getColorAttrDefaultColor(
- mContext, com.android.internal.R.attr.materialColorOnSurface);
- final @ColorInt int onSurfaceVariant = Utils.getColorAttrDefaultColor(
- mContext, com.android.internal.R.attr.materialColorOnSurfaceVariant);
-
- mSectionsManager.setHeaderForegroundColors(onSurface, onSurfaceVariant);
+ final @ColorInt int textColor =
+ Utils.getColorAttrDefaultColor(mContext, android.R.attr.textColorPrimary);
+ mSectionsManager.setHeaderForegroundColor(textColor);
if (mFooterView != null) {
mFooterView.updateColors();
}
if (mEmptyShadeView != null) {
- mEmptyShadeView.setTextColors(onSurface, onSurfaceVariant);
+ mEmptyShadeView.setTextColor(textColor);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java
index 580431a13d1b..59e1af5eb6f1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java
@@ -132,8 +132,8 @@ public class SectionHeaderView extends StackScrollerDecorView {
mLabelView.setText(resId);
}
- void setForegroundColors(@ColorInt int onSurface, @ColorInt int onSurfaceVariant) {
- mLabelView.setTextColor(onSurface);
- mClearAllButton.setImageTintList(ColorStateList.valueOf(onSurfaceVariant));
+ void setForegroundColor(@ColorInt int color) {
+ mLabelView.setTextColor(color);
+ mClearAllButton.setImageTintList(ColorStateList.valueOf(color));
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index d2e36b88fd9d..3404d5bbcc53 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -1555,9 +1555,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
private void updateThemeColors() {
if (mScrimBehind == null) return;
int background = Utils.getColorAttr(mScrimBehind.getContext(),
- com.android.internal.R.attr.materialColorSurfaceDim).getDefaultColor();
- int accent = Utils.getColorAttr(mScrimBehind.getContext(),
- com.android.internal.R.attr.materialColorPrimary).getDefaultColor();
+ android.R.attr.colorBackgroundFloating).getDefaultColor();
+ int accent = Utils.getColorAccent(mScrimBehind.getContext()).getDefaultColor();
mColors.setMainColor(background);
mColors.setSecondaryColor(accent);
final boolean isBackgroundLight = !ContrastColorUtil.isColorDark(background);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/TapAgainView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/TapAgainView.java
index 66ac17eee545..a033e1d55333 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/TapAgainView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/TapAgainView.java
@@ -20,7 +20,6 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
-import android.annotation.ColorInt;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
@@ -29,7 +28,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import com.android.settingslib.Utils;
import com.android.systemui.res.R;
import com.android.wm.shell.animation.Interpolators;
@@ -51,9 +49,8 @@ public class TapAgainView extends TextView {
}
void updateColor() {
- final @ColorInt int onSurface = Utils.getColorAttrDefaultColor(mContext,
- com.android.internal.R.attr.materialColorOnSurface);
- setTextColor(onSurface);
+ int textColor = getResources().getColor(R.color.notif_pill_text, mContext.getTheme());
+ setTextColor(textColor);
setBackground(getResources().getDrawable(R.drawable.rounded_bg_full, mContext.getTheme()));
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
index 2a48807ace2f..e02881951dd4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
@@ -130,7 +130,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
private ImageView mDelete;
private ImageView mDeleteBg;
private boolean mColorized;
- private int mLastBackgroundColor;
+ private int mTint;
private boolean mResetting;
@Nullable
private RevealParams mRevealParams;
@@ -181,9 +181,10 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
mEditorActionHandler = new EditorActionHandler();
mUiEventLogger = Dependency.get(UiEventLogger.class);
TypedArray ta = getContext().getTheme().obtainStyledAttributes(new int[]{
- com.android.internal.R.attr.materialColorSurfaceDim,
+ com.android.internal.R.attr.colorAccent,
+ com.android.internal.R.attr.colorSurface,
});
- mLastBackgroundColor = ta.getColor(0, 0);
+ mTint = ta.getColor(0, 0);
ta.recycle();
}
@@ -209,9 +210,9 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
* @param backgroundColor colorized notification color
*/
public void setBackgroundTintColor(final int backgroundColor, boolean colorized) {
- if (colorized == mColorized && backgroundColor == mLastBackgroundColor) return;
+ if (colorized == mColorized && backgroundColor == mTint) return;
mColorized = colorized;
- mLastBackgroundColor = backgroundColor;
+ mTint = backgroundColor;
final int editBgColor;
final int deleteBgColor;
final int deleteFgColor;
@@ -236,8 +237,8 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
hintColor = mContext.getColor(R.color.remote_input_hint);
deleteFgColor = textColor.getDefaultColor();
try (TypedArray ta = getContext().getTheme().obtainStyledAttributes(new int[]{
- com.android.internal.R.attr.materialColorSurfaceDim,
- com.android.internal.R.attr.materialColorSurfaceVariant
+ com.android.internal.R.attr.colorSurfaceHighlight,
+ com.android.internal.R.attr.colorSurfaceVariant
})) {
editBgColor = ta.getColor(0, backgroundColor);
deleteBgColor = ta.getColor(1, Color.GRAY);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt
index 9b9cb8213c91..ccef1d56c6a0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewTest.kt
@@ -61,9 +61,8 @@ class ActivatableNotificationViewTest : SysuiTestCase() {
else -> null
} as T?
}
-
- mNormalColor = Utils.getColorAttrDefaultColor(mContext,
- com.android.internal.R.attr.materialColorSurfaceContainerHigh)
+ mNormalColor =
+ Utils.getColorAttrDefaultColor(mContext, com.android.internal.R.attr.colorSurface)
}
@Test
--
2.34.1
@@ -0,0 +1,181 @@
From ddefb3aa749044a6b4838687f669c390512c6711 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Thu, 4 Apr 2024 18:26:08 +0800
Subject: [PATCH 19/43] Revert "Update framework to new notification color
spec"
This reverts commit 6063e254e0cc84243e3a3fb85fe1bff71b302a87.
---
core/java/android/app/Notification.java | 50 ++++---------------
core/res/res/values/colors.xml | 9 ++--
.../src/android/app/NotificationTest.java | 9 ----
3 files changed, 15 insertions(+), 53 deletions(-)
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index baecf785a8af..671b8d4153c5 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -5718,8 +5718,7 @@ public class Notification implements Parcelable
contentView.setInt(R.id.expand_button, "setDefaultPillColor", pillColor);
// Use different highlighted colors for conversations' unread count
if (p.mHighlightExpander) {
- pillColor = Colors.flattenAlpha(
- getColors(p).getTertiaryFixedDimAccentColor(), bgColor);
+ pillColor = Colors.flattenAlpha(getColors(p).getTertiaryAccentColor(), bgColor);
textColor = Colors.flattenAlpha(
getColors(p).getOnTertiaryAccentTextColor(), pillColor);
}
@@ -12944,9 +12943,6 @@ public class Notification implements Parcelable
private int mSecondaryAccentColor = COLOR_INVALID;
private int mTertiaryAccentColor = COLOR_INVALID;
private int mOnTertiaryAccentTextColor = COLOR_INVALID;
- private int mTertiaryFixedDimAccentColor = COLOR_INVALID;
- private int mOnTertiaryFixedAccentTextColor = COLOR_INVALID;
-
private int mErrorColor = COLOR_INVALID;
private int mContrastColor = COLOR_INVALID;
private int mRippleAlpha = 0x33;
@@ -13004,7 +13000,7 @@ public class Notification implements Parcelable
if (isColorized) {
if (rawColor == COLOR_DEFAULT) {
- int[] attrs = {R.attr.materialColorSecondary};
+ int[] attrs = {R.attr.colorAccentSecondary};
try (TypedArray ta = obtainDayNightAttributes(ctx, attrs)) {
mBackgroundColor = getColor(ta, 0, Color.WHITE);
}
@@ -13022,21 +13018,17 @@ public class Notification implements Parcelable
mSecondaryAccentColor = mSecondaryTextColor;
mTertiaryAccentColor = flattenAlpha(mPrimaryTextColor, mBackgroundColor);
mOnTertiaryAccentTextColor = mBackgroundColor;
- mTertiaryFixedDimAccentColor = mTertiaryAccentColor;
- mOnTertiaryFixedAccentTextColor = mOnTertiaryAccentTextColor;
mErrorColor = mPrimaryTextColor;
mRippleAlpha = 0x33;
} else {
int[] attrs = {
- R.attr.materialColorSurfaceContainerHigh,
- R.attr.materialColorOnSurface,
- R.attr.materialColorOnSurfaceVariant,
- R.attr.materialColorPrimary,
- R.attr.materialColorSecondary,
- R.attr.materialColorTertiary,
- R.attr.materialColorOnTertiary,
- R.attr.materialColorTertiaryFixedDim,
- R.attr.materialColorOnTertiaryFixed,
+ R.attr.colorSurface,
+ R.attr.textColorPrimary,
+ R.attr.textColorSecondary,
+ R.attr.colorAccent,
+ R.attr.colorAccentSecondary,
+ R.attr.colorAccentTertiary,
+ R.attr.textColorOnAccent,
R.attr.colorError,
R.attr.colorControlHighlight
};
@@ -13048,10 +13040,8 @@ public class Notification implements Parcelable
mSecondaryAccentColor = getColor(ta, 4, COLOR_INVALID);
mTertiaryAccentColor = getColor(ta, 5, COLOR_INVALID);
mOnTertiaryAccentTextColor = getColor(ta, 6, COLOR_INVALID);
- mTertiaryFixedDimAccentColor = getColor(ta, 7, COLOR_INVALID);
- mOnTertiaryFixedAccentTextColor = getColor(ta, 8, COLOR_INVALID);
- mErrorColor = getColor(ta, 9, COLOR_INVALID);
- mRippleAlpha = Color.alpha(getColor(ta, 10, 0x33ffffff));
+ mErrorColor = getColor(ta, 7, COLOR_INVALID);
+ mRippleAlpha = Color.alpha(getColor(ta, 8, 0x33ffffff));
}
mContrastColor = calculateContrastColor(ctx, rawColor, mPrimaryAccentColor,
mBackgroundColor, nightMode);
@@ -13079,14 +13069,6 @@ public class Notification implements Parcelable
ContrastColorUtil.resolvePrimaryColor(
ctx, mTertiaryAccentColor, nightMode), 0xFF);
}
- if (mTertiaryFixedDimAccentColor == COLOR_INVALID) {
- mTertiaryFixedDimAccentColor = mContrastColor;
- }
- if (mOnTertiaryFixedAccentTextColor == COLOR_INVALID) {
- mOnTertiaryFixedAccentTextColor = ColorUtils.setAlphaComponent(
- ContrastColorUtil.resolvePrimaryColor(
- ctx, mTertiaryFixedDimAccentColor, nightMode), 0xFF);
- }
if (mErrorColor == COLOR_INVALID) {
mErrorColor = mPrimaryTextColor;
}
@@ -13160,16 +13142,6 @@ public class Notification implements Parcelable
return mOnTertiaryAccentTextColor;
}
- /** @return the theme's tertiary fixed dim accent color for colored UI elements. */
- public @ColorInt int getTertiaryFixedDimAccentColor() {
- return mTertiaryFixedDimAccentColor;
- }
-
- /** @return the theme's text color to be used on the tertiary fixed accent color. */
- public @ColorInt int getOnTertiaryFixedAccentTextColor() {
- return mOnTertiaryFixedAccentTextColor;
- }
-
/**
* @return the contrast-adjusted version of the color provided by the app, or the
* primary text color when colorized.
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index d8191c0c3597..b4139f343fa5 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -135,12 +135,11 @@
<drawable name="notification_template_icon_low_bg">#0cffffff</drawable>
<drawable name="notification_template_divider">#29000000</drawable>
<drawable name="notification_template_divider_media">#29ffffff</drawable>
- <color name="notification_primary_text_color_light">@color/system_on_surface_light</color>
- <color name="notification_primary_text_color_dark">@color/system_on_surface_dark</color>
- <!-- Note that the primary and secondary notification text colors are, in fact, the same. -->
- <color name="notification_secondary_text_color_light">@color/system_on_surface_light</color>
- <color name="notification_secondary_text_color_dark">@color/system_on_surface_dark</color>
+ <color name="notification_primary_text_color_light">@color/primary_text_default_material_light</color>
+ <color name="notification_primary_text_color_dark">@color/primary_text_default_material_dark</color>
+ <color name="notification_secondary_text_color_light">@color/primary_text_default_material_light</color>
<item name="notification_secondary_text_disabled_alpha" format="float" type="dimen">0.38</item>
+ <color name="notification_secondary_text_color_dark">@color/primary_text_default_material_dark</color>
<color name="notification_default_color_dark">#ddffffff</color>
<color name="notification_default_color_light">#a3202124</color>
diff --git a/core/tests/coretests/src/android/app/NotificationTest.java b/core/tests/coretests/src/android/app/NotificationTest.java
index 5b0502da1bdf..297f8254ded1 100644
--- a/core/tests/coretests/src/android/app/NotificationTest.java
+++ b/core/tests/coretests/src/android/app/NotificationTest.java
@@ -859,10 +859,6 @@ public class NotificationTest {
assertEquals(cDay.getTertiaryAccentColor(), cNight.getTertiaryAccentColor());
assertEquals(cDay.getOnTertiaryAccentTextColor(),
cNight.getOnTertiaryAccentTextColor());
- assertEquals(cDay.getTertiaryFixedDimAccentColor(),
- cNight.getTertiaryFixedDimAccentColor());
- assertEquals(cDay.getOnTertiaryFixedAccentTextColor(),
- cNight.getOnTertiaryFixedAccentTextColor());
assertEquals(cDay.getProtectionColor(), cNight.getProtectionColor());
assertEquals(cDay.getContrastColor(), cNight.getContrastColor());
assertEquals(cDay.getRippleAlpha(), cNight.getRippleAlpha());
@@ -1844,8 +1840,6 @@ public class NotificationTest {
assertThat(c.getSecondaryAccentColor()).isNotEqualTo(Notification.COLOR_INVALID);
assertThat(c.getTertiaryAccentColor()).isNotEqualTo(Notification.COLOR_INVALID);
assertThat(c.getOnTertiaryAccentTextColor()).isNotEqualTo(Notification.COLOR_INVALID);
- assertThat(c.getTertiaryFixedDimAccentColor()).isNotEqualTo(Notification.COLOR_INVALID);
- assertThat(c.getOnTertiaryFixedAccentTextColor()).isNotEqualTo(Notification.COLOR_INVALID);
assertThat(c.getErrorColor()).isNotEqualTo(Notification.COLOR_INVALID);
assertThat(c.getContrastColor()).isNotEqualTo(Notification.COLOR_INVALID);
assertThat(c.getRippleAlpha()).isAtLeast(0x00);
@@ -1861,12 +1855,9 @@ public class NotificationTest {
// These colors are only used for emphasized buttons; they do not need contrast
assertContrastIsAtLeast(c.getSecondaryAccentColor(), c.getBackgroundColor(), 1);
assertContrastIsAtLeast(c.getTertiaryAccentColor(), c.getBackgroundColor(), 1);
- assertContrastIsAtLeast(c.getTertiaryFixedDimAccentColor(), c.getBackgroundColor(), 1);
// The text that is used within the accent color DOES need to have contrast
assertContrastIsAtLeast(c.getOnTertiaryAccentTextColor(), c.getTertiaryAccentColor(), 4.5);
- assertContrastIsAtLeast(c.getOnTertiaryFixedAccentTextColor(),
- c.getTertiaryFixedDimAccentColor(), 4.5);
}
private void resolveColorsInNightMode(boolean nightMode, Notification.Colors c, int rawColor,
--
2.34.1

Some files were not shown because too many files have changed in this diff Show More