diff options
author | Narayan Kamath <narayan@google.com> | 2014-12-17 18:14:00 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2014-12-17 18:14:00 +0000 |
commit | 25c29c19474e5cb359473d3d36fdb1eddb90f50b (patch) | |
tree | 0fc94921dbf5cabed502aa8f51fb7d2851ba3255 /services/core | |
parent | 8b282e7e06858cf263e9e7a483efedf5f3eaa7a3 (diff) | |
parent | 681e6df1221ca7671f574d368d428f62184448b0 (diff) | |
download | frameworks_base-25c29c19474e5cb359473d3d36fdb1eddb90f50b.zip frameworks_base-25c29c19474e5cb359473d3d36fdb1eddb90f50b.tar.gz frameworks_base-25c29c19474e5cb359473d3d36fdb1eddb90f50b.tar.bz2 |
am 6d41504d: Merge "Move frameworks users over to libcore hex encoding API."
automerge: 681e6df1
* commit '681e6df1221ca7671f574d368d428f62184448b0':
Move frameworks users over to libcore hex encoding API.
Diffstat (limited to 'services/core')
-rw-r--r-- | services/core/java/com/android/server/MountService.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java index 6c981c0..97879ed7 100644 --- a/services/core/java/com/android/server/MountService.java +++ b/services/core/java/com/android/server/MountService.java @@ -76,9 +76,8 @@ import com.android.server.pm.PackageManagerService; import com.android.server.pm.UserManagerService; import com.google.android.collect.Lists; import com.google.android.collect.Maps; +import libcore.util.HexEncoding; -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.codec.DecoderException; import org.xmlpull.v1.XmlPullParserException; import java.io.File; @@ -2206,10 +2205,10 @@ class MountService extends IMountService.Stub private String toHex(String password) { if (password == null) { - return new String(); + return ""; } byte[] bytes = password.getBytes(StandardCharsets.UTF_8); - return new String(Hex.encodeHex(bytes)); + return new String(HexEncoding.encode(bytes)); } private String fromHex(String hexPassword) { @@ -2217,12 +2216,14 @@ class MountService extends IMountService.Stub return null; } + final byte[] bytes; try { - byte[] bytes = Hex.decodeHex(hexPassword.toCharArray()); - return new String(bytes, StandardCharsets.UTF_8); - } catch (DecoderException e) { + bytes = HexEncoding.decode(hexPassword.toCharArray(), false); + } catch (IllegalArgumentException e) { return null; } + + return new String(bytes, StandardCharsets.UTF_8); } @Override |