diff options
| author | Robin Lee <rgl@google.com> | 2017-09-14 14:28:26 +0200 |
|---|---|---|
| committer | Robin Lee <rgl@google.com> | 2017-12-18 15:07:44 +0000 |
| commit | 56be27cbb6d95290276712d678a2b57278a5afc1 (patch) | |
| tree | 42caef5492a88bfa08761b83bf6e274d2cf0c8a8 /core/java/android/os/ShellCommand.java | |
| parent | 0ecc14fb22c7abc802083e350f9583b0cb15a1d9 (diff) | |
Don't suggest writing to /tmp if we already are
Small fix to not write the suggestion line about saving to
/data/local/tmp/ if that's what we're already trying to do but the
actual problem is file permissions (eg from adb unroot)
Test: adb shell am dumpheap com.android.systemui /data/local/tmp/systemui.hprof
Test: adb shell am dumpheap com.android.systemui /tmp/systemui.hprof
Change-Id: I201456a4a72e3d5c988a14590374b2dd559b97d2
Diffstat (limited to 'core/java/android/os/ShellCommand.java')
| -rw-r--r-- | core/java/android/os/ShellCommand.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/os/ShellCommand.java b/core/java/android/os/ShellCommand.java index e4a12e84e466..48a2887e881a 100644 --- a/core/java/android/os/ShellCommand.java +++ b/core/java/android/os/ShellCommand.java @@ -202,7 +202,11 @@ public abstract class ShellCommand { getErrPrintWriter().println("Failure opening file: " + e.getMessage()); } getErrPrintWriter().println("Error: Unable to open file: " + path); - getErrPrintWriter().println("Consider using a file under /data/local/tmp/"); + + String suggestedPath = "/data/local/tmp/"; + if (path == null || !path.startsWith(suggestedPath)) { + getErrPrintWriter().println("Consider using a file under " + suggestedPath); + } return null; } |
