diff options
author | 2023-11-27 19:02:55 +0000 | |
---|---|---|
committer | 2023-11-27 19:02:55 +0000 | |
commit | a52fcec3886c9ddb695574e44675159dc414ca96 (patch) | |
tree | 39f614e232440258338e08e66aff3895d6db087b | |
parent | ecf90eb72ee6c1b9db5a0fd564d102ebc4802235 (diff) |
Avoid log spam for the common "no user keys" case.
We see this a lot in logs, and it causes a lot of people to hassle us
about what is actually a common case:
```
AdbDebuggingManager: Cannot read user keys
AdbDebuggingManager: java.io.FileNotFoundException: /data/misc/adb/adb_keys: open failed: ENOENT (No such file or directory)
AdbDebuggingManager: at libcore.io.IoBridge.open(IoBridge.java:574)
AdbDebuggingManager: at java.io.FileInputStream.<init>(FileInputStream.java:160)
AdbDebuggingManager: at android.os.FileUtils.readTextFile(FileUtils.java:638)
AdbDebuggingManager: at com.android.server.adb.AdbDebuggingManager.dump(AdbDebuggingManager.java:1801)
AdbDebuggingManager: at com.android.server.adb.AdbService.dump(AdbService.java:604)
AdbDebuggingManager: at android.os.Binder.doDump(Binder.java:1030)
AdbDebuggingManager: at android.os.Binder.dump(Binder.java:1020)
AdbDebuggingManager: at android.os.Binder.onTransact(Binder.java:890)
AdbDebuggingManager: at android.debug.IAdbManager$Stub.onTransact(IAdbManager.java:357)
AdbDebuggingManager: at android.os.Binder.execTransactInternal(Binder.java:1362)
AdbDebuggingManager: at android.os.Binder.execTransact(Binder.java:1301)
AdbDebuggingManager: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
AdbDebuggingManager: at libcore.io.Linux.open(Native Method)
AdbDebuggingManager: at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
AdbDebuggingManager: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:274)
AdbDebuggingManager: at libcore.io.IoBridge.open(IoBridge.java:560)
```
Test: treehugger
Change-Id: I5206f8dada0d97c022459c2370b839c209041539
-rw-r--r-- | services/core/java/com/android/server/adb/AdbDebuggingManager.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/adb/AdbDebuggingManager.java b/services/core/java/com/android/server/adb/AdbDebuggingManager.java index 6794f750c82d..3280afdf6703 100644 --- a/services/core/java/com/android/server/adb/AdbDebuggingManager.java +++ b/services/core/java/com/android/server/adb/AdbDebuggingManager.java @@ -1797,8 +1797,13 @@ public class AdbDebuggingManager { mFingerprints); try { - dump.write("user_keys", AdbDebuggingManagerProto.USER_KEYS, - FileUtils.readTextFile(new File("/data/misc/adb/adb_keys"), 0, null)); + File userKeys = new File("/data/misc/adb/adb_keys"); + if (userKeys.exists()) { + dump.write("user_keys", AdbDebuggingManagerProto.USER_KEYS, + FileUtils.readTextFile(userKeys, 0, null)); + } else { + Slog.i(TAG, "No user keys on this device"); + } } catch (IOException e) { Slog.i(TAG, "Cannot read user keys", e); } |