Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cdc89a1e authored by Ananta Kishore K's avatar Ananta Kishore K
Browse files

Graphics: Avoid vulkan libs access if vulkan is disabled

Some CTS tests open vulkan libs without checking permission
files. Avoid loading of vulkan libs if vulkan is disabled.

CRs-fixed: 1053183

Change-Id: I7c36fdfb9480b156191dd4237432d6b12d113f53
parent 1fe1ff7c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <new>
#include <malloc.h>
#include <sys/prctl.h>
#include <cutils/properties.h>

#include "driver.h"
#include "stubhal.h"
@@ -130,6 +131,14 @@ bool Hal::Open() {
    hal_.dev_ = &stubhal::kDevice;

    const hwvulkan_module_t* module;

    // Use stub HAL if vulkan is disabled
    bool disableVulkan = property_get_bool("persist.graphics.vulkan.disable", false);
    if (disableVulkan == true) {
        ALOGI("no Vulkan HAL present, using stub HAL");
        return true;
    }

    int result =
        hw_get_module("vulkan", reinterpret_cast<const hw_module_t**>(&module));
    if (result != 0) {