From df5af484f882ede16931a61a866f2ffefbe491ab Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Tue, 4 Aug 2015 22:11:11 -0700 Subject: [PATCH] Reduce log spam for the ease of debugging Bug 22857361. Now InputMethodManagerService generates the following log Couldn't create dir.: /data/system/inputmethod not only when it fails to create the directory but also when /data/system/inputmethod already exists, which makes it difficult for us to figure out the root cause of boot failure on emulator environments (Bug 22857361). With this CL, IMMS no longer shows the message when the directory already exists. Basically this is no risk change, which changes only the condition to show the logging message. Bug: 22857361 Change-Id: I09aaf501b19845c8309b09b57c23077f1757cd1a --- .../core/java/com/android/server/InputMethodManagerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java index 64ee5f1a1037c..4e110705050b8 100644 --- a/services/core/java/com/android/server/InputMethodManagerService.java +++ b/services/core/java/com/android/server/InputMethodManagerService.java @@ -3555,7 +3555,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub ? new File(Environment.getDataDirectory(), SYSTEM_PATH) : Environment.getUserSystemDirectory(userId); final File inputMethodDir = new File(systemDir, INPUT_METHOD_PATH); - if (!inputMethodDir.mkdirs()) { + if (!inputMethodDir.exists() && !inputMethodDir.mkdirs()) { Slog.w(TAG, "Couldn't create dir.: " + inputMethodDir.getAbsolutePath()); } final File subtypeFile = new File(inputMethodDir, ADDITIONAL_SUBTYPES_FILE_NAME);