VehiclePropertyAccessControlForTesting.cpp revision 17954fee2501db6ae2cb3f56bf4a2ab5c6518842
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#include <VehiclePropertyAccessControlForTesting.h>
18
19namespace android {
20bool VehiclePropertyAccessControlForTesting::isHexNotation(std::string const& s) {
21      return VehiclePropertyAccessControl::isHexNotation(s);
22}
23
24bool VehiclePropertyAccessControlForTesting::accessToInt(int32_t* const value,const xmlChar* property,
25                   const xmlChar* uid, const xmlChar* access) {
26      return VehiclePropertyAccessControl::accessToInt(value, property, uid, access);
27}
28
29bool VehiclePropertyAccessControlForTesting::updateOrCreate(int32_t uid, int32_t property, int32_t access) {
30      return VehiclePropertyAccessControl::updateOrCreate(uid, property, access);
31}
32
33bool VehiclePropertyAccessControlForTesting::populate(xmlNode* a_node) {
34      return VehiclePropertyAccessControl::populate(a_node);
35}
36
37bool VehiclePropertyAccessControlForTesting::process(const char* policy) {
38      return VehiclePropertyAccessControl::process(policy);
39}
40
41void VehiclePropertyAccessControlForTesting::emptyAccessControlMap() {
42    for (auto& i: VehiclePropertyAccessControl::mVehicleAccessControlMap) {
43        delete(&i);
44    }
45
46    VehiclePropertyAccessControl::mVehicleAccessControlMap.clear();
47}
48
49bool VehiclePropertyAccessControlForTesting::getAccessToProperty(int32_t property, std::map<int32_t, int32_t>** accessMap) {
50  if (mVehicleAccessControlMap.count(property) == 0) {
51    return false;
52  }
53
54  *accessMap = mVehicleAccessControlMap[property];
55  return true;
56}
57
58};
59