summaryrefslogtreecommitdiff
path: root/libs/utils/String8.cpp
diff options
context:
space:
mode:
author Jeff Brown <jeffbrown@google.com> 2010-12-02 13:50:46 -0800
committer Jeff Brown <jeffbrown@google.com> 2010-12-02 16:01:32 -0800
commitdb360642ed7a48eb3b3607a791bbe449cc6529bb (patch)
tree0b58f551214399aeabda9e029818d4c4e9d1049d /libs/utils/String8.cpp
parent1945ef5b26a82109de5e4bf9951e73ee95197455 (diff)
Improve support for external keyboards.
Use Vendor ID, Product ID and optionally the Version to locate keymaps and configuration files for external devices. Moved virtual key definition parsing to native code so that EventHub can identify touch screens with virtual keys and load the appropriate key layout file. Cleaned up a lot of old code in EventHub. Fixed a regression in ViewRoot's fallback event handling. Fixed a minor bug in FileMap that caused it to try to munmap or close invalid handled when released if the attempt to map the file failed. Added a couple of new String8 conveniences for formatting strings. Modified Tokenizer to fall back to open+read when mmap fails since we can't mmap sysfs files as needed to open the virtual key definition files in /sys/board_properties/. Change-Id: I6ca5e5f9547619fd082ddac47e87ce185da69ee6
Diffstat (limited to 'libs/utils/String8.cpp')
-rw-r--r--libs/utils/String8.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/libs/utils/String8.cpp b/libs/utils/String8.cpp
index e531a2a0f0..0bc5aff221 100644
--- a/libs/utils/String8.cpp
+++ b/libs/utils/String8.cpp
@@ -195,6 +195,24 @@ String8::~String8()
SharedBuffer::bufferFromData(mString)->release();
}
+String8 String8::format(const char* fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+
+ String8 result(formatV(fmt, args));
+
+ va_end(args);
+ return result;
+}
+
+String8 String8::formatV(const char* fmt, va_list args)
+{
+ String8 result;
+ result.appendFormatV(fmt, args);
+ return result;
+}
+
void String8::clear() {
SharedBuffer::bufferFromData(mString)->release();
mString = getEmptyString();