summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai2018-07-30 18:13:32 -0500
committerandroid-build-merger2018-07-30 18:13:32 -0500
commitf922b09a6031a5896a28ec33cb7718bb62fe0c20 (patch)
tree170e55b4bf1d370aadc7bea6a5492b31f47cca9f
parentb24e47e294bb379a8d842eff2b4305549993aaf3 (diff)
parent50191247deaa32508a5d230b9124ce9df74e0416 (diff)
downloadplatform-packages-services-car-f922b09a6031a5896a28ec33cb7718bb62fe0c20.tar.gz
platform-packages-services-car-f922b09a6031a5896a28ec33cb7718bb62fe0c20.tar.xz
platform-packages-services-car-f922b09a6031a5896a28ec33cb7718bb62fe0c20.zip
Merge "Cache CarPropertyConfigs in CarPropertyService" into pi-dev
am: 50191247de Change-Id: I9391fbba21b99188e14a6962c83bb4fe60c079b2
-rw-r--r--service/src/com/android/car/CarPropertyService.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/service/src/com/android/car/CarPropertyService.java b/service/src/com/android/car/CarPropertyService.java
index 785e5981..a01d4b87 100644
--- a/service/src/com/android/car/CarPropertyService.java
+++ b/service/src/com/android/car/CarPropertyService.java
@@ -137,6 +137,13 @@ public class CarPropertyService extends ICarProperty.Stub
137 137
138 @Override 138 @Override
139 public void init() { 139 public void init() {
140 if (mConfigs == null) {
141 // Cache the configs list to avoid subsequent binder calls
142 mConfigs = mHal.getPropertyList();
143 if (DBG) {
144 Log.d(TAG, "cache CarPropertyConfigs " + mConfigs.size());
145 }
146 }
140 } 147 }
141 148
142 @Override 149 @Override
@@ -159,9 +166,6 @@ public class CarPropertyService extends ICarProperty.Stub
159 if (DBG) { 166 if (DBG) {
160 Log.d(TAG, "registerListener: propId=0x" + toHexString(propId) + " rate=" + rate); 167 Log.d(TAG, "registerListener: propId=0x" + toHexString(propId) + " rate=" + rate);
161 } 168 }
162 if (mConfigs == null) {
163 mConfigs = mHal.getPropertyList();
164 }
165 if (mConfigs.get(propId) == null) { 169 if (mConfigs.get(propId) == null) {
166 // Do not attempt to register an invalid propId 170 // Do not attempt to register an invalid propId
167 Log.e(TAG, "registerListener: propId is not in config list: " + propId); 171 Log.e(TAG, "registerListener: propId is not in config list: " + propId);
@@ -285,15 +289,10 @@ public class CarPropertyService extends ICarProperty.Stub
285 289
286 /** 290 /**
287 * Return the list of properties that the caller may access. 291 * Return the list of properties that the caller may access.
288 * Should be called before get/setProperty().
289 */ 292 */
290 @Override 293 @Override
291 public List<CarPropertyConfig> getPropertyList() { 294 public List<CarPropertyConfig> getPropertyList() {
292 List<CarPropertyConfig> returnList = new ArrayList<CarPropertyConfig>(); 295 List<CarPropertyConfig> returnList = new ArrayList<CarPropertyConfig>();
293 if (mConfigs == null) {
294 // Cache the configs list to avoid subsequent binder calls
295 mConfigs = mHal.getPropertyList();
296 }
297 for (CarPropertyConfig c : mConfigs.values()) { 296 for (CarPropertyConfig c : mConfigs.values()) {
298 if (ICarImpl.hasPermission(mContext, mHal.getReadPermission(c.getPropertyId()))) { 297 if (ICarImpl.hasPermission(mContext, mHal.getReadPermission(c.getPropertyId()))) {
299 // Only add properties the list if the process has permissions to read it 298 // Only add properties the list if the process has permissions to read it