From e84123b1c2a1665636e101f86bec0cc3e6e785fa Mon Sep 17 00:00:00 2001 From: liupengle Date: Tue, 9 May 2023 14:27:59 +0800 Subject: [PATCH] Get input-port-associations config files from ODM partition 1.For fold devices, some necessary config files must be configured in vendor partition.These config files will effect some phones that has the same Soc. 2.Odm partition is intended for hardware SKUs. For GSI, odm partition can keep the logic of original design manufacturers. 3.Add getting input-port-associations.xml from odm partition. Bug: 276181381 Change-Id: I4486398b19749ada67f53645bc97cf6d8482c3c7 Signed-off-by: liupengle --- .../com/android/server/input/InputManagerService.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index 139217b91bd03..a614b6574e34c 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -3105,12 +3105,17 @@ public class InputManagerService extends IInputManager.Stub } /** - * Ports are highly platform-specific, so only allow these to be specified in the vendor + * Ports are highly platform-specific, so allow these to be specified in the odm/vendor * directory. */ private static Map loadStaticInputPortAssociations() { - final File baseDir = Environment.getVendorDirectory(); - final File confFile = new File(baseDir, PORT_ASSOCIATIONS_PATH); + File baseDir = Environment.getOdmDirectory(); + File confFile = new File(baseDir, PORT_ASSOCIATIONS_PATH); + + if (!confFile.exists()) { + baseDir = Environment.getVendorDirectory(); + confFile = new File(baseDir, PORT_ASSOCIATIONS_PATH); + } try (final InputStream stream = new FileInputStream(confFile)) { return ConfigurationProcessor.processInputPortAssociations(stream);