Merge "Return TotalMemory size when ddr size is not present" into udc-dev

This commit is contained in:
Juan Yescas
2023-05-10 00:05:47 +00:00
committed by Android (Google) Code Review
2 changed files with 2 additions and 1 deletions

View File

@@ -1359,7 +1359,7 @@ public class Process {
String formatSize = MemoryProperties.memory_ddr_size().orElse("0KB"); String formatSize = MemoryProperties.memory_ddr_size().orElse("0KB");
long memSize = FileUtils.parseSize(formatSize); long memSize = FileUtils.parseSize(formatSize);
if (memSize == Long.MIN_VALUE) { if (memSize <= 0) {
return FileUtils.roundStorageSize(getTotalMemory()); return FileUtils.roundStorageSize(getTotalMemory());
} }

View File

@@ -73,6 +73,7 @@ public class ProcessTest extends TestCase {
} }
public void testGetAdvertisedMem() { public void testGetAdvertisedMem() {
assertTrue(Process.getAdvertisedMem() > 0);
assertTrue(Process.getTotalMemory() <= Process.getAdvertisedMem()); assertTrue(Process.getTotalMemory() <= Process.getAdvertisedMem());
} }
} }