gralloc: Read debug properties in allocator process

This change resolves selinux denials caused by system processes
reading vendor debug properties via gralloc. The debug properties
are read and parsed in the allocator process, then propagated
through the BufferManager

CRs-Fixed: 2619084
Change-Id: I5175a7848cdcd2671bd16ee11721066a921f3d79
diff --git a/libqdutils/qd_utils.cpp b/libqdutils/qd_utils.cpp
index 5fff1cb..9e8cad7 100644
--- a/libqdutils/qd_utils.cpp
+++ b/libqdutils/qd_utils.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013, 2018, 2020, The Linux Foundation. All rights reserved.
 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -84,91 +84,6 @@
     return -1;
 }
 
-static int querySDEInfoDRM(HWQueryType type, int *value) {
-    char property[PROPERTY_VALUE_MAX] = {0};
-
-    // TODO(user): If future targets don't support WB UBWC, add separate
-    // properties in target specific system.prop and have clients like WFD
-    // directly rely on those.
-    switch(type) {
-    case HAS_UBWC:
-    case HAS_WB_UBWC:  // WFD stack still uses this
-        *value = 1;
-        property_get(DISABLE_UBWC_PROP, property, "0");
-        if(!(strncmp(property, "1", PROPERTY_VALUE_MAX)) ||
-                !(strncmp(property, "true", PROPERTY_VALUE_MAX))) {
-            *value = 0;
-        }
-        break;
-    default:
-        ALOGE("Invalid query type %d", type);
-        return -EINVAL;
-    }
-
-    return 0;
-}
-
-static int querySDEInfoFB(HWQueryType type, int *value) {
-    FILE *fileptr = NULL;
-    const char *featureName;
-    char stringBuffer[MAX_STRING_LENGTH];
-    uint32_t tokenCount = 0;
-    const uint32_t maxCount = 10;
-    char *tokens[maxCount] = { NULL };
-
-    switch(type) {
-    case HAS_UBWC:
-        featureName = "ubwc";
-        break;
-    case HAS_WB_UBWC:
-        featureName = "wb_ubwc";
-        break;
-    default:
-        ALOGE("Invalid query type %d", type);
-        return -EINVAL;
-    }
-
-    fileptr = fopen("/sys/devices/virtual/graphics/fb0/mdp/caps", "rb");
-    if (!fileptr) {
-        ALOGE("File '%s' not found", stringBuffer);
-        return -EINVAL;
-    }
-
-    size_t len = MAX_STRING_LENGTH;
-    ssize_t read;
-    char *line = stringBuffer;
-    while ((read = getline(&line, &len, fileptr)) != -1) {
-        // parse the line and update information accordingly
-        if (parseLine(line, tokens, maxCount, &tokenCount)) {
-            continue;
-        }
-
-        if (strncmp(tokens[0], "features", strlen("features"))) {
-            continue;
-        }
-
-        for (uint32_t i = 0; i < tokenCount; i++) {
-            if (!strncmp(tokens[i], featureName, strlen(featureName))) {
-              *value = 1;
-            }
-        }
-    }
-    fclose(fileptr);
-
-    return 0;
-}
-
-int querySDEInfo(HWQueryType type, int *value) {
-    if (!value) {
-        return -EINVAL;
-    }
-
-    if (getDriverType() ==  DriverType::DRM) {
-        return querySDEInfoDRM(type, value);
-    }
-
-    return querySDEInfoFB(type, value);
-}
 
 bool isDPConnected() {
     char connectPath[MAX_FRAME_BUFFER_NAME_SIZE];