1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.car.hal; 18 19 import android.hardware.automotive.vehicle.V2_0.VehiclePropertyGroup; 20 21 /** 22 * Implementation of {@link HalServiceBase} that responsible for custom properties that were defined 23 * by OEMs. 24 */ 25 public class VendorExtensionHalService extends PropertyHalServiceBase { 26 27 private final static String TAG = VendorExtensionHalService.class.getSimpleName(); 28 private final static boolean DEBUG = false; 29 30 VendorExtensionHalService(VehicleHal vehicleHal) { 31 super(vehicleHal, TAG, DEBUG); 32 } 33 34 @Override 35 protected int managerToHalPropId(int managerPropId) { 36 return isVendorProperty(managerPropId) ? managerPropId : NOT_SUPPORTED_PROPERTY; 37 } 38 39 @Override 40 protected int halToManagerPropId(int halPropId) { 41 return isVendorProperty(halPropId) ? halPropId : NOT_SUPPORTED_PROPERTY; 42 } 43 44 private static boolean isVendorProperty(int property) { 45 return (property & VehiclePropertyGroup.MASK) == VehiclePropertyGroup.VENDOR; 46 } 47 }