diff options
| author | Dianne Hackborn <hackbod@google.com> | 2018-08-23 15:20:05 -0700 |
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2018-08-24 11:27:50 -0700 |
| commit | 1f3b0302fda5cbbe0d5683cc057c84aaa1b8925c (patch) | |
| tree | 293706192a11eab79bb17ccab6fd0b86ab9cab87 /core/java/android/os/Debug.java | |
| parent | 1a4b8154fc7f92aec4f621906c707479feead6e3 (diff) | |
Throttle requests to ActivityManager.getProcessMemoryInfo().
This is very expensive and needs to run in the system process, we
don't want apps abusing it.
Also don't allow apps to get information about anything but their
own process, unless they have the appropriate privileged permissions.
Bug: 112537519
Test: manual
Change-Id: I103a11f8d5b49fd4536795ea52c05de297698cb5
Diffstat (limited to 'core/java/android/os/Debug.java')
| -rw-r--r-- | core/java/android/os/Debug.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java index 6ddcbe0b3b64..aba81af00282 100644 --- a/core/java/android/os/Debug.java +++ b/core/java/android/os/Debug.java @@ -321,6 +321,45 @@ public final class Debug } /** + * @hide Copy contents from another object. + */ + public void set(MemoryInfo other) { + dalvikPss = other.dalvikPss; + dalvikSwappablePss = other.dalvikSwappablePss; + dalvikRss = other.dalvikRss; + dalvikPrivateDirty = other.dalvikPrivateDirty; + dalvikSharedDirty = other.dalvikSharedDirty; + dalvikPrivateClean = other.dalvikPrivateClean; + dalvikSharedClean = other.dalvikSharedClean; + dalvikSwappedOut = other.dalvikSwappedOut; + dalvikSwappedOutPss = other.dalvikSwappedOutPss; + + nativePss = other.nativePss; + nativeSwappablePss = other.nativeSwappablePss; + nativeRss = other.nativeRss; + nativePrivateDirty = other.nativePrivateDirty; + nativeSharedDirty = other.nativeSharedDirty; + nativePrivateClean = other.nativePrivateClean; + nativeSharedClean = other.nativeSharedClean; + nativeSwappedOut = other.nativeSwappedOut; + nativeSwappedOutPss = other.nativeSwappedOutPss; + + otherPss = other.otherPss; + otherSwappablePss = other.otherSwappablePss; + otherRss = other.otherRss; + otherPrivateDirty = other.otherPrivateDirty; + otherSharedDirty = other.otherSharedDirty; + otherPrivateClean = other.otherPrivateClean; + otherSharedClean = other.otherSharedClean; + otherSwappedOut = other.otherSwappedOut; + otherSwappedOutPss = other.otherSwappedOutPss; + + hasSwappedOutPss = other.hasSwappedOutPss; + + System.arraycopy(other.otherStats, 0, otherStats, 0, otherStats.length); + } + + /** * Return total PSS memory usage in kB. */ public int getTotalPss() { |
