Customize permissions for vendor property
Add a new property, vendors can use the configArray in the property
to chose permission for each vendor property.
Add testCase into CarPropertyTest
Bug: 109950289
Test: flash HU with google vhal and run vts
Change-Id: I40c22d35008d576a04807fd3df100a3422d3b5ff
diff --git a/car-lib/api/system-current.txt b/car-lib/api/system-current.txt
index c980faa..584d527 100644
--- a/car-lib/api/system-current.txt
+++ b/car-lib/api/system-current.txt
@@ -41,6 +41,7 @@
field public static final String PERMISSION_EXTERIOR_LIGHTS = "android.car.permission.CAR_EXTERIOR_LIGHTS";
field public static final String PERMISSION_MILEAGE = "android.car.permission.CAR_MILEAGE";
field @Deprecated public static final String PERMISSION_MOCK_VEHICLE_HAL = "android.car.permission.CAR_MOCK_VEHICLE_HAL";
+ field public static final String PERMISSION_READ_CAR_VENDOR_PERMISSION_INFO = "android.car.permission.READ_CAR_VENDOR_PERMISSION_INFO";
field public static final String PERMISSION_RECEIVE_CAR_AUDIO_DUCKING_EVENTS = "android.car.permission.RECEIVE_CAR_AUDIO_DUCKING_EVENTS";
field public static final String PERMISSION_STORAGE_MONITORING = "android.car.permission.STORAGE_MONITORING";
field public static final String PERMISSION_TIRES = "android.car.permission.CAR_TIRES";
@@ -734,6 +735,49 @@
}
+package android.car.hardware.property {
+
+ public final class VehicleVendorPermission {
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_1 = "android.car.permission.GET_CAR_VENDOR_CATEGORY_1";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_10 = "android.car.permission.GET_CAR_VENDOR_CATEGORY_10";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_2 = "android.car.permission.GET_CAR_VENDOR_CATEGORY_2";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_3 = "android.car.permission.GET_CAR_VENDOR_CATEGORY_3";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_4 = "android.car.permission.GET_CAR_VENDOR_CATEGORY_4";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_5 = "android.car.permission.GET_CAR_VENDOR_CATEGORY_5";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_6 = "android.car.permission.GET_CAR_VENDOR_CATEGORY_6";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_7 = "android.car.permission.GET_CAR_VENDOR_CATEGORY_7";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_8 = "android.car.permission.GET_CAR_VENDOR_CATEGORY_8";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_9 = "android.car.permission.GET_CAR_VENDOR_CATEGORY_9";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_DOOR = "android.car.permission.GET_CAR_VENDOR_CATEGORY_DOOR";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_ENGINE = "android.car.permission.GET_CAR_VENDOR_CATEGORY_ENGINE";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_HVAC = "android.car.permission.GET_CAR_VENDOR_CATEGORY_HVAC";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_INFO = "android.car.permission.GET_CAR_VENDOR_CATEGORY_INFO";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_LIGHT = "android.car.permission.GET_CAR_VENDOR_CATEGORY_LIGHT";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_MIRROR = "android.car.permission.GET_CAR_VENDOR_CATEGORY_MIRROR";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_SEAT = "android.car.permission.GET_CAR_VENDOR_CATEGORY_SEAT";
+ field public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_WINDOW = "android.car.permission.GET_CAR_VENDOR_CATEGORY_WINDOW";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_1 = "android.car.permission.SET_CAR_VENDOR_CATEGORY_1";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_10 = "android.car.permission.SET_CAR_VENDOR_CATEGORY_10";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_2 = "android.car.permission.SET_CAR_VENDOR_CATEGORY_2";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_3 = "android.car.permission.SET_CAR_VENDOR_CATEGORY_3";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_4 = "android.car.permission.SET_CAR_VENDOR_CATEGORY_4";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_5 = "android.car.permission.SET_CAR_VENDOR_CATEGORY_5";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_6 = "android.car.permission.SET_CAR_VENDOR_CATEGORY_6";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_7 = "android.car.permission.SET_CAR_VENDOR_CATEGORY_7";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_8 = "android.car.permission.SET_CAR_VENDOR_CATEGORY_8";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_9 = "android.car.permission.SET_CAR_VENDOR_CATEGORY_9";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_DOOR = "android.car.permission.SET_CAR_VENDOR_CATEGORY_DOOR";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_ENGINE = "android.car.permission.SET_CAR_VENDOR_CATEGORY_ENGINE";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_HVAC = "android.car.permission.SET_CAR_VENDOR_CATEGORY_HVAC";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_INFO = "android.car.permission.SET_CAR_VENDOR_CATEGORY_INFO";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_LIGHT = "android.car.permission.SET_CAR_VENDOR_CATEGORY_LIGHT";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_MIRROR = "android.car.permission.SET_CAR_VENDOR_CATEGORY_MIRROR";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_SEAT = "android.car.permission.SET_CAR_VENDOR_CATEGORY_SEAT";
+ field public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_WINDOW = "android.car.permission.SET_CAR_VENDOR_CATEGORY_WINDOW";
+ }
+
+}
+
package android.car.input {
public abstract class CarInputHandlingService extends android.app.Service {
diff --git a/car-lib/src/android/car/Car.java b/car-lib/src/android/car/Car.java
index 2d03cc9..42f7fbb 100644
--- a/car-lib/src/android/car/Car.java
+++ b/car-lib/src/android/car/Car.java
@@ -353,6 +353,14 @@
/** Permission necessary to use {@link CarInfoManager}. */
public static final String PERMISSION_CAR_INFO = "android.car.permission.CAR_INFO";
+ /**
+ * Permission necessary to read information of vendor properties' permissions.
+ * @hide
+ */
+ @SystemApi
+ public static final String PERMISSION_READ_CAR_VENDOR_PERMISSION_INFO =
+ "android.car.permission.READ_CAR_VENDOR_PERMISSION_INFO";
+
/** Permission necessary to read temperature of car's exterior environment. */
public static final String PERMISSION_EXTERIOR_ENVIRONMENT =
"android.car.permission.CAR_EXTERIOR_ENVIRONMENT";
diff --git a/car-lib/src/android/car/hardware/property/VehicleVendorPermission.java b/car-lib/src/android/car/hardware/property/VehicleVendorPermission.java
new file mode 100644
index 0000000..3ad6b9c
--- /dev/null
+++ b/car-lib/src/android/car/hardware/property/VehicleVendorPermission.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2019 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 android.car.hardware.property;
+
+import android.annotation.SystemApi;
+
+/**
+ * VehicleVendorPermission list all vendor permissions for vehicle. Vendors can map the vendor
+ * properties with any vendor permission.
+ * @hide
+ */
+@SystemApi
+public final class VehicleVendorPermission {
+
+ // permissions for the property related with window
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_WINDOW =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_WINDOW";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_WINDOW =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_WINDOW";
+
+ // permissions for the property related with door
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_DOOR =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_DOOR";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_DOOR =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_DOOR";
+
+ // permissions for the property related with seat
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_SEAT =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_SEAT";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_SEAT =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_SEAT";
+
+ // permissions for the property related with mirror
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_MIRROR =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_MIRROR";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_MIRROR =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_MIRROR";
+
+ // permissions for the property related with car's information
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_INFO =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_INFO";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_INFO =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_INFO";
+
+ // permissions for the property related with car's engine
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_ENGINE =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_ENGINE";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_ENGINE =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_ENGINE";
+
+ // permissions for the property related with car's HVAC
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_HVAC =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_HVAC";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_HVAC =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_HVAC";
+
+ // permissions for the property related with car's light
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_LIGHT =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_LIGHT";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_LIGHT =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_LIGHT";
+
+
+ // permissions reserved for other vendor permission
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_1 =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_1";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_1 =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_1";
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_2 =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_2";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_2 =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_2";
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_3 =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_3";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_3 =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_3";
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_4 =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_4";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_4 =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_4";
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_5 =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_5";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_5 =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_5";
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_6 =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_6";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_6 =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_6";
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_7 =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_7";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_7 =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_7";
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_8 =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_8";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_8 =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_8";
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_9 =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_9";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_9 =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_9";
+ public static final String PERMISSION_GET_CAR_VENDOR_CATEGORY_10 =
+ "android.car.permission.GET_CAR_VENDOR_CATEGORY_10";
+ public static final String PERMISSION_SET_CAR_VENDOR_CATEGORY_10 =
+ "android.car.permission.SET_CAR_VENDOR_CATEGORY_10";
+
+ private VehicleVendorPermission() {}
+
+}
diff --git a/service/AndroidManifest.xml b/service/AndroidManifest.xml
index a37302d..82a4896 100644
--- a/service/AndroidManifest.xml
+++ b/service/AndroidManifest.xml
@@ -245,6 +245,15 @@
android:label="@string/car_permission_label_car_info"
android:description="@string/car_permission_desc_car_info" />
+ <!-- Allows an application to read information of car's vendor permission.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.READ_CAR_VENDOR_PERMISSION_INFO"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_vendor_permission_info"
+ android:description="@string/car_permission_desc_vendor_permission_info" />
+
<!-- Allows an application to read the vehicle exterior environment information. For example,
it allows an application to read the vehicle exterior temperature and night mode status.
<p>Protection level: normal
@@ -494,6 +503,332 @@
android:label="@string/car_permission_label_car_test_service"
android:description="@string/car_permission_desc_car_test_service" />
+ <!-- Allows an application to read vendor properties related with windows.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_WINDOW"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_window"
+ android:description="@string/car_permission_desc_get_car_vendor_category_window" />
+
+ <!-- Allows an application to control vendor properties related with windows.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_WINDOW"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_window"
+ android:description="@string/car_permission_desc_set_car_vendor_category_window" />
+
+ <!-- Allows an application to read vendor properties related with doors.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_DOOR"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_door"
+ android:description="@string/car_permission_desc_get_car_vendor_category_door" />
+
+ <!-- Allows an application to control vendor properties related with doors.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_DOOR"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_door"
+ android:description="@string/car_permission_desc_set_car_vendor_category_door" />
+
+
+ <!-- Allows an application to read vendor properties related with seats.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_SEAT"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_seat"
+ android:description="@string/car_permission_desc_get_car_vendor_category_seat" />
+
+ <!-- Allows an application to control vendor properties related with seats.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_SEAT"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_seat"
+ android:description="@string/car_permission_desc_set_car_vendor_category_seat" />
+
+ <!-- Allows an application to read vendor properties related with mirrors.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_MIRROR"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_mirror"
+ android:description="@string/car_permission_desc_get_car_vendor_category_mirror" />
+
+ <!-- Allows an application to control vendor properties related with mirrors.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_MIRROR"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_mirror"
+ android:description="@string/car_permission_desc_set_car_vendor_category_mirror" />
+
+ <!-- Allows an application to read vendor properties related with car information.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_INFO"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_info"
+ android:description="@string/car_permission_desc_get_car_vendor_category_info" />
+
+ <!-- Allows an application to control vendor properties related with car information.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_INFO"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_info"
+ android:description="@string/car_permission_desc_set_car_vendor_category_info" />
+
+ <!-- Allows an application to read vendor properties related with engine.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_ENGINE"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_engine"
+ android:description="@string/car_permission_desc_get_car_vendor_category_engine" />
+
+ <!-- Allows an application to control vendor properties related with engine.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_ENGINE"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_engine"
+ android:description="@string/car_permission_desc_set_car_vendor_category_engine" />
+
+ <!-- Allows an application to read vendor properties related with HVAC.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_HVAC"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_hvac"
+ android:description="@string/car_permission_desc_get_car_vendor_category_hvac" />
+
+ <!-- Allows an application to control vendor properties related with hvac.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_HVAC"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_hvac"
+ android:description="@string/car_permission_desc_set_car_vendor_category_hvac" />
+
+ <!-- Allows an application to read vendor properties related with light.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_LIGHT"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_light"
+ android:description="@string/car_permission_desc_get_car_vendor_category_light" />
+
+ <!-- Allows an application to control vendor properties related with light.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_LIGHT"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_light"
+ android:description="@string/car_permission_desc_set_car_vendor_category_light" />
+
+ <!-- Allows an application to access vendor properties in category 1.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_1"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_1"
+ android:description="@string/car_permission_desc_get_car_vendor_category_1" />
+
+ <!-- Allows an application to control vendor properties in category 1.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_1"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_1"
+ android:description="@string/car_permission_desc_set_car_vendor_category_1" />
+
+ <!-- Allows an application to access vendor properties in category 2.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_2"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_2"
+ android:description="@string/car_permission_desc_get_car_vendor_category_2" />
+
+ <!-- Allows an application to control vendor properties in category 2.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_2"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_2"
+ android:description="@string/car_permission_desc_set_car_vendor_category_2" />
+
+ <!-- Allows an application to access vendor properties in category 3.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_3"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_3"
+ android:description="@string/car_permission_desc_get_car_vendor_category_3" />
+
+ <!-- Allows an application to control vendor properties in category 3.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_3"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_3"
+ android:description="@string/car_permission_desc_set_car_vendor_category_3" />
+
+ <!-- Allows an application to access vendor properties in category 4.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_4"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_4"
+ android:description="@string/car_permission_desc_get_car_vendor_category_4" />
+
+ <!-- Allows an application to control vendor properties in category 4.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_4"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_4"
+ android:description="@string/car_permission_desc_set_car_vendor_category_4" />
+
+ <!-- Allows an application to access vendor properties in category 5.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_5"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_5"
+ android:description="@string/car_permission_desc_get_car_vendor_category_5" />
+
+ <!-- Allows an application to control vendor properties in category 5.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_5"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_5"
+ android:description="@string/car_permission_desc_set_car_vendor_category_5" />
+
+ <!-- Allows an application to access vendor properties in category 6.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_6"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_6"
+ android:description="@string/car_permission_desc_get_car_vendor_category_6" />
+
+ <!-- Allows an application to control vendor properties in category 6.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_6"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_6"
+ android:description="@string/car_permission_desc_set_car_vendor_category_6" />
+
+ <!-- Allows an application to access vendor properties in category 7.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_7"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_7"
+ android:description="@string/car_permission_desc_get_car_vendor_category_7" />
+
+ <!-- Allows an application to control vendor properties in category 7.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_7"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_7"
+ android:description="@string/car_permission_desc_set_car_vendor_category_7" />
+
+ <!-- Allows an application to access vendor properties in category 8.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_8"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_8"
+ android:description="@string/car_permission_desc_get_car_vendor_category_8" />
+
+ <!-- Allows an application to control vendor properties in category 8.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_8"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_8"
+ android:description="@string/car_permission_desc_set_car_vendor_category_8" />
+
+ <!-- Allows an application to access vendor properties in category 9.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_9"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_9"
+ android:description="@string/car_permission_desc_get_car_vendor_category_9" />
+
+ <!-- Allows an application to control vendor properties in category 9.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_9"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_9"
+ android:description="@string/car_permission_desc_set_car_vendor_category_9" />
+
+ <!-- Allows an application to access vendor properties in category 10.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_10"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_get_car_vendor_category_10"
+ android:description="@string/car_permission_desc_get_car_vendor_category_10" />
+
+ <!-- Allows an application to control vendor properties in category 10.
+ <p>Protection level: signature|privileged
+ -->
+ <permission
+ android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_10"
+ android:protectionLevel="signature|privileged"
+ android:label="@string/car_permission_label_set_car_vendor_category_10"
+ android:description="@string/car_permission_desc_set_car_vendor_category_10" />
+
+
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.DEVICE_POWER" />
<uses-permission android:name="android.permission.GRANT_RUNTIME_PERMISSIONS" />
diff --git a/service/res/values/strings.xml b/service/res/values/strings.xml
index 3cf241a..340f95a 100644
--- a/service/res/values/strings.xml
+++ b/service/res/values/strings.xml
@@ -202,6 +202,11 @@
<!-- Permission text: apps read car's basic information [CHAR LIMIT=NONE] -->
<string name="car_permission_desc_car_info">Access car\u2019s basic information.</string>
+ <!-- Permission text: apps read car's vendor permissions information [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_vendor_permission_info">access car\u2019s vendor permission information</string>
+ <!-- Permission text: apps read car's vendor permissions information [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_vendor_permission_info">Access car\u2019s vendor permission information.</string>
+
<!-- Permission text: apps access car's exterior lights state [CHAR LIMIT=NONE] -->
<string name="car_permission_label_car_exterior_lights">read car\u2019s exterior lights state</string>
<!-- Permission text: apps access car's exterior lights state [CHAR LIMIT=NONE] -->
@@ -265,6 +270,186 @@
<!-- Permission text: Control car's test mode [CHAR LIMIT=NONE] -->
<string name="car_permission_desc_car_test_service">Control car\u2019s test mode</string>
+ <!-- Permission text: apps control vendor properties related with window [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_window">control vendor specific window properties</string>
+ <!-- Permission text: apps control vendor properties related with window [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_window">Control vendor specific window properties.</string>
+
+ <!-- Permission text: apps access vendor properties related with window [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_window">access vendor specific window properties</string>
+ <!-- Permission text: apps access vendor properties related with window [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_window">Access vendor specific window properties.</string>
+
+ <!-- Permission text: apps control vendor properties related with door [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_door">control vendor specific door properties</string>
+ <!-- Permission text: apps control vendor properties related with door [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_door">Control vendor specific door properties.</string>
+
+ <!-- Permission text: apps access vendor properties related with door [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_door">access vendor specific door properties</string>
+ <!-- Permission text: apps access vendor properties related with door [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_door">Access vendor specific door properties.</string>
+
+ <!-- Permission text: apps control vendor properties related with seat [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_seat">control vendor specific seat properties</string>
+ <!-- Permission text: apps control vendor properties related with seat [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_seat">Control vendor specific seat properties.</string>
+
+ <!-- Permission text: apps access vendor properties related with seat [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_seat">access vendor specific seat properties</string>
+ <!-- Permission text: apps access vendor properties related with seat [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_seat">Access vendor specific seat properties.</string>
+
+ <!-- Permission text: apps control vendor properties related with mirror [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_mirror">control vendor specific mirror properties</string>
+ <!-- Permission text: apps control vendor properties related with mirror [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_mirror">Control vendor specific mirror properties.</string>
+
+ <!-- Permission text: apps access vendor properties related with mirror [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_mirror">access vendor specific mirror properties</string>
+ <!-- Permission text: apps access vendor properties related with mirror [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_mirror">Access vendor specific mirror properties.</string>
+
+ <!-- Permission text: apps control vendor properties related with info [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_info">control vendor specific information properties</string>
+ <!-- Permission text: apps control vendor properties related with info [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_info">Control vendor specific information properties.</string>
+
+ <!-- Permission text: apps access vendor properties related with info [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_info">access vendor specific information properties</string>
+ <!-- Permission text: apps access vendor properties related with info [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_info">Access vendor specific information properties.</string>
+
+ <!-- Permission text: apps control vendor properties related with engine [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_engine">control vendor specific engine properties</string>
+ <!-- Permission text: apps control vendor properties related with engine [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_engine">Control vendor specific engine properties.</string>
+
+ <!-- Permission text: apps access vendor properties related with engine [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_engine">access vendor specific engine properties</string>
+ <!-- Permission text: apps access vendor properties related with engine [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_engine">Access vendor specific engine properties.</string>
+
+ <!-- Permission text: apps control vendor properties related with hvac [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_hvac">control vendor specific hvac properties</string>
+ <!-- Permission text: apps control vendor properties related with hvac [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_hvac">Control vendor specific hvac properties.</string>
+
+ <!-- Permission text: apps access vendor properties related with hvac [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_hvac">access vendor specific hvac properties</string>
+ <!-- Permission text: apps access vendor properties related with hvac [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_hvac">Access vendor specific hvac properties.</string>
+
+ <!-- Permission text: apps control vendor properties related with light [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_light">control vendor specific light properties</string>
+ <!-- Permission text: apps control vendor properties related with light [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_light">Control vendor specific light properties.</string>
+
+ <!-- Permission text: apps access vendor properties related with light [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_light">access vendor specific light properties</string>
+ <!-- Permission text: apps access vendor properties related with light [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_light">Access vendor specific light properties.</string>
+
+ <!-- Permission text: apps access properties in category 1 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_1">access vendor specific properties in category 1</string>
+ <!-- Permission text: apps access vendor properties in category 1 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_1">Access vendor specific properties in category 1.</string>
+
+ <!-- Permission text: apps access vendor properties in category 2 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_2">access vendor specific properties in category 2</string>
+ <!-- Permission text: apps access vendor properties in category 2 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_2">Access vendor specific properties in category 2.</string>
+
+ <!-- Permission text: apps access properties in category 3 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_3">access vendor specific properties in category 3</string>
+ <!-- Permission text: apps access properties in category 3 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_3">Access vendor specific properties in category 3.</string>
+
+ <!-- Permission text: apps access vendor properties in category 4 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_4">access vendor specific properties in category 4</string>
+ <!-- Permission text: apps access vendor properties in category 4 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_4">Access vendor specific properties in category 4.</string>
+
+ <!-- Permission text: apps access vendor properties in category 5 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_5">access vendor specific properties in category 5</string>
+ <!-- Permission text: apps access vendor properties in category 5 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_5">Access vendor specific properties in category 5.</string>
+
+ <!-- Permission text: apps access vendor properties in category 6 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_6">access vendor specific properties in category 6</string>
+ <!-- Permission text: apps access and control vendor properties in category 6 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_6">Access vendor specific properties in category 6.</string>
+
+ <!-- Permission text: apps access vendor properties in category 7 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_7">access vendor specific properties in category 7</string>
+ <!-- Permission text: apps access vendor properties in category 7 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_7">Access vendor specific properties in category 7.</string>
+
+ <!-- Permission text: apps access vendor properties in category 8 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_8">access vendor specific properties in category 8</string>
+ <!-- Permission text: apps access vendor properties in category 8 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_8">Access vendor specific properties in category 8.</string>
+
+ <!-- Permission text: apps access vendor properties in category 9 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_9">access vendor specific properties in category 9</string>
+ <!-- Permission text: apps access vendor properties in category 9 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_9">Access vendor specific properties in category 9.</string>
+
+ <!-- Permission text: apps access vendor properties in category 10 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_get_car_vendor_category_10">access vendor specific properties in category 10</string>
+ <!-- Permission text: apps access vendor properties in category 10 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_get_car_vendor_category_10">Access vendor specific properties in category 10.</string>
+
+ <!-- Permission text: apps control vendor properties in category 1 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_1">control vendor specific properties in category 1</string>
+ <!-- Permission text: apps control vendor properties in category 1 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_1">Control vendor specific properties in category 1.</string>
+
+ <!-- Permission text: apps control vendor properties in category 2 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_2">control vendor specific properties in category 2</string>
+ <!-- Permission text: apps control vendor properties in category 2 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_2">Control vendor specific properties in category 2.</string>
+
+ <!-- Permission text: apps control vendor properties in category 3 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_3">control vendor specific properties in category 3</string>
+ <!-- Permission text: apps control vendor properties in category 3 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_3">Control vendor specific properties in category 3.</string>
+
+ <!-- Permission text: apps control vendor properties in category 4 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_4">control vendor specific properties in category 4</string>
+ <!-- Permission text: apps control vendor properties in category 4 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_4">Control vendor specific properties in category 4.</string>
+
+ <!-- Permission text: apps control vendor properties in category 5 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_5">control vendor specific properties in category 5</string>
+ <!-- Permission text: apps control vendor properties in category 5 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_5">Control vendor specific properties in category 5.</string>
+
+ <!-- Permission text: apps control vendor properties in category 6 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_6">control vendor specific properties in category 6</string>
+ <!-- Permission text: apps control vendor properties in category 6 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_6">Control vendor specific properties in category 6.</string>
+
+ <!-- Permission text: apps control vendor properties in category 7 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_7">control vendor specific properties in category 7</string>
+ <!-- Permission text: apps control vendor properties in category 7 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_7">Control vendor specific properties in category 7.</string>
+
+ <!-- Permission text: apps control vendor properties in category 8 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_8">control vendor specific properties in category 8</string>
+ <!-- Permission text: apps control vendor properties in category 8 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_8">Control vendor specific properties in category 8.</string>
+
+ <!-- Permission text: apps control vendor properties in category 9 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_9">control vendor specific properties in category 9</string>
+ <!-- Permission text: apps control vendor properties in category 9 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_9">Control vendor specific properties in category 9.</string>
+
+ <!-- Permission text: apps control vendor properties in category 10 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_label_set_car_vendor_category_10">control vendor specific properties in category 10</string>
+ <!-- Permission text: apps control vendor properties in category 10 [CHAR LIMIT=NONE] -->
+ <string name="car_permission_desc_set_car_vendor_category_10">Control vendor specific properties in category 10.</string>
+
<!-- The default name of device enrolled as trust device [CHAR LIMIT=NONE] -->
<string name="trust_device_default_name">My Device</string>
diff --git a/service/src/com/android/car/hal/PropertyHalService.java b/service/src/com/android/car/hal/PropertyHalService.java
index 8df070d..0cb2325 100644
--- a/service/src/com/android/car/hal/PropertyHalService.java
+++ b/service/src/com/android/car/hal/PropertyHalService.java
@@ -28,6 +28,7 @@
import android.car.hardware.property.CarPropertyEvent;
import android.hardware.automotive.vehicle.V2_0.VehiclePropConfig;
import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
+import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
import android.hardware.automotive.vehicle.V2_0.VehiclePropertyType;
import android.util.Log;
import android.util.SparseArray;
@@ -318,6 +319,12 @@
if (mDbg) {
Log.d(TAG, "takeSupportedProperties() took " + taken.size() + " properties");
}
+
+ // If vehicle hal support to select permission for vendor properties.
+ if (mProps.containsKey(VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION)) {
+ mPropIds.customizeVendorPermission(mProps.get(
+ VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION).getConfigArray());
+ }
return taken;
}
diff --git a/service/src/com/android/car/hal/PropertyHalServiceIds.java b/service/src/com/android/car/hal/PropertyHalServiceIds.java
index 71e60cc..41f15f8 100644
--- a/service/src/com/android/car/hal/PropertyHalServiceIds.java
+++ b/service/src/com/android/car/hal/PropertyHalServiceIds.java
@@ -18,8 +18,10 @@
import static java.lang.Integer.toHexString;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.car.Car;
+import android.car.hardware.property.VehicleVendorPermission;
import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
import android.hardware.automotive.vehicle.V2_0.VehiclePropertyGroup;
import android.util.Log;
@@ -27,6 +29,7 @@
import android.util.SparseArray;
import java.util.HashSet;
+import java.util.List;
/**
* Helper class to define which property IDs are used by PropertyHalService. This class binds the
@@ -44,6 +47,59 @@
private final HashSet<Integer> mPropForUnits;
private static final String TAG = "PropertyHalServiceIds";
+ // default vendor permission
+ private static final int PERMISSION_CAR_VENDOR_DEFAULT = 0x00000000;
+
+ // permissions for the property related with window
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_WINDOW = 0X00000001;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_WINDOW = 0x00000002;
+ // permissions for the property related with door
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_DOOR = 0x00000003;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_DOOR = 0x00000004;
+ // permissions for the property related with seat
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_SEAT = 0x00000005;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_SEAT = 0x00000006;
+ // permissions for the property related with mirror
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_MIRROR = 0x00000007;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_MIRROR = 0x00000008;
+
+ // permissions for the property related with car's information
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_INFO = 0x00000009;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_INFO = 0x0000000A;
+ // permissions for the property related with car's engine
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_ENGINE = 0x0000000B;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_ENGINE = 0x0000000C;
+ // permissions for the property related with car's HVAC
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_HVAC = 0x0000000D;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_HVAC = 0x0000000E;
+ // permissions for the property related with car's light
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_LIGHT = 0x0000000F;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_LIGHT = 0x00000010;
+
+ // permissions reserved for other vendor permission
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_1 = 0x00010000;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_1 = 0x00011000;
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_2 = 0x00020000;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_2 = 0x00021000;
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_3 = 0x00030000;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_3 = 0x00031000;
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_4 = 0x00040000;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_4 = 0x00041000;
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_5 = 0x00050000;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_5 = 0x00051000;
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_6 = 0x00060000;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_6 = 0x00061000;
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_7 = 0x00070000;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_7 = 0x00071000;
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_8 = 0x00080000;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_8 = 0x00081000;
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_9 = 0x00090000;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_9 = 0x00091000;
+ private static final int PERMISSION_SET_CAR_VENDOR_CATEGORY_10 = 0x000A0000;
+ private static final int PERMISSION_GET_CAR_VENDOR_CATEGORY_10 = 0x000A1000;
+ // Not available for android
+ private static final int PERMISSION_CAR_VENDOR_NOT_ACCESSIBLE = 0xF0000000;
+
public PropertyHalServiceIds() {
mProps = new SparseArray<>();
mPropForUnits = new HashSet<>();
@@ -416,6 +472,10 @@
Car.PERMISSION_READ_DISPLAY_UNITS,
Car.PERMISSION_CONTROL_DISPLAY_UNITS));
mPropForUnits.add(VehicleProperty.VEHICLE_SPEED_DISPLAY_UNITS);
+
+ mProps.put(VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, new Pair<>(
+ Car.PERMISSION_READ_CAR_VENDOR_PERMISSION_INFO,
+ null));
}
/**
@@ -460,7 +520,7 @@
* Return true if property is a vendor property and was added
*/
public boolean insertVendorProperty(int propId) {
- if ((propId & VehiclePropertyGroup.MASK) == VehiclePropertyGroup.VENDOR) {
+ if (isVendorProperty(propId)) {
mProps.put(propId, new Pair<>(
Car.PERMISSION_VENDOR_EXTENSION, Car.PERMISSION_VENDOR_EXTENSION));
return true;
@@ -470,6 +530,9 @@
}
}
+ private static boolean isVendorProperty(int propId) {
+ return (propId & VehiclePropertyGroup.MASK) == VehiclePropertyGroup.VENDOR;
+ }
/**
* Check if property ID is in the list of known IDs that PropertyHalService is interested it.
*/
@@ -489,4 +552,122 @@
public boolean isPropertyToChangeUnits(int propertyId) {
return mPropForUnits.contains(propertyId);
}
+
+ /**
+ * Overrides the permission map for vendor properties
+ *
+ * @param configArray the configArray for
+ * {@link VehicleProperty#SUPPORT_CUSTOMIZE_VENDOR_PERMISSION}
+ */
+ public void customizeVendorPermission(@NonNull List<Integer> configArray) {
+ if (configArray == null || configArray.size() % 3 != 0) {
+ throw new IllegalArgumentException(
+ "ConfigArray for SUPPORT_CUSTOMIZE_VENDOR_PERMISSION is wrong");
+ }
+ int index = 0;
+ while (index < configArray.size()) {
+ int propId = configArray.get(index++);
+ if (!isVendorProperty(propId)) {
+ throw new IllegalArgumentException("Property Id: " + propId
+ + " is not in vendor range");
+ }
+ int readPermission = configArray.get(index++);
+ int writePermission = configArray.get(index++);
+ mProps.put(propId, new Pair<>(
+ toPermissionString(readPermission, propId),
+ toPermissionString(writePermission, propId)));
+ }
+
+ }
+
+ /**
+ * Map VehicleVendorPermission enums in VHAL to android permissions.
+ *
+ * @return permission string, return null if vendor property is not available.
+ */
+ @Nullable
+ private String toPermissionString(int permissionEnum, int propId) {
+ switch (permissionEnum) {
+ case PERMISSION_CAR_VENDOR_DEFAULT:
+ return Car.PERMISSION_VENDOR_EXTENSION;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_WINDOW:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_WINDOW;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_WINDOW:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_WINDOW;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_DOOR:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_DOOR;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_DOOR:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_DOOR;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_SEAT:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_SEAT;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_SEAT:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_SEAT;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_MIRROR:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_MIRROR;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_MIRROR:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_MIRROR;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_INFO:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_INFO;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_INFO:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_INFO;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_ENGINE:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_ENGINE;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_ENGINE:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_ENGINE;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_HVAC:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_HVAC;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_HVAC:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_HVAC;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_LIGHT:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_LIGHT;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_LIGHT:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_LIGHT;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_1:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_1;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_1:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_1;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_2:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_2;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_2:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_2;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_3:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_3;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_3:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_3;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_4:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_4;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_4:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_4;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_5:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_5;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_5:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_5;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_6:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_6;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_6:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_6;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_7:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_7;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_7:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_7;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_8:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_8;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_8:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_8;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_9:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_9;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_9:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_9;
+ case PERMISSION_SET_CAR_VENDOR_CATEGORY_10:
+ return VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_10;
+ case PERMISSION_GET_CAR_VENDOR_CATEGORY_10:
+ return VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_10;
+ case PERMISSION_CAR_VENDOR_NOT_ACCESSIBLE:
+ return null;
+ default:
+ throw new IllegalArgumentException("permission Id: " + permissionEnum
+ + " for property:" + propId + " is invalid vendor permission Id");
+ }
+ }
+
}
diff --git a/tests/EmbeddedKitchenSinkApp/AndroidManifest.xml b/tests/EmbeddedKitchenSinkApp/AndroidManifest.xml
index e034f36..4031032 100644
--- a/tests/EmbeddedKitchenSinkApp/AndroidManifest.xml
+++ b/tests/EmbeddedKitchenSinkApp/AndroidManifest.xml
@@ -78,7 +78,11 @@
<uses-permission android:name="android.permission.SET_ACTIVITY_WATCHER"/>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
-
+ <!-- use for vendor properties -->
+ <uses-permission android:name="android.car.permission.CAR_VENDOR_EXTENSION" />
+ <uses-permission android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_SEAT" />
+ <uses-permission android:name="android.car.permission.GET_CAR_VENDOR_CATEGORY_INFO" />
+ <uses-permission android:name="android.car.permission.SET_CAR_VENDOR_CATEGORY_INFO" />
<application android:label="@string/app_title"
android:icon="@drawable/ic_launcher">
<uses-library android:name="android.test.runner"/>
diff --git a/tests/carservice_unit_test/src/com/android/car/hal/PropertyHalServiceIdsTest.java b/tests/carservice_unit_test/src/com/android/car/hal/PropertyHalServiceIdsTest.java
new file mode 100644
index 0000000..a6dd386
--- /dev/null
+++ b/tests/carservice_unit_test/src/com/android/car/hal/PropertyHalServiceIdsTest.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2019 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.hal;
+
+import android.car.Car;
+import android.car.VehiclePropertyIds;
+import android.hardware.automotive.vehicle.V2_0.VehicleVendorPermission;
+import android.util.Log;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@RunWith(AndroidJUnit4.class)
+public class PropertyHalServiceIdsTest {
+ @Rule
+ public MockitoRule mMockitoRule = MockitoJUnit.rule();
+
+ private PropertyHalServiceIds mPropertyHalServiceIds;
+
+ private static final String TAG = PropertyHalServiceIdsTest.class.getSimpleName();
+ private static final int VENDOR_PROPERTY_1 = 0x21e01111;
+ private static final int VENDOR_PROPERTY_2 = 0x21e01112;
+ private static final int VENDOR_PROPERTY_3 = 0x21e01113;
+ private static final int VENDOR_PROPERTY_4 = 0x21e01114;
+ private static final int[] VENDOR_PROPERTY_IDS = {
+ VENDOR_PROPERTY_1, VENDOR_PROPERTY_2, VENDOR_PROPERTY_3, VENDOR_PROPERTY_4};
+ private static final int[] SYSTEM_PROPERTY_IDS = {VehiclePropertyIds.ENGINE_OIL_LEVEL,
+ VehiclePropertyIds.CURRENT_GEAR, VehiclePropertyIds.NIGHT_MODE,
+ VehiclePropertyIds.HVAC_FAN_SPEED, VehiclePropertyIds.DOOR_LOCK};
+ private static final List<Integer> CONFIG_ARRAY = new ArrayList<>();
+ private static final List<Integer> CONFIG_ARRAY_INVALID = new ArrayList<>();
+ @Before
+ public void setUp() {
+ mPropertyHalServiceIds = new PropertyHalServiceIds();
+ // set up read permission and write permission to VENDOR_PROPERTY_1
+ CONFIG_ARRAY.add(VENDOR_PROPERTY_1);
+ CONFIG_ARRAY.add(VehicleVendorPermission.PERMISSION_DEFAULT);
+ CONFIG_ARRAY.add(VehicleVendorPermission.PERMISSION_NOT_ACCESSIBLE);
+ // set up read permission and write permission to VENDOR_PROPERTY_2
+ CONFIG_ARRAY.add(VENDOR_PROPERTY_2);
+ CONFIG_ARRAY.add(VehicleVendorPermission.PERMISSION_GET_VENDOR_CATEGORY_ENGINE);
+ CONFIG_ARRAY.add(VehicleVendorPermission.PERMISSION_SET_VENDOR_CATEGORY_ENGINE);
+ // set up read permission and write permission to VENDOR_PROPERTY_3
+ CONFIG_ARRAY.add(VENDOR_PROPERTY_3);
+ CONFIG_ARRAY.add(VehicleVendorPermission.PERMISSION_GET_VENDOR_CATEGORY_INFO);
+ CONFIG_ARRAY.add(VehicleVendorPermission.PERMISSION_DEFAULT);
+
+ // set a invalid config
+ CONFIG_ARRAY_INVALID.add(VehiclePropertyIds.CURRENT_GEAR);
+ CONFIG_ARRAY_INVALID.add(VehicleVendorPermission.PERMISSION_GET_VENDOR_CATEGORY_ENGINE);
+ CONFIG_ARRAY_INVALID.add(VehicleVendorPermission.PERMISSION_SET_VENDOR_CATEGORY_ENGINE);
+ }
+
+ /**
+ * Test {@link PropertyHalServiceIds#getReadPermission(int)}
+ * and {@link PropertyHalServiceIds#getWritePermission(int)} for system properties
+ */
+ @Test
+ public void checkPermissionForSystemProperty() {
+ Assert.assertEquals(Car.PERMISSION_CAR_ENGINE_DETAILED,
+ mPropertyHalServiceIds.getReadPermission(VehiclePropertyIds.ENGINE_OIL_LEVEL));
+ Assert.assertNull(
+ mPropertyHalServiceIds.getWritePermission(VehiclePropertyIds.ENGINE_OIL_LEVEL));
+ Assert.assertEquals(Car.PERMISSION_CONTROL_CAR_CLIMATE,
+ mPropertyHalServiceIds.getReadPermission(VehiclePropertyIds.HVAC_FAN_SPEED));
+ Assert.assertEquals(Car.PERMISSION_CONTROL_CAR_CLIMATE,
+ mPropertyHalServiceIds.getWritePermission(VehiclePropertyIds.HVAC_FAN_SPEED));
+ }
+
+ /**
+ * Test {@link PropertyHalServiceIds#customizeVendorPermission(List)}
+ */
+ @Test
+ public void checkPermissionForVendorProperty() {
+ for (int propId : VENDOR_PROPERTY_IDS) {
+ mPropertyHalServiceIds.insertVendorProperty(propId);
+ }
+ // test insert a valid config
+ mPropertyHalServiceIds.customizeVendorPermission(CONFIG_ARRAY);
+
+ Assert.assertEquals(Car.PERMISSION_VENDOR_EXTENSION,
+ mPropertyHalServiceIds.getReadPermission(VENDOR_PROPERTY_1));
+ Assert.assertNull(mPropertyHalServiceIds.getWritePermission(VENDOR_PROPERTY_1));
+
+ Assert.assertEquals(android.car.hardware.property
+ .VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_ENGINE,
+ mPropertyHalServiceIds.getReadPermission(VENDOR_PROPERTY_2));
+ Assert.assertEquals(android.car.hardware.property
+ .VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_ENGINE,
+ mPropertyHalServiceIds.getWritePermission(VENDOR_PROPERTY_2));
+
+ Assert.assertEquals(android.car.hardware.property
+ .VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_INFO,
+ mPropertyHalServiceIds.getReadPermission(VENDOR_PROPERTY_3));
+ Assert.assertEquals(Car.PERMISSION_VENDOR_EXTENSION,
+ mPropertyHalServiceIds.getWritePermission(VENDOR_PROPERTY_3));
+
+ Assert.assertEquals(Car.PERMISSION_VENDOR_EXTENSION,
+ mPropertyHalServiceIds.getReadPermission(VENDOR_PROPERTY_4));
+ Assert.assertEquals(Car.PERMISSION_VENDOR_EXTENSION,
+ mPropertyHalServiceIds.getWritePermission(VENDOR_PROPERTY_4));
+
+ // test insert invalid config
+ try {
+ mPropertyHalServiceIds.customizeVendorPermission(CONFIG_ARRAY_INVALID);
+ Assert.fail("Insert system properties with vendor permissions");
+ } catch (IllegalArgumentException e) {
+ Log.v(TAG, e.getMessage());
+ }
+ }
+
+ /**
+ * Test {@link PropertyHalServiceIds#isSupportedProperty(int)}
+ */
+ @Test
+ public void checkVendorPropertyId() {
+ for (int vendorProp : VENDOR_PROPERTY_IDS) {
+ Assert.assertTrue(mPropertyHalServiceIds.isSupportedProperty(vendorProp));
+ }
+ for (int systemProp : SYSTEM_PROPERTY_IDS) {
+ Assert.assertTrue(mPropertyHalServiceIds.isSupportedProperty(systemProp));
+ }
+ }
+
+}
diff --git a/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarPropertyTest.java b/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarPropertyTest.java
index 9d638ba..8e41c19 100644
--- a/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarPropertyTest.java
+++ b/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarPropertyTest.java
@@ -28,6 +28,8 @@
import android.car.hardware.CarPropertyValue;
import android.car.hardware.property.CarPropertyManager;
import android.car.hardware.property.CarPropertyManager.CarPropertyEventCallback;
+import android.car.hardware.property.VehicleVendorPermission;
+import android.hardware.automotive.vehicle.V2_0.VehiclePropertyGroup;
import android.os.SystemClock;
import android.util.ArraySet;
import android.util.Log;
@@ -41,7 +43,9 @@
import java.time.Duration;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
* The test suite will execute end-to-end Car Property API test by generating VHAL property data
@@ -73,6 +77,55 @@
private static final String CAR_PROPERTY_TEST_JSON = "car_property_test.json";
private static final int GEAR_PROPERTY_ID = 289408000;
+ private static final Set<String> VENDOR_PERMISSIONS = new HashSet<>(Arrays.asList(
+ Car.PERMISSION_VENDOR_EXTENSION,
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_WINDOW,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_WINDOW,
+ // permissions for the property related with door
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_DOOR,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_DOOR,
+ // permissions for the property related with seat
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_SEAT,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_SEAT,
+ // permissions for the property related with mirror
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_MIRROR,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_MIRROR,
+
+ // permissions for the property related with car's information
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_INFO,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_INFO,
+ // permissions for the property related with car's engine
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_ENGINE,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_ENGINE,
+ // permissions for the property related with car's HVAC
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_HVAC,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_HVAC,
+ // permissions for the property related with car's light
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_LIGHT,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_LIGHT,
+
+ // permissions reserved for other vendor permission
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_1,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_1,
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_2,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_2,
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_3,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_3,
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_4,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_4,
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_5,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_5,
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_6,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_6,
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_7,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_7,
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_8,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_8,
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_9,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_9,
+ VehicleVendorPermission.PERMISSION_SET_CAR_VENDOR_CATEGORY_10,
+ VehicleVendorPermission.PERMISSION_GET_CAR_VENDOR_CATEGORY_10
+ ));
private class CarPropertyEventReceiver implements CarPropertyEventCallback {
private VhalEventVerifier mVerifier;
@@ -228,6 +281,30 @@
assertEquals(16, currentGear);
}
+ /**
+ * Check only vendor properties have vendor permissions.
+ */
+ @Test
+ public void checkPropertyPermission() {
+ CarPropertyManager propMgr = (CarPropertyManager) mCar.getCarManager(Car.PROPERTY_SERVICE);
+ List<CarPropertyConfig> configs = propMgr.getPropertyList();
+ for (CarPropertyConfig cfg : configs) {
+ String readPermission = propMgr.getReadPermission(cfg.getPropertyId());
+ String writePermission = propMgr.getWritePermission(cfg.getPropertyId());
+ if ((cfg.getPropertyId() & VehiclePropertyGroup.MASK) == VehiclePropertyGroup.VENDOR) {
+ Assert.assertTrue(readPermission == null
+ || VENDOR_PERMISSIONS.contains(readPermission));
+ Assert.assertTrue(writePermission == null
+ || VENDOR_PERMISSIONS.contains(writePermission));
+ } else {
+ Assert.assertTrue(readPermission == null
+ || !VENDOR_PERMISSIONS.contains(readPermission));
+ Assert.assertTrue(writePermission == null
+ || !VENDOR_PERMISSIONS.contains(writePermission));
+ }
+ }
+ }
+
private class GearEventTestCallback implements CarPropertyEventCallback {
private long mTimestamp = 0L;