Tim Van Patten | 0b6b81d | 2025-01-13 10:19:19 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2025 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 <graphicsenv/FeatureOverrides.h> |
| 18 | |
| 19 | #include <android-base/stringprintf.h> |
| 20 | |
| 21 | namespace android { |
| 22 | |
| 23 | using base::StringAppendF; |
| 24 | |
| 25 | std::string FeatureConfig::toString() const { |
| 26 | std::string result; |
| 27 | StringAppendF(&result, "Feature: %s\n", mFeatureName.c_str()); |
| 28 | StringAppendF(&result, " Status: %s\n", mEnabled ? "enabled" : "disabled"); |
| 29 | |
| 30 | return result; |
| 31 | } |
| 32 | |
| 33 | std::string FeatureOverrides::toString() const { |
| 34 | std::string result; |
| 35 | result.append("Global Features:\n"); |
| 36 | for (auto& cfg : mGlobalFeatures) { |
| 37 | result.append(" " + cfg.toString()); |
| 38 | } |
| 39 | result.append("\n"); |
| 40 | result.append("Package Features:\n"); |
| 41 | for (const auto& packageFeature : mPackageFeatures) { |
| 42 | result.append(" Package:"); |
| 43 | StringAppendF(&result, " %s\n", packageFeature.first.c_str()); |
| 44 | for (auto& cfg : packageFeature.second) { |
| 45 | result.append(" " + cfg.toString()); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | return result; |
| 50 | } |
| 51 | |
| 52 | } // namespace android |