diff options
author | Wojciech Staszkiewicz <staszkiewicz@google.com> | 2015-05-08 14:58:46 +0100 |
---|---|---|
committer | Wojciech Staszkiewicz <staszkiewicz@google.com> | 2015-05-14 10:24:34 +0100 |
commit | 9e9e2e73c6ec7bece20268196dc89ad0c8bafad4 (patch) | |
tree | c2bf1f99d8bc64db925a95dcab0b5ddec6b8de41 /services/core/java/com/android/server/DeviceIdleController.java | |
parent | 39087b1cec6a54e96ab9eafe8317952720790533 (diff) | |
download | frameworks_base-9e9e2e73c6ec7bece20268196dc89ad0c8bafad4.zip frameworks_base-9e9e2e73c6ec7bece20268196dc89ad0c8bafad4.tar.gz frameworks_base-9e9e2e73c6ec7bece20268196dc89ad0c8bafad4.tar.bz2 |
Pass charset to XmlPullParser.setInput instead of null
Passing null to XmlPullParser.setInput forces it to do additional
work, which can be easily avoided if we know the charset beforehand.
bug: b/20849543
Change-Id: Iaff97be9df2d0f99d7af8f19f65934439c9658e2
Diffstat (limited to 'services/core/java/com/android/server/DeviceIdleController.java')
-rw-r--r-- | services/core/java/com/android/server/DeviceIdleController.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/DeviceIdleController.java b/services/core/java/com/android/server/DeviceIdleController.java index 5dbf4c9..9b7b2d3 100644 --- a/services/core/java/com/android/server/DeviceIdleController.java +++ b/services/core/java/com/android/server/DeviceIdleController.java @@ -71,6 +71,7 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; /** * Keeps track of device idleness and drives low power mode based on that. @@ -679,7 +680,7 @@ public class DeviceIdleController extends SystemService { } try { XmlPullParser parser = Xml.newPullParser(); - parser.setInput(stream, null); + parser.setInput(stream, StandardCharsets.UTF_8.name()); readConfigFileLocked(parser); } catch (XmlPullParserException e) { } finally { @@ -756,7 +757,7 @@ public class DeviceIdleController extends SystemService { try { synchronized (this) { XmlSerializer out = new FastXmlSerializer(); - out.setOutput(memStream, "utf-8"); + out.setOutput(memStream, StandardCharsets.UTF_8.name()); writeConfigFileLocked(out); } } catch (IOException e) { |