diff --git a/car-lib/src/android/car/Car.java b/car-lib/src/android/car/Car.java index 12955ee..c094d54 100644 --- a/car-lib/src/android/car/Car.java +++ b/car-lib/src/android/car/Car.java @@ -1139,6 +1139,13 @@ public final class Car { public static final String PERMISSION_MANAGE_THREAD_PRIORITY = "android.car.permission.MANAGE_THREAD_PRIORITY"; /** + * Custom Permission. + * @hide + */ @AddedInOrBefore(majorVersion = 33) public static final String PERMISSION_CAR_CUSTOM = "android.car.permission.CAR_CUSTOM";
diff --git a/car-lib/src/android/car/VehiclePropertyIds.java b/car-lib/src/android/car/VehiclePropertyIds.java index 1531ff1..f8966f5 100644 --- a/car-lib/src/android/car/VehiclePropertyIds.java +++ b/car-lib/src/android/car/VehiclePropertyIds.java @@ -2229,6 +2229,15 @@ public final class VehiclePropertyIds { @AddedInOrBefore(majorVersion = 33) public static final int VEHICLE_CURB_WEIGHT = 289410886; + @RequiresPermission(Car.PERMISSION_CAR_CUSTOM) + @AddedInOrBefore(majorVersion = 33) public static final int VEHICLE_TEST_PROPERTY = 289410896;
@@ -34,6 +34,9 @@ public final class PropertyPermissionMapping { public PropertyPermissionMapping() { // Add propertyId and read/write permissions // Cabin Properties + map(Car.PERMISSION_CAR_CUSTOM, VehiclePropertyIds.VEHICLE_TEST_PROPERTY);
--git a/car-lib-module/api/current.txt b/car-lib-module/api/current.txt index 05464e4..c39a981 100644 --- a/car-lib-module/api/current.txt +++ b/car-lib-module/api/current.txt @@ -329,6 +329,8 @@ package android.car { field @RequiresPermission.Read(@androidx.annotation.RequiresPermission(android.car.Car.PERMISSION_ENERGY))
public static final int EV_REGENERATIVE_BRAKING_STATE = 289410884; // 0x11400f44 field @RequiresPermission("android.car.permission.CAR_EXTERIOR_LIGHTS") public static final int FOG_LIGHTS_STATE = 289410562; // 0x11400e02 field @RequiresPermission("android.car.permission.CONTROL_CAR_EXTERIOR_LIGHTS") public static final int FOG_LIGHTS_SWITCH = 289410578; // 0x11400F50 + field @RequiresPermission("android.car.permission.CAR_CUSTOM") public static final int VEHICLE_TEST_PROPERTY = 289410896; // 0x11200f48 field @RequiresPermission("android.car.permission.CAR_EXTERIOR_LIGHTS") public static final int FRONT_FOG_LIGHTS_STATE = 289410875; // 0x11400f3b field @RequiresPermission("android.car.permission.CONTROL_CAR_EXTERIOR_LIGHTS") public static final int FRONT_FOG_LIGHTS_SWITCH = 289410876; // 0x11400f3c --git a/car-lib/api/current.txt b/car-lib/api/current.txt index 05464e4..c39a981 100644 --- a/car-lib/api/current.txt +++ b/car-lib/api/current.txt @@ -329,6 +329,8 @@ package android.car { field @RequiresPermission.Read(@androidx.annotation.RequiresPermission(android.car.Car.PERMISSION_ENERGY)) public static final int EV_REGENERATIVE_BRAKING_STATE = 289410884; // 0x11400f44 field @RequiresPermission("android.car.permission.CAR_EXTERIOR_LIGHTS") public static final int FOG_LIGHTS_STATE = 289410562; // 0x11400e02 field @RequiresPermission("android.car.permission.CONTROL_CAR_EXTERIOR_LIGHTS") public static final int FOG_LIGHTS_SWITCH = 289410578; // 0x11400e12 +field @RequiresPermission("android.car.permission.CAR_CUSTOM") public static final int VEHICLE_TEST_PROPERTY = 289410896; // 0x11400F50
验证
回到项目根目录,使用 m 命令重新编译整个项目。 使用 make emu_img_zip 重新编译模拟器镜像。 编译好的镜像文件在 out/target/product/emulator_car_x86_64/sdk-repo-linux-system-images-eng.$(whoami).zip。 将生成的 zip 文件复制出来,解压之后替换本地 SDK 中的镜像~/Library/Android/sdk/system-images/android-33/android-automotive/x86_64,然后把模拟器 wipe data 并重新启动模拟器。