-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Sync with September source of Arrow
* Synced with latest td source Signed-off-by: naz664 <nazimnavas145@gmail.com>
- Loading branch information
Showing
5 changed files
with
446 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
...al/platform_frameworks_base/07-Revert-BrightnessUtils-Conditionally-use-low-gamma-i.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
From 0e8ea14cca825e30e5b4b21afd012e39aedb35c9 Mon Sep 17 00:00:00 2001 | ||
From: naz664 <nazimnavas145@gmail.com> | ||
Date: Sat, 28 Oct 2023 13:51:59 +0000 | ||
Subject: [PATCH 1/2] Revert "BrightnessUtils: Conditionally use low gamma | ||
implementation for brightness curve" | ||
|
||
This reverts commit 3840e36dc962aabbf4c873793d887ce7ce245edc. | ||
--- | ||
.../settingslib/display/BrightnessUtils.java | 16 +--------------- | ||
1 file changed, 1 insertion(+), 15 deletions(-) | ||
|
||
diff --git a/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java b/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java | ||
index bbfd8cefcddf..4f86afaa995c 100644 | ||
--- a/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java | ||
+++ b/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java | ||
@@ -16,18 +16,12 @@ | ||
|
||
package com.android.settingslib.display; | ||
|
||
-import android.os.SystemProperties; | ||
import android.util.MathUtils; | ||
|
||
-import com.android.internal.display.BrightnessSynchronizer; | ||
- | ||
public class BrightnessUtils { | ||
|
||
- private static final boolean sysUseLowGamma = SystemProperties.getBoolean( | ||
- "persist.sys.brightness.low.gamma", false); | ||
- | ||
public static final int GAMMA_SPACE_MIN = 0; | ||
- public static final int GAMMA_SPACE_MAX = sysUseLowGamma ? 255 : 65535; | ||
+ public static final int GAMMA_SPACE_MAX = 65535; | ||
|
||
// Hybrid Log Gamma constant values | ||
private static final float R = 0.5f; | ||
@@ -81,10 +75,6 @@ public class BrightnessUtils { | ||
* @return The corresponding setting value. | ||
*/ | ||
public static final float convertGammaToLinearFloat(int val, float min, float max) { | ||
- if (sysUseLowGamma) { | ||
- return MathUtils.constrain(BrightnessSynchronizer.brightnessIntToFloat(val), min, max); | ||
- } | ||
- | ||
final float normalizedVal = MathUtils.norm(GAMMA_SPACE_MIN, GAMMA_SPACE_MAX, val); | ||
final float ret; | ||
if (normalizedVal <= R) { | ||
@@ -137,10 +127,6 @@ public class BrightnessUtils { | ||
* @return The corresponding slider value | ||
*/ | ||
public static final int convertLinearToGammaFloat(float val, float min, float max) { | ||
- if (sysUseLowGamma) { | ||
- return BrightnessSynchronizer.brightnessFloatToInt(MathUtils.constrain(val, min, max)); | ||
- } | ||
- | ||
// 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.34.1 | ||
|
57 changes: 57 additions & 0 deletions
57
...s/personal/platform_frameworks_base/08-Fix-brightness-slider-curve-for-some-devices.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
From ce696930b19047c5d9370a82291ecb975e453086 Mon Sep 17 00:00:00 2001 | ||
From: ChonDoit <thphantomblog@gmail.com> | ||
Date: Thu, 24 Aug 2023 15:58:15 -0300 | ||
Subject: [PATCH 2/2] Fix brightness slider curve for some devices | ||
|
||
Some devices report max brightness as 2047 or 4095 | ||
--- | ||
.../settingslib/display/BrightnessUtils.java | 15 ++++++++++----- | ||
1 file changed, 10 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java b/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java | ||
index 4f86afaa995c..c31a1bff8240 100644 | ||
--- a/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java | ||
+++ b/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java | ||
@@ -16,12 +16,17 @@ | ||
|
||
package com.android.settingslib.display; | ||
|
||
+import android.os.SystemProperties; | ||
import android.util.MathUtils; | ||
|
||
+import com.android.internal.display.BrightnessSynchronizer; | ||
+ | ||
public class BrightnessUtils { | ||
|
||
+ public static final boolean LowGammaBrightness = Boolean.parseBoolean(SystemProperties.get("persist.sys.phh.low_gamma_brightness", "false")); | ||
+ | ||
public static final int GAMMA_SPACE_MIN = 0; | ||
- public static final int GAMMA_SPACE_MAX = 65535; | ||
+ public static final int GAMMA_SPACE_MAX = LowGammaBrightness ? 255 : 65535; | ||
|
||
// Hybrid Log Gamma constant values | ||
private static final float R = 0.5f; | ||
@@ -87,9 +92,8 @@ public class BrightnessUtils { | ||
// it shouldn't be out of bounds. | ||
final float normalizedRet = MathUtils.constrain(ret, 0, 12); | ||
|
||
- // Re-normalize to the range [0, 1] | ||
- // in order to derive the correct setting value. | ||
- return MathUtils.lerp(min, max, normalizedRet / 12); | ||
+ return LowGammaBrightness ? MathUtils.constrain(BrightnessSynchronizer.brightnessIntToFloat(val), | ||
+ min, max) : MathUtils.lerp(min, max, normalizedRet / 12); | ||
} | ||
|
||
/** | ||
@@ -136,6 +140,7 @@ public class BrightnessUtils { | ||
ret = A * MathUtils.log(normalizedVal - B) + C; | ||
} | ||
|
||
- return Math.round(MathUtils.lerp(GAMMA_SPACE_MIN, GAMMA_SPACE_MAX, ret)); | ||
+ return LowGammaBrightness ? BrightnessSynchronizer.brightnessFloatToInt( | ||
+ MathUtils.constrain(val, min, max)) : Math.round(MathUtils.lerp(GAMMA_SPACE_MIN, GAMMA_SPACE_MAX, ret)); | ||
} | ||
} | ||
-- | ||
2.34.1 | ||
|
48 changes: 48 additions & 0 deletions
48
patches/trebledroid/platform_frameworks_base/0035-Detect-Moto-dynamic-hardware-feature.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
From 162c338e486a0de6ecf669bc2e660e3c268f6d25 Mon Sep 17 00:00:00 2001 | ||
From: Pierre-Hugues Husson <phh@phh.me> | ||
Date: Wed, 5 Jul 2023 10:50:36 -0400 | ||
Subject: [PATCH] Detect Moto dynamic hardware feature | ||
|
||
Moto added a custom node in sysconfig XMLs: | ||
<unavailable-feature-conditional /> | ||
This node reads a property and enables a feature based on it. | ||
|
||
Take those into account to enable NFC on Moto devices which have | ||
NFC-less variants | ||
--- | ||
.../java/com/android/server/SystemConfig.java | 19 +++++++++++++++++++ | ||
1 file changed, 19 insertions(+) | ||
|
||
diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java | ||
index 00b01051adae..ffcc75e63d66 100644 | ||
--- a/core/java/com/android/server/SystemConfig.java | ||
+++ b/core/java/com/android/server/SystemConfig.java | ||
@@ -979,6 +979,25 @@ public class SystemConfig { | ||
} | ||
XmlUtils.skipCurrentTag(parser); | ||
} break; | ||
+ case "unavailable-feature-conditional": { | ||
+ if (allowFeatures) { | ||
+ String fname = parser.getAttributeValue(null, "name"); | ||
+ String prop = parser.getAttributeValue(null, "prop"); | ||
+ if (fname == null || prop == null) { | ||
+ Slog.w(TAG, "<" + name + "> without name in " + permFile | ||
+ + " at " + parser.getPositionDescription()); | ||
+ } else { | ||
+ if(android.os.SystemProperties.getBoolean(prop, false)) { | ||
+ addFeature(fname, 0); | ||
+ } else { | ||
+ mUnavailableFeatures.add(fname); | ||
+ } | ||
+ } | ||
+ } else { | ||
+ logNotAllowedInPartition(name, permFile, parser); | ||
+ } | ||
+ XmlUtils.skipCurrentTag(parser); | ||
+ } break; | ||
case "allow-in-power-save-except-idle": { | ||
if (allowOverrideAppRestrictions) { | ||
String pkgname = parser.getAttributeValue(null, "package"); | ||
-- | ||
2.34.1 | ||
|
214 changes: 214 additions & 0 deletions
214
.../platform_frameworks_base/0036-Add-initial-Xiaomi-FOD-implementation-for-recent-Xia.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
From 8edc46352a0cc716a034479393c471181b0d6e54 Mon Sep 17 00:00:00 2001 | ||
From: jgudec <jakov.gudec@gmail.com> | ||
Date: Fri, 18 Aug 2023 08:41:49 +0100 | ||
Subject: [PATCH] Add initial Xiaomi FOD implementation for recent Xiaomi | ||
devices | ||
|
||
Huge thanks to phhusson for the help and guidance. | ||
--- | ||
packages/SystemUI/Android.bp | 2 + | ||
.../android/systemui/biometrics/UdfpsView.kt | 46 +++++++++++++++++- | ||
services/core/Android.bp | 1 + | ||
.../server/biometrics/AuthService.java | 47 +++++++++++++++++++ | ||
4 files changed, 94 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp | ||
index dd7f2c22f266..b477ef955956 100644 | ||
--- a/packages/SystemUI/Android.bp | ||
+++ b/packages/SystemUI/Android.bp | ||
@@ -179,6 +179,8 @@ android_library { | ||
"motion_tool_lib", | ||
"vendor.lineage.powershare-V1.0-java", | ||
"vendor.goodix.hardware.biometrics.fingerprint-V2.1-java", | ||
+ "vendor.xiaomi.hw.touchfeature-V1.0-java", | ||
+ "vendor.xiaomi.hardware.fingerprintextension-V1.0-java" | ||
], | ||
manifest: "AndroidManifest.xml", | ||
|
||
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt | ||
index 8fd6c338a6d7..e1272cc0b583 100644 | ||
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt | ||
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt | ||
@@ -38,6 +38,12 @@ import java.io.File | ||
|
||
import vendor.goodix.hardware.biometrics.fingerprint.V2_1.IGoodixFingerprintDaemon | ||
|
||
+import vendor.xiaomi.hw.touchfeature.V1_0.ITouchFeature | ||
+import vendor.xiaomi.hardware.fingerprintextension.V1_0.IXiaomiFingerprint | ||
+ | ||
+import android.os.Handler | ||
+import android.os.HandlerThread | ||
+ | ||
private const val TAG = "UdfpsView" | ||
|
||
/** | ||
@@ -225,9 +231,14 @@ Log.d("PHH", "Surface destroyed!") | ||
var samsungActualMaskBrightness = "/sys/class/lcd/panel/actual_mask_brightness" | ||
val hasSamsungMask = File(samsungActualMaskBrightness).exists() | ||
var fodFileObserver: FileObserver? = null | ||
- | ||
|
||
- fun configureDisplay(onDisplayConfigured: Runnable) { | ||
+ val xiaomiDispParam = "/sys/class/mi_display/disp-DSI-0/disp_param" | ||
+ var hasXiaomiLhbm = File(xiaomiDispParam).exists() | ||
+ | ||
+ private val handlerThread = HandlerThread("UDFPS").also { it.start() } | ||
+ val myHandler = Handler(handlerThread.looper) | ||
+ | ||
+ fun configureDisplay(onDisplayConfigured: Runnable) { | ||
isDisplayConfigured = true | ||
animationViewController?.onDisplayConfiguring() | ||
mUdfpsDisplayMode?.enable(onDisplayConfigured) | ||
@@ -262,6 +273,34 @@ Log.d("PHH", "Surface destroyed!") | ||
if(android.os.SystemProperties.get("ro.vendor.build.fingerprint").contains("ASUS")) { | ||
goodixCmd(200001) | ||
} | ||
+ | ||
+ if(hasXiaomiLhbm){ | ||
+ Log.d("PHH-Enroll", "Xiaomi scenario in UdfpsView reached!") | ||
+ mySurfaceView.setVisibility(INVISIBLE) | ||
+ | ||
+ IXiaomiFingerprint.getService().extCmd(android.os.SystemProperties.getInt("persist.phh.xiaomi.fod.enrollment.id", 4), 1); | ||
+ var res = ITouchFeature.getService().setTouchMode(0, 10, 1); | ||
+ if(res != 0){ | ||
+ Log.d("PHH-Enroll", "SetTouchMode 10,1 was NOT executed successfully. Res is " + res) | ||
+ } | ||
+ | ||
+ myHandler.postDelayed({ | ||
+ var ret200 = ITouchFeature.getService().setTouchMode(0, 10, 1); | ||
+ | ||
+ if(ret200 != 0){ | ||
+ Log.d("PHH-Enroll", "myHandler.postDelayed 200ms -SetTouchMode was NOT executed successfully. Ret is " + ret200) | ||
+ } | ||
+ | ||
+ myHandler.postDelayed({ | ||
+ Log.d("PHH-Enroll", "myHandler.postDelayed 600ms - line prior to setTouchMode 10,0") | ||
+ var ret600 = ITouchFeature.getService().setTouchMode(0, 10, 0); | ||
+ | ||
+ if(ret600 != 0){ | ||
+ Log.d("PHH-Enroll", "myHandler.postDelayed 600ms -SetTouchMode 10,0 was NOT executed successfully. Ret is " + ret600) | ||
+ } | ||
+ }, 600) | ||
+ }, 200) | ||
+ } | ||
} | ||
|
||
fun unconfigureDisplay() { | ||
@@ -303,6 +342,9 @@ Log.d("PHH", "Surface destroyed!") | ||
} | ||
}; | ||
fodFileObserver?.startWatching(); | ||
+ } else if(hasXiaomiLhbm) { | ||
+ IXiaomiFingerprint.getService().extCmd(android.os.SystemProperties.getInt("persist.phh.xiaomi.fod.enrollment.id", 4), 0); | ||
+ ITouchFeature.getService().setTouchMode(0, 10, 0); | ||
} else { | ||
dimUpdate(0.0f) | ||
} | ||
diff --git a/services/core/Android.bp b/services/core/Android.bp | ||
index 08a35f566d47..60afa0a562bf 100644 | ||
--- a/services/core/Android.bp | ||
+++ b/services/core/Android.bp | ||
@@ -187,6 +187,7 @@ java_library_static { | ||
"vendor.samsung.hardware.biometrics.fingerprint-V3.0-java", | ||
"vendor.oplus.hardware.biometrics.fingerprint-V2.1-java", | ||
"vendor.oppo.hardware.biometrics.fingerprint-V2.1-java", | ||
+ "vendor.xiaomi.hardware.fingerprintextension-V1.0-java", | ||
], | ||
javac_shard_size: 50, | ||
} | ||
diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java | ||
index 31e03397dd7d..b6df91aa3080 100644 | ||
--- a/services/core/java/com/android/server/biometrics/AuthService.java | ||
+++ b/services/core/java/com/android/server/biometrics/AuthService.java | ||
@@ -66,6 +66,7 @@ import android.os.ServiceManager; | ||
import android.os.SystemProperties; | ||
import android.os.UserHandle; | ||
import android.provider.Settings; | ||
+import android.text.TextUtils; | ||
import android.util.Slog; | ||
|
||
import com.android.internal.R; | ||
@@ -92,6 +93,7 @@ import android.os.Build; | ||
import vendor.samsung.hardware.biometrics.fingerprint.V3_0.ISehBiometricsFingerprint; | ||
import vendor.goodix.hardware.biometrics.fingerprint.V2_1.IGoodixFingerprintDaemon; | ||
import vendor.samsung.hardware.sysinput.V1_0.ISehSysInputDev; | ||
+import vendor.xiaomi.hardware.fingerprintextension.V1_0.IXiaomiFingerprint; | ||
|
||
/** | ||
* System service that provides an interface for authenticating with biometrics and | ||
@@ -114,6 +116,8 @@ public class AuthService extends SystemService { | ||
private FileObserver fodFileObserver = null; | ||
private ISehBiometricsFingerprint mSamsungFingerprint = null; | ||
|
||
+ private IXiaomiFingerprint mXiaomiFingerprint = null; | ||
+ | ||
/** | ||
* Class for injecting dependencies into AuthService. | ||
* TODO(b/141025588): Replace with a dependency injection framework (e.g. Guice, Dagger). | ||
@@ -677,6 +681,12 @@ public class AuthService extends SystemService { | ||
} catch(Exception e) { | ||
android.util.Log.e("PHH", "Failed getting Samsung fingerprint HAL", e); | ||
} | ||
+ try { | ||
+ mXiaomiFingerprint = IXiaomiFingerprint.getService(); | ||
+ android.util.Log.e("PHH", "Got xiaomi fingerprint HAL"); | ||
+ } catch(Exception e) { | ||
+ android.util.Log.e("PHH", "Failed getting xiaomi fingerprint HAL", e); | ||
+ } | ||
if(samsungHasCmd("fod_enable") && mSamsungFingerprint != null) { | ||
samsungCmd("fod_enable,1,1,0"); | ||
String actualMaskBrightnessPath = "/sys/class/lcd/panel/actual_mask_brightness"; | ||
@@ -736,6 +746,31 @@ public class AuthService extends SystemService { | ||
}; | ||
fodFileObserver.startWatching(); | ||
} | ||
+ | ||
+ String xiaomiFodPressedStatusPath = "/sys/class/touch/touch_dev/fod_press_status"; | ||
+ if(new File(xiaomiFodPressedStatusPath).exists() && mXiaomiFingerprint != null) { | ||
+ fodFileObserver = new FileObserver(xiaomiFodPressedStatusPath, FileObserver.MODIFY) { | ||
+ @Override | ||
+ public void onEvent(int event, String path) { | ||
+ String isFodPressed = readFile(xiaomiFodPressedStatusPath); | ||
+ Slog.d("PHH-Enroll", "Fod pressed status: " + isFodPressed); | ||
+ Slog.d("PHH-Enroll", "Within xiaomi scenario for FOD"); | ||
+ | ||
+ try { | ||
+ if("0".equals(isFodPressed)) { | ||
+ Slog.d("PHH-Enroll", "Fod un-pressed!"); | ||
+ mXiaomiFingerprint.extCmd(android.os.SystemProperties.getInt("phh.xiaomi.fod.enrollment.id", 4), 0); | ||
+ } else if("1".equals(isFodPressed)) { | ||
+ Slog.d("PHH-Enroll", "Fod pressed!"); | ||
+ mXiaomiFingerprint.extCmd(android.os.SystemProperties.getInt("phh.xiaomi.fod.enrollment.id", 4), 1); | ||
+ } | ||
+ } catch(Exception e) { | ||
+ Slog.d("PHH-Enroll", "Failed Xiaomi async extcmd", e); | ||
+ } | ||
+ } | ||
+ }; | ||
+ fodFileObserver.startWatching(); | ||
+ } | ||
} | ||
|
||
/** | ||
@@ -937,6 +972,18 @@ public class AuthService extends SystemService { | ||
return udfpsProps; | ||
} | ||
|
||
+ if(!TextUtils.isEmpty(android.os.SystemProperties.get("persist.vendor.sys.fp.fod.location.X_Y"))) { | ||
+ int[] udfpsProps = new int[3]; | ||
+ String[] coordinates = android.os.SystemProperties.get("persist.vendor.sys.fp.fod.location.X_Y").split(","); | ||
+ udfpsProps[0] = displayRealSize.x/2; | ||
+ udfpsProps[1] = Integer.parseInt(coordinates[1]) + 100; | ||
+ | ||
+ String[] widthHeight = android.os.SystemProperties.get("persist.vendor.sys.fp.fod.size.width_height").split(","); | ||
+ | ||
+ udfpsProps[2] = (Integer.parseInt(widthHeight[0]) /2); | ||
+ return udfpsProps; | ||
+ } | ||
+ | ||
return new int[0]; | ||
} | ||
|
||
-- | ||
2.34.1 | ||
|
Oops, something went wrong.