summaryrefslogtreecommitdiffstats
path: root/tools/releasetools/common.py
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-02-11 22:38:54 +0100
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-02-11 22:38:54 +0100
commit530288f5a725848bb899636665ea3f14f9398fad (patch)
tree097879192b3926c5c6503b058d3582d680110bfc /tools/releasetools/common.py
parent34b65b9553c9395846ae1bbe186be2667139db79 (diff)
parentfafb7e2a14706f75bd76aca21c1c7d695f938ed3 (diff)
downloadbuild-530288f5a725848bb899636665ea3f14f9398fad.zip
build-530288f5a725848bb899636665ea3f14f9398fad.tar.gz
build-530288f5a725848bb899636665ea3f14f9398fad.tar.bz2
Merge branch 'cm-13.0' of https://github.com/LineageOS/android_build into replicant-6.0
Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Diffstat (limited to 'tools/releasetools/common.py')
-rw-r--r--tools/releasetools/common.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 32bbc68..ea7312a 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -863,6 +863,7 @@ class PasswordManager(object):
def __init__(self):
self.editor = os.getenv("EDITOR", None)
self.pwfile = os.getenv("ANDROID_PW_FILE", None)
+ self.secure_storage_cmd = os.getenv("ANDROID_SECURE_STORAGE_CMD", None)
def GetPasswords(self, items):
"""Get passwords corresponding to each string in 'items',
@@ -882,9 +883,23 @@ class PasswordManager(object):
missing = []
for i in items:
if i not in current or not current[i]:
- missing.append(i)
+ #Attempt to load using ANDROID_SECURE_STORAGE_CMD
+ if self.secure_storage_cmd:
+ try:
+ os.environ["TMP__KEY_FILE_NAME"] = str(i)
+ ps = subprocess.Popen(self.secure_storage_cmd, shell=True, stdout=subprocess.PIPE)
+ output = ps.communicate()[0]
+ if ps.returncode == 0:
+ current[i] = output
+ except Exception as e:
+ print(e)
+ pass
+ if i not in current or not current[i]:
+ missing.append(i)
# Are all the passwords already in the file?
if not missing:
+ if "ANDROID_SECURE_STORAGE_CMD" in os.environ:
+ del os.environ["ANDROID_SECURE_STORAGE_CMD"]
return current
for i in missing: