aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeun young Park <keunyoung@google.com>2019-12-19 18:25:14 -0800
committerKeun young Park <keunyoung@google.com>2020-03-19 12:02:09 -0700
commit1fd33fe5ba108a9edfe4766e8a773c59e9c232be (patch)
treed655d4a6c6412b0bd165f536c23674c0beec4ae1
parent5a210fad74494d69c13b7d26b8becdc01a8e890d (diff)
downloadCar-1fd33fe5ba108a9edfe4766e8a773c59e9c232be.tar.gz
Read DISABLED_OPTIONAL_FEATURES from vhal for feature disabling
- The property is used to disable specific optional features. - Optional features declared in car service's config_allowed_optional_car_features resource. - VHAL can detect the H/W varation and disable specific feature for that H/W. - VHAL access was refactored as vhal access should be done before ICarImpl.init() phase. - Also refactored vhal's init part so that all HalServices, except PropertyHalService, return fixed list of supported features. This reduces unnecessary iteration of all properties, which can bring performance issue for large number of properties. Bug: 144504820 Test: run added test, atest com.android.car.CarFeatureControllerTest Change-Id: Ieee1caa0ffb22e1de4b4992b7528bf2d0d44a473
-rw-r--r--service/src/com/android/car/CarFeatureController.java8
-rw-r--r--service/src/com/android/car/CarServiceUtils.java3
-rw-r--r--service/src/com/android/car/ICarImpl.java23
-rw-r--r--service/src/com/android/car/hal/DiagnosticHalService.java23
-rw-r--r--service/src/com/android/car/hal/HalServiceBase.java38
-rw-r--r--service/src/com/android/car/hal/InputHalService.java20
-rw-r--r--service/src/com/android/car/hal/PowerHalService.java28
-rw-r--r--service/src/com/android/car/hal/PropertyHalService.java20
-rw-r--r--service/src/com/android/car/hal/UserHalService.java42
-rw-r--r--service/src/com/android/car/hal/VehicleHal.java149
-rw-r--r--service/src/com/android/car/hal/VmsHalService.java25
-rw-r--r--tests/carservice_test/src/com/android/car/CarFeatureControllerTest.java109
-rw-r--r--tests/carservice_test/src/com/android/car/CarPropertyServiceTest.java2
-rw-r--r--tests/carservice_test/src/com/android/car/MockedCarTestBase.java19
-rw-r--r--tests/carservice_unit_test/src/com/android/car/CarPowerManagementServiceTest.java2
-rw-r--r--tests/carservice_unit_test/src/com/android/car/hal/InputHalServiceTest.java15
-rw-r--r--tests/carservice_unit_test/src/com/android/car/hal/UserHalServiceTest.java11
-rw-r--r--tests/carservice_unit_test/src/com/android/car/hal/VmsHalServiceTest.java8
18 files changed, 398 insertions, 147 deletions
diff --git a/service/src/com/android/car/CarFeatureController.java b/service/src/com/android/car/CarFeatureController.java
index 7a97231b6f..1b33331784 100644
--- a/service/src/com/android/car/CarFeatureController.java
+++ b/service/src/com/android/car/CarFeatureController.java
@@ -28,6 +28,7 @@ import android.util.AtomicFile;
import android.util.Log;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.annotations.VisibleForTesting;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@@ -135,6 +136,8 @@ public final class CarFeatureController implements CarServiceBase {
mContext = context;
mDefaultEnabledFeaturesFromConfig = Arrays.asList(defaultEnabledFeaturesFromConfig);
mDisabledFeaturesFromVhal = Arrays.asList(disabledFeaturesFromVhal);
+ Log.i(TAG, "mDefaultEnabledFeaturesFromConfig:" + mDefaultEnabledFeaturesFromConfig
+ + ",mDisabledFeaturesFromVhal:" + mDisabledFeaturesFromVhal);
mEnabledFeatures = new HashSet<>(MANDATORY_FEATURES);
mFeatureConfigFile = new AtomicFile(new File(dataDir, FEATURE_CONFIG_FILE_NAME), TAG);
boolean shouldLoadDefaultConfig = !mFeatureConfigFile.exists();
@@ -158,6 +161,11 @@ public final class CarFeatureController implements CarServiceBase {
}
}
+ @VisibleForTesting
+ List<String> getDisabledFeaturesFromVhal() {
+ return mDisabledFeaturesFromVhal;
+ }
+
@Override
public void init() {
// nothing should be done here. This should work with only constructor.
diff --git a/service/src/com/android/car/CarServiceUtils.java b/service/src/com/android/car/CarServiceUtils.java
index de474b94b9..12b721e1dd 100644
--- a/service/src/com/android/car/CarServiceUtils.java
+++ b/service/src/com/android/car/CarServiceUtils.java
@@ -30,6 +30,9 @@ import java.util.List;
/** Utility class */
public final class CarServiceUtils {
+ /** Empty int array */
+ public static final int[] EMPTY_INT_ARRAY = new int[0];
+
private static final String PACKAGE_NOT_FOUND = "Package not found:";
/** do not construct. static only */
diff --git a/service/src/com/android/car/ICarImpl.java b/service/src/com/android/car/ICarImpl.java
index 8acfa87df9..8a17ac09cd 100644
--- a/service/src/com/android/car/ICarImpl.java
+++ b/service/src/com/android/car/ICarImpl.java
@@ -38,6 +38,8 @@ import android.hardware.automotive.vehicle.V2_0.IVehicle;
import android.hardware.automotive.vehicle.V2_0.InitialUserInfoResponseAction;
import android.hardware.automotive.vehicle.V2_0.UsersInfo;
import android.hardware.automotive.vehicle.V2_0.VehicleArea;
+import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
+import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
@@ -90,6 +92,8 @@ public class ICarImpl extends ICar.Stub {
public static final String INTERNAL_SYSTEM_ACTIVITY_MONITORING_SERVICE =
"system_activity_monitoring";
+ private static final int INITIAL_VHAL_GET_RETRY = 2;
+
private final Context mContext;
private final VehicleHal mHal;
@@ -163,14 +167,25 @@ public class ICarImpl extends ICar.Stub {
mContext = serviceContext;
mSystemInterface = systemInterface;
mHal = new VehicleHal(serviceContext, vehicle);
+ // Do this before any other service components to allow feature check. It should work
+ // even without init. For that, vhal get is retried as it can be too early.
+ VehiclePropValue disabledOptionalFeatureValue = mHal.getIfAvailableOrFailForEarlyStage(
+ VehicleProperty.DISABLED_OPTIONAL_FEATURES, INITIAL_VHAL_GET_RETRY);
+ String[] disabledFeaturesFromVhal = null;
+ if (disabledOptionalFeatureValue != null) {
+ String disabledFeatures = disabledOptionalFeatureValue.value.stringValue;
+ if (disabledFeatures != null && !disabledFeatures.isEmpty()) {
+ disabledFeaturesFromVhal = disabledFeatures.split(",");
+ }
+ }
+ if (disabledFeaturesFromVhal == null) {
+ disabledFeaturesFromVhal = new String[0];
+ }
Resources res = mContext.getResources();
String[] defaultEnabledFeatures = res.getStringArray(
R.array.config_allowed_optional_car_features);
- // Do this before any other service components to allow feature check. It should work
- // even without init.
- // TODO (b/144504820) Add vhal plumbing
mFeatureController = new CarFeatureController(serviceContext, defaultEnabledFeatures,
- /* disabledFeaturesFromVhal= */ new String[0], mSystemInterface.getSystemCarDir());
+ disabledFeaturesFromVhal , mSystemInterface.getSystemCarDir());
CarLocalServices.addService(CarFeatureController.class, mFeatureController);
mVehicleInterfaceName = vehicleInterfaceName;
mUserManagerHelper = new CarUserManagerHelper(serviceContext);
diff --git a/service/src/com/android/car/hal/DiagnosticHalService.java b/service/src/com/android/car/hal/DiagnosticHalService.java
index b248ac06ea..fed4eca533 100644
--- a/service/src/com/android/car/hal/DiagnosticHalService.java
+++ b/service/src/com/android/car/hal/DiagnosticHalService.java
@@ -48,9 +48,17 @@ import java.util.concurrent.CopyOnWriteArraySet;
* Diagnostic HAL service supporting gathering diagnostic info from VHAL and translating it into
* higher-level semantic information
*/
-public class DiagnosticHalService extends HalServiceBase{
+public class DiagnosticHalService extends HalServiceBase {
static final int OBD2_SELECTIVE_FRAME_CLEAR = 1;
static final boolean DEBUG = false;
+
+ private static final int[] SUPPORTED_PROPERTIES = new int[]{
+ VehicleProperty.OBD2_LIVE_FRAME,
+ VehicleProperty.OBD2_FREEZE_FRAME,
+ VehicleProperty.OBD2_FREEZE_FRAME_INFO,
+ VehicleProperty.OBD2_FREEZE_FRAME_CLEAR
+ };
+
private final Object mLock = new Object();
private final VehicleHal mVehicleHal;
@@ -111,13 +119,16 @@ public class DiagnosticHalService extends HalServiceBase{
}
@Override
- public Collection<VehiclePropConfig> takeSupportedProperties(
- Collection<VehiclePropConfig> allProperties) {
+ public int[] getAllSupportedProperties() {
+ return SUPPORTED_PROPERTIES;
+ }
+
+ @Override
+ public void takeProperties(Collection<VehiclePropConfig> properties) {
if (DEBUG) {
Log.d(CarLog.TAG_DIAGNOSTIC, "takeSupportedProperties");
}
- LinkedList<VehiclePropConfig> supportedProperties = new LinkedList<VehiclePropConfig>();
- for (VehiclePropConfig vp : allProperties) {
+ for (VehiclePropConfig vp : properties) {
int sensorType = getTokenForProperty(vp);
if (sensorType == NOT_SUPPORTED_PROPERTY) {
if (DEBUG) {
@@ -128,13 +139,11 @@ public class DiagnosticHalService extends HalServiceBase{
.toString());
}
} else {
- supportedProperties.add(vp);
synchronized (mLock) {
mSensorTypeToConfig.append(sensorType, vp);
}
}
}
- return supportedProperties;
}
/**
diff --git a/service/src/com/android/car/hal/HalServiceBase.java b/service/src/com/android/car/hal/HalServiceBase.java
index 1e2b6e4009..5e2e5bb520 100644
--- a/service/src/com/android/car/hal/HalServiceBase.java
+++ b/service/src/com/android/car/hal/HalServiceBase.java
@@ -17,14 +17,14 @@
package com.android.car.hal;
-import android.annotation.Nullable;
+import android.annotation.NonNull;
import android.hardware.automotive.vehicle.V2_0.VehiclePropConfig;
import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
import android.util.Log;
import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.LinkedList;
import java.util.List;
/**
@@ -37,7 +37,7 @@ public abstract class HalServiceBase {
private static final String MY_TAG = HalServiceBase.class.getSimpleName();
/** For dispatching events. Kept here to avoid alloc every time */
- private final LinkedList<VehiclePropValue> mDispatchList = new LinkedList<VehiclePropValue>();
+ private final ArrayList<VehiclePropValue> mDispatchList = new ArrayList<>(1);
final static int NOT_SUPPORTED_PROPERTY = -1;
@@ -52,16 +52,36 @@ public abstract class HalServiceBase {
public abstract void release();
/**
- * Takes the supported properties from given {@code allProperties} and return List of supported
- * properties (or {@code null} are supported.
+ * Returns all property IDs this HalService can support. If return value is empty,
+ * {@link #isSupportedProperty(int)} is used to query support for each property.
*/
- @Nullable
- public Collection<VehiclePropConfig> takeSupportedProperties(
- Collection<VehiclePropConfig> allProperties) {
- return null;
+ @NonNull
+ public abstract int[] getAllSupportedProperties();
+
+ /**
+ * Checks if given {@code propId} is supported.
+ */
+ public boolean isSupportedProperty(int propId) {
+ for (int supported: getAllSupportedProperties()) {
+ if (propId == supported) {
+ return true;
+ }
+ }
+ return false;
}
/**
+ * Takes the passed properties. Passed properties are a subset of properties returned from
+ * {@link #getAllSupportedProperties()} and are supported in the current device.
+ *
+ * @param properties properties that are available in this device. This is guaranteed to be
+ * supported by the HalService as the list is filtered with
+ * {@link #getAllSupportedProperties()} or {@link #isSupportedProperty(int)}.
+ * It can be empty if no property is available.
+ */
+ public abstract void takeProperties(@NonNull Collection<VehiclePropConfig> properties);
+
+ /**
* Handles property changes from HAL.
*/
public abstract void onHalEvents(List<VehiclePropValue> values);
diff --git a/service/src/com/android/car/hal/InputHalService.java b/service/src/com/android/car/hal/InputHalService.java
index 139ca6b8c8..d6e3750f82 100644
--- a/service/src/com/android/car/hal/InputHalService.java
+++ b/service/src/com/android/car/hal/InputHalService.java
@@ -39,7 +39,6 @@ import com.android.internal.annotations.VisibleForTesting;
import java.io.PrintWriter;
import java.util.Collection;
-import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.LongSupplier;
@@ -49,6 +48,11 @@ public class InputHalService extends HalServiceBase {
public static final int DISPLAY_MAIN = VehicleDisplay.MAIN;
public static final int DISPLAY_INSTRUMENT_CLUSTER = VehicleDisplay.INSTRUMENT_CLUSTER;
+ private static final int[] SUPPORTED_PROPERTIES = new int[] {
+ HW_KEY_INPUT,
+ HW_ROTARY_INPUT
+ };
+
private final VehicleHal mHal;
/**
@@ -146,26 +150,26 @@ public class InputHalService extends HalServiceBase {
}
@Override
- public Collection<VehiclePropConfig> takeSupportedProperties(
- Collection<VehiclePropConfig> allProperties) {
- List<VehiclePropConfig> supported = new LinkedList<>();
- for (VehiclePropConfig property : allProperties) {
+ public int[] getAllSupportedProperties() {
+ return SUPPORTED_PROPERTIES;
+ }
+
+ @Override
+ public void takeProperties(Collection<VehiclePropConfig> properties) {
+ for (VehiclePropConfig property : properties) {
switch (property.prop) {
case HW_KEY_INPUT:
- supported.add(property);
synchronized (mLock) {
mKeyInputSupported = true;
}
break;
case HW_ROTARY_INPUT:
- supported.add(property);
synchronized (mLock) {
mRotaryInputSupported = true;
}
break;
}
}
- return supported;
}
@Override
diff --git a/service/src/com/android/car/hal/PowerHalService.java b/service/src/com/android/car/hal/PowerHalService.java
index 8f6ac9fca2..3e27bdae3f 100644
--- a/service/src/com/android/car/hal/PowerHalService.java
+++ b/service/src/com/android/car/hal/PowerHalService.java
@@ -46,6 +46,12 @@ public class PowerHalService extends HalServiceBase {
// Set display brightness from 0-100%
public static final int MAX_BRIGHTNESS = 100;
+ private static final int[] SUPPORTED_PROPERTIES = new int[]{
+ AP_POWER_STATE_REQ,
+ AP_POWER_STATE_REPORT,
+ DISPLAY_BRIGHTNESS
+ };
+
@VisibleForTesting
public static final int SET_WAIT_FOR_VHAL = VehicleApPowerStateReport.WAIT_FOR_VHAL;
@VisibleForTesting
@@ -373,19 +379,19 @@ public class PowerHalService extends HalServiceBase {
}
@Override
- public Collection<VehiclePropConfig> takeSupportedProperties(
- Collection<VehiclePropConfig> allProperties) {
+ public int[] getAllSupportedProperties() {
+ return SUPPORTED_PROPERTIES;
+ }
+
+ @Override
+ public void takeProperties(Collection<VehiclePropConfig> properties) {
+ if (properties.isEmpty()) {
+ return;
+ }
synchronized (mLock) {
- for (VehiclePropConfig config : allProperties) {
- switch (config.prop) {
- case AP_POWER_STATE_REQ:
- case AP_POWER_STATE_REPORT:
- case DISPLAY_BRIGHTNESS:
- mProperties.put(config.prop, config);
- break;
- }
+ for (VehiclePropConfig config : properties) {
+ mProperties.put(config.prop, config);
}
- return new LinkedList<>(mProperties.values());
}
}
diff --git a/service/src/com/android/car/hal/PropertyHalService.java b/service/src/com/android/car/hal/PropertyHalService.java
index b0f1582004..990eee00e3 100644
--- a/service/src/com/android/car/hal/PropertyHalService.java
+++ b/service/src/com/android/car/hal/PropertyHalService.java
@@ -34,6 +34,7 @@ import android.hardware.automotive.vehicle.V2_0.VehiclePropertyType;
import android.util.Log;
import android.util.SparseArray;
+import com.android.car.CarServiceUtils;
import com.android.internal.annotations.GuardedBy;
import java.io.PrintWriter;
@@ -313,12 +314,19 @@ public class PropertyHalService extends HalServiceBase {
}
@Override
- public Collection<VehiclePropConfig> takeSupportedProperties(
- Collection<VehiclePropConfig> allProperties) {
- List<VehiclePropConfig> taken = new LinkedList<>();
+ public boolean isSupportedProperty(int propId) {
+ return mPropIds.isSupportedProperty(propId);
+ }
+
+ @Override
+ public int[] getAllSupportedProperties() {
+ return CarServiceUtils.EMPTY_INT_ARRAY;
+ }
+
+ @Override
+ public void takeProperties(Collection<VehiclePropConfig> allProperties) {
for (VehiclePropConfig p : allProperties) {
if (mPropIds.isSupportedProperty(p.prop)) {
- taken.add(p);
synchronized (mLock) {
mPropConfigSparseArray.put(p.prop, p);
}
@@ -328,7 +336,8 @@ public class PropertyHalService extends HalServiceBase {
}
}
if (mDbg) {
- Log.d(TAG, "takeSupportedProperties() took " + taken.size() + " properties");
+ Log.d(TAG, "takeSupportedProperties() took " + allProperties.size()
+ + " properties");
}
// If vehicle hal support to select permission for vendor properties.
VehiclePropConfig customizePermission;
@@ -339,7 +348,6 @@ public class PropertyHalService extends HalServiceBase {
if (customizePermission != null) {
mPropIds.customizeVendorPermission(customizePermission.configArray);
}
- return taken;
}
@Override
diff --git a/service/src/com/android/car/hal/UserHalService.java b/service/src/com/android/car/hal/UserHalService.java
index de65b34078..a22c8c7211 100644
--- a/service/src/com/android/car/hal/UserHalService.java
+++ b/service/src/com/android/car/hal/UserHalService.java
@@ -45,7 +45,6 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.Preconditions;
import java.io.PrintWriter;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
@@ -60,6 +59,10 @@ public final class UserHalService extends HalServiceBase {
private static final String TAG = UserHalService.class.getSimpleName();
+ private static final int[] SUPPORTED_PROPERTIES = new int[]{
+ INITIAL_USER_INFO
+ };
+
// TODO(b/150413515): STOPSHIP - change to false before R is launched
private static final boolean DBG = true;
@@ -96,6 +99,10 @@ public final class UserHalService extends HalServiceBase {
public void init() {
if (DBG) Log.d(TAG, "init()");
+ if (mProperties == null) {
+ return;
+ }
+
int size = mProperties.size();
for (int i = 0; i < size; i++) {
VehiclePropConfig config = mProperties.valueAt(i);
@@ -135,31 +142,24 @@ public final class UserHalService extends HalServiceBase {
}
@Override
- @Nullable
- public Collection<VehiclePropConfig> takeSupportedProperties(
- Collection<VehiclePropConfig> allProperties) {
- boolean supported = false;
- // TODO(b/150413515): increase capacity once it supports more
- SparseArray<VehiclePropConfig> properties = new SparseArray<>(1);
- ArrayList<VehiclePropConfig> taken = new ArrayList<>();
- for (VehiclePropConfig config : allProperties) {
- switch (config.prop) {
- case INITIAL_USER_INFO:
- supported = true;
- taken.add(config);
- properties.put(config.prop, config);
- break;
- }
+ public int[] getAllSupportedProperties() {
+ return SUPPORTED_PROPERTIES;
+ }
- }
- if (!supported) {
+ @Override
+ public void takeProperties(Collection<VehiclePropConfig> properties) {
+ if (properties.isEmpty()) {
Log.w(TAG, UNSUPPORTED_MSG);
- return null;
+ return;
+ }
+ // TODO(b/150413515): increase capacity once it supports more
+ SparseArray<VehiclePropConfig> supportedProperties = new SparseArray<>(1);
+ for (VehiclePropConfig config : properties) {
+ supportedProperties.put(config.prop, config);
}
synchronized (mLock) {
- mProperties = properties;
+ mProperties = supportedProperties;
}
- return taken;
}
/**
diff --git a/service/src/com/android/car/hal/VehicleHal.java b/service/src/com/android/car/hal/VehicleHal.java
index 318889d3e2..55eff7bd16 100644
--- a/service/src/com/android/car/hal/VehicleHal.java
+++ b/service/src/com/android/car/hal/VehicleHal.java
@@ -23,6 +23,7 @@ import static com.android.car.CarServiceUtils.toIntArray;
import static java.lang.Integer.toHexString;
import android.annotation.CheckResult;
+import android.annotation.Nullable;
import android.car.hardware.property.CarPropertyManager;
import android.content.Context;
import android.hardware.automotive.vehicle.V2_0.IVehicle;
@@ -38,12 +39,14 @@ import android.hardware.automotive.vehicle.V2_0.VehiclePropertyChangeMode;
import android.hardware.automotive.vehicle.V2_0.VehiclePropertyType;
import android.os.HandlerThread;
import android.os.RemoteException;
+import android.os.ServiceSpecificException;
import android.os.SystemClock;
import android.util.ArraySet;
import android.util.Log;
import android.util.SparseArray;
import com.android.car.CarLog;
+import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.google.android.collect.Lists;
@@ -54,10 +57,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.stream.Collectors;
/**
@@ -80,15 +81,23 @@ public class VehicleHal extends IVehicleCallback.Stub {
private final UserHalService mUserHal;
private DiagnosticHalService mDiagnosticHal = null;
+ private final Object mLock = new Object();
+
/** Might be re-assigned if Vehicle HAL is reconnected. */
private volatile HalClient mHalClient;
/** Stores handler for each HAL property. Property events are sent to handler. */
+ @GuardedBy("mLock")
private final SparseArray<HalServiceBase> mPropertyHandlers = new SparseArray<>();
/** This is for iterating all HalServices with fixed order. */
+ @GuardedBy("mLock")
private final ArrayList<HalServiceBase> mAllServices = new ArrayList<>();
+ @GuardedBy("mLock")
private final HashMap<Integer, SubscribeOptions> mSubscribedProperties = new HashMap<>();
+ @GuardedBy("mLock")
private final HashMap<Integer, VehiclePropConfig> mAllProperties = new HashMap<>();
+
+ @GuardedBy("mLock")
private final HashMap<Integer, VehiclePropertyEventInfo> mEventLog = new HashMap<>();
// Used by injectVHALEvent for testing purposes. Delimiter for an array of data
@@ -106,10 +115,10 @@ public class VehicleHal extends IVehicleCallback.Stub {
mUserHal = new UserHalService(this);
mAllServices.addAll(Arrays.asList(mPowerHal,
mInputHal,
- mPropertyHal,
mDiagnosticHal,
mVmsHal,
- mUserHal));
+ mUserHal,
+ mPropertyHal)); // mPropertyHal should be the last.
mHalClient = new HalClient(vehicle, mHandlerThread.getLooper(), this /*IVehicleCallback*/);
}
@@ -130,7 +139,7 @@ public class VehicleHal extends IVehicleCallback.Stub {
}
public void vehicleHalReconnected(IVehicle vehicle) {
- synchronized (this) {
+ synchronized (mLock) {
mHalClient = new HalClient(vehicle, mHandlerThread.getLooper(),
this /*IVehicleCallback*/);
@@ -145,37 +154,72 @@ public class VehicleHal extends IVehicleCallback.Stub {
}
}
- public void init() {
- Set<VehiclePropConfig> properties;
+ private void fetchAllPropConfigs() {
+ synchronized (mLock) {
+ if (!mAllProperties.isEmpty()) { // already set
+ Log.i(CarLog.TAG_HAL, "fetchAllPropConfigs already fetched");
+ return;
+ }
+ }
+ ArrayList<VehiclePropConfig> configs;
try {
- properties = new HashSet<>(mHalClient.getAllPropConfigs());
+ configs = mHalClient.getAllPropConfigs();
+ if (configs == null || configs.size() == 0) {
+ Log.e(CarLog.TAG_HAL, "getAllPropConfigs returned empty configs");
+ return;
+ }
} catch (RemoteException e) {
throw new RuntimeException("Unable to retrieve vehicle property configuration", e);
}
- synchronized (this) {
+ synchronized (mLock) {
// Create map of all properties
- for (VehiclePropConfig p : properties) {
+ for (VehiclePropConfig p : configs) {
+ if (DBG) {
+ Log.i(CarLog.TAG_HAL, "Add config for prop:" + Integer.toHexString(p.prop)
+ + " config:" + p);
+ }
mAllProperties.put(p.prop, p);
}
}
+ }
- for (HalServiceBase service: mAllServices) {
- Collection<VehiclePropConfig> taken = service.takeSupportedProperties(properties);
- if (taken == null) {
- Log.w(CarLog.TAG_HAL, "HalService " + service + " didn't take any property");
- continue;
- }
- if (DBG) {
- Log.i(CarLog.TAG_HAL, "HalService " + service + " took " + taken.size()
- + " properties ");
- }
- synchronized (this) {
- for (VehiclePropConfig p: taken) {
- mPropertyHandlers.append(p.prop, service);
+ /**
+ * Inits the vhal configurations.
+ *
+ * <p><Note that {@link #getIfAvailableOrFailForEarlyStage(int, int)}
+ * can be called before {@code init()}.
+ */
+ public void init() {
+ fetchAllPropConfigs();
+
+ // PropertyHalService will take most properties, so make it big enough.
+ ArrayList<VehiclePropConfig> configsForService = new ArrayList<>(mAllServices.size());
+ for (int i = 0; i < mAllServices.size(); i++) {
+ HalServiceBase service = mAllServices.get(i);
+ int[] supportedProps = service.getAllSupportedProperties();
+ configsForService.clear();
+ synchronized (mLock) {
+ if (supportedProps.length == 0) {
+ for (Integer propId : mAllProperties.keySet()) {
+ if (service.isSupportedProperty(propId)) {
+ VehiclePropConfig config = mAllProperties.get(propId);
+ mPropertyHandlers.append(propId, service);
+ configsForService.add(config);
+ }
+ }
+ } else {
+ for (int prop : supportedProps) {
+ VehiclePropConfig config = mAllProperties.get(prop);
+ if (config == null) {
+ continue;
+ }
+ mPropertyHandlers.append(prop, service);
+ configsForService.add(config);
+ }
}
}
- properties.removeAll(taken);
+ service.takeProperties(configsForService);
service.init();
}
}
@@ -185,7 +229,7 @@ public class VehicleHal extends IVehicleCallback.Stub {
for (int i = mAllServices.size() - 1; i >= 0; i--) {
mAllServices.get(i).release();
}
- synchronized (this) {
+ synchronized (mLock) {
for (int p : mSubscribedProperties.keySet()) {
try {
mHalClient.unsubscribe(p);
@@ -263,7 +307,7 @@ public class VehicleHal extends IVehicleCallback.Stub {
+ ", property: 0x" + toHexString(property));
}
VehiclePropConfig config;
- synchronized (this) {
+ synchronized (mLock) {
config = mAllProperties.get(property);
}
@@ -275,7 +319,7 @@ public class VehicleHal extends IVehicleCallback.Stub {
opts.propId = property;
opts.sampleRate = samplingRateHz;
opts.flags = flags;
- synchronized (this) {
+ synchronized (mLock) {
assertServiceOwnerLocked(service, property);
mSubscribedProperties.put(property, opts);
}
@@ -295,14 +339,14 @@ public class VehicleHal extends IVehicleCallback.Stub {
+ ", property: 0x" + toHexString(property));
}
VehiclePropConfig config;
- synchronized (this) {
+ synchronized (mLock) {
config = mAllProperties.get(property);
}
if (config == null) {
Log.e(CarLog.TAG_HAL, "unsubscribeProperty: property " + property + " does not exist");
} else if (isPropertySubscribable(config)) {
- synchronized (this) {
+ synchronized (mLock) {
assertServiceOwnerLocked(service, property);
mSubscribedProperties.remove(property);
}
@@ -318,13 +362,48 @@ public class VehicleHal extends IVehicleCallback.Stub {
}
public boolean isPropertySupported(int propertyId) {
- return mAllProperties.containsKey(propertyId);
+ synchronized (mLock) {
+ return mAllProperties.containsKey(propertyId);
+ }
}
- public Collection<VehiclePropConfig> getAllPropConfigs() {
- return mAllProperties.values();
+ /**
+ * Gets given property with retries.
+ *
+ * <p>If getting the property fails after all retries, it will throw
+ * {@code IllegalStateException}. If the property does not exist, it will simply return
+ * {@code null}.
+ */
+ public @Nullable VehiclePropValue getIfAvailableOrFail(int propertyId, int numberOfRetries) {
+ if (!isPropertySupported(propertyId)) {
+ return null;
+ }
+ VehiclePropValue value;
+ for (int i = 0; i < numberOfRetries; i++) {
+ try {
+ return get(propertyId);
+ } catch (ServiceSpecificException e) {
+ Log.e(CarLog.TAG_HAL, "Cannot get property:" + propertyId, e);
+ }
+ }
+ throw new IllegalStateException("Cannot get property:" + propertyId
+ + " after " + numberOfRetries + " retries");
+ }
+
+ /**
+ * This works similar to {@link #getIfAvailableOrFail(int, int)} except that this can be called
+ * before {@code init()} is called.
+ *
+ * <p>This call will check if requested vhal property is supported by querying directly to vhal
+ * and can have worse performance. Use this only for accessing vhal properties before
+ * {@code ICarImpl.init()} phase.
+ */
+ public @Nullable VehiclePropValue getIfAvailableOrFailForEarlyStage(int propertyId,
+ int numberOfRetries) {
+ fetchAllPropConfigs();
+ return getIfAvailableOrFail(propertyId, numberOfRetries);
}
-
+
public VehiclePropValue get(int propertyId) {
return get(propertyId, NO_AREA);
}
@@ -431,7 +510,7 @@ public class VehicleHal extends IVehicleCallback.Stub {
@Override
public void onPropertyEvent(ArrayList<VehiclePropValue> propValues) {
- synchronized (this) {
+ synchronized (mLock) {
for (VehiclePropValue v : propValues) {
HalServiceBase service = mPropertyHandlers.get(v.prop);
if(service == null) {
@@ -586,7 +665,7 @@ public class VehicleHal extends IVehicleCallback.Stub {
*/
public void dumpPropertyConfigs(PrintWriter writer, String propId) {
List<VehiclePropConfig> configList;
- synchronized (this) {
+ synchronized (mLock) {
configList = new ArrayList<>(mAllProperties.values());
}
diff --git a/service/src/com/android/car/hal/VmsHalService.java b/service/src/com/android/car/hal/VmsHalService.java
index 7f130ba9d2..55e3e70820 100644
--- a/service/src/com/android/car/hal/VmsHalService.java
+++ b/service/src/com/android/car/hal/VmsHalService.java
@@ -59,7 +59,6 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -76,6 +75,9 @@ public class VmsHalService extends HalServiceBase {
private static final boolean DBG = false;
private static final String TAG = "VmsHalService";
private static final int HAL_PROPERTY_ID = VehicleProperty.VEHICLE_MAP_SERVICE;
+ private static final int[] SUPPORTED_PROPERTIES = new int[]{
+ HAL_PROPERTY_ID
+ };
private static final int NUM_INTEGERS_IN_VMS_LAYER = 3;
private static final int UNKNOWN_CLIENT_ID = -1;
private static final byte[] DEFAULT_PUBLISHER_INFO = new byte[0];
@@ -170,17 +172,18 @@ public class VmsHalService extends HalServiceBase {
}
@Override
- public Collection<VehiclePropConfig> takeSupportedProperties(
- Collection<VehiclePropConfig> allProperties) {
- for (VehiclePropConfig p : allProperties) {
- if (p.prop == HAL_PROPERTY_ID) {
- synchronized (mLock) {
- mIsSupported = true;
- }
- return Collections.singleton(p);
- }
+ public int[] getAllSupportedProperties() {
+ return SUPPORTED_PROPERTIES;
+ }
+
+ @Override
+ public void takeProperties(Collection<VehiclePropConfig> properties) {
+ if (properties.isEmpty()) {
+ return;
+ }
+ synchronized (mLock) {
+ mIsSupported = true;
}
- return Collections.emptySet();
}
@Override
diff --git a/tests/carservice_test/src/com/android/car/CarFeatureControllerTest.java b/tests/carservice_test/src/com/android/car/CarFeatureControllerTest.java
new file mode 100644
index 0000000000..5d508ca8f1
--- /dev/null
+++ b/tests/carservice_test/src/com/android/car/CarFeatureControllerTest.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.car;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.car.Car;
+import android.car.CarFeatures;
+import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
+import android.util.Log;
+
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.MediumTest;
+
+import com.android.car.vehiclehal.VehiclePropValueBuilder;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.List;
+
+@RunWith(AndroidJUnit4.class)
+@MediumTest
+public class CarFeatureControllerTest extends MockedCarTestBase {
+ private static final String TAG = CarFeatureControllerTest.class.getSimpleName();
+ private static final String[] ENABLED_OPTIONAL_FEATURES = {
+ CarFeatures.FEATURE_CAR_USER_NOTICE_SERVICE,
+ Car.STORAGE_MONITORING_SERVICE
+ };
+ private String mDisabledOptionalFeatures = "";
+
+ @Override
+ protected void configureMockedHal() {
+ Log.i(TAG, "mDisabledOptionalFeatures:" + mDisabledOptionalFeatures);
+ addProperty(VehicleProperty.DISABLED_OPTIONAL_FEATURES,
+ VehiclePropValueBuilder.newBuilder(VehicleProperty.DISABLED_OPTIONAL_FEATURES)
+ .setStringValue(mDisabledOptionalFeatures)
+ .build());
+ }
+
+ @Override
+ protected void configureResourceOverrides(MockResources resources) {
+ super.configureResourceOverrides(resources);
+ resources.overrideResource(com.android.car.R.array.config_allowed_optional_car_features,
+ ENABLED_OPTIONAL_FEATURES);
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ // Do nothing so that we can call super.setUp in test itself.
+ }
+
+ @Test
+ @UiThreadTest
+ public void testParsingVhalEmptyList() throws Exception {
+ super.setUp();
+ CarFeatureController featureController = CarLocalServices.getService(
+ CarFeatureController.class);
+ assertThat(featureController).isNotNull();
+ List<String> disabledFeatures = featureController.getDisabledFeaturesFromVhal();
+ assertThat(disabledFeatures).isEmpty();
+ }
+
+ @Test
+ @UiThreadTest
+ public void testParsingVhalMultipleEntries() throws Exception {
+ String[] disabledFeaturesExpected = {"com.aaa", "com.bbb"};
+ mDisabledOptionalFeatures = String.join(",", disabledFeaturesExpected);
+ super.setUp();
+ CarFeatureController featureController = CarLocalServices.getService(
+ CarFeatureController.class);
+ assertThat(featureController).isNotNull();
+ List<String> disabledFeatures = featureController.getDisabledFeaturesFromVhal();
+ assertThat(disabledFeatures).hasSize(disabledFeaturesExpected.length);
+ for (String feature: disabledFeaturesExpected) {
+ assertThat(disabledFeatures).contains(feature);
+ }
+ }
+
+ @Test
+ @UiThreadTest
+ public void testUserNoticeDisabledFromVhal() throws Exception {
+ mDisabledOptionalFeatures = CarFeatures.FEATURE_CAR_USER_NOTICE_SERVICE;
+ super.setUp();
+ CarFeatureController featureController = CarLocalServices.getService(
+ CarFeatureController.class);
+ assertThat(featureController).isNotNull();
+ List<String> disabledFeatures = featureController.getDisabledFeaturesFromVhal();
+ assertThat(disabledFeatures).contains(CarFeatures.FEATURE_CAR_USER_NOTICE_SERVICE);
+ assertThat(featureController.isFeatureEnabled(CarFeatures.FEATURE_CAR_USER_NOTICE_SERVICE))
+ .isFalse();
+ assertThat(featureController.isFeatureEnabled(Car.STORAGE_MONITORING_SERVICE)).isTrue();
+ }
+}
diff --git a/tests/carservice_test/src/com/android/car/CarPropertyServiceTest.java b/tests/carservice_test/src/com/android/car/CarPropertyServiceTest.java
index 2d5c1c2669..0dbe369ec6 100644
--- a/tests/carservice_test/src/com/android/car/CarPropertyServiceTest.java
+++ b/tests/carservice_test/src/com/android/car/CarPropertyServiceTest.java
@@ -93,7 +93,7 @@ public class CarPropertyServiceTest extends MockedCarTestBase {
}
@Override
- protected synchronized void spyOnInitMockedHal() {
+ protected synchronized void spyOnBeforeCarImplInit() {
mService = getCarPropertyService();
assertThat(mService).isNotNull();
spyOn(mService);
diff --git a/tests/carservice_test/src/com/android/car/MockedCarTestBase.java b/tests/carservice_test/src/com/android/car/MockedCarTestBase.java
index 99f5708643..dbb4ca0ba1 100644
--- a/tests/carservice_test/src/com/android/car/MockedCarTestBase.java
+++ b/tests/carservice_test/src/com/android/car/MockedCarTestBase.java
@@ -119,7 +119,7 @@ public class MockedCarTestBase {
protected synchronized void configureMockedHal() {
}
- protected synchronized void spyOnInitMockedHal() {
+ protected synchronized void spyOnBeforeCarImplInit() {
}
protected synchronized SystemInterface.Builder getSystemInterfaceBuilder() {
@@ -211,11 +211,14 @@ public class MockedCarTestBase {
// This prevents one test failure in tearDown from triggering assertion failure for single
// CarLocalServices service.
CarLocalServices.removeAllServices();
+
+ // This should be done here as feature property is accessed inside the constructor.
+ initMockedHal();
mCarImpl = new ICarImpl(mMockedCarTestContext, mMockedVehicleHal, mFakeSystemInterface,
/* errorNotifier= */ null , "MockedCar", mCarUserService, mCarWatchdogService);
- spyOnInitMockedHal();
- initMockedHal(mCarImpl, false /* no need to release */);
+ spyOnBeforeCarImplInit();
+ mCarImpl.init();
mCar = new Car(mMockedCarTestContext, mCarImpl, null /* handler */);
}
@@ -252,20 +255,16 @@ public class MockedCarTestBase {
}
protected synchronized void reinitializeMockedHal() throws Exception {
- initMockedHal(mCarImpl, true /* release */);
+ mCarImpl.release();
+ initMockedHal();
}
- private synchronized void initMockedHal(ICarImpl carImpl, boolean release) throws Exception {
- if (release) {
- carImpl.release();
- }
-
+ private synchronized void initMockedHal() throws Exception {
for (Map.Entry<VehiclePropConfigBuilder, VehicleHalPropertyHandler> entry
: mHalConfig.entrySet()) {
mMockedVehicleHal.addProperty(entry.getKey().build(), entry.getValue());
}
mHalConfig.clear();
- carImpl.init();
}
protected synchronized VehiclePropConfigBuilder addProperty(int propertyId,
diff --git a/tests/carservice_unit_test/src/com/android/car/CarPowerManagementServiceTest.java b/tests/carservice_unit_test/src/com/android/car/CarPowerManagementServiceTest.java
index dbf1016136..d31fcb26bb 100644
--- a/tests/carservice_unit_test/src/com/android/car/CarPowerManagementServiceTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/CarPowerManagementServiceTest.java
@@ -243,7 +243,7 @@ public class CarPowerManagementServiceTest {
// start with display off
mSystemInterface.setDisplayState(false);
mDisplayInterface.waitForDisplayStateChange(WAIT_TIMEOUT_MS);
- initTest();
+ initTestForUser10();
// Transition to ON state
mPowerHal.setCurrentPowerState(new PowerState(VehicleApPowerStateReq.ON, 0));
diff --git a/tests/carservice_unit_test/src/com/android/car/hal/InputHalServiceTest.java b/tests/carservice_unit_test/src/com/android/car/hal/InputHalServiceTest.java
index 9f68b39a8f..09c3d4addb 100644
--- a/tests/carservice_unit_test/src/com/android/car/hal/InputHalServiceTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/hal/InputHalServiceTest.java
@@ -49,7 +49,6 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.function.LongSupplier;
@@ -101,10 +100,8 @@ public class InputHalServiceTest {
HW_KEY_INPUT_CONFIG,
VehiclePropConfigBuilder.newBuilder(VehicleProperty.CURRENT_GEAR).build());
- Collection<VehiclePropConfig> takenProps =
- mInputHalService.takeSupportedProperties(offeredProps);
+ mInputHalService.takeProperties(offeredProps);
- assertThat(takenProps).containsExactly(HW_KEY_INPUT_CONFIG);
assertThat(mInputHalService.isKeyInputSupported()).isTrue();
assertThat(mInputHalService.isRotaryInputSupported()).isFalse();
}
@@ -116,10 +113,8 @@ public class InputHalServiceTest {
HW_ROTARY_INPUT_CONFIG,
VehiclePropConfigBuilder.newBuilder(VehicleProperty.CURRENT_GEAR).build());
- Collection<VehiclePropConfig> takenProps =
- mInputHalService.takeSupportedProperties(offeredProps);
+ mInputHalService.takeProperties(offeredProps);
- assertThat(takenProps).containsExactly(HW_ROTARY_INPUT_CONFIG);
assertThat(mInputHalService.isRotaryInputSupported()).isTrue();
assertThat(mInputHalService.isKeyInputSupported()).isFalse();
}
@@ -132,10 +127,8 @@ public class InputHalServiceTest {
HW_ROTARY_INPUT_CONFIG,
VehiclePropConfigBuilder.newBuilder(VehicleProperty.CURRENT_GEAR).build());
- Collection<VehiclePropConfig> takenProps =
- mInputHalService.takeSupportedProperties(offeredProps);
+ mInputHalService.takeProperties(offeredProps);
- assertThat(takenProps).containsExactly(HW_KEY_INPUT_CONFIG, HW_ROTARY_INPUT_CONFIG);
assertThat(mInputHalService.isKeyInputSupported()).isTrue();
assertThat(mInputHalService.isRotaryInputSupported()).isTrue();
}
@@ -333,7 +326,7 @@ public class InputHalServiceTest {
}
private void subscribeListener() {
- mInputHalService.takeSupportedProperties(ImmutableSet.of(HW_KEY_INPUT_CONFIG));
+ mInputHalService.takeProperties(ImmutableSet.of(HW_KEY_INPUT_CONFIG));
assertThat(mInputHalService.isKeyInputSupported()).isTrue();
mInputHalService.setInputListener(mInputListener);
diff --git a/tests/carservice_unit_test/src/com/android/car/hal/UserHalServiceTest.java b/tests/carservice_unit_test/src/com/android/car/hal/UserHalServiceTest.java
index 6776a9a32c..bf07c265fb 100644
--- a/tests/carservice_unit_test/src/com/android/car/hal/UserHalServiceTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/hal/UserHalServiceTest.java
@@ -54,7 +54,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -102,7 +102,7 @@ public final class UserHalServiceTest {
public void setFixtures() {
mUserHalService = new UserHalService(mVehicleHal);
mUserHalService
- .takeSupportedProperties(Arrays.asList(newSubscribableConfig(INITIAL_USER_INFO)));
+ .takeProperties(Arrays.asList(newSubscribableConfig(INITIAL_USER_INFO)));
mUser0.userId = 0;
mUser0.flags = 100;
@@ -121,10 +121,8 @@ public final class UserHalServiceTest {
// Cannot use mUserHalService because it's already set with supported properties
UserHalService myHalService = new UserHalService(mVehicleHal);
- List<VehiclePropConfig> input = Arrays.asList(newConfig(CURRENT_GEAR));
- Collection<VehiclePropConfig> output = myHalService.takeSupportedProperties(input);
+ myHalService.takeProperties(Collections.EMPTY_LIST);
assertThat(myHalService.isSupported()).isFalse();
- assertThat(output).isNull();
}
@Test
@@ -135,9 +133,8 @@ public final class UserHalServiceTest {
VehiclePropConfig unsupportedConfig = newConfig(CURRENT_GEAR);
VehiclePropConfig userInfoConfig = newSubscribableConfig(INITIAL_USER_INFO);
List<VehiclePropConfig> input = Arrays.asList(unsupportedConfig, userInfoConfig);
- Collection<VehiclePropConfig> output = myHalService.takeSupportedProperties(input);
+ myHalService.takeProperties(input);
assertThat(mUserHalService.isSupported()).isTrue();
- assertThat(output).containsExactly(userInfoConfig);
// Ideally there should be 2 test methods (one for takeSupportedProperties() and one for
// init()), but on "real life" VehicleHal calls these 2 methods in sequence, and the latter
diff --git a/tests/carservice_unit_test/src/com/android/car/hal/VmsHalServiceTest.java b/tests/carservice_unit_test/src/com/android/car/hal/VmsHalServiceTest.java
index c0657ba2da..dadcbadf76 100644
--- a/tests/carservice_unit_test/src/com/android/car/hal/VmsHalServiceTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/hal/VmsHalServiceTest.java
@@ -104,7 +104,7 @@ public class VmsHalServiceTest {
VehiclePropConfig propConfig = new VehiclePropConfig();
propConfig.prop = VehicleProperty.VEHICLE_MAP_SERVICE;
- mHalService.takeSupportedProperties(Collections.singleton(propConfig));
+ mHalService.takeProperties(Collections.singleton(propConfig));
when(mVmsClient.getAvailableLayers()).thenReturn(
new VmsAvailableLayers(Collections.emptySet(), 0));
@@ -156,7 +156,7 @@ public class VmsHalServiceTest {
VehiclePropConfig propConfig = new VehiclePropConfig();
propConfig.prop = VehicleProperty.VEHICLE_MAP_SERVICE;
- mHalService.takeSupportedProperties(Collections.singleton(propConfig));
+ mHalService.takeProperties(Collections.singleton(propConfig));
when(mVmsClient.getAvailableLayers()).thenReturn(
new VmsAvailableLayers(Collections.emptySet(), 0));
@@ -176,9 +176,7 @@ public class VmsHalServiceTest {
VehiclePropConfig otherPropConfig = new VehiclePropConfig();
otherPropConfig.prop = VehicleProperty.CURRENT_GEAR;
-
- assertEquals(Collections.singleton(vmsPropConfig),
- mHalService.takeSupportedProperties(Arrays.asList(otherPropConfig, vmsPropConfig)));
+ mHalService.takeProperties(Arrays.asList(vmsPropConfig));
}
/**