Removed interface to load audio effects libraries

Removed unused functions allowing dynamic loading of audio effects libraries
from effects factory API.

Change-Id: I06cc5a51dc10aca87c7a8687bbb874babd711eca
diff --git a/include/media/AudioEffect.h b/include/media/AudioEffect.h
index 401638a..dd93fd8 100644
--- a/include/media/AudioEffect.h
+++ b/include/media/AudioEffect.h
@@ -44,50 +44,6 @@
 public:
 
     /*
-     *  Static methods for effect libraries management.
-     */
-
-    /*
-     *   Loads the effect library which path is given as first argument.
-     *   This must be the full path of a dynamic library (.so) implementing one or
-     *   more effect engines and exposing the effect library interface described in
-     *   EffectApi.h. The function returns a handle on the library for use by
-     *   further call to unloadEffectLibrary() to unload the library.
-     *
-     *   Parameters:
-     *          libPath:    full path of the dynamic library file in the file system.
-     *          handle:     address where to return the library handle
-     *
-     *   Returned status (from utils/Errors.h) can be:
-     *          NO_ERROR    successful operation.
-     *          PERMISSION_DENIED could not get AudioFlinger interface or
-     *                      application does not have permission to configure audio
-     *          NO_INIT     effect factory not initialized or
-     *                      library could not be loaded or
-     *                      library does not implement required functions
-     *          BAD_VALUE   invalid libPath string or handle
-     *
-     *   Returned value:
-     *          *handle updated with library handle
-     */
-    static status_t loadEffectLibrary(const char *libPath, int *handle);
-
-    /*
-     *   Unloads the effect library which handle is given as argument.
-     *
-     *   Parameters:
-     *          handle: library handle
-     *
-     *   Returned status (from utils/Errors.h) can be:
-     *          NO_ERROR    successful operation.
-     *          PERMISSION_DENIED could not get AudioFlinger interface or
-     *                      application does not have permission to configure audio
-     *          NO_INIT     effect factory not initialized
-     *          BAD_VALUE   invalid handle
-     */
-    static status_t unloadEffectLibrary(int handle);
-
-    /*
      *  Static methods for effects enumeration.
      */
 
diff --git a/include/media/EffectsFactoryApi.h b/include/media/EffectsFactoryApi.h
index b63fac6..8ae13cc 100644
--- a/include/media/EffectsFactoryApi.h
+++ b/include/media/EffectsFactoryApi.h
@@ -132,50 +132,6 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 //
-//    Function:       EffectLoadLibrary
-//
-//    Description:    Loads the effect library which path is given as first argument.
-//          This must be the full path of a dynamic library (.so) implementing one or
-//          more effect engines and exposing the effect library interface described in
-//          EffectApi.h. The function returns a handle on the library for used by
-//          further call to EffectUnloadLibrary() to unload the library.
-//
-//    Input:
-//          libPath:    full path of the dynamic library file in the file system.
-//
-//          handle:     address where to return the library handle
-//
-//    Output:
-//        returned value:    0          successful operation.
-//                          -ENODEV     effect factory not initialized or
-//                                      library could not be loaded or
-//                                      library does not implement required functions
-//                          -EINVAL     invalid libPath string or handle
-//
-////////////////////////////////////////////////////////////////////////////////
-int EffectLoadLibrary(const char *libPath, int *handle);
-
-////////////////////////////////////////////////////////////////////////////////
-//
-//    Function:       EffectUnloadLibrary
-//
-//    Description:  Unloads the effect library which handle is given as argument.
-//
-//    Input:
-//          handle: library handle
-//
-//    Output:
-//        returned value:    0          successful operation.
-//                          -ENODEV     effect factory not initialized
-//                          -ENOENT     invalid handle
-//
-////////////////////////////////////////////////////////////////////////////////
-int EffectUnloadLibrary(int handle);
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-//
 //    Function:       EffectGetDescriptor
 //
 //    Description:    Returns the descriptor of the effect which uuid is pointed
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 75f3e71..d8fdc27 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -139,10 +139,6 @@
 
     virtual int newAudioSessionId() = 0;
 
-    virtual status_t loadEffectLibrary(const char *libPath, int *handle) = 0;
-
-    virtual status_t unloadEffectLibrary(int handle) = 0;
-
     virtual status_t queryNumberEffects(uint32_t *numEffects) = 0;
 
     virtual status_t queryEffect(uint32_t index, effect_descriptor_t *pDescriptor) = 0;
diff --git a/media/libeffects/factory/EffectsFactory.c b/media/libeffects/factory/EffectsFactory.c
index b541be5..b0e8585 100644
--- a/media/libeffects/factory/EffectsFactory.c
+++ b/media/libeffects/factory/EffectsFactory.c
@@ -332,18 +332,6 @@
     return ret;
 }
 
-int EffectLoadLibrary(const char *libPath, int *handle)
-{
-    // TODO: see if this interface still makes sense with the use of config files
-    return -ENOSYS;
-}
-
-int EffectUnloadLibrary(int handle)
-{
-    // TODO: see if this interface still makes sense with the use of config files
-    return -ENOSYS;
-}
-
 int EffectIsNullUuid(effect_uuid_t *uuid)
 {
     if (memcmp(uuid, EFFECT_UUID_NULL, sizeof(effect_uuid_t))) {
diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp
index a043329..8d98900 100644
--- a/media/libmedia/AudioEffect.cpp
+++ b/media/libmedia/AudioEffect.cpp
@@ -398,20 +398,6 @@
 
 // -------------------------------------------------------------------------
 
-status_t AudioEffect::loadEffectLibrary(const char *libPath, int *handle)
-{
-    const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
-    if (af == 0) return PERMISSION_DENIED;
-    return af->loadEffectLibrary(libPath, handle);
-}
-
-status_t AudioEffect::unloadEffectLibrary(int handle)
-{
-    const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
-    if (af == 0) return PERMISSION_DENIED;
-    return af->unloadEffectLibrary(handle);
-}
-
 status_t AudioEffect::queryNumberEffects(uint32_t *numEffects)
 {
     const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index eec47c0..158d2f5 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -63,8 +63,6 @@
     GET_RENDER_POSITION,
     GET_INPUT_FRAMES_LOST,
     NEW_AUDIO_SESSION_ID,
-    LOAD_EFFECT_LIBRARY,
-    UNLOAD_EFFECT_LIBRARY,
     QUERY_NUM_EFFECTS,
     QUERY_EFFECT,
     GET_EFFECT_DESCRIPTOR,
@@ -528,37 +526,6 @@
         return id;
     }
 
-    virtual status_t loadEffectLibrary(const char *libPath, int *handle)
-    {
-        if (libPath == NULL || handle == NULL) {
-            return BAD_VALUE;
-        }
-        *handle = 0;
-        Parcel data, reply;
-        data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
-        data.writeCString(libPath);
-        status_t status = remote()->transact(LOAD_EFFECT_LIBRARY, data, &reply);
-        if (status == NO_ERROR) {
-            status = reply.readInt32();
-            if (status == NO_ERROR) {
-                *handle = reply.readInt32();
-            }
-        }
-        return status;
-    }
-
-    virtual status_t unloadEffectLibrary(int handle)
-    {
-        Parcel data, reply;
-        data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
-        data.writeInt32(handle);
-        status_t status = remote()->transact(UNLOAD_EFFECT_LIBRARY, data, &reply);
-        if (status == NO_ERROR) {
-            status = reply.readInt32();
-        }
-        return status;
-    }
-
     virtual status_t queryNumberEffects(uint32_t *numEffects)
     {
         Parcel data, reply;
@@ -952,21 +919,6 @@
             reply->writeInt32(newAudioSessionId());
             return NO_ERROR;
         } break;
-        case LOAD_EFFECT_LIBRARY: {
-            CHECK_INTERFACE(IAudioFlinger, data, reply);
-            int handle;
-            status_t status = loadEffectLibrary(data.readCString(), &handle);
-            reply->writeInt32(status);
-            if (status == NO_ERROR) {
-                reply->writeInt32(handle);
-            }
-            return NO_ERROR;
-        }
-        case UNLOAD_EFFECT_LIBRARY: {
-            CHECK_INTERFACE(IAudioFlinger, data, reply);
-            reply->writeInt32(unloadEffectLibrary(data.readInt32()));
-            return NO_ERROR;
-        }
         case QUERY_NUM_EFFECTS: {
             CHECK_INTERFACE(IAudioFlinger, data, reply);
             uint32_t numEffects;
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 67c6d96..053854f 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -4615,28 +4615,6 @@
 // ----------------------------------------------------------------------------
 
 
-status_t AudioFlinger::loadEffectLibrary(const char *libPath, int *handle)
-{
-    // check calling permissions
-    if (!settingsAllowed()) {
-        return PERMISSION_DENIED;
-    }
-
-    Mutex::Autolock _l(mLock);
-    return EffectLoadLibrary(libPath, handle);
-}
-
-status_t AudioFlinger::unloadEffectLibrary(int handle)
-{
-    // check calling permissions
-    if (!settingsAllowed()) {
-        return PERMISSION_DENIED;
-    }
-
-    Mutex::Autolock _l(mLock);
-    return EffectUnloadLibrary(handle);
-}
-
 status_t AudioFlinger::queryNumberEffects(uint32_t *numEffects)
 {
     Mutex::Autolock _l(mLock);
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index f3e1984..0698dcb 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -147,10 +147,6 @@
 
     virtual int newAudioSessionId();
 
-    virtual status_t loadEffectLibrary(const char *libPath, int *handle);
-
-    virtual status_t unloadEffectLibrary(int handle);
-
     virtual status_t queryNumberEffects(uint32_t *numEffects);
 
     virtual status_t queryEffect(uint32_t index, effect_descriptor_t *descriptor);