Sync up to v215

This commit is contained in:
Andy CrossGate Yan
2020-04-13 03:00:27 +00:00
parent 80a47a7f4f
commit d1718561d3
5 changed files with 147 additions and 50 deletions

View File

@@ -0,0 +1,88 @@
From 06972c2ccb195e177bab0184ca7f3abd1747080f Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Mon, 30 Mar 2020 10:07:00 +0000
Subject: [PATCH 56/57] Support Huawei light HAL
For https://github.com/phhusson/treble_experimentations/issues/1204
Change-Id: I719a13eb66a46703b7ff0e00113f9b98b3244996
---
services/core/jni/Android.bp | 1 +
...om_android_server_lights_LightsService.cpp | 30 +++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
index e417420a135..d1df6337240 100644
--- a/services/core/jni/Android.bp
+++ b/services/core/jni/Android.bp
@@ -138,6 +138,7 @@ cc_defaults {
"vendor.samsung.hardware.miscpower@2.0",
"vendor.samsung.hardware.light@2.0",
"vendor.samsung.hardware.light@3.0",
+ "vendor.huawei.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 a6a5849caed..f3e456203f1 100644
--- a/services/core/jni/com_android_server_lights_LightsService.cpp
+++ b/services/core/jni/com_android_server_lights_LightsService.cpp
@@ -26,6 +26,7 @@
#include <vendor/samsung/hardware/light/2.0/types.h>
#include <vendor/samsung/hardware/light/3.0/ISehLight.h>
#include <vendor/samsung/hardware/light/3.0/types.h>
+#include <vendor/huawei/hardware/light/2.0/ILight.h>
#include <android-base/chrono_utils.h>
#include <utils/misc.h>
#include <utils/Log.h>
@@ -48,11 +49,15 @@ using SecType = ::vendor::samsung::hardware::light::V2_0::SecType;
using ISehLight = ::vendor::samsung::hardware::light::V3_0::ISehLight;
using SehType = ::vendor::samsung::hardware::light::V3_0::SehType;
using SehLightState = ::vendor::samsung::hardware::light::V3_0::SehLightState;
+using ILightHw = ::vendor::huawei::hardware::light::V2_0::ILight;
+using LightStateHw = ::android::hardware::light::V2_0::LightState;
static bool sLightSupported = true;
static sp<ISecLight> sSecHal;
static sp<ISehLight> sSehHal;
static bool sSecTried = false;
+static sp<ILightHw> sHwHal;
+static bool sHwTried = false;
static bool validate(jint light, jint flash, jint brightness) {
bool valid = true;
@@ -193,6 +198,31 @@ static void setLight_native(
return;
}
+ if (!sHwTried) {
+ sHwHal = ILightHw::getService();
+ //sHwTried = true;
+ }
+
+ if (sHwHal != nullptr && light == 0) {
+ ALOGE("sHwHal triggered!");
+ int brightness = colorARGB & 0xff;
+ int hwBrightness = brightness << 4;
+ LightState state = constructState(hwBrightness, flashMode, onMS, offMS, brightnessMode);
+ bool got260 = false;
+ sHwHal->HWgetSupportedTypes([&](auto types) {
+ for (const auto& type: types) {
+ if (type == 260) {
+ ALOGE("sHwHal reports 260 as a supported type");
+ got260 = true;
+ }
+ }
+ });
+ if (got260) {
+ sHwHal->HWsetLight(260, state);
+ return;
+ }
+ }
+
Type type = static_cast<Type>(light);
LightState state = constructState(
colorARGB, flashMode, onMS, offMS, brightnessMode);
--
2.17.1

View File

@@ -0,0 +1,33 @@
From ba959392b9e59279ec0fd490439c145618b3978b Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 5 Apr 2020 16:32:46 +0200
Subject: [PATCH 57/57] Always allow overriding the number of work profiles
---
.../java/com/android/server/pm/UserManagerService.java | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index d7e070981b1..52797ef1821 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -4429,14 +4429,8 @@ public class UserManagerService extends IUserManager.Stub {
@VisibleForTesting
static int getMaxManagedProfiles() {
- // Allow overriding max managed profiles on debuggable builds for testing
- // of multiple profiles.
- if (!Build.IS_DEBUGGABLE) {
- return MAX_MANAGED_PROFILES;
- } else {
- return SystemProperties.getInt("persist.sys.max_profiles",
- MAX_MANAGED_PROFILES);
- }
+ return SystemProperties.getInt("persist.sys.max_profiles",
+ MAX_MANAGED_PROFILES);
}
@GuardedBy("mUsersLock")
--
2.17.1