diff options
author | Yu-Han Yang <yuhany@google.com> | 2023-03-17 19:38:31 +0000 |
---|---|---|
committer | Yu-Han Yang <yuhany@google.com> | 2023-03-24 16:39:13 +0000 |
commit | 97d7113cbc8b64d4ce65055b8686e70e5dc92123 (patch) | |
tree | bb1943775e5468d9eca0f7168e565bcb16d716b0 | |
parent | 08b4bac5dd564b9c92eea72957b3b40b1c5b9f13 (diff) | |
download | base-97d7113cbc8b64d4ce65055b8686e70e5dc92123.tar.gz |
Loads gps_debug.conf from vendor path before system path
Bug: 269649649
Test: on device
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5496251e623aab0ee323129907353ea13e819eee)
Merged-In: Ibaa0b469bf62aae9af4d204ed371359babbe8da5
Change-Id: Ibaa0b469bf62aae9af4d204ed371359babbe8da5
NOTE FOR REVIEWERS - original patch and result patch are not identical.
PLEASE REVIEW CAREFULLY.
Diffs between the patches:
3,7 +53,9 @@
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
- private static final String DEBUG_PROPERTIES_FILE = "/etc/gps_debug.conf";
+ private static final String DEBUG_PROPERTIES_SYSTEM_FILE = "/etc/gps_debug.conf";
+
+ private static final String DEBUG_PROPERTIES_VENDOR_FILE = "/vendor/etc/gps_debug.conf";
// config.xml properties
private static final String CONFIG_SUPL_HOST = "SUPL_HOST";
@@ -225,7 +227,8 @@
/*
* Overlay carrier properties from a debug configuration file.
*/
- loadPropertiesFromGpsDebugConfig(mProperties);
+ loadPropertiesFromGpsDebugConfig(mProperties, DEBUG_PROPERTIES_VENDOR_FILE);
+ loadPropertiesFromGpsDebugConfig(mProperties, DEBUG_PROPERTIES_SYSTEM_FILE);
mEsExtensionSec = getRangeCheckedConfigEsExtensionSec();
logConfigurations();
@@ -331,9 +334,9 @@
}
}
- private void loadPropertiesFromGpsDebugConfig(Properties properties) {
+ private void loadPropertiesFromGpsDebugConfig(Properties properties, String filePath) {
try {
- File file = new File(DEBUG_PROPERTIES_FILE);
+ File file = new File(filePath);
FileInputStream stream = null;
try {
stream = new FileInputStream(file);
@@ -342,7 +345,7 @@
IoUtils.closeQuietly(stream);
}
} catch (IOException e) {
- if (DEBUG) Log.d(TAG, "Could not open GPS configuration file " + DEBUG_PROPERTIES_FILE);
+ if (DEBUG) Log.d(TAG, "Could not open GPS configuration file " + filePath);
}
}
Original patch:
From 5496251e623aab0ee323129907353ea13e819eee Mon Sep 17 00:00:00 2001
From: Yu-Han Yang <yuhany@google.com>
Date: Thu, 16 Mar 2023 22:11:36 +0000
Subject: [PATCH] Loads gps_debug.conf from vendor path before system path
Bug: 269649649
Test: on device
Change-Id: Ibaa0b469bf62aae9af4d204ed371359babbe8da5
---
-rw-r--r-- | services/core/java/com/android/server/location/gnss/GnssConfiguration.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/location/gnss/GnssConfiguration.java b/services/core/java/com/android/server/location/gnss/GnssConfiguration.java index 7db234a29942..859b42948a43 100644 --- a/services/core/java/com/android/server/location/gnss/GnssConfiguration.java +++ b/services/core/java/com/android/server/location/gnss/GnssConfiguration.java @@ -53,7 +53,9 @@ public class GnssConfiguration { private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); - private static final String DEBUG_PROPERTIES_FILE = "/etc/gps_debug.conf"; + private static final String DEBUG_PROPERTIES_SYSTEM_FILE = "/etc/gps_debug.conf"; + + private static final String DEBUG_PROPERTIES_VENDOR_FILE = "/vendor/etc/gps_debug.conf"; // config.xml properties private static final String CONFIG_SUPL_HOST = "SUPL_HOST"; @@ -225,7 +227,8 @@ public class GnssConfiguration { /* * Overlay carrier properties from a debug configuration file. */ - loadPropertiesFromGpsDebugConfig(mProperties); + loadPropertiesFromGpsDebugConfig(mProperties, DEBUG_PROPERTIES_VENDOR_FILE); + loadPropertiesFromGpsDebugConfig(mProperties, DEBUG_PROPERTIES_SYSTEM_FILE); mEsExtensionSec = getRangeCheckedConfigEsExtensionSec(); logConfigurations(); @@ -331,9 +334,9 @@ public class GnssConfiguration { } } - private void loadPropertiesFromGpsDebugConfig(Properties properties) { + private void loadPropertiesFromGpsDebugConfig(Properties properties, String filePath) { try { - File file = new File(DEBUG_PROPERTIES_FILE); + File file = new File(filePath); FileInputStream stream = null; try { stream = new FileInputStream(file); @@ -342,7 +345,7 @@ public class GnssConfiguration { IoUtils.closeQuietly(stream); } } catch (IOException e) { - if (DEBUG) Log.d(TAG, "Could not open GPS configuration file " + DEBUG_PROPERTIES_FILE); + if (DEBUG) Log.d(TAG, "Could not open GPS configuration file " + filePath); } } |