adb: add helper to get the ~/.android directory.

Extract the logic for creating ~/.android out of get_user_key_path into
its own function. Also, fall back to getpwuid_r when $HOME isn't
defined.

Change-Id: I676a7c750cb364f89b544818ffda07903d14fb97
Test: ran adb with ~/.android missing
diff --git a/adb_auth_host.cpp b/adb_auth_host.cpp
index 4f4f382..8366549 100644
--- a/adb_auth_host.cpp
+++ b/adb_auth_host.cpp
@@ -246,21 +246,7 @@
 }
 
 static std::string get_user_key_path() {
-    const std::string home = adb_get_homedir_path(true);
-    LOG(DEBUG) << "adb_get_homedir_path returned '" << home << "'";
-
-    const std::string android_dir = android::base::StringPrintf("%s%c.android", home.c_str(),
-                                                                OS_PATH_SEPARATOR);
-
-    struct stat buf;
-    if (stat(android_dir.c_str(), &buf) == -1) {
-        if (adb_mkdir(android_dir.c_str(), 0750) == -1) {
-            PLOG(ERROR) << "Cannot mkdir '" << android_dir << "'";
-            return "";
-        }
-    }
-
-    return android_dir + OS_PATH_SEPARATOR + "adbkey";
+    return adb_get_android_dir_path() + OS_PATH_SEPARATOR + "adbkey";
 }
 
 static bool get_user_key() {