Avoid unnecessary File.delete() for nonexistent directory
This is a follow up CL to my previous CL [1], which aimed to delete /data/system/inputmethod/ when it's empty. One thing I overlooked was the case where the directory does not exist already. In that case, further trying to delete such a nonexistent directory simply failed hence resulted in outputting the following error message to logcat. Failed to delete the empty parent directory /data/system/inputmethod With this CL, the existence of /data/system/inputmethod/ will be checked first to see if there is anything to clean up in the first place. [1]: I2307b5e4edf7b90d2fc03138f233d6051f80cf90 b1a3fdb9 Bug: 121223050 Test: Manually verified as follows 1. Build and flash aosp_taimen-userdebug into taimen 2. Wait until the device fully boots up 3. adb reboot # to avoid Bug 121259290 4. adb root 5. adb shell cat /data/system/inputmethod/subtypes.xml -> make sure the content looks as follows: <subtypes> <imi id="com.android.inputmethod.latin/.LatinIME"> <subtype ....> <subtype ....> </imi/> </subtypes> 6. Open AOSP Keyboard settings 7. Go to "Appearance & Layouts" -> "Custom input styles" 8. Remove all layouts 9. adb shell cat /data/system/inputmethod/subtypes.xml -> make sure the file no longer exists 10. adb shell ls /data/system/inputmethod -> make sure the directory no longer exists 11. adb reboot 12. adb logcat -s InputMethodManagerService:* -> no error message about /data/system/inputmethod Change-Id: I0428a1ec6300ef346503c53928ddbcf5bb38aab0
Loading
Please register or sign in to comment