diff options
author | Roozbeh Pournader <roozbeh@google.com> | 2015-08-07 12:22:00 -0700 |
---|---|---|
committer | Roozbeh Pournader <roozbeh@google.com> | 2015-08-07 12:22:00 -0700 |
commit | 92eede13edbf22b501edb9aeb92366f91eab9781 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
parent | 709f713ebcd62c61defc270d945810efca179621 (diff) | |
download | emoji-92eede13edbf22b501edb9aeb92366f91eab9781.tar.gz |
Remove EmojiFactory.HEADandroid-wear-o-preview-4android-wear-o-preview-3android-vts-8.1_r7android-vts-8.0_r9android-vts-8.0_r8android-vts-8.0_r7android-vts-8.0_r6android-vts-8.0_r2android-vts-8.0_r13android-vts-8.0_r12android-vts-8.0_r11android-vts-8.0_r10android-vts-8.0_r1android-security-8.0.0_r54android-security-8.0.0_r53android-security-8.0.0_r52android-o-preview-4android-o-preview-3android-o-preview-2android-o-preview-1android-o-mr1-preview-2android-o-mr1-preview-1android-o-mr1-iot-preview-6android-o-iot-preview-5android-n-mr2-preview-2android-n-mr2-preview-1android-n-mr1-preview-2android-n-mr1-preview-1android-n-iot-release-smart-display-r2android-n-iot-release-smart-displayandroid-n-iot-release-polk-at1android-n-iot-release-lg-thinq-wk7android-n-iot-release-ihome-igv1android-n-iot-preview-4android-cts_7.1_r1android-cts-8.0_r9android-cts-8.0_r8android-cts-8.0_r7android-cts-8.0_r6android-cts-8.0_r5android-cts-8.0_r4android-cts-8.0_r3android-cts-8.0_r26android-cts-8.0_r25android-cts-8.0_r24android-cts-8.0_r23android-cts-8.0_r22android-cts-8.0_r21android-cts-8.0_r20android-cts-8.0_r2android-cts-8.0_r19android-cts-8.0_r18android-cts-8.0_r17android-cts-8.0_r16android-cts-8.0_r15android-cts-8.0_r14android-cts-8.0_r13android-cts-8.0_r12android-cts-8.0_r11android-cts-8.0_r10android-cts-8.0_r1android-cts-7.1_r9android-cts-7.1_r8android-cts-7.1_r7android-cts-7.1_r6android-cts-7.1_r5android-cts-7.1_r4android-cts-7.1_r3android-cts-7.1_r29android-cts-7.1_r28android-cts-7.1_r27android-cts-7.1_r26android-cts-7.1_r25android-cts-7.1_r24android-cts-7.1_r23android-cts-7.1_r22android-cts-7.1_r21android-cts-7.1_r20android-cts-7.1_r2android-cts-7.1_r19android-cts-7.1_r18android-cts-7.1_r17android-cts-7.1_r16android-cts-7.1_r15android-cts-7.1_r14android-cts-7.1_r13android-cts-7.1_r12android-cts-7.1_r11android-cts-7.1_r10android-cts-7.1_r1android-cts-7.0_r9android-cts-7.0_r8android-cts-7.0_r7android-cts-7.0_r6android-cts-7.0_r5android-cts-7.0_r4android-cts-7.0_r33android-cts-7.0_r32android-cts-7.0_r31android-cts-7.0_r30android-cts-7.0_r3android-cts-7.0_r29android-cts-7.0_r28android-cts-7.0_r27android-cts-7.0_r26android-cts-7.0_r25android-cts-7.0_r24android-cts-7.0_r23android-cts-7.0_r22android-cts-7.0_r21android-cts-7.0_r20android-cts-7.0_r2android-cts-7.0_r19android-cts-7.0_r18android-cts-7.0_r17android-cts-7.0_r16android-cts-7.0_r15android-cts-7.0_r14android-cts-7.0_r13android-cts-7.0_r12android-cts-7.0_r11android-cts-7.0_r10android-cts-7.0_r1android-8.0.0_r9android-8.0.0_r7android-8.0.0_r51android-8.0.0_r50android-8.0.0_r49android-8.0.0_r48android-8.0.0_r47android-8.0.0_r46android-8.0.0_r45android-8.0.0_r44android-8.0.0_r43android-8.0.0_r42android-8.0.0_r41android-8.0.0_r40android-8.0.0_r4android-8.0.0_r39android-8.0.0_r38android-8.0.0_r37android-8.0.0_r36android-8.0.0_r35android-8.0.0_r32android-8.0.0_r31android-8.0.0_r30android-8.0.0_r3android-8.0.0_r29android-8.0.0_r28android-8.0.0_r2android-8.0.0_r17android-8.0.0_r16android-8.0.0_r15android-8.0.0_r13android-8.0.0_r12android-8.0.0_r11android-8.0.0_r10android-8.0.0_r1android-7.1.2_r9android-7.1.2_r8android-7.1.2_r6android-7.1.2_r5android-7.1.2_r4android-7.1.2_r39android-7.1.2_r38android-7.1.2_r37android-7.1.2_r36android-7.1.2_r33android-7.1.2_r32android-7.1.2_r30android-7.1.2_r3android-7.1.2_r29android-7.1.2_r28android-7.1.2_r27android-7.1.2_r25android-7.1.2_r24android-7.1.2_r23android-7.1.2_r2android-7.1.2_r19android-7.1.2_r18android-7.1.2_r17android-7.1.2_r16android-7.1.2_r15android-7.1.2_r14android-7.1.2_r13android-7.1.2_r12android-7.1.2_r11android-7.1.2_r10android-7.1.2_r1android-7.1.1_r9android-7.1.1_r8android-7.1.1_r7android-7.1.1_r61android-7.1.1_r60android-7.1.1_r6android-7.1.1_r59android-7.1.1_r58android-7.1.1_r57android-7.1.1_r56android-7.1.1_r55android-7.1.1_r54android-7.1.1_r53android-7.1.1_r52android-7.1.1_r51android-7.1.1_r50android-7.1.1_r49android-7.1.1_r48android-7.1.1_r47android-7.1.1_r46android-7.1.1_r45android-7.1.1_r44android-7.1.1_r43android-7.1.1_r42android-7.1.1_r41android-7.1.1_r40android-7.1.1_r4android-7.1.1_r39android-7.1.1_r38android-7.1.1_r35android-7.1.1_r33android-7.1.1_r32android-7.1.1_r31android-7.1.1_r3android-7.1.1_r28android-7.1.1_r27android-7.1.1_r26android-7.1.1_r25android-7.1.1_r24android-7.1.1_r23android-7.1.1_r22android-7.1.1_r21android-7.1.1_r20android-7.1.1_r2android-7.1.1_r17android-7.1.1_r16android-7.1.1_r15android-7.1.1_r14android-7.1.1_r13android-7.1.1_r12android-7.1.1_r11android-7.1.1_r10android-7.1.1_r1android-7.1.0_r7android-7.1.0_r6android-7.1.0_r5android-7.1.0_r4android-7.1.0_r3android-7.1.0_r2android-7.1.0_r1android-7.0.0_r9android-7.0.0_r8android-7.0.0_r7android-7.0.0_r6android-7.0.0_r5android-7.0.0_r4android-7.0.0_r36android-7.0.0_r35android-7.0.0_r34android-7.0.0_r33android-7.0.0_r32android-7.0.0_r31android-7.0.0_r30android-7.0.0_r3android-7.0.0_r29android-7.0.0_r28android-7.0.0_r27android-7.0.0_r24android-7.0.0_r21android-7.0.0_r19android-7.0.0_r17android-7.0.0_r15android-7.0.0_r14android-7.0.0_r13android-7.0.0_r12android-7.0.0_r11android-7.0.0_r10android-7.0.0_r1security-oc-releasesdk-releaseoreo-vts-releaseoreo-security-releaseoreo-releaseoreo-r6-releaseoreo-r5-releaseoreo-r4-releaseoreo-r3-releaseoreo-r2-releaseoreo-devoreo-cts-releaseo-previewo-mr1-iot-preview-6o-iot-preview-5nougat-releasenougat-mr2.3-releasenougat-mr2.2-releasenougat-mr2.1-releasenougat-mr2-security-releasenougat-mr2-releasenougat-mr2-pixel-releasenougat-mr2-devnougat-mr1.8-releasenougat-mr1.7-releasenougat-mr1.6-releasenougat-mr1.5-releasenougat-mr1.4-releasenougat-mr1.3-releasenougat-mr1.2-releasenougat-mr1.1-releasenougat-mr1-volantis-releasenougat-mr1-security-releasenougat-mr1-releasenougat-mr1-flounder-releasenougat-mr1-devnougat-mr1-cts-releasenougat-mr0.5-releasenougat-iot-releasenougat-dr1-releasenougat-devnougat-cts-releasenougat-bugfix-releasen-iot-preview-4mastermain
Bug: 18134313
Change-Id: I6e7ff9fffef6f205b83b38764f50be6e29d97479
-rw-r--r-- | Android.mk | 35 | ||||
-rw-r--r-- | CleanSpec.mk | 49 | ||||
-rw-r--r-- | EmojiFactory.cpp | 183 | ||||
-rw-r--r-- | EmojiFactory.h | 104 |
4 files changed, 0 insertions, 371 deletions
diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 42b19ab..0000000 --- a/Android.mk +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (C) 2009 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := EmojiFactory.cpp - -LOCAL_MODULE_TAGS := optional - -LOCAL_MODULE := libemoji - -LOCAL_SHARED_LIBRARIES := \ - libcutils \ - libutils \ - liblog \ - libdl - -LOCAL_CFLAGS += -Wall -Werror - -LOCAL_C_INCLUDES += \ - $(base)/include/utils - -include $(BUILD_SHARED_LIBRARY) diff --git a/CleanSpec.mk b/CleanSpec.mk deleted file mode 100644 index b84e1b6..0000000 --- a/CleanSpec.mk +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2007 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# If you don't need to do a full clean build but would like to touch -# a file or delete some intermediate files, add a clean step to the end -# of the list. These steps will only be run once, if they haven't been -# run before. -# -# E.g.: -# $(call add-clean-step, touch -c external/sqlite/sqlite3.h) -# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) -# -# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with -# files that are missing or have been moved. -# -# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. -# Use $(OUT_DIR) to refer to the "out" directory. -# -# If you need to re-do something that's already mentioned, just copy -# the command and add it to the bottom of the list. E.g., if a change -# that you made last week required touching a file and a change you -# made today requires touching the same file, just copy the old -# touch step and add it to the end of the list. -# -# ************************************************ -# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST -# ************************************************ - -# For example: -#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) -#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) -#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) -#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) - -# ************************************************ -# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST -# ************************************************ diff --git a/EmojiFactory.cpp b/EmojiFactory.cpp deleted file mode 100644 index 3693314..0000000 --- a/EmojiFactory.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "EmojiFactory.h" - -#define LOG_TAG "EmojiFactory" -#include <utils/Log.h> -#include <utils/Vector.h> - -#include <cutils/properties.h> - -#include <dlfcn.h> -#include <stdlib.h> -#include <string.h> -#include <pthread.h> - - -namespace android { - -static pthread_once_t g_once = PTHREAD_ONCE_INIT; -static Vector<EmojiFactory *> *g_factories = NULL; -static Vector<void *> *g_handles = NULL; - -class EmojiFactoryManager { - public: - void Init(); - virtual ~EmojiFactoryManager(); - private: - void TryRegisterEmojiFactory(const char *library_name); -}; - -// Note: I previously did this procedure in the construcor. However, -// property_get() didn't return a correct value in that context. I guess -// property_get() does not return correct values before AndroidRuntime -// instance (or exactly, AppRuntime in instance app_main.cpp) is -// fully ready (see AndroidRunitem.cpp and app_main.cpp). -// So, instead of doing this in constructor, I decided this shoud be done -// when a user requires to EmojiFactory, which makes better sense to me. -void EmojiFactoryManager::Init() { - g_handles = new Vector<void *>(); - g_factories = new Vector<EmojiFactory *>(); - - char *emoji_libraries = new char[PROPERTY_VALUE_MAX]; - int len = property_get("ro.config.libemoji", emoji_libraries, ""); - // ALOGD("ro.config.libemoji: %s", emoji_libraries); - if (len > 0) { - char *saveptr, *ptr; - ptr = emoji_libraries; - while (true) { - ptr = strtok_r(ptr, ":", &saveptr); - if (NULL == ptr) { - break; - } - TryRegisterEmojiFactory(ptr); - ptr = NULL; - } - } - - delete [] emoji_libraries; -} - -void EmojiFactoryManager::TryRegisterEmojiFactory(const char *library_name) { - void *handle = dlopen(library_name, RTLD_LAZY | RTLD_LOCAL); - if (handle == NULL) { - const char* error_str = dlerror(); - if (error_str) { - error_str = "Unknown reason"; - } - ALOGE("Failed to load shared library %s: %s", library_name, error_str); - return; - } - EmojiFactory *(*get_emoji_factory)() = - reinterpret_cast<EmojiFactory *(*)()>(dlsym(handle, - "GetEmojiFactory")); - if (get_emoji_factory == NULL) { - const char* error_str = dlerror(); - if (error_str) { - error_str = "Unknown reason"; - } - ALOGE("Failed to call GetEmojiFactory: %s", error_str); - dlclose(handle); - return; - } - - EmojiFactory *factory = (*get_emoji_factory)(); - if (NULL == factory) { - ALOGE("Returned factory is NULL"); - dlclose(handle); - return; - } - - const char *name = factory->Name(); - - size_t size = g_factories->size(); - for (size_t i = 0; i < size; ++i) { - EmojiFactory *f = g_factories->itemAt(i); - if (!strcmp(name, f->Name())) { - ALOGE("Same EmojiFactory was found: %s", name); - delete factory; - dlclose(handle); - return; - } - } - g_factories->push(factory); - // dlclose() must not be called here, since returned factory may point to - // static data in the shared library (like "static const char* = "emoji";") - g_handles->push(handle); -} - -EmojiFactoryManager::~EmojiFactoryManager() { - if (g_factories != NULL) { - size_t size = g_factories->size(); - for (size_t i = 0; i < size; ++i) { - delete g_factories->itemAt(i); - } - delete g_factories; - } - - if (g_handles != NULL) { - size_t size = g_handles->size(); - for (size_t i = 0; i < size; ++i) { - dlclose(g_handles->itemAt(i)); - } - delete g_handles; - } -} - -static EmojiFactoryManager g_registrar; - -static void InitializeEmojiFactory() { - g_registrar.Init(); -} - -/* static */ -EmojiFactory *EmojiFactory::GetImplementation(const char *name) { - pthread_once(&g_once, InitializeEmojiFactory); - if (NULL == name) { - return NULL; - } - size_t size = g_factories->size(); - for (size_t i = 0; i < size; ++i) { - EmojiFactory *factory = g_factories->itemAt(i); - if (!strcmp(name, factory->Name())) { - return factory; - } - } - return NULL; -} - -/* static */ -EmojiFactory *EmojiFactory::GetAvailableImplementation() { - pthread_once(&g_once, InitializeEmojiFactory); - size_t size = g_factories->size(); - for (size_t i = 0; i < size; ++i) { - EmojiFactory *factory = g_factories->itemAt(i); - return factory; - } - return NULL; -} - -} // namespace android - -extern "C" android::EmojiFactory *GetImplementation( - const char *name) { - return android::EmojiFactory::GetImplementation(name); -} - -extern "C" android::EmojiFactory *GetAvailableImplementation() { - return android::EmojiFactory::GetAvailableImplementation(); -} diff --git a/EmojiFactory.h b/EmojiFactory.h deleted file mode 100644 index 97ded4c..0000000 --- a/EmojiFactory.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_EMOJI_FACTORY_H -#define ANDROID_EMOJI_FACTORY_H - -namespace android { - -// Abstract class for EmojiFactory. -// -// Here, PUA (or Android PUA) means Unicode PUA defined for various emoji. The -// PUA supports emoji of DoCoMo, KDDI, Softbank and Goomoji. Each PUA defined -// by the other vendors (careers) are called Vendor Specific PUA (vsp). -// For more information, go -// http://unicode.org/~mdavis/08080r-emoji-proposal/ (tentative) -class EmojiFactory { - public: - virtual ~EmojiFactory() {} - // Returns binary image data corresponding to "pua". The size of binary is - // stored to "size". Returns NULL if there's no mapping from the "pua" to a - // specific image. Currently, image format is all (animated) gif. - // - // TODO(dmiyakawa): there should be a way to tell users the format of the - // binary. - virtual const char *GetImageBinaryFromAndroidPua(int pua, int *size) = 0; - - // Returns binary image data corresponding to "sjis", which is defined by - // each career. Returns NULL when there's no mapping for "sjis". - virtual const char *GetImageBinaryFromVendorSpecificSjis(unsigned short sjis, - int *size) { - return GetImageBinaryFromAndroidPua( - GetAndroidPuaFromVendorSpecificSjis(sjis), size); - } - - // Returns binary image data corresponding to Vendor-specific PUA "vsp". - // Returns NULL when there's no mapping for "vsp". - virtual const char *GetImageBinaryFromVendorSpecificPua(int vsp, - int *size) { - return GetImageBinaryFromAndroidPua( - GetAndroidPuaFromVendorSpecificPua(vsp), size); - } - - // Returns Android PUA corresponding to "sjis". Returns -1 when there's no - // mapping from "sjis" to a Android PUA. - virtual int GetAndroidPuaFromVendorSpecificSjis(unsigned short sjis) = 0; - - // Returns Vendor-specific Shift jis code corresponding to "pua". Returns -1 - // when ther's no mapping from "pua" to a specific sjis. - virtual int GetVendorSpecificSjisFromAndroidPua(int pua) = 0; - - // Returns maximum Vendor-Specific PUA. This is the last valid value. - virtual int GetMaximumVendorSpecificPua() = 0; - - // Returns minimum Vendor-Specific PUA. - virtual int GetMinimumVendorSpecificPua() = 0; - - // Returns maximum Android PUA. This the last valid value. - virtual int GetMaximumAndroidPua() = 0; - - // Returns minimum Android PUA. - virtual int GetMinimumAndroidPua() = 0; - - // Returns Android PUA corresponding to Vendor-Specific Unicode "vsp". Returns - // -1 when there's no mapping from "vsp" to a Android PUA. - virtual int GetAndroidPuaFromVendorSpecificPua(int vsp) = 0; - - // Returns Vendor-specific PUA corresponding to "pua". Returns -1 when - // there's no mapping from "pua" to a specific unicode. - virtual int GetVendorSpecificPuaFromAndroidPua(int pua) = 0; - - // Returns non NULL string which defines the name of this factory. - // e.g. "docomo", "goomoji" - virtual const char *Name() const = 0; - - // Get a specific implementation of EmojiFactory. If there's no implementation - // for "name", returns NULL. - // The ownership of the instance remains to this class, so users must not - // release it. - static EmojiFactory *GetImplementation(const char *name); - - // Get an implementation of EmojiFactory. This assumes that, usually, there - // should be only one possible EmojiFactory implementation. If there are more - // than one implementations, most prefered one is returned. - // The ownership of the instance remains to this class, so users must not - // release it. - static EmojiFactory *GetAvailableImplementation(); -}; - -} // namespace android - -#endif // ANDROID_EMOJI_FACTORY_H |