Remove EmojiFactory.

Bug: 18134313
Change-Id: I6e7ff9fffef6f205b83b38764f50be6e29d97479
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