Snap for 7513903 from b0bf27c1f4eb1a5319f5702bb307f81c7973a86b to sc-d2-release

Change-Id: I537a6ad745b7f64b5cb0d276350e7e76ad4cd287
diff --git a/libdmabufinfo/dmabuf_sysfs_stats.cpp b/libdmabufinfo/dmabuf_sysfs_stats.cpp
index c9254fc..f797f7a 100644
--- a/libdmabufinfo/dmabuf_sysfs_stats.cpp
+++ b/libdmabufinfo/dmabuf_sysfs_stats.cpp
@@ -74,13 +74,6 @@
     return true;
 }
 
-bool ReadBufferTotalMmapCount(unsigned int inode, unsigned int* mmap_count,
-                              const std::string& dmabuf_sysfs_path) {
-    std::string mmap_count_path =
-            ::android::base::StringPrintf("%s/%u/mmap_count", dmabuf_sysfs_path.c_str(), inode);
-    return ReadUintFromFile(mmap_count_path, mmap_count);
-}
-
 bool ReadBufferExporter(unsigned int inode, std::string* exporter,
                         const std::string& dmabuf_sysfs_path) {
     std::string exporter_path =
diff --git a/libdmabufinfo/dmabufinfo.cpp b/libdmabufinfo/dmabufinfo.cpp
index a0fc9da..422fc6e 100644
--- a/libdmabufinfo/dmabufinfo.cpp
+++ b/libdmabufinfo/dmabufinfo.cpp
@@ -302,38 +302,5 @@
     return true;
 }
 
-bool ReadDmaBufPss(int pid, uint64_t* pss, const std::string& procfs_path,
-                   const std::string& dmabuf_sysfs_path) {
-    std::vector<DmaBuffer> dmabufs;
-
-    if (!ReadDmaBufMapRefs(pid, &dmabufs, procfs_path, dmabuf_sysfs_path)) {
-        LOG(ERROR) << "Failed to read mapped DMA buffers for pid " << pid;
-        return false;
-    }
-
-    *pss = 0;
-    for (const auto& buf : dmabufs) {
-        const auto& maprefs = buf.maprefs();
-        auto maprefs_it = maprefs.find(pid);
-        if (maprefs_it == maprefs.end()) {
-            LOG(ERROR) << "Failed to retrieve DMA buffer mmap count for pid " << pid;
-            return false;
-        }
-        int process_mmap_count = maprefs_it->second;
-
-        unsigned int total_mmap_count;
-        if (!ReadBufferTotalMmapCount(buf.inode(), &total_mmap_count, dmabuf_sysfs_path)) {
-            LOG(ERROR) << "Failed to read size DMA buffer total_mmap_count from sysfs";
-            return false;
-        }
-
-        if (total_mmap_count > 0) {
-            *pss += process_mmap_count / total_mmap_count * buf.size();
-        }
-    }
-
-    return true;
-}
-
 }  // namespace dmabufinfo
 }  // namespace android
diff --git a/libdmabufinfo/dmabufinfo_test.cpp b/libdmabufinfo/dmabufinfo_test.cpp
index 362eca7..f3f3c43 100644
--- a/libdmabufinfo/dmabufinfo_test.cpp
+++ b/libdmabufinfo/dmabufinfo_test.cpp
@@ -416,25 +416,6 @@
     ASSERT_EQ(dmabuf2->exporter(), exporter);
 }
 
-TEST_F(DmaBufProcessStatsTest, TestReadDmaBufPss) {
-    AddFdInfo(1, 1024, false);
-    AddFdInfo(2, 2048, true);  // Dmabuf 1
-
-    std::vector<std::string> map_entries;
-    map_entries.emplace_back(CreateMapEntry(3, 1024, false));
-    map_entries.emplace_back(CreateMapEntry(4, 1024, true));  // Dmabuf 2
-    map_entries.emplace_back(CreateMapEntry(4, 1024, true));  // Dmabuf 2
-    AddMapEntries(map_entries);
-
-    AddSysfsDmaBufStats(2, 2048, 1);  // Dmabuf 1
-    AddSysfsDmaBufStats(4, 1024, 5);  // Dmabuf 2
-
-    uint64_t expected_pss = 2 / 5 * 1024;
-    uint64_t pss = 0;
-    ASSERT_TRUE(ReadDmaBufPss(pid, &pss, procfs_path, dmabuf_sysfs_path));
-    ASSERT_EQ(pss, expected_pss);
-}
-
 TEST_F(DmaBufProcessStatsTest, TestReadDmaBufFdRefs) {
     AddFdInfo(1, 1024, false);
     AddFdInfo(2, 2048, true);  // Dmabuf 1