|
29 | 29 | #include <android-base/strings.h> |
30 | 30 | #include <android/dlext.h> |
31 | 31 | #include <binder/IServiceManager.h> |
| 32 | +#include <com_android_graphics_graphicsenv_flags.h> |
32 | 33 | #include <graphicsenv/IGpuService.h> |
33 | 34 | #include <log/log.h> |
34 | 35 | #include <nativeloader/dlext_namespaces.h> |
@@ -70,6 +71,8 @@ static bool isVndkEnabled() { |
70 | 71 | } |
71 | 72 | } // namespace |
72 | 73 |
|
| 74 | +namespace graphicsenv_flags = com::android::graphics::graphicsenv::flags; |
| 75 | + |
73 | 76 | namespace android { |
74 | 77 |
|
75 | 78 | enum NativeLibrary { |
@@ -624,10 +627,36 @@ std::string& GraphicsEnv::getPackageName() { |
624 | 627 | return mPackageName; |
625 | 628 | } |
626 | 629 |
|
| 630 | +// List of ANGLE features to enable, specified in the Global.Settings value "angle_egl_features". |
627 | 631 | const std::vector<std::string>& GraphicsEnv::getAngleEglFeatures() { |
628 | 632 | return mAngleEglFeatures; |
629 | 633 | } |
630 | 634 |
|
| 635 | +void GraphicsEnv::getAngleFeatureOverrides(std::vector<const char*>& enabled, |
| 636 | + std::vector<const char*>& disabled) { |
| 637 | + if (!graphicsenv_flags::feature_overrides()) { |
| 638 | + return; |
| 639 | + } |
| 640 | + |
| 641 | + for (const FeatureConfig& feature : mFeatureOverrides.mGlobalFeatures) { |
| 642 | + if (feature.mEnabled) { |
| 643 | + enabled.push_back(feature.mFeatureName.c_str()); |
| 644 | + } else { |
| 645 | + disabled.push_back(feature.mFeatureName.c_str()); |
| 646 | + } |
| 647 | + } |
| 648 | + |
| 649 | + if (mFeatureOverrides.mPackageFeatures.count(mPackageName)) { |
| 650 | + for (const FeatureConfig& feature : mFeatureOverrides.mPackageFeatures[mPackageName]) { |
| 651 | + if (feature.mEnabled) { |
| 652 | + enabled.push_back(feature.mFeatureName.c_str()); |
| 653 | + } else { |
| 654 | + disabled.push_back(feature.mFeatureName.c_str()); |
| 655 | + } |
| 656 | + } |
| 657 | + } |
| 658 | +} |
| 659 | + |
631 | 660 | android_namespace_t* GraphicsEnv::getAngleNamespace() { |
632 | 661 | std::lock_guard<std::mutex> lock(mNamespaceMutex); |
633 | 662 |
|
|
0 commit comments