From d30210153d8f19a0ca825b33f2282b9ae071c6ec Mon Sep 17 00:00:00 2001 From: Daniel Hillenbrand Date: Sun, 22 Jul 2012 15:24:24 +0200 Subject: [PATCH] jellybeaned --- 80cfw | 14 +- BoardConfig.mk | 14 +- TVOutDummy/Android.mk | 40 + TVOutDummy/Barrier.h | 55 + TVOutDummy/ISecTVOut.cpp | 111 ++ TVOutDummy/ISecTVOut.h | 74 + TVOutDummy/MessageQueue.cpp | 197 +++ TVOutDummy/MessageQueue.h | 126 ++ TVOutDummy/SecTVOutService.cpp | 168 ++ TVOutDummy/SecTVOutService.h | 94 + TVOutDummy/main.cpp | 11 + audio/Android.mk | 6 +- audio/audio_hw.c | 1218 +++++++++---- audio/audio_hw.h | 48 + audio/ril_interface.c | 14 +- camerawrapper/CameraWrapper.cpp | 118 +- configs/audio_policy.conf | 82 + configs/media_codecs.xml | 113 ++ extract-files.sh | 473 ----- galaxys3_base.mk | 216 --- i9300.mk | 208 ++- init.smdk4x12.rc | 146 +- init.smdk4x12.usb.rc | 64 +- libsecril-client/Android.mk | 22 + libsecril-client/secril-client.cpp | 1570 +++++++++++++++++ libsecril-client/secril-client.h | 293 +++ macloader/macloader.cpp | 20 +- .../base/core/res/res/values/arrays.xml | 2 +- .../base/core/res/res/values/config.xml | 36 +- .../base/core/res/res/xml/storage_list.xml | 2 +- overlay/include/hardware/gralloc.h | 273 +++ .../packages/apps/Phone/res/values/config.xml | 4 +- .../apps/Settings/res/values/config.xml | 4 +- recovery.fstab | 3 +- secril_multi/Oem_ril_sap.h | 284 +++ setup-makefiles.sh | 63 - system.prop | 2 - 37 files changed, 4898 insertions(+), 1290 deletions(-) create mode 100644 TVOutDummy/Android.mk create mode 100644 TVOutDummy/Barrier.h create mode 100644 TVOutDummy/ISecTVOut.cpp create mode 100644 TVOutDummy/ISecTVOut.h create mode 100644 TVOutDummy/MessageQueue.cpp create mode 100644 TVOutDummy/MessageQueue.h create mode 100644 TVOutDummy/SecTVOutService.cpp create mode 100644 TVOutDummy/SecTVOutService.h create mode 100644 TVOutDummy/main.cpp create mode 100644 configs/audio_policy.conf create mode 100644 configs/media_codecs.xml delete mode 100755 extract-files.sh delete mode 100644 galaxys3_base.mk create mode 100755 libsecril-client/Android.mk create mode 100755 libsecril-client/secril-client.cpp create mode 100755 libsecril-client/secril-client.h create mode 100644 overlay/include/hardware/gralloc.h create mode 100755 secril_multi/Oem_ril_sap.h delete mode 100755 setup-makefiles.sh diff --git a/80cfw b/80cfw index ccdd906e..ba04436f 100644 --- a/80cfw +++ b/80cfw @@ -3,12 +3,8 @@ # Copy camera firmware to /data/cfw # -if [ ! -f /data/cfw/SlimISP_GD.bin ]; -then - busybox cp /system/vendor/firmware/SlimISP_GD.bin /data/cfw/SlimISP_GD.bin -fi - -if [ ! -f /data/cfw/SlimISP_ZD.bin ]; -then - busybox cp /system/vendor/firmware/SlimISP_ZD.bin /data/cfw/SlimISP_ZD.bin -fi +busybox cp /system/vendor/firmware/SlimISP_GD.bin /data/cfw/SlimISP_GD.bin +busybox cp /system/vendor/firmware/SlimISP_ZD.bin /data/cfw/SlimISP_ZD.bin +busybox chown system /data/cfw/* +busybox chgrp media /data/cfw/* +busybox chmod 0775 /data/cfw/* diff --git a/BoardConfig.mk b/BoardConfig.mk index 73776528..0b4e2e98 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -29,11 +29,14 @@ TARGET_ARCH_VARIANT_CPU := cortex-a9 ARCH_ARM_HAVE_NEON := true ARCH_ARM_HAVE_TLS_REGISTER := true EXYNOS4X12_ENHANCEMENTS := true +EXYNOS4_ENHANCEMENTS := true ifdef EXYNOS4X12_ENHANCEMENTS COMMON_GLOBAL_CFLAGS += -DEXYNOS4210_ENHANCEMENTS COMMON_GLOBAL_CFLAGS += -DEXYNOS4X12_ENHANCEMENTS +COMMON_GLOBAL_CFLAGS += -DEXYNOS4_ENHANCEMENTS COMMON_GLOBAL_CFLAGS += -DSURFACEFLINGER_FORCE_SCREEN_RELEASE +COMMON_GLOBAL_CFLAGS += -DDISABLE_HW_ID_MATCH_CHECK endif TARGET_BOARD_PLATFORM := exynos4 @@ -76,12 +79,13 @@ COMMON_GLOBAL_CFLAGS += -DSEC_HWJPEG_G2D ENABLE_WEBGL := true # Audio +BOARD_USE_SAMSUNG_SEPARATEDSTREAM := true BOARD_USES_LIBMEDIA_WITH_AUDIOPARAMETER := true # HWComposer -BOARD_USES_HWCOMPOSER := true -BOARD_USE_SECTVOUT := true -BOARD_USES_FIMGAPI := true +#BOARD_USES_HWCOMPOSER := true +#BOARD_USE_SECTVOUT := true +#BOARD_USES_FIMGAPI := true #BOARD_USES_HDMI_SUBTITLES := false #BOARD_USES_HDMI := true #BOARD_HDMI_STD := STD_1080P @@ -93,8 +97,8 @@ COMMON_GLOBAL_CFLAGS += -DSAMSUNG_CAMERA_HARDWARE # OMX BOARD_HAVE_CODEC_SUPPORT := SAMSUNG_CODEC_SUPPORT COMMON_GLOBAL_CFLAGS += -DSAMSUNG_CODEC_SUPPORT -#BOARD_USES_PROPRIETARY_OMX := SAMSUNG -#COMMON_GLOBAL_CFLAGS += -DSAMSUNG_OMX +BOARD_USES_PROPRIETARY_OMX := SAMSUNG +COMMON_GLOBAL_CFLAGS += -DSAMSUNG_OMX BOARD_NONBLOCK_MODE_PROCESS := true BOARD_USE_STOREMETADATA := true BOARD_USE_METADATABUFFERTYPE := true diff --git a/TVOutDummy/Android.mk b/TVOutDummy/Android.mk new file mode 100644 index 00000000..1e741744 --- /dev/null +++ b/TVOutDummy/Android.mk @@ -0,0 +1,40 @@ +# Copyright (C) 2008 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) + +# +# libTVOut +# + +include $(CLEAR_VARS) +LOCAL_MODULE_TAGS := optional +LOCAL_PRELINK_MODULE := false + +LOCAL_SRC_FILES := \ + SecTVOutService.cpp \ + MessageQueue.cpp \ + main.cpp +# ISecTVOut.cpp \ + +LOCAL_C_INCLUDES := \ + +LOCAL_SHARED_LIBRARIES := \ + libbinder \ + libutils \ + libcutils + +LOCAL_MODULE := TVOutDummy +include $(BUILD_EXECUTABLE) + diff --git a/TVOutDummy/Barrier.h b/TVOutDummy/Barrier.h new file mode 100644 index 00000000..6f8507e2 --- /dev/null +++ b/TVOutDummy/Barrier.h @@ -0,0 +1,55 @@ +/* + * 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. + */ + +#ifndef ANDROID_BARRIER_H +#define ANDROID_BARRIER_H + +#include +#include +#include + +namespace android { + +class Barrier +{ +public: + inline Barrier() : state(CLOSED) { } + inline ~Barrier() { } + void open() { + Mutex::Autolock _l(lock); + state = OPENED; + cv.broadcast(); + } + void close() { + Mutex::Autolock _l(lock); + state = CLOSED; + } + void wait() const { + Mutex::Autolock _l(lock); + while (state == CLOSED) { + cv.wait(lock); + } + } +private: + enum { OPENED, CLOSED }; + mutable Mutex lock; + mutable Condition cv; + volatile int state; +}; + +}; // namespace android + +#endif // ANDROID_BARRIER_H diff --git a/TVOutDummy/ISecTVOut.cpp b/TVOutDummy/ISecTVOut.cpp new file mode 100644 index 00000000..a013bf1f --- /dev/null +++ b/TVOutDummy/ISecTVOut.cpp @@ -0,0 +1,111 @@ +/* +** +** Copyright 2008, The Android Open Source Project +** Copyright 2010, Samsung Electronics Co. LTD +** +** 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. +*/ + +/* +** +** @author Taikyung, Yu(taikyung.yu@samsung.com) +** @date 2011-07-06 +*/ + +#include +#include +#include +#include +#include "ISecTVOut.h" + +namespace android { + + enum { + SET_HDMI_STATUS = IBinder::FIRST_CALL_TRANSACTION, + SET_HDMI_MODE, + SET_HDMI_RESOLUTION, + SET_HDMI_HDCP, + SET_HDMI_ROTATE, + SET_HDMI_HWCLAYER, + BLIT_2_HDMI + }; + + void BpSecTVOut::setHdmiCableStatus(uint32_t status) + { + Parcel data, reply; + data.writeInt32(status); + remote()->transact(SET_HDMI_STATUS, data, &reply); + } + + void BpSecTVOut::setHdmiMode(uint32_t mode) + { + Parcel data, reply; + data.writeInt32(mode); + remote()->transact(SET_HDMI_MODE, data, &reply); + } + + void BpSecTVOut::setHdmiResolution(uint32_t resolution) + { + Parcel data, reply; + data.writeInt32(resolution); + remote()->transact(SET_HDMI_RESOLUTION, data, &reply); + } + + void BpSecTVOut::setHdmiHdcp(uint32_t resolution) + { + Parcel data, reply; + data.writeInt32(resolution); + remote()->transact(SET_HDMI_HDCP, data, &reply); + } + + void BpSecTVOut::setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer) + { + Parcel data, reply; + data.writeInt32(rotVal); + data.writeInt32(hwcLayer); + remote()->transact(SET_HDMI_ROTATE, data, &reply); + } + + void BpSecTVOut::setHdmiHwcLayer(uint32_t hwcLayer) + { + Parcel data, reply; + data.writeInt32(hwcLayer); + remote()->transact(SET_HDMI_HWCLAYER, data, &reply); + } + + void BpSecTVOut::blit2Hdmi(uint32_t w, uint32_t h, + uint32_t colorFormat, + uint32_t physYAddr, + uint32_t physCbAddr, + uint32_t physCrAddr, + uint32_t dstX, + uint32_t dstY, + uint32_t hdmiLayer, + uint32_t num_of_hwc_layer) + { + Parcel data, reply; + data.writeInt32(w); + data.writeInt32(h); + data.writeInt32(colorFormat); + data.writeInt32(physYAddr); + data.writeInt32(physCbAddr); + data.writeInt32(physCrAddr); + data.writeInt32(dstX); + data.writeInt32(dstY); + data.writeInt32(hdmiLayer); + data.writeInt32(num_of_hwc_layer); + remote()->transact(BLIT_2_HDMI, data, &reply); + } + + IMPLEMENT_META_INTERFACE(SecTVOut, "android.os.ISecTVOut"); +}; diff --git a/TVOutDummy/ISecTVOut.h b/TVOutDummy/ISecTVOut.h new file mode 100644 index 00000000..5506b577 --- /dev/null +++ b/TVOutDummy/ISecTVOut.h @@ -0,0 +1,74 @@ +/* +** +** Copyright 2008, The Android Open Source Project +** Copyright 2010, Samsung Electronics Co. LTD +** +** 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. +*/ + +/* +** +** @author Taikyung, Yu(taikyung.yu@samsung.com) +** @date 2011-07-06 +*/ + +#ifndef ISECTVOUT_H +#define ISECTVOUT_H +#include +#include +#include + +namespace android { + class ISecTVOut: public IInterface + { + public: + DECLARE_META_INTERFACE(SecTVOut); + virtual void setHdmiCableStatus(uint32_t status) = 0; + virtual void setHdmiMode(uint32_t mode) = 0; + virtual void setHdmiResolution(uint32_t resolution) = 0; + virtual void setHdmiHdcp(uint32_t enHdcp) = 0; + virtual void setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer) = 0; + virtual void setHdmiHwcLayer(uint32_t hwcLayer) = 0; + virtual void blit2Hdmi(uint32_t w, uint32_t h, + uint32_t colorFormat, + uint32_t physYAddr, + uint32_t physCbAddr, + uint32_t physCrAddr, + uint32_t dstX, + uint32_t dstY, + uint32_t hdmiLayer, + uint32_t num_of_hwc_layer) = 0; + }; + //-------------------------------------------------------------- + class BpSecTVOut: public BpInterface + { + public: + BpSecTVOut(const sp& impl): BpInterface(impl){} + virtual void setHdmiCableStatus(uint32_t status); + virtual void setHdmiMode(uint32_t mode); + virtual void setHdmiResolution(uint32_t resolution); + virtual void setHdmiHdcp(uint32_t enHdcp); + virtual void setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer); + virtual void setHdmiHwcLayer(uint32_t hwcLayer); + virtual void blit2Hdmi(uint32_t w, uint32_t h, + uint32_t colorFormat, + uint32_t physYAddr, + uint32_t physCbAddr, + uint32_t physCrAddr, + uint32_t dstX, + uint32_t dstY, + uint32_t hdmiLayer, + uint32_t num_of_hwc_layer); + }; +}; +#endif diff --git a/TVOutDummy/MessageQueue.cpp b/TVOutDummy/MessageQueue.cpp new file mode 100644 index 00000000..94410197 --- /dev/null +++ b/TVOutDummy/MessageQueue.cpp @@ -0,0 +1,197 @@ +/* + * 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 +#include +#include + +#include +#include +#include +#include + +#include "MessageQueue.h" + +namespace android { + +// --------------------------------------------------------------------------- + +void MessageList::insert(const sp& node) +{ + LIST::iterator cur(mList.begin()); + LIST::iterator end(mList.end()); + while (cur != end) { + if (*node < **cur) { + mList.insert(cur, node); + return; + } + ++cur; + } + mList.insert(++end, node); +} + +void MessageList::remove(MessageList::LIST::iterator pos) +{ + mList.erase(pos); +} + +// --------------------------------------------------------------------------- + +MessageQueue::MessageQueue() + : mInvalidate(false) +{ + mInvalidateMessage = new MessageBase(INVALIDATE); +} + +MessageQueue::~MessageQueue() +{ +} + +sp MessageQueue::waitMessage(nsecs_t timeout) +{ + sp result; + + bool again; + do { + const nsecs_t timeoutTime = systemTime() + timeout; + while (true) { + Mutex::Autolock _l(mLock); + nsecs_t now = systemTime(); + nsecs_t nextEventTime = -1; + + LIST::iterator cur(mMessages.begin()); + if (cur != mMessages.end()) { + result = *cur; + } + + if (result != 0) { + if (result->when <= now) { + // there is a message to deliver + mMessages.remove(cur); + break; + } + nextEventTime = result->when; + result = 0; + } + + // see if we have an invalidate message + if (mInvalidate) { + mInvalidate = false; + mInvalidateMessage->when = now; + result = mInvalidateMessage; + break; + } + + if (timeout >= 0) { + if (timeoutTime < now) { + // we timed-out, return a NULL message + result = 0; + break; + } + if (nextEventTime > 0) { + if (nextEventTime > timeoutTime) { + nextEventTime = timeoutTime; + } + } else { + nextEventTime = timeoutTime; + } + } + + if (nextEventTime >= 0) { + //ALOGD("nextEventTime = %lld ms", nextEventTime); + if (nextEventTime > 0) { + // we're about to wait, flush the binder command buffer + IPCThreadState::self()->flushCommands(); + const nsecs_t reltime = nextEventTime - systemTime(); + if (reltime > 0) { + mCondition.waitRelative(mLock, reltime); + } + } + } else { + //ALOGD("going to wait"); + // we're about to wait, flush the binder command buffer + IPCThreadState::self()->flushCommands(); + mCondition.wait(mLock); + } + } + // here we're not holding the lock anymore + + if (result == 0) + break; + + again = result->handler(); + if (again) { + // the message has been processed. release our reference to it + // without holding the lock. + result->notify(); + result = 0; + } + + } while (again); + + return result; +} + +status_t MessageQueue::postMessage( + const sp& message, nsecs_t relTime, uint32_t flags) +{ + return queueMessage(message, relTime, flags); +} + +status_t MessageQueue::invalidate() { + Mutex::Autolock _l(mLock); + mInvalidate = true; + mCondition.signal(); + return NO_ERROR; +} + +status_t MessageQueue::queueMessage( + const sp& message, nsecs_t relTime, uint32_t flags) +{ + Mutex::Autolock _l(mLock); + message->when = systemTime() + relTime; + mMessages.insert(message); + + //ALOGD("MessageQueue::queueMessage time = %lld ms", message->when); + //dumpLocked(message); + + mCondition.signal(); + return NO_ERROR; +} + +void MessageQueue::dump(const sp& message) +{ + Mutex::Autolock _l(mLock); + dumpLocked(message); +} + +void MessageQueue::dumpLocked(const sp& message) +{ + LIST::const_iterator cur(mMessages.begin()); + LIST::const_iterator end(mMessages.end()); + int c = 0; + while (cur != end) { + const char tick = (*cur == message) ? '>' : ' '; + ALOGD("%c %d: msg{.what=%08x, when=%lld}", + tick, c, (*cur)->what, (*cur)->when); + ++cur; + c++; + } +} + +// --------------------------------------------------------------------------- + +}; // namespace android diff --git a/TVOutDummy/MessageQueue.h b/TVOutDummy/MessageQueue.h new file mode 100644 index 00000000..890f809a --- /dev/null +++ b/TVOutDummy/MessageQueue.h @@ -0,0 +1,126 @@ +/* + * 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_MESSAGE_QUEUE_H +#define ANDROID_MESSAGE_QUEUE_H + +#include +#include +#include + +#include +#include +#include + +#include "Barrier.h" + +namespace android { + +// --------------------------------------------------------------------------- + +class MessageBase; + +class MessageList +{ + List< sp > mList; + typedef List< sp > LIST; +public: + inline LIST::iterator begin() { return mList.begin(); } + inline LIST::const_iterator begin() const { return mList.begin(); } + inline LIST::iterator end() { return mList.end(); } + inline LIST::const_iterator end() const { return mList.end(); } + inline bool isEmpty() const { return mList.empty(); } + void insert(const sp& node); + void remove(LIST::iterator pos); +}; + +// ============================================================================ + +class MessageBase : + public LightRefBase +{ +public: + nsecs_t when; + uint32_t what; + int32_t arg0; + + MessageBase() : when(0), what(0), arg0(0) { } + MessageBase(uint32_t what, int32_t arg0=0) + : when(0), what(what), arg0(arg0) { } + + // return true if message has a handler + virtual bool handler() { return false; } + + // waits for the handler to be processed + void wait() const { barrier.wait(); } + + // releases all waiters. this is done automatically if + // handler returns true + void notify() const { barrier.open(); } + +protected: + virtual ~MessageBase() { } + +private: + mutable Barrier barrier; + friend class LightRefBase; +}; + +inline bool operator < (const MessageBase& lhs, const MessageBase& rhs) { + return lhs.when < rhs.when; +} + +// --------------------------------------------------------------------------- + +class MessageQueue +{ + typedef List< sp > LIST; +public: + + MessageQueue(); + ~MessageQueue(); + + // pre-defined messages + enum { + INVALIDATE = '_upd' + }; + + sp waitMessage(nsecs_t timeout = -1); + + status_t postMessage(const sp& message, + nsecs_t reltime=0, uint32_t flags = 0); + + status_t invalidate(); + + void dump(const sp& message); + +private: + status_t queueMessage(const sp& message, + nsecs_t reltime, uint32_t flags); + void dumpLocked(const sp& message); + + Mutex mLock; + Condition mCondition; + MessageList mMessages; + bool mInvalidate; + sp mInvalidateMessage; +}; + +// --------------------------------------------------------------------------- + +}; // namespace android + +#endif /* ANDROID_MESSAGE_QUEUE_H */ diff --git a/TVOutDummy/SecTVOutService.cpp b/TVOutDummy/SecTVOutService.cpp new file mode 100644 index 00000000..490f8883 --- /dev/null +++ b/TVOutDummy/SecTVOutService.cpp @@ -0,0 +1,168 @@ +/* +** +** Copyright 2008, The Android Open Source Project +** Copyright 2010, Samsung Electronics Co. LTD +** +** 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. +*/ + +/* +** +** @author Taikyung, Yu(taikyung.yu@samsung.com) +** @date 2011-07-06 +*/ + +#define ALOG_TAG "SecTVOutService" + +#include +#include +#include +#include +#include +#include "SecTVOutService.h" +#include + +namespace android { +#define DEFAULT_LCD_WIDTH 800 +#define DEFAULT_LCD_HEIGHT 480 + +#define DIRECT_VIDEO_RENDERING (1) +#define DIRECT_UI_RENDERING (0) + + enum { + SET_HDMI_STATUS = IBinder::FIRST_CALL_TRANSACTION, + SET_HDMI_MODE, + SET_HDMI_RESOLUTION, + SET_HDMI_HDCP, + SET_HDMI_ROTATE, + SET_HDMI_HWCLAYER, + BLIT_2_HDMI + }; + + int SecTVOutService::instantiate() + { + ALOGD("SKURWYSYN, SecTVOutService instantiate!"); + int r = defaultServiceManager()->addService(String16( "SecTVOutService"), new SecTVOutService ()); + ALOGD("SecTVOutService r=%d", r); + + return r; + } + + SecTVOutService::SecTVOutService () { + ALOGV("SecTVOutService created"); + mHdmiCableInserted = false; + } + + void SecTVOutService::setLCDsize(void) { + } + + SecTVOutService::~SecTVOutService () { + ALOGV ("SecTVOutService destroyed"); + } + + status_t SecTVOutService::onTransact(uint32_t code, const Parcel & data, Parcel * reply, uint32_t flags) + { + switch (code) { + case SET_HDMI_STATUS: { + int status = data.readInt32(); + setHdmiStatus(status); + } break; + + case SET_HDMI_MODE: { + int mode = data.readInt32(); + setHdmiMode(mode); + } break; + + case SET_HDMI_RESOLUTION: { + int resolution = data.readInt32(); + setHdmiResolution(resolution); + } break; + + case SET_HDMI_HDCP: { + int enHdcp = data.readInt32(); + setHdmiHdcp(enHdcp); + } break; + + case SET_HDMI_ROTATE: { + int rotVal = data.readInt32(); + int hwcLayer = data.readInt32(); + setHdmiRotate(rotVal, hwcLayer); + } break; + + case SET_HDMI_HWCLAYER: { + int hwcLayer = data.readInt32(); + setHdmiHwcLayer((uint32_t)hwcLayer); + } break; + + case BLIT_2_HDMI: { + uint32_t w = data.readInt32(); + uint32_t h = data.readInt32(); + uint32_t colorFormat = data.readInt32(); + uint32_t physYAddr = data.readInt32(); + uint32_t physCbAddr = data.readInt32(); + uint32_t physCrAddr = data.readInt32(); + uint32_t dstX = data.readInt32(); + uint32_t dstY = data.readInt32(); + uint32_t hdmiLayer = data.readInt32(); + uint32_t num_of_hwc_layer = data.readInt32(); + + blit2Hdmi(w, h, colorFormat, physYAddr, physCbAddr, physCrAddr, dstX, dstY, hdmiLayer, num_of_hwc_layer); + } break; + + default : + ALOGE ( "onTransact::default"); + return BBinder::onTransact (code, data, reply, flags); + } + + return NO_ERROR; + } + + void SecTVOutService::setHdmiStatus(uint32_t status) + { + + } + + void SecTVOutService::setHdmiMode(uint32_t mode) + { + } + + void SecTVOutService::setHdmiResolution(uint32_t resolution) + { + } + + void SecTVOutService::setHdmiHdcp(uint32_t hdcp_en) + { + } + + void SecTVOutService::setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer) + { + } + + void SecTVOutService::setHdmiHwcLayer(uint32_t hwcLayer) + { + } + + void SecTVOutService::blit2Hdmi(uint32_t w, uint32_t h, uint32_t colorFormat, + uint32_t pPhyYAddr, uint32_t pPhyCbAddr, uint32_t pPhyCrAddr, + uint32_t dstX, uint32_t dstY, + uint32_t hdmiMode, + uint32_t num_of_hwc_layer) + { + } + + bool SecTVOutService::hdmiCableInserted(void) + { + return mHdmiCableInserted; + } + +} diff --git a/TVOutDummy/SecTVOutService.h b/TVOutDummy/SecTVOutService.h new file mode 100644 index 00000000..11e10d52 --- /dev/null +++ b/TVOutDummy/SecTVOutService.h @@ -0,0 +1,94 @@ +/* +** +** Copyright 2008, The Android Open Source Project +** Copyright 2010, Samsung Electronics Co. LTD +** +** 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. +*/ + +/* +** +** @author Taikyung, Yu(taikyung.yu@samsung.com) +** @date 2011-07-06 +*/ + +#ifndef SECTVOUTSERVICE_H +#define SECTVOUTSERVICE_H + +#include +#include +#include +#include + +#include "ISecTVOut.h" +#include "MessageQueue.h" + +namespace android { +//#define CHECK_VIDEO_TIME +//#define CHECK_UI_TIME + + class SecTVOutService : public BBinder + { + public : + enum { + HDMI_MODE_NONE = 0, + HDMI_MODE_UI, + HDMI_MODE_VIDEO, + }; + + mutable Mutex mLock; + + class HDMIFlushThread : public Thread { + SecTVOutService *mTVOutService; + public: + HDMIFlushThread(SecTVOutService *service): + Thread(false), + mTVOutService(service) { } + virtual void onFirstRef() { + run("HDMIFlushThread", PRIORITY_URGENT_DISPLAY); + } + virtual bool threadLoop() { + return false; + } + }; + + mutable MessageQueue mHdmiEventQueue; + bool mExitHdmiFlushThread; + + SecTVOutService(); + static int instantiate (); + virtual status_t onTransact(uint32_t, const Parcel &, Parcel *, uint32_t); + virtual ~SecTVOutService (); + + virtual void setHdmiStatus(uint32_t status); + virtual void setHdmiMode(uint32_t mode); + virtual void setHdmiResolution(uint32_t resolution); + virtual void setHdmiHdcp(uint32_t enHdcp); + virtual void setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer); + virtual void setHdmiHwcLayer(uint32_t hwcLayer); + virtual void blit2Hdmi(uint32_t w, uint32_t h, + uint32_t colorFormat, + uint32_t pPhyYAddr, uint32_t pPhyCbAddr, uint32_t pPhyCrAddr, + uint32_t dstX, uint32_t dstY, + uint32_t hdmiMode, uint32_t num_of_hwc_layer); + bool hdmiCableInserted(void); + void setLCDsize(void); + + private: + bool mHdmiCableInserted; + int mUILayerMode; + uint32_t mLCD_width, mLCD_height; + uint32_t mHwcLayer; + }; +}; +#endif diff --git a/TVOutDummy/main.cpp b/TVOutDummy/main.cpp new file mode 100644 index 00000000..d0a7497d --- /dev/null +++ b/TVOutDummy/main.cpp @@ -0,0 +1,11 @@ +#include "SecTVOutService.h" +#include + +int main() { + android::SecTVOutService::instantiate(); + + // let it run for some time (1 sec) + usleep(1000000); + + return 0; +} diff --git a/audio/Android.mk b/audio/Android.mk index bc962c0d..4655db04 100644 --- a/audio/Android.mk +++ b/audio/Android.mk @@ -16,7 +16,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM) +LOCAL_MODULE := audio.primary.$(TARGET_BOOTLOADER_BOARD_NAME) LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_MODULE_TAGS := optional @@ -25,8 +25,8 @@ LOCAL_SRC_FILES := audio_hw.c ril_interface.c LOCAL_C_INCLUDES += \ external/tinyalsa/include \ external/expat/lib \ - system/media/audio_utils/include \ - system/media/audio_effects/include + $(call include-path-for, audio-utils) \ + $(call include-path-for, audio-effects) LOCAL_SHARED_LIBRARIES := liblog libcutils libtinyalsa libaudioutils libdl libexpat diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 4ba97bfe..ebc57b35 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -3,6 +3,7 @@ * Copyright (C) 2012 Wolfson Microelectronics plc * Copyright (C) 2012 The CyanogenMod Project * Daniel Hillenbrand + * Guillaume "XpLoDWilD" Lesniak * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ */ #define LOG_TAG "audio_hw_primary" -//#define LOG_NDEBUG 0 +#define LOG_NDEBUG 0 #include #include @@ -44,14 +45,24 @@ #include "audio_hw.h" #include "ril_interface.h" -struct pcm_config pcm_config_playback = { +struct pcm_config pcm_config_mm = { .channels = 2, - .rate = DEFAULT_OUT_SAMPLING_RATE, - .period_count = PLAYBACK_PERIOD_COUNT, - .period_size = PLAYBACK_PERIOD_SIZE, + .rate = MM_FULL_POWER_SAMPLING_RATE, + .period_size = DEEP_BUFFER_LONG_PERIOD_SIZE, + .period_count = PLAYBACK_DEEP_BUFFER_LONG_PERIOD_COUNT, .format = PCM_FORMAT_S16_LE, }; +struct pcm_config pcm_config_tones = { + .channels = 2, + .rate = MM_FULL_POWER_SAMPLING_RATE, + .period_size = SHORT_PERIOD_SIZE, + .period_count = PLAYBACK_SHORT_PERIOD_COUNT, + .format = PCM_FORMAT_S16_LE, + .start_threshold = 0, + .avail_min = 0, +}; + struct pcm_config pcm_config_capture = { .channels = 2, .rate = DEFAULT_IN_SAMPLING_RATE, @@ -70,18 +81,6 @@ struct pcm_config pcm_config_vx = { #define MIN(x, y) ((x) > (y) ? (y) : (x)) -struct mixer_ctls -{ - struct mixer_ctl *aif2dacl_source; - struct mixer_ctl *aif2dacr_source; - struct mixer_ctl *aif2_mode; - struct mixer_ctl *dac1l_mixer_aif1_switch; - struct mixer_ctl *dac1r_mixer_aif1_switch; - struct mixer_ctl *dac1l_mixer_aif2_switch; - struct mixer_ctl *dac1r_mixer_aif2_switch; - struct mixer_ctl *aif2dac_mux; -}; - struct m0_audio_device { struct audio_hw_device hw_device; @@ -89,22 +88,21 @@ struct m0_audio_device { struct m0_dev_cfg *dev_cfgs; int num_dev_cfgs; struct mixer *mixer; - struct mixer_ctls mixer_ctls; - int mode; - int active_devices; + audio_mode_t mode; + int active_devices; int devices; struct pcm *pcm_modem_dl; struct pcm *pcm_modem_ul; int in_call; float voice_volume; struct m0_stream_in *active_input; - struct m0_stream_out *active_output; + struct m0_stream_out *outputs[OUTPUT_TOTAL]; bool mic_mute; int tty_mode; struct echo_reference_itfe *echo_reference; bool bluetooth_nrec; int wb_amr; - bool screen_state; + bool screen_off; /* RIL */ struct ril_handle ril; @@ -114,19 +112,35 @@ struct m0_stream_out { struct audio_stream_out stream; pthread_mutex_t lock; /* see note below on mutex acquisition order */ - struct pcm_config config; - struct pcm *pcm; + struct pcm_config config[PCM_TOTAL]; + struct pcm *pcm[PCM_TOTAL]; struct resampler_itfe *resampler; char *buffer; + size_t buffer_frames; int standby; struct echo_reference_itfe *echo_reference; - struct m0_audio_device *dev; int write_threshold; - bool screen_state; + bool use_long_periods; + audio_channel_mask_t channel_mask; + audio_channel_mask_t sup_channel_masks[3]; + + struct m0_audio_device *dev; }; #define MAX_PREPROCESSORS 3 /* maximum one AGC + one NS + one AEC per input stream */ +struct effect_info_s { + effect_handle_t effect_itfe; + size_t num_channel_configs; + channel_config_t* channel_configs; +}; + +#define NUM_IN_AUX_CNL_CONFIGS 2 +channel_config_t in_aux_cnl_configs[NUM_IN_AUX_CNL_CONFIGS] = { + { AUDIO_CHANNEL_IN_FRONT , AUDIO_CHANNEL_IN_BACK}, + { AUDIO_CHANNEL_IN_STEREO , AUDIO_CHANNEL_IN_RIGHT} +}; + struct m0_stream_in { struct audio_stream_in stream; @@ -157,9 +171,12 @@ struct m0_stream_in { int read_status; - int num_preprocessors; - effect_handle_t preprocessors[MAX_PREPROCESSORS]; + int num_preprocessors; + struct effect_info_s preprocessors[MAX_PREPROCESSORS]; + bool aux_channels_changed; + uint32_t main_channels; + uint32_t aux_channels; struct m0_audio_device *dev; }; @@ -183,6 +200,7 @@ static void select_input_device(struct m0_audio_device *adev); static int adev_set_voice_volume(struct audio_hw_device *dev, float volume); static int do_input_standby(struct m0_stream_in *in); static int do_output_standby(struct m0_stream_out *out); +static void in_update_aux_channels(struct m0_stream_in *in, effect_handle_t effect); /* The enable flag when 0 makes the assumption that enums are disabled by * "Off" and integers/booleans by 0 */ @@ -197,7 +215,7 @@ static int set_bigroute_by_array(struct mixer *mixer, struct route_setting *rout while (route[i].ctl_name) { ctl = mixer_get_ctl_by_name(mixer, route[i].ctl_name); if (!ctl) { - LOGE("Unknown control '%s'\n", route[i].ctl_name); + ALOGE("Unknown control '%s'\n", route[i].ctl_name); return -EINVAL; } @@ -205,16 +223,16 @@ static int set_bigroute_by_array(struct mixer *mixer, struct route_setting *rout if (enable) { ret = mixer_ctl_set_enum_by_string(ctl, route[i].strval); if (ret != 0) { - LOGE("Failed to set '%s' to '%s'\n", route[i].ctl_name, route[i].strval); + ALOGE("Failed to set '%s' to '%s'\n", route[i].ctl_name, route[i].strval); } else { - LOGV("Set '%s' to '%s'\n", route[i].ctl_name, route[i].strval); + ALOGV("Set '%s' to '%s'\n", route[i].ctl_name, route[i].strval); } } else { ret = mixer_ctl_set_enum_by_string(ctl, "Off"); if (ret != 0) { - LOGE("Failed to set '%s' to '%s'\n", route[i].ctl_name, route[i].strval); + ALOGE("Failed to set '%s' to '%s'\n", route[i].ctl_name, route[i].strval); } else { - LOGV("Set '%s' to '%s'\n", route[i].ctl_name, "Off"); + ALOGV("Set '%s' to '%s'\n", route[i].ctl_name, "Off"); } } } else { @@ -223,16 +241,16 @@ static int set_bigroute_by_array(struct mixer *mixer, struct route_setting *rout if (enable) { ret = mixer_ctl_set_value(ctl, j, route[i].intval); if (ret != 0) { - LOGE("Failed to set '%s' to '%d'\n", route[i].ctl_name, route[i].intval); + ALOGE("Failed to set '%s' to '%d'\n", route[i].ctl_name, route[i].intval); } else { - LOGV("Set '%s' to '%d'\n", route[i].ctl_name, route[i].intval); + ALOGV("Set '%s' to '%d'\n", route[i].ctl_name, route[i].intval); } } else { ret = mixer_ctl_set_value(ctl, j, 0); if (ret != 0) { - LOGE("Failed to set '%s' to '%d'\n", route[i].ctl_name, route[i].intval); + ALOGE("Failed to set '%s' to '%d'\n", route[i].ctl_name, route[i].intval); } else { - LOGV("Set '%s' to '%d'\n", route[i].ctl_name, 0); + ALOGV("Set '%s' to '%d'\n", route[i].ctl_name, 0); } } } @@ -255,17 +273,17 @@ static int set_route_by_array(struct mixer *mixer, struct route_setting *route, for (i = 0; i < len; i++) { ctl = mixer_get_ctl_by_name(mixer, route[i].ctl_name); if (!ctl) { - LOGE("Unknown control '%s'\n", route[i].ctl_name); + ALOGE("Unknown control '%s'\n", route[i].ctl_name); return -EINVAL; } if (route[i].strval) { ret = mixer_ctl_set_enum_by_string(ctl, route[i].strval); if (ret != 0) { - LOGE("Failed to set '%s' to '%s'\n", + ALOGE("Failed to set '%s' to '%s'\n", route[i].ctl_name, route[i].strval); } else { - LOGV("Set '%s' to '%s'\n", + ALOGV("Set '%s' to '%s'\n", route[i].ctl_name, route[i].strval); } @@ -274,10 +292,10 @@ static int set_route_by_array(struct mixer *mixer, struct route_setting *route, for (j = 0; j < mixer_ctl_get_num_values(ctl); j++) { ret = mixer_ctl_set_value(ctl, j, route[i].intval); if (ret != 0) { - LOGE("Failed to set '%s'.%d to %d\n", + ALOGE("Failed to set '%s'.%d to %d\n", route[i].ctl_name, j, route[i].intval); } else { - LOGV("Set '%s'.%d to %d\n", + ALOGV("Set '%s'.%d to %d\n", route[i].ctl_name, j, route[i].intval); } } @@ -295,7 +313,7 @@ void select_devices(struct m0_audio_device *adev) if (adev->active_devices == adev->devices) return; - LOGV("Changing devices %x => %x\n", adev->active_devices, adev->devices); + ALOGV("Changing devices %x => %x\n", adev->active_devices, adev->devices); /* Turn on new devices first so we don't glitch due to powerdown... */ for (i = 0; i < adev->num_dev_cfgs; i++) @@ -316,8 +334,7 @@ void select_devices(struct m0_audio_device *adev) static int start_call(struct m0_audio_device *adev) { - LOGD("%s: E", __func__); - LOGE("Opening modem PCMs"); + ALOGE("Opening modem PCMs"); int bt_on; bt_on = adev->devices & AUDIO_DEVICE_OUT_ALL_SCO; @@ -330,7 +347,7 @@ static int start_call(struct m0_audio_device *adev) else adev->pcm_modem_dl = pcm_open(CARD_DEFAULT, PORT_MODEM, PCM_OUT, &pcm_config_vx); if (!pcm_is_ready(adev->pcm_modem_dl)) { - LOGE("cannot open PCM modem DL stream: %s", pcm_get_error(adev->pcm_modem_dl)); + ALOGE("cannot open PCM modem DL stream: %s", pcm_get_error(adev->pcm_modem_dl)); goto err_open_dl; } } @@ -338,7 +355,7 @@ static int start_call(struct m0_audio_device *adev) if (adev->pcm_modem_ul == NULL) { adev->pcm_modem_ul = pcm_open(CARD_DEFAULT, PORT_MODEM, PCM_IN, &pcm_config_vx); if (!pcm_is_ready(adev->pcm_modem_ul)) { - LOGE("cannot open PCM modem UL stream: %s", pcm_get_error(adev->pcm_modem_ul)); + ALOGE("cannot open PCM modem UL stream: %s", pcm_get_error(adev->pcm_modem_ul)); goto err_open_ul; } } @@ -346,8 +363,6 @@ static int start_call(struct m0_audio_device *adev) pcm_start(adev->pcm_modem_dl); pcm_start(adev->pcm_modem_ul); - LOGD("%s: X", __func__); - return 0; err_open_ul: @@ -362,15 +377,14 @@ static int start_call(struct m0_audio_device *adev) static void end_call(struct m0_audio_device *adev) { - LOGD("%s: E", __func__); - LOGE("Closing modem PCMs"); + ALOGE("Closing modem PCMs"); + pcm_stop(adev->pcm_modem_dl); pcm_stop(adev->pcm_modem_ul); pcm_close(adev->pcm_modem_dl); pcm_close(adev->pcm_modem_ul); adev->pcm_modem_dl = NULL; adev->pcm_modem_ul = NULL; - LOGD("%s: X", __func__); } static void set_eq_filter(struct m0_audio_device *adev) @@ -379,7 +393,6 @@ static void set_eq_filter(struct m0_audio_device *adev) void audio_set_wb_amr_callback(void *data, int enable) { - LOGD("%s: E", __func__); struct m0_audio_device *adev = (struct m0_audio_device *)data; pthread_mutex_lock(&adev->lock); @@ -394,12 +407,10 @@ void audio_set_wb_amr_callback(void *data, int enable) } } pthread_mutex_unlock(&adev->lock); - LOGD("%s: X", __func__); } static void set_incall_device(struct m0_audio_device *adev) { - LOGD("%s: E", __func__); int device_type; switch(adev->devices & AUDIO_DEVICE_OUT_ALL) { @@ -432,9 +443,8 @@ static void set_incall_device(struct m0_audio_device *adev) } /* if output device isn't supported, open modem side to handset by default */ - LOGE("%s: ril_set_call_audio_path(%d)", __func__, device_type); + ALOGE("%s: ril_set_call_audio_path(%d)", __func__, device_type); ril_set_call_audio_path(&adev->ril, device_type); - LOGD("%s: X", __func__); } static void set_input_volumes(struct m0_audio_device *adev, int main_mic_on, @@ -451,8 +461,11 @@ static void force_all_standby(struct m0_audio_device *adev) struct m0_stream_in *in; struct m0_stream_out *out; - if (adev->active_output) { - out = adev->active_output; + /* only needed for low latency output streams as other streams are not used + * for voice use cases */ + if (adev->outputs[OUTPUT_LOW_LATENCY] != NULL && + !adev->outputs[OUTPUT_LOW_LATENCY]->standby) { + out = adev->outputs[OUTPUT_LOW_LATENCY]; pthread_mutex_lock(&out->lock); do_output_standby(out); pthread_mutex_unlock(&out->lock); @@ -468,9 +481,8 @@ static void force_all_standby(struct m0_audio_device *adev) static void select_mode(struct m0_audio_device *adev) { - LOGD("%s: E", __func__); if (adev->mode == AUDIO_MODE_IN_CALL) { - LOGE("Entering IN_CALL state, in_call=%d", adev->in_call); + ALOGE("Entering IN_CALL state, in_call=%d", adev->in_call); if (!adev->in_call) { force_all_standby(adev); /* force earpiece route for in call state if speaker is the @@ -488,7 +500,6 @@ static void select_mode(struct m0_audio_device *adev) AUDIO_DEVICE_IN_BUILTIN_MIC; else adev->devices &= ~AUDIO_DEVICE_OUT_SPEAKER; - select_output_device(adev); start_call(adev); ril_set_call_clock_sync(&adev->ril, SOUND_CLOCK_START); @@ -496,7 +507,7 @@ static void select_mode(struct m0_audio_device *adev) adev->in_call = 1; } } else { - LOGE("Leaving IN_CALL state, in_call=%d, mode=%d", + ALOGE("Leaving IN_CALL state, in_call=%d, mode=%d", adev->in_call, adev->mode); if (adev->in_call) { adev->in_call = 0; @@ -506,19 +517,17 @@ static void select_mode(struct m0_audio_device *adev) select_input_device(adev); } } - LOGD("%s: X", __func__); } static void select_output_device(struct m0_audio_device *adev) { - LOGD("%s: E", __func__); int headset_on; int headphone_on; int speaker_on; int earpiece_on; int bt_on; bool tty_volume = false; - unsigned int channel = 0; + unsigned int channel; headset_on = adev->devices & AUDIO_DEVICE_OUT_WIRED_HEADSET; headphone_on = adev->devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE; @@ -528,33 +537,35 @@ static void select_output_device(struct m0_audio_device *adev) switch(adev->devices & AUDIO_DEVICE_OUT_ALL) { case AUDIO_DEVICE_OUT_SPEAKER: - LOGD("%s: AUDIO_DEVICE_OUT_SPEAKER", __func__); + ALOGD("%s: AUDIO_DEVICE_OUT_SPEAKER", __func__); break; case AUDIO_DEVICE_OUT_WIRED_HEADSET: - LOGD("%s: AUDIO_DEVICE_OUT_WIRED_HEADSET", __func__); + ALOGD("%s: AUDIO_DEVICE_OUT_WIRED_HEADSET", __func__); break; case AUDIO_DEVICE_OUT_WIRED_HEADPHONE: - LOGD("%s: AUDIO_DEVICE_OUT_WIRED_HEADPHONE", __func__); + ALOGD("%s: AUDIO_DEVICE_OUT_WIRED_HEADPHONE", __func__); break; case AUDIO_DEVICE_OUT_EARPIECE: - LOGD("%s: AUDIO_DEVICE_OUT_EARPIECE", __func__); + ALOGD("%s: AUDIO_DEVICE_OUT_EARPIECE", __func__); break; case AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET: - LOGD("%s: AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET", __func__); + ALOGD("%s: AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET", __func__); break; case AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET: - LOGD("%s: AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET", __func__); + ALOGD("%s: AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET", __func__); break; case AUDIO_DEVICE_OUT_ALL_SCO: - LOGD("%s: AUDIO_DEVICE_OUT_ALL_SCO", __func__); + ALOGD("%s: AUDIO_DEVICE_OUT_ALL_SCO", __func__); break; default: - LOGD("%s: AUDIO_DEVICE_OUT_ALL", __func__); + ALOGD("%s: AUDIO_DEVICE_OUT_ALL", __func__); break; } select_devices(adev); + set_eq_filter(adev); + if (adev->mode == AUDIO_MODE_IN_CALL) { if (!bt_on) { /* force tx path according to TTY mode when in call */ @@ -581,15 +592,15 @@ static void select_output_device(struct m0_audio_device *adev) } if (headset_on || headphone_on || speaker_on || earpiece_on) { - LOGD("%s: set bigroute: voicecall_input_default", __func__); + ALOGD("%s: set bigroute: voicecall_input_default", __func__); set_bigroute_by_array(adev->mixer, voicecall_default, 1); } else { - LOGD("%s: set bigroute: voicecall_input_default_disable", __func__); + ALOGD("%s: set bigroute: voicecall_input_default_disable", __func__); set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); } if (headset_on || headphone_on) { - LOGD("%s: set bigroute: headset_input", __func__); + ALOGD("%s: set bigroute: headset_input", __func__); set_bigroute_by_array(adev->mixer, headset_input, 1); } @@ -597,70 +608,85 @@ static void select_output_device(struct m0_audio_device *adev) // bt uses a different port (PORT_BT) for playback, reopen the pcms end_call(adev); start_call(adev); - LOGD("%s: set bigroute: bt_input", __func__); + ALOGD("%s: set bigroute: bt_input", __func__); set_bigroute_by_array(adev->mixer, bt_input, 1); - LOGD("%s: set bigroute: bt_output", __func__); + ALOGD("%s: set bigroute: bt_output", __func__); set_bigroute_by_array(adev->mixer, bt_output, 1); } set_incall_device(adev); } - LOGD("%s: X", __func__); } static void select_input_device(struct m0_audio_device *adev) { - LOGD("%s: E", __func__); - switch(adev->devices & AUDIO_DEVICE_IN_ALL) { case AUDIO_DEVICE_IN_BUILTIN_MIC: - LOGD("%s: AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); + ALOGD("%s: AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); break; case AUDIO_DEVICE_IN_BACK_MIC: - LOGD("%s: AUDIO_DEVICE_IN_BACK_MIC", __func__); + ALOGD("%s: AUDIO_DEVICE_IN_BACK_MIC", __func__); break; case AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET: - LOGD("%s: AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET", __func__); + ALOGD("%s: AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET", __func__); break; case AUDIO_DEVICE_IN_WIRED_HEADSET: - LOGD("%s: AUDIO_DEVICE_IN_WIRED_HEADSET", __func__); + ALOGD("%s: AUDIO_DEVICE_IN_WIRED_HEADSET", __func__); break; default: break; } select_devices(adev); - LOGD("%s: X", __func__); } /* must be called with hw device and output stream mutexes locked */ -static int start_output_stream(struct m0_stream_out *out) +static int start_output_stream_low_latency(struct m0_stream_out *out) { - LOGD("%s: E", __func__); struct m0_audio_device *adev = out->dev; - unsigned int flags = PCM_OUT | PCM_MMAP; + unsigned int flags = PCM_OUT; int i; bool success = true; - adev->active_output = out; - if (adev->mode != AUDIO_MODE_IN_CALL) { - /* FIXME: only works if only one output can be active at a time */ select_output_device(adev); } - out->config = pcm_config_playback; - out->config.rate = DEFAULT_OUT_SAMPLING_RATE; - out->pcm = pcm_open(CARD_DEFAULT, PORT_PLAYBACK, flags, &out->config); + /* default to low power: will be corrected in out_write if necessary before first write to + * tinyalsa. + */ - /* Close PCM that could not be opened properly and return an error */ - if (out->pcm && !pcm_is_ready(out->pcm)) { - LOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm)); - pcm_close(out->pcm); - out->pcm = NULL; - success = false; + if (adev->devices & (AUDIO_DEVICE_OUT_ALL & + ~(AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET | AUDIO_DEVICE_OUT_AUX_DIGITAL))) { + /* Something not a dock in use */ + out->config[PCM_NORMAL] = pcm_config_tones; + out->config[PCM_NORMAL].rate = MM_FULL_POWER_SAMPLING_RATE; + out->pcm[PCM_NORMAL] = pcm_open(CARD_DEFAULT, PORT_PLAYBACK, + flags, &out->config[PCM_NORMAL]); + } + + if (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) { + /* SPDIF output in use */ + out->config[PCM_SPDIF] = pcm_config_tones; + out->config[PCM_SPDIF].rate = MM_FULL_POWER_SAMPLING_RATE; + out->pcm[PCM_SPDIF] = pcm_open(CARD_DEFAULT, PORT_PLAYBACK, + flags, &out->config[PCM_SPDIF]); + } + + /* Close any PCMs that could not be opened properly and return an error */ + for (i = 0; i < PCM_TOTAL; i++) { + if (out->pcm[i] && !pcm_is_ready(out->pcm[i])) { + ALOGE("%s: cannot open pcm_out driver %d: %s", __func__ , i, pcm_get_error(out->pcm[i])); + pcm_close(out->pcm[i]); + out->pcm[i] = NULL; + success = false; + } } if (success) { + out->buffer_frames = pcm_config_tones.period_size * 2; + if (out->buffer == NULL) + out->buffer = malloc(out->buffer_frames * audio_stream_frame_size(&out->stream.common)); + if (adev->echo_reference != NULL) out->echo_reference = adev->echo_reference; out->resampler->reset(out->resampler); @@ -668,12 +694,39 @@ static int start_output_stream(struct m0_stream_out *out) return 0; } - adev->active_output = NULL; - LOGD("%s: X", __func__); return -ENOMEM; } -static int check_input_parameters(uint32_t sample_rate, int format, int channel_count) +/* must be called with hw device and output stream mutexes locked */ +static int start_output_stream_deep_buffer(struct m0_stream_out *out) +{ + struct m0_audio_device *adev = out->dev; + + if (adev->mode != AUDIO_MODE_IN_CALL) { + select_output_device(adev); + } + + out->write_threshold = PLAYBACK_DEEP_BUFFER_LONG_PERIOD_COUNT * DEEP_BUFFER_LONG_PERIOD_SIZE; + out->use_long_periods = true; + + out->config[PCM_NORMAL] = pcm_config_mm; + out->config[PCM_NORMAL].rate = MM_FULL_POWER_SAMPLING_RATE; + out->pcm[PCM_NORMAL] = pcm_open(CARD_DEFAULT, PORT_PLAYBACK, + PCM_OUT | PCM_MMAP | PCM_NOIRQ, &out->config[PCM_NORMAL]); + if (out->pcm[PCM_NORMAL] && !pcm_is_ready(out->pcm[PCM_NORMAL])) { + ALOGE("%s: cannot open pcm_out driver: %s", __func__, pcm_get_error(out->pcm[PCM_NORMAL])); + pcm_close(out->pcm[PCM_NORMAL]); + out->pcm[PCM_NORMAL] = NULL; + return -ENOMEM; + } + out->buffer_frames = DEEP_BUFFER_SHORT_PERIOD_SIZE * 2; + if (out->buffer == NULL) + out->buffer = malloc(PLAYBACK_DEEP_BUFFER_LONG_PERIOD_COUNT * DEEP_BUFFER_LONG_PERIOD_SIZE); + + return 0; +} + +static int check_input_parameters(uint32_t sample_rate, audio_format_t format, int channel_count) { if (format != AUDIO_FORMAT_PCM_16_BIT) return -EINVAL; @@ -698,7 +751,7 @@ static int check_input_parameters(uint32_t sample_rate, int format, int channel_ return 0; } -static size_t get_input_buffer_size(uint32_t sample_rate, int format, int channel_count) +static size_t get_input_buffer_size(uint32_t sample_rate, audio_format_t format, int channel_count) { size_t size; size_t device_rate; @@ -740,8 +793,11 @@ static void put_echo_reference(struct m0_audio_device *adev, { if (adev->echo_reference != NULL && reference == adev->echo_reference) { - if (adev->active_output != NULL) - remove_echo_reference(adev->active_output, reference); + /* echo reference is taken from the low latency output stream used + * for voice use cases */ + if (adev->outputs[OUTPUT_LOW_LATENCY] != NULL && + !adev->outputs[OUTPUT_LOW_LATENCY]->standby) + remove_echo_reference(adev->outputs[OUTPUT_LOW_LATENCY], reference); release_echo_reference(reference); adev->echo_reference = NULL; } @@ -753,8 +809,12 @@ static struct echo_reference_itfe *get_echo_reference(struct m0_audio_device *ad uint32_t sampling_rate) { put_echo_reference(adev, adev->echo_reference); - if (adev->active_output != NULL) { - struct audio_stream *stream = &adev->active_output->stream.common; + /* echo reference is taken from the low latency output stream used + * for voice use cases */ + if (adev->outputs[OUTPUT_LOW_LATENCY] != NULL && + !adev->outputs[OUTPUT_LOW_LATENCY]->standby) { + struct audio_stream *stream = + &adev->outputs[OUTPUT_LOW_LATENCY]->stream.common; uint32_t wr_channel_count = popcount(stream->get_channels(stream)); uint32_t wr_sampling_rate = stream->get_sample_rate(stream); @@ -766,7 +826,8 @@ static struct echo_reference_itfe *get_echo_reference(struct m0_audio_device *ad wr_sampling_rate, &adev->echo_reference); if (status == 0) - add_echo_reference(adev->active_output, adev->echo_reference); + add_echo_reference(adev->outputs[OUTPUT_LOW_LATENCY], + adev->echo_reference); } return adev->echo_reference; } @@ -777,24 +838,29 @@ static int get_playback_delay(struct m0_stream_out *out, { size_t kernel_frames; int status; + int primary_pcm = 0; + + /* Find the first active PCM to act as primary */ + while ((primary_pcm < PCM_TOTAL) && !out->pcm[primary_pcm]) + primary_pcm++; - status = pcm_get_htimestamp(out->pcm, &kernel_frames, &buffer->time_stamp); + status = pcm_get_htimestamp(out->pcm[primary_pcm], &kernel_frames, &buffer->time_stamp); if (status < 0) { buffer->time_stamp.tv_sec = 0; buffer->time_stamp.tv_nsec = 0; buffer->delay_ns = 0; - LOGV("%s: pcm_get_htimestamp error," + ALOGV("%s: pcm_get_htimestamp error," "setting playbackTimestamp to 0", __func__); return status; } - kernel_frames = pcm_get_buffer_size(out->pcm) - kernel_frames; + kernel_frames = pcm_get_buffer_size(out->pcm[primary_pcm]) - kernel_frames; /* adjust render time stamp with delay added by current driver buffer. * Add the duration of current frame as we want the render time of the last * sample being written. */ buffer->delay_ns = (long)(((int64_t)(kernel_frames + frames)* 1000000000)/ - DEFAULT_OUT_SAMPLING_RATE); + MM_FULL_POWER_SAMPLING_RATE); return 0; } @@ -809,30 +875,46 @@ static int out_set_sample_rate(struct audio_stream *stream, uint32_t rate) return 0; } -static size_t out_get_buffer_size(const struct audio_stream *stream) +static size_t out_get_buffer_size_low_latency(const struct audio_stream *stream) { struct m0_stream_out *out = (struct m0_stream_out *)stream; /* take resampling into account and return the closest majoring multiple of 16 frames, as audioflinger expects audio buffers to be a multiple of 16 frames. Note: we use the default rate here - from pcm_config_playback.rate. */ - size_t size = (PLAYBACK_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / pcm_config_playback.rate; + from pcm_config_tones.rate. */ + size_t size = (SHORT_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / pcm_config_tones.rate; + size = ((size + 15) / 16) * 16; + return size * audio_stream_frame_size((struct audio_stream *)stream); +} + +static size_t out_get_buffer_size_deep_buffer(const struct audio_stream *stream) +{ + struct m0_stream_out *out = (struct m0_stream_out *)stream; + + /* take resampling into account and return the closest majoring + multiple of 16 frames, as audioflinger expects audio buffers to + be a multiple of 16 frames. Note: we use the default rate here + from pcm_config_mm.rate. */ + size_t size = (DEEP_BUFFER_SHORT_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / + pcm_config_mm.rate; size = ((size + 15) / 16) * 16; return size * audio_stream_frame_size((struct audio_stream *)stream); } static uint32_t out_get_channels(const struct audio_stream *stream) { - return AUDIO_CHANNEL_OUT_STEREO; + struct m0_stream_out *out = (struct m0_stream_out *)stream; + + return out->channel_mask; } -static int out_get_format(const struct audio_stream *stream) +static audio_format_t out_get_format(const struct audio_stream *stream) { return AUDIO_FORMAT_PCM_16_BIT; } -static int out_set_format(struct audio_stream *stream, int format) +static int out_set_format(struct audio_stream *stream, audio_format_t format) { return 0; } @@ -842,23 +924,42 @@ static int do_output_standby(struct m0_stream_out *out) { struct m0_audio_device *adev = out->dev; int i; + bool all_outputs_in_standby = true; if (!out->standby) { + out->standby = 1; - if (out->pcm) { - pcm_close(out->pcm); - out->pcm = NULL; + for (i = 0; i < PCM_TOTAL; i++) { + if (out->pcm[i]) { + pcm_close(out->pcm[i]); + out->pcm[i] = NULL; + } } - adev->active_output = 0; + for (i = 0; i < OUTPUT_TOTAL; i++) { + if (adev->outputs[i] != NULL && !adev->outputs[i]->standby) { + all_outputs_in_standby = false; + break; + } + } + + /* force standby on low latency output stream so that it can reuse HDMI driver if + * necessary when restarted */ + if (out == adev->outputs[OUTPUT_HDMI]) { + if (adev->outputs[OUTPUT_LOW_LATENCY] != NULL && + !adev->outputs[OUTPUT_LOW_LATENCY]->standby) { + struct m0_stream_out *ll_out = adev->outputs[OUTPUT_LOW_LATENCY]; + pthread_mutex_lock(&ll_out->lock); + do_output_standby(ll_out); + pthread_mutex_unlock(&ll_out->lock); + } + } /* stop writing to echo reference */ if (out->echo_reference != NULL) { out->echo_reference->write(out->echo_reference, NULL); out->echo_reference = NULL; } - - out->standby = 1; } return 0; } @@ -883,7 +984,6 @@ static int out_dump(const struct audio_stream *stream, int fd) static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) { - LOGD("%s: E", __func__); struct m0_stream_out *out = (struct m0_stream_out *)stream; struct m0_audio_device *adev = out->dev; struct m0_stream_in *in; @@ -901,16 +1001,46 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) pthread_mutex_lock(&adev->lock); pthread_mutex_lock(&out->lock); if (((adev->devices & AUDIO_DEVICE_OUT_ALL) != val) && (val != 0)) { - if (out == adev->active_output) { + /* this is needed only when changing device on low latency output + * as other output streams are not used for voice use cases nor + * handle duplication to HDMI or SPDIF */ + if (out == adev->outputs[OUTPUT_LOW_LATENCY] && !out->standby) { /* a change in output device may change the microphone selection */ if (adev->active_input && adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION) { force_input_standby = true; } + /* force standby if moving to/from HDMI/SPDIF or if the output + * device changes when in HDMI/SPDIF mode */ + /* FIXME also force standby when in call as some audio path switches do not work + * while in call and an output stream is active (e.g BT SCO => earpiece) */ + + /* FIXME workaround for audio being dropped when switching path without forcing standby + * (several hundred ms of audio can be lost: e.g beginning of a ringtone. We must understand + * the root cause in audio HAL, driver or ABE. + if (((val & AUDIO_DEVICE_OUT_AUX_DIGITAL) ^ + (adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)) || + ((val & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) ^ + (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) || + (adev->devices & (AUDIO_DEVICE_OUT_AUX_DIGITAL | + AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET))) + */ + if (((val & AUDIO_DEVICE_OUT_AUX_DIGITAL) ^ + (adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)) || + ((val & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) ^ + (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) || + (adev->devices & (AUDIO_DEVICE_OUT_AUX_DIGITAL | + AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) || + ((val & AUDIO_DEVICE_OUT_SPEAKER) ^ + (adev->devices & AUDIO_DEVICE_OUT_SPEAKER)) || + (adev->mode == AUDIO_MODE_IN_CALL)) + do_output_standby(out); + } + if (out != adev->outputs[OUTPUT_HDMI]) { + adev->devices &= ~AUDIO_DEVICE_OUT_ALL; + adev->devices |= val; + select_output_device(adev); } - adev->devices &= ~AUDIO_DEVICE_OUT_ALL; - adev->devices |= val; - select_output_device(adev); } pthread_mutex_unlock(&out->lock); if (force_input_standby) { @@ -923,21 +1053,63 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) } str_parms_destroy(parms); - LOGD("%s: X", __func__); return ret; } static char * out_get_parameters(const struct audio_stream *stream, const char *keys) { - return strdup(""); + struct m0_stream_out *out = (struct m0_stream_out *)stream; + + struct str_parms *query = str_parms_create_str(keys); + char *str; + char value[256]; + struct str_parms *reply = str_parms_create(); + size_t i, j; + int ret; + bool first = true; + + ret = str_parms_get_str(query, AUDIO_PARAMETER_STREAM_SUP_CHANNELS, value, sizeof(value)); + if (ret >= 0) { + value[0] = '\0'; + i = 0; + while (out->sup_channel_masks[i] != 0) { + for (j = 0; j < ARRAY_SIZE(out_channels_name_to_enum_table); j++) { + if (out_channels_name_to_enum_table[j].value == out->sup_channel_masks[i]) { + if (!first) { + strcat(value, "|"); + } + strcat(value, out_channels_name_to_enum_table[j].name); + first = false; + break; + } + } + i++; + } + str_parms_add_str(reply, AUDIO_PARAMETER_STREAM_SUP_CHANNELS, value); + str = strdup(str_parms_to_str(reply)); + } else { + str = strdup(keys); + } + str_parms_destroy(query); + str_parms_destroy(reply); + return str; +} + +static uint32_t out_get_latency_low_latency(const struct audio_stream_out *stream) +{ + struct m0_stream_out *out = (struct m0_stream_out *)stream; + + /* Note: we use the default rate here from pcm_config_mm.rate */ + return (SHORT_PERIOD_SIZE * PLAYBACK_SHORT_PERIOD_COUNT * 1000) / pcm_config_tones.rate; } -static uint32_t out_get_latency(const struct audio_stream_out *stream) +static uint32_t out_get_latency_deep_buffer(const struct audio_stream_out *stream) { struct m0_stream_out *out = (struct m0_stream_out *)stream; - /* Note: we use the default rate here from pcm_config_playback.rate */ - return (PLAYBACK_PERIOD_SIZE * PLAYBACK_PERIOD_COUNT * 1000) / pcm_config_playback.rate; + /* Note: we use the default rate here from pcm_config_mm.rate */ + return (DEEP_BUFFER_LONG_PERIOD_SIZE * PLAYBACK_DEEP_BUFFER_LONG_PERIOD_COUNT * 1000) / + pcm_config_mm.rate; } static int out_set_volume(struct audio_stream_out *stream, float left, @@ -946,7 +1118,7 @@ static int out_set_volume(struct audio_stream_out *stream, float left, return -ENOSYS; } -static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, +static ssize_t out_write_low_latency(struct audio_stream_out *stream, const void* buffer, size_t bytes) { int ret; @@ -957,14 +1129,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, size_t out_frames = in_frames; bool force_input_standby = false; struct m0_stream_in *in; - bool screen_state; - int kernel_frames; - void *buf; - /* If we're in out_write, we will find at least one pcm active */ - int primary_pcm = -1; int i; - bool use_resampler = false; - int period_size = 0; /* acquiring hw device mutex systematically is useful if a low priority thread is waiting * on the output stream mutex - e.g. executing select_mode() while holding the hw device @@ -973,7 +1138,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, pthread_mutex_lock(&adev->lock); pthread_mutex_lock(&out->lock); if (out->standby) { - ret = start_output_stream(out); + ret = start_output_stream_low_latency(out); if (ret != 0) { pthread_mutex_unlock(&adev->lock); goto exit; @@ -984,64 +1149,147 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION) force_input_standby = true; } + pthread_mutex_unlock(&adev->lock); + + for (i = 0; i < PCM_TOTAL; i++) { + /* only use resampler if required */ + if (out->pcm[i] && (out->config[i].rate != DEFAULT_OUT_SAMPLING_RATE)) { + out_frames = out->buffer_frames; + out->resampler->resample_from_input(out->resampler, + (int16_t *)buffer, + &in_frames, + (int16_t *)out->buffer, + &out_frames); + break; + } + } + + if (out->echo_reference != NULL) { + struct echo_reference_buffer b; + b.raw = (void *)buffer; + b.frame_count = in_frames; + + get_playback_delay(out, out_frames, &b); + out->echo_reference->write(out->echo_reference, &b); + } + + /* Write to all active PCMs */ + for (i = 0; i < PCM_TOTAL; i++) { + if (out->pcm[i]) { + if (out->config[i].rate == DEFAULT_OUT_SAMPLING_RATE) { + /* PCM uses native sample rate */ + ret = PCM_WRITE(out->pcm[i], (void *)buffer, bytes); + } else { + /* PCM needs resampler */ + ret = PCM_WRITE(out->pcm[i], (void *)out->buffer, out_frames * frame_size); + } + if (ret) + break; + } + } + +exit: + pthread_mutex_unlock(&out->lock); + + if (ret != 0) { + usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) / + out_get_sample_rate(&stream->common)); + } + if (force_input_standby) { + pthread_mutex_lock(&adev->lock); + if (adev->active_input) { + in = adev->active_input; + pthread_mutex_lock(&in->lock); + do_input_standby(in); + pthread_mutex_unlock(&in->lock); + } + pthread_mutex_unlock(&adev->lock); + } + + return bytes; +} + +static ssize_t out_write_deep_buffer(struct audio_stream_out *stream, const void* buffer, + size_t bytes) +{ + int ret; + struct m0_stream_out *out = (struct m0_stream_out *)stream; + struct m0_audio_device *adev = out->dev; + size_t frame_size = audio_stream_frame_size(&out->stream.common); + size_t in_frames = bytes / frame_size; + size_t out_frames; + bool use_long_periods; + int kernel_frames; + void *buf; + + /* acquiring hw device mutex systematically is useful if a low priority thread is waiting + * on the output stream mutex - e.g. executing select_mode() while holding the hw device + * mutex + */ + pthread_mutex_lock(&adev->lock); + pthread_mutex_lock(&out->lock); + if (out->standby) { + ret = start_output_stream_deep_buffer(out); + if (ret != 0) { + pthread_mutex_unlock(&adev->lock); + goto exit; + } + out->standby = 0; + } + use_long_periods = adev->screen_off && !adev->active_input; pthread_mutex_unlock(&adev->lock); - out->write_threshold = PLAYBACK_PERIOD_SIZE * PLAYBACK_PERIOD_COUNT; + if (use_long_periods != out->use_long_periods) { + size_t period_size; + size_t period_count; - if (out->pcm) { - if (out->config.rate != DEFAULT_OUT_SAMPLING_RATE) - use_resampler = true; + if (use_long_periods) { + period_size = DEEP_BUFFER_LONG_PERIOD_SIZE; + period_count = PLAYBACK_DEEP_BUFFER_LONG_PERIOD_COUNT; + } else { + period_size = DEEP_BUFFER_SHORT_PERIOD_SIZE; + period_count = PLAYBACK_DEEP_BUFFER_SHORT_PERIOD_COUNT; + } + out->write_threshold = period_size * period_count; + pcm_set_avail_min(out->pcm[PCM_NORMAL], period_size); + out->use_long_periods = use_long_periods; } /* only use resampler if required */ - if (use_resampler) + if (out->config[PCM_NORMAL].rate != DEFAULT_OUT_SAMPLING_RATE) { + out_frames = out->buffer_frames; out->resampler->resample_from_input(out->resampler, (int16_t *)buffer, &in_frames, (int16_t *)out->buffer, &out_frames); - else + buf = (void *)out->buffer; + } else { out_frames = in_frames; - - if (out->echo_reference != NULL) { - struct echo_reference_buffer b; - b.raw = (void *)buffer; - b.frame_count = in_frames; - - get_playback_delay(out, out_frames, &b); - out->echo_reference->write(out->echo_reference, &b); + buf = (void *)buffer; } /* do not allow more than out->write_threshold frames in kernel pcm driver buffer */ do { struct timespec time_stamp; - if (pcm_get_htimestamp(out->pcm, (unsigned int *)&kernel_frames, &time_stamp) < 0) + if (pcm_get_htimestamp(out->pcm[PCM_NORMAL], + (unsigned int *)&kernel_frames, &time_stamp) < 0) break; - kernel_frames = pcm_get_buffer_size(out->pcm) - kernel_frames; + kernel_frames = pcm_get_buffer_size(out->pcm[PCM_NORMAL]) - kernel_frames; if (kernel_frames > out->write_threshold) { unsigned long time = (unsigned long) (((int64_t)(kernel_frames - out->write_threshold) * 1000000) / - DEFAULT_OUT_SAMPLING_RATE); + MM_FULL_POWER_SAMPLING_RATE); if (time < MIN_WRITE_SLEEP_US) time = MIN_WRITE_SLEEP_US; usleep(time); } } while (kernel_frames > out->write_threshold); - /* Write to all active PCMs */ - - if (out->pcm) { - if (out->config.rate == DEFAULT_OUT_SAMPLING_RATE) { - /* PCM uses native sample rate */ - ret = pcm_mmap_write(out->pcm, (void *)buffer, bytes); - } else { - /* PCM needs resampler */ - ret = pcm_mmap_write(out->pcm, (void *)out->buffer, out_frames * frame_size); - } - } + ret = pcm_mmap_write(out->pcm[PCM_NORMAL], buf, out_frames * frame_size); exit: pthread_mutex_unlock(&out->lock); @@ -1051,17 +1299,6 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, out_get_sample_rate(&stream->common)); } - if (force_input_standby) { - pthread_mutex_lock(&adev->lock); - if (adev->active_input) { - in = adev->active_input; - pthread_mutex_lock(&in->lock); - do_input_standby(in); - pthread_mutex_unlock(&in->lock); - } - pthread_mutex_unlock(&adev->lock); - } - return bytes; } @@ -1086,7 +1323,6 @@ static int out_remove_audio_effect(const struct audio_stream *stream, effect_han /* must be called with hw device and input stream mutexes locked */ static int start_input_stream(struct m0_stream_in *in) { - LOGD("%s: E", __func__); int ret = 0; struct m0_audio_device *adev = in->dev; @@ -1098,16 +1334,25 @@ static int start_input_stream(struct m0_stream_in *in) select_input_device(adev); } - /* in case channel count has changed, restart the resampler */ - if (in->resampler) { - release_resampler(in->resampler); - in->resampler = NULL; - ret = create_resampler(in->config.rate, + if (in->aux_channels_changed) + { + in->aux_channels_changed = false; + in->config.channels = popcount(in->main_channels | in->aux_channels); + + if (in->resampler) { + /* release and recreate the resampler with the new number of channel of the input */ + release_resampler(in->resampler); + in->resampler = NULL; + ret = create_resampler(in->config.rate, in->requested_rate, in->config.channels, RESAMPLER_QUALITY_DEFAULT, &in->buf_provider, &in->resampler); + } + ALOGV("%s: New channel configuration, " + "main_channels = [%04x], aux_channels = [%04x], config.channels = %d", + __func__, in->main_channels, in->aux_channels, in->config.channels); } if (in->need_echo_reference && in->echo_reference == NULL) @@ -1116,10 +1361,10 @@ static int start_input_stream(struct m0_stream_in *in) in->config.channels, in->requested_rate); + /* this assumes routing is done previously */ in->pcm = pcm_open(CARD_DEFAULT, PORT_CAPTURE, PCM_IN, &in->config); - if (!pcm_is_ready(in->pcm)) { - LOGE("cannot open pcm_in driver: %s", pcm_get_error(in->pcm)); + ALOGE("cannot open pcm_in driver: %s", pcm_get_error(in->pcm)); pcm_close(in->pcm); adev->active_input = NULL; return -ENOMEM; @@ -1134,7 +1379,6 @@ static int start_input_stream(struct m0_stream_in *in) if (in->resampler) { in->resampler->reset(in->resampler); } - LOGD("%s: X", __func__); return 0; } @@ -1156,26 +1400,22 @@ static size_t in_get_buffer_size(const struct audio_stream *stream) return get_input_buffer_size(in->requested_rate, AUDIO_FORMAT_PCM_16_BIT, - in->config.channels); + popcount(in->main_channels)); } static uint32_t in_get_channels(const struct audio_stream *stream) { struct m0_stream_in *in = (struct m0_stream_in *)stream; - if (in->config.channels == 1) { - return AUDIO_CHANNEL_IN_MONO; - } else { - return AUDIO_CHANNEL_IN_STEREO; - } + return in->main_channels; } -static int in_get_format(const struct audio_stream *stream) +static audio_format_t in_get_format(const struct audio_stream *stream) { return AUDIO_FORMAT_PCM_16_BIT; } -static int in_set_format(struct audio_stream *stream, int format) +static int in_set_format(struct audio_stream *stream, audio_format_t format) { return 0; } @@ -1227,7 +1467,6 @@ static int in_dump(const struct audio_stream *stream, int fd) static int in_set_parameters(struct audio_stream *stream, const char *kvpairs) { - LOGD("%s: E", __func__); struct m0_stream_in *in = (struct m0_stream_in *)stream; struct m0_audio_device *adev = in->dev; struct str_parms *parms; @@ -1257,6 +1496,9 @@ static int in_set_parameters(struct audio_stream *stream, const char *kvpairs) if ((in->device != val) && (val != 0)) { in->device = val; do_standby = true; + /* make sure new device selection is incompatible with multi-mic pre processing + * configuration */ + in_update_aux_channels(in, NULL); } } @@ -1266,7 +1508,6 @@ static int in_set_parameters(struct audio_stream *stream, const char *kvpairs) pthread_mutex_unlock(&adev->lock); str_parms_destroy(parms); - LOGD("%s: X", __func__); return ret; } @@ -1298,7 +1539,7 @@ static void get_capture_delay(struct m0_stream_in *in, buffer->time_stamp.tv_sec = 0; buffer->time_stamp.tv_nsec = 0; buffer->delay_ns = 0; - LOGW("%s: pcm_htimestamp error", __func__); + ALOGW("%s: pcm_htimestamp error", __func__); return; } @@ -1323,7 +1564,7 @@ static void get_capture_delay(struct m0_stream_in *in, buffer->time_stamp = tstamp; buffer->delay_ns = delay_ns; - LOGV("%s: time_stamp = [%ld].[%ld], delay_ns: [%d]," + ALOGV("%s: time_stamp = [%ld].[%ld], delay_ns: [%d]," " kernel_delay:[%ld], buf_delay:[%ld], rsmp_delay:[%ld], kernel_frames:[%d], " "in->read_buf_frames:[%d], in->proc_buf_frames:[%d], frames:[%d]", __func__, buffer->time_stamp.tv_sec , buffer->time_stamp.tv_nsec, buffer->delay_ns, @@ -1337,13 +1578,17 @@ static int32_t update_echo_reference(struct m0_stream_in *in, size_t frames) struct echo_reference_buffer b; b.delay_ns = 0; - LOGV("%s: frames = [%d], in->ref_frames_in = [%d], " + ALOGV("%s: frames = [%d], in->ref_frames_in = [%d], " "b.frame_count = [%d]", __func__, frames, in->ref_buf_frames, frames - in->ref_buf_frames); if (in->ref_buf_frames < frames) { if (in->ref_buf_size < frames) { in->ref_buf_size = frames; in->ref_buf = (int16_t *)realloc(in->ref_buf, pcm_frames_to_bytes(in->pcm, frames)); + ALOG_ASSERT((in->ref_buf != NULL), + "%s failed to reallocate ref_buf", __func__); + ALOGV("%s: ref_buf %p extended to %d bytes", + __func__, in->ref_buf, pcm_frames_to_bytes(in->pcm, frames)); } b.frame_count = frames - in->ref_buf_frames; b.raw = (void *)(in->ref_buf + in->ref_buf_frames * in->config.channels); @@ -1353,12 +1598,12 @@ static int32_t update_echo_reference(struct m0_stream_in *in, size_t frames) if (in->echo_reference->read(in->echo_reference, &b) == 0) { in->ref_buf_frames += b.frame_count; - LOGD("%s: in->ref_buf_frames:[%d], " + ALOGD("%s: in->ref_buf_frames:[%d], " "in->ref_buf_size:[%d], frames:[%d], b.frame_count:[%d]", __func__, in->ref_buf_frames, in->ref_buf_size, frames, b.frame_count); } } else - LOGW("%s: NOT enough frames to read ref buffer", __func__); + ALOGW("%s: NOT enough frames to read ref buffer", __func__); return b.delay_ns; } @@ -1410,13 +1655,13 @@ static void push_echo_reference(struct m0_stream_in *in, size_t frames) buf.raw = in->ref_buf; for (i = 0; i < in->num_preprocessors; i++) { - if ((*in->preprocessors[i])->process_reverse == NULL) + if ((*in->preprocessors[i].effect_itfe)->process_reverse == NULL) continue; - (*in->preprocessors[i])->process_reverse(in->preprocessors[i], + (*in->preprocessors[i].effect_itfe)->process_reverse(in->preprocessors[i].effect_itfe, &buf, NULL); - set_preprocessor_echo_delay(in->preprocessors[i], delay_us); + set_preprocessor_echo_delay(in->preprocessors[i].effect_itfe, delay_us); } in->ref_buf_frames -= buf.frameCount; @@ -1450,14 +1695,16 @@ static int get_next_buffer(struct resampler_buffer_provider *buffer_provider, if (in->read_buf_size < in->config.period_size) { in->read_buf_size = in->config.period_size; in->read_buf = (int16_t *) realloc(in->read_buf, size_in_bytes); - LOGI("%s: read_buf %p extended to %d bytes", + ALOG_ASSERT((in->read_buf != NULL), + "%s failed to reallocate read_buf", __func__); + ALOGV("%s: read_buf %p extended to %d bytes", __func__, in->read_buf, size_in_bytes); } in->read_status = pcm_read(in->pcm, (void*)in->read_buf, size_in_bytes); if (in->read_status != 0) { - LOGE("%s: pcm_read error %d", __func__, in->read_status); + ALOGE("%s: pcm_read error %d", __func__, in->read_status); buffer->raw = NULL; buffer->frame_count = 0; return in->read_status; @@ -1536,7 +1783,16 @@ static ssize_t process_frames(struct m0_stream_in *in, void* buffer, ssize_t fra audio_buffer_t in_buf; audio_buffer_t out_buf; int i; + bool has_aux_channels = (~in->main_channels & in->aux_channels); + void *proc_buf_out; + if (has_aux_channels) + proc_buf_out = in->proc_buf_out; + else + proc_buf_out = buffer; + + /* since all the processing below is done in frames and using the config.channels + * as the number of channels, no changes is required in case aux_channels are present */ while (frames_wr < frames) { /* first reload enough frames at the end of process input buffer */ if (in->proc_buf_frames < (size_t)frames) { @@ -1547,7 +1803,16 @@ static ssize_t process_frames(struct m0_stream_in *in, void* buffer, ssize_t fra in->proc_buf_size = (size_t)frames; in->proc_buf_in = (int16_t *)realloc(in->proc_buf_in, size_in_bytes); - LOGD("%s: proc_buf_in %p extended to %d bytes", __func__, in->proc_buf_in, size_in_bytes); + ALOG_ASSERT((in->proc_buf_in != NULL), + "%s failed to reallocate proc_buf_in", __func__); + if (has_aux_channels) { + in->proc_buf_out = (int16_t *)realloc(in->proc_buf_out, size_in_bytes); + ALOG_ASSERT((in->proc_buf_out != NULL), + "%s failed to reallocate proc_buf_out", __func__); + proc_buf_out = in->proc_buf_out; + } + ALOGV("process_frames(): proc_buf_in %p extended to %d bytes", + in->proc_buf_in, size_in_bytes); } frames_rd = read_frames(in, in->proc_buf_in + @@ -1568,12 +1833,18 @@ static ssize_t process_frames(struct m0_stream_in *in, void* buffer, ssize_t fra in_buf.frameCount = in->proc_buf_frames; in_buf.s16 = in->proc_buf_in; out_buf.frameCount = frames - frames_wr; - out_buf.s16 = (int16_t *)buffer + frames_wr * in->config.channels; - - for (i = 0; i < in->num_preprocessors; i++) - (*in->preprocessors[i])->process(in->preprocessors[i], + out_buf.s16 = (int16_t *)proc_buf_out + frames_wr * in->config.channels; + + /* FIXME: this works because of current pre processing library implementation that + * does the actual process only when the last enabled effect process is called. + * The generic solution is to have an output buffer for each effect and pass it as + * input to the next. + */ + for (i = 0; i < in->num_preprocessors; i++) { + (*in->preprocessors[i].effect_itfe)->process(in->preprocessors[i].effect_itfe, &in_buf, &out_buf); + } /* process() has updated the number of frames consumed and produced in * in_buf.frameCount and out_buf.frameCount respectively @@ -1587,18 +1858,47 @@ static ssize_t process_frames(struct m0_stream_in *in, void* buffer, ssize_t fra } /* if not enough frames were passed to process(), read more and retry. */ - if (out_buf.frameCount == 0) + if (out_buf.frameCount == 0) { + ALOGW("No frames produced by preproc"); continue; + } if ((frames_wr + (ssize_t)out_buf.frameCount) <= frames) { frames_wr += out_buf.frameCount; } else { /* The effect does not comply to the API. In theory, we should never end up here! */ - LOGE("%s: preprocessing produced too many frames: %d + %d > %d !", __func__, + ALOGE("%s: preprocessing produced too many frames: %d + %d > %d !", __func__, (unsigned int)frames_wr, out_buf.frameCount, (unsigned int)frames); frames_wr = frames; } } + + /* Remove aux_channels that have been added on top of main_channels + * Assumption is made that the channels are interleaved and that the main + * channels are first. */ + if (has_aux_channels) + { + size_t src_channels = in->config.channels; + size_t dst_channels = popcount(in->main_channels); + int16_t* src_buffer = (int16_t *)proc_buf_out; + int16_t* dst_buffer = (int16_t *)buffer; + + if (dst_channels == 1) { + for (i = frames_wr; i > 0; i--) + { + *dst_buffer++ = *src_buffer; + src_buffer += src_channels; + } + } else { + for (i = frames_wr; i > 0; i--) + { + memcpy(dst_buffer, src_buffer, dst_channels*sizeof(int16_t)); + dst_buffer += dst_channels; + src_buffer += src_channels; + } + } + } + return frames_wr; } @@ -1653,6 +1953,284 @@ static uint32_t in_get_input_frames_lost(struct audio_stream_in *stream) return 0; } +#define GET_COMMAND_STATUS(status, fct_status, cmd_status) \ + do { \ + if (fct_status != 0) \ + status = fct_status; \ + else if (cmd_status != 0) \ + status = cmd_status; \ + } while(0) + +static int in_configure_reverse(struct m0_stream_in *in) +{ + int32_t cmd_status; + uint32_t size = sizeof(int); + effect_config_t config; + int32_t status = 0; + int32_t fct_status = 0; + int i; + + if (in->num_preprocessors > 0) { + config.inputCfg.channels = in->main_channels; + config.outputCfg.channels = in->main_channels; + config.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT; + config.outputCfg.format = AUDIO_FORMAT_PCM_16_BIT; + config.inputCfg.samplingRate = in->requested_rate; + config.outputCfg.samplingRate = in->requested_rate; + config.inputCfg.mask = + ( EFFECT_CONFIG_SMP_RATE | EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT ); + config.outputCfg.mask = + ( EFFECT_CONFIG_SMP_RATE | EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT ); + + for (i = 0; i < in->num_preprocessors; i++) + { + if ((*in->preprocessors[i].effect_itfe)->process_reverse == NULL) + continue; + fct_status = (*(in->preprocessors[i].effect_itfe))->command( + in->preprocessors[i].effect_itfe, + EFFECT_CMD_SET_CONFIG_REVERSE, + sizeof(effect_config_t), + &config, + &size, + &cmd_status); + GET_COMMAND_STATUS(status, fct_status, cmd_status); + } + } + return status; +} + +#define MAX_NUM_CHANNEL_CONFIGS 10 + +static void in_read_audio_effect_channel_configs(struct m0_stream_in *in, + struct effect_info_s *effect_info) +{ + /* size and format of the cmd are defined in hardware/audio_effect.h */ + effect_handle_t effect = effect_info->effect_itfe; + uint32_t cmd_size = 2 * sizeof(uint32_t); + uint32_t cmd[] = { EFFECT_FEATURE_AUX_CHANNELS, MAX_NUM_CHANNEL_CONFIGS }; + /* reply = status + number of configs (n) + n x channel_config_t */ + uint32_t reply_size = + 2 * sizeof(uint32_t) + (MAX_NUM_CHANNEL_CONFIGS * sizeof(channel_config_t)); + int32_t reply[reply_size]; + int32_t cmd_status; + + ALOG_ASSERT((effect_info->num_channel_configs == 0), + "in_read_audio_effect_channel_configs() num_channel_configs not cleared"); + ALOG_ASSERT((effect_info->channel_configs == NULL), + "in_read_audio_effect_channel_configs() channel_configs not cleared"); + + /* if this command is not supported, then the effect is supposed to return -EINVAL. + * This error will be interpreted as if the effect supports the main_channels but does not + * support any aux_channels */ + cmd_status = (*effect)->command(effect, + EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS, + cmd_size, + (void*)&cmd, + &reply_size, + (void*)&reply); + + if (cmd_status != 0) { + ALOGI("%s: fx->command returned %d", __func__, cmd_status); + return; + } + + if (reply[0] != 0) { + ALOGW("%s: " + "command EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS error %d num configs %d", + __func__, reply[0], (reply[0] == -ENOMEM) ? reply[1] : MAX_NUM_CHANNEL_CONFIGS); + return; + } + + /* the feature is not supported */ + ALOGI("in_read_audio_effect_channel_configs()(): " + "Feature supported and adding %d channel configs to the list", reply[1]); + effect_info->num_channel_configs = reply[1]; + effect_info->channel_configs = + (channel_config_t *) malloc(sizeof(channel_config_t) * reply[1]); /* n x configs */ + memcpy(effect_info->channel_configs, (reply + 2), sizeof(channel_config_t) * reply[1]); +} + + +static uint32_t in_get_aux_channels(struct m0_stream_in *in) +{ + int i; + channel_config_t new_chcfg = {0, 0}; + + if (in->num_preprocessors == 0) + return 0; + + /* do not enable dual mic configurations when capturing from other microphones than + * main or sub */ + if (!(in->device & (AUDIO_DEVICE_IN_BUILTIN_MIC | AUDIO_DEVICE_IN_BACK_MIC))) + return 0; + + /* retain most complex aux channels configuration compatible with requested main channels and + * supported by audio driver and all pre processors */ + for (i = 0; i < NUM_IN_AUX_CNL_CONFIGS; i++) { + channel_config_t *cur_chcfg = &in_aux_cnl_configs[i]; + if (cur_chcfg->main_channels == in->main_channels) { + size_t match_cnt; + size_t idx_preproc; + for (idx_preproc = 0, match_cnt = 0; + /* no need to continue if at least one preprocessor doesn't match */ + idx_preproc < (size_t)in->num_preprocessors && match_cnt == idx_preproc; + idx_preproc++) { + struct effect_info_s *effect_info = &in->preprocessors[idx_preproc]; + size_t idx_chcfg; + + for (idx_chcfg = 0; idx_chcfg < effect_info->num_channel_configs; idx_chcfg++) { + if (memcmp(effect_info->channel_configs + idx_chcfg, + cur_chcfg, + sizeof(channel_config_t)) == 0) { + match_cnt++; + break; + } + } + } + /* if all preprocessors match, we have a candidate */ + if (match_cnt == (size_t)in->num_preprocessors) { + /* retain most complex aux channels configuration */ + if (popcount(cur_chcfg->aux_channels) > popcount(new_chcfg.aux_channels)) { + new_chcfg = *cur_chcfg; + } + } + } + } + + ALOGI("in_get_aux_channels(): return %04x", new_chcfg.aux_channels); + + return new_chcfg.aux_channels; +} + +static int in_configure_effect_channels(effect_handle_t effect, + channel_config_t *channel_config) +{ + int status = 0; + int fct_status; + int32_t cmd_status; + uint32_t reply_size; + effect_config_t config; + uint32_t cmd[(sizeof(uint32_t) + sizeof(channel_config_t) - 1) / sizeof(uint32_t) + 1]; + + ALOGI("in_configure_effect_channels(): configure effect with channels: [%04x][%04x]", + channel_config->main_channels, + channel_config->aux_channels); + + config.inputCfg.mask = EFFECT_CONFIG_CHANNELS; + config.outputCfg.mask = EFFECT_CONFIG_CHANNELS; + reply_size = sizeof(effect_config_t); + fct_status = (*effect)->command(effect, + EFFECT_CMD_GET_CONFIG, + 0, + NULL, + &reply_size, + &config); + if (fct_status != 0) { + ALOGE("in_configure_effect_channels(): EFFECT_CMD_GET_CONFIG failed"); + return fct_status; + } + + config.inputCfg.channels = channel_config->main_channels | channel_config->aux_channels; + config.outputCfg.channels = config.inputCfg.channels; + reply_size = sizeof(uint32_t); + fct_status = (*effect)->command(effect, + EFFECT_CMD_SET_CONFIG, + sizeof(effect_config_t), + &config, + &reply_size, + &cmd_status); + GET_COMMAND_STATUS(status, fct_status, cmd_status); + + cmd[0] = EFFECT_FEATURE_AUX_CHANNELS; + memcpy(cmd + 1, channel_config, sizeof(channel_config_t)); + reply_size = sizeof(uint32_t); + fct_status = (*effect)->command(effect, + EFFECT_CMD_SET_FEATURE_CONFIG, + sizeof(cmd), //sizeof(uint32_t) + sizeof(channel_config_t), + cmd, + &reply_size, + &cmd_status); + GET_COMMAND_STATUS(status, fct_status, cmd_status); + + /* some implementations need to be re-enabled after a config change */ + reply_size = sizeof(uint32_t); + fct_status = (*effect)->command(effect, + EFFECT_CMD_ENABLE, + 0, + NULL, + &reply_size, + &cmd_status); + GET_COMMAND_STATUS(status, fct_status, cmd_status); + + return status; +} + +static int in_reconfigure_channels(struct m0_stream_in *in, + effect_handle_t effect, + channel_config_t *channel_config, + bool config_changed) { + + int status = 0; + + ALOGI("%s: config_changed %d effect %p", + __func__, config_changed, effect); + + /* if config changed, reconfigure all previously added effects */ + if (config_changed) { + int i; + for (i = 0; i < in->num_preprocessors; i++) + { + int cur_status = in_configure_effect_channels(in->preprocessors[i].effect_itfe, + channel_config); + if (cur_status != 0) { + ALOGI("%s: error %d configuring effect " + "%d with channels: [%04x][%04x]", + __func__, + cur_status, + i, + channel_config->main_channels, + channel_config->aux_channels); + status = cur_status; + } + } + } else if (effect != NULL && channel_config->aux_channels) { + /* if aux channels config did not change but aux channels are present, + * we still need to configure the effect being added */ + status = in_configure_effect_channels(effect, channel_config); + } + return status; +} + +static void in_update_aux_channels(struct m0_stream_in *in, + effect_handle_t effect) +{ + uint32_t aux_channels; + channel_config_t channel_config; + int status; + + aux_channels = in_get_aux_channels(in); + + channel_config.main_channels = in->main_channels; + channel_config.aux_channels = aux_channels; + status = in_reconfigure_channels(in, + effect, + &channel_config, + (aux_channels != in->aux_channels)); + + if (status != 0) { + ALOGI("%s: in_reconfigure_channels error %d", __func__, status); + /* resetting aux channels configuration */ + aux_channels = 0; + channel_config.aux_channels = 0; + in_reconfigure_channels(in, effect, &channel_config, true); + } + if (in->aux_channels != aux_channels) { + in->aux_channels_changed = true; + in->aux_channels = aux_channels; + do_input_standby(in); + } +} + static int in_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect) { @@ -1671,15 +2249,26 @@ static int in_add_audio_effect(const struct audio_stream *stream, if (status != 0) goto exit; - in->preprocessors[in->num_preprocessors++] = effect; + in->preprocessors[in->num_preprocessors].effect_itfe = effect; + /* add the supported channel of the effect in the channel_configs */ + in_read_audio_effect_channel_configs(in, &in->preprocessors[in->num_preprocessors]); + + in->num_preprocessors++; + + /* check compatibility between main channel supported and possible auxiliary channels */ + in_update_aux_channels(in, effect); + + ALOGV("%s: effect type: %08x", __func__, desc.type.timeLow); if (memcmp(&desc.type, FX_IID_AEC, sizeof(effect_uuid_t)) == 0) { in->need_echo_reference = true; do_input_standby(in); + in_configure_reverse(in); } exit: + ALOGW_IF(status != 0, "%s: error %d", __func__, status); pthread_mutex_unlock(&in->lock); pthread_mutex_unlock(&in->dev->lock); return status; @@ -1691,7 +2280,6 @@ static int in_remove_audio_effect(const struct audio_stream *stream, struct m0_stream_in *in = (struct m0_stream_in *)stream; int i; int status = -EINVAL; - bool found = false; effect_descriptor_t desc; pthread_mutex_lock(&in->dev->lock); @@ -1702,14 +2290,17 @@ static int in_remove_audio_effect(const struct audio_stream *stream, } for (i = 0; i < in->num_preprocessors; i++) { - if (found) { - in->preprocessors[i - 1] = in->preprocessors[i]; + if (status == 0) { /* status == 0 means an effect was removed from a previous slot */ + in->preprocessors[i - 1].effect_itfe = in->preprocessors[i].effect_itfe; + in->preprocessors[i - 1].channel_configs = in->preprocessors[i].channel_configs; + in->preprocessors[i - 1].num_channel_configs = in->preprocessors[i].num_channel_configs; + ALOGI("in_remove_audio_effect moving fx from %d to %d", i, i - 1); continue; } - if (in->preprocessors[i] == effect) { - in->preprocessors[i] = NULL; + if (in->preprocessors[i].effect_itfe == effect) { + ALOGI("in_remove_audio_effect found fx at index %d", i); + free(in->preprocessors[i].channel_configs); status = 0; - found = true; } } @@ -1717,10 +2308,21 @@ static int in_remove_audio_effect(const struct audio_stream *stream, goto exit; in->num_preprocessors--; + /* if we remove one effect, at least the last preproc should be reset */ + in->preprocessors[in->num_preprocessors].num_channel_configs = 0; + in->preprocessors[in->num_preprocessors].effect_itfe = NULL; + in->preprocessors[in->num_preprocessors].channel_configs = NULL; + + + /* check compatibility between main channel supported and possible auxiliary channels */ + in_update_aux_channels(in, NULL); status = (*effect)->get_descriptor(effect, &desc); if (status != 0) goto exit; + + ALOGI("%s: effect type: %08x", __func__, desc.type.timeLow); + if (memcmp(&desc.type, FX_IID_AEC, sizeof(effect_uuid_t)) == 0) { in->need_echo_reference = false; do_input_standby(in); @@ -1728,38 +2330,53 @@ static int in_remove_audio_effect(const struct audio_stream *stream, exit: + ALOGW_IF(status != 0, "%s: error %d", __func__, status); pthread_mutex_unlock(&in->lock); pthread_mutex_unlock(&in->dev->lock); return status; } - static int adev_open_output_stream(struct audio_hw_device *dev, - uint32_t devices, int *format, - uint32_t *channels, uint32_t *sample_rate, + audio_io_handle_t handle, + audio_devices_t devices, + audio_output_flags_t flags, + struct audio_config *config, struct audio_stream_out **stream_out) { struct m0_audio_device *ladev = (struct m0_audio_device *)dev; struct m0_stream_out *out; int ret; + int output_type; + *stream_out = NULL; out = (struct m0_stream_out *)calloc(1, sizeof(struct m0_stream_out)); if (!out) return -ENOMEM; + out->sup_channel_masks[0] = AUDIO_CHANNEL_OUT_STEREO; + out->channel_mask = AUDIO_CHANNEL_OUT_STEREO; + + if (ladev->outputs[OUTPUT_DEEP_BUF] != NULL) { + ret = -ENOSYS; + goto err_open; + } + output_type = OUTPUT_DEEP_BUF; + out->channel_mask = AUDIO_CHANNEL_OUT_STEREO; + out->stream.common.get_buffer_size = out_get_buffer_size_deep_buffer; + out->stream.common.get_sample_rate = out_get_sample_rate; + out->stream.get_latency = out_get_latency_deep_buffer; + out->stream.write = out_write_deep_buffer; + ret = create_resampler(DEFAULT_OUT_SAMPLING_RATE, - DEFAULT_OUT_SAMPLING_RATE, + MM_FULL_POWER_SAMPLING_RATE, 2, RESAMPLER_QUALITY_DEFAULT, NULL, &out->resampler); if (ret != 0) goto err_open; - out->buffer = malloc(RESAMPLER_BUFFER_SIZE); /* todo: allow for reallocing */ - out->stream.common.get_sample_rate = out_get_sample_rate; out->stream.common.set_sample_rate = out_set_sample_rate; - out->stream.common.get_buffer_size = out_get_buffer_size; out->stream.common.get_channels = out_get_channels; out->stream.common.get_format = out_get_format; out->stream.common.set_format = out_set_format; @@ -1769,9 +2386,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev, out->stream.common.get_parameters = out_get_parameters; out->stream.common.add_audio_effect = out_add_audio_effect; out->stream.common.remove_audio_effect = out_remove_audio_effect; - out->stream.get_latency = out_get_latency; out->stream.set_volume = out_set_volume; - out->stream.write = out_write; out->stream.get_render_position = out_get_render_position; out->dev = ladev; @@ -1781,29 +2396,39 @@ static int adev_open_output_stream(struct audio_hw_device *dev, * do the following: * adev->devices &= ~AUDIO_DEVICE_OUT_ALL; * adev->devices |= out->device; - * select_devices(adev); + * select_output_device(adev); * This is because out_set_parameters() with a route is not * guaranteed to be called after an output stream is opened. */ - *format = out_get_format(&out->stream.common); - *channels = out_get_channels(&out->stream.common); - *sample_rate = out_get_sample_rate(&out->stream.common); + config->format = out->stream.common.get_format(&out->stream.common); + config->channel_mask = out->stream.common.get_channels(&out->stream.common); + config->sample_rate = out->stream.common.get_sample_rate(&out->stream.common); *stream_out = &out->stream; + ladev->outputs[output_type] = out; + return 0; err_open: free(out); - *stream_out = NULL; return ret; } static void adev_close_output_stream(struct audio_hw_device *dev, struct audio_stream_out *stream) { + struct m0_audio_device *ladev = (struct m0_audio_device *)dev; struct m0_stream_out *out = (struct m0_stream_out *)stream; + int i; out_standby(&stream->common); + for (i = 0; i < OUTPUT_TOTAL; i++) { + if (ladev->outputs[i] == out) { + ladev->outputs[i] = NULL; + break; + } + } + if (out->buffer) free(out->buffer); if (out->resampler) @@ -1813,7 +2438,6 @@ static void adev_close_output_stream(struct audio_hw_device *dev, static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) { - LOGD("%s: E", __func__); struct m0_audio_device *adev = (struct m0_audio_device *)dev; struct str_parms *parms; char *str; @@ -1853,16 +2477,15 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) adev->bluetooth_nrec = false; } - ret = str_parms_get_str(parms, "screen_state", value, sizeof(value)); + ret = str_parms_get_str(parms, "screen_off", value, sizeof(value)); if (ret >= 0) { if (strcmp(value, AUDIO_PARAMETER_VALUE_ON) == 0) - adev->screen_state = false; + adev->screen_off = false; else - adev->screen_state = true; + adev->screen_off = true; } str_parms_destroy(parms); - LOGD("%s: X", __func__); return ret; } @@ -1894,7 +2517,7 @@ static int adev_set_master_volume(struct audio_hw_device *dev, float volume) return -ENOSYS; } -static int adev_set_mode(struct audio_hw_device *dev, int mode) +static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode) { struct m0_audio_device *adev = (struct m0_audio_device *)dev; @@ -1927,30 +2550,30 @@ static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state) } static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev, - uint32_t sample_rate, int format, - int channel_count) + const struct audio_config *config) { size_t size; - - if (check_input_parameters(sample_rate, format, channel_count) != 0) + int channel_count = popcount(config->channel_mask); + if (check_input_parameters(config->sample_rate, config->format, channel_count) != 0) return 0; - return get_input_buffer_size(sample_rate, format, channel_count); + return get_input_buffer_size(config->sample_rate, config->format, channel_count); } -static int adev_open_input_stream(struct audio_hw_device *dev, uint32_t devices, - int *format, uint32_t *channel_mask, - uint32_t *sample_rate, - audio_in_acoustics_t acoustics, +static int adev_open_input_stream(struct audio_hw_device *dev, + audio_io_handle_t handle, + audio_devices_t devices, + struct audio_config *config, struct audio_stream_in **stream_in) { - LOGD("%s: E", __func__); struct m0_audio_device *ladev = (struct m0_audio_device *)dev; struct m0_stream_in *in; int ret; - int channel_count = popcount(*channel_mask); + int channel_count = popcount(config->channel_mask); + + *stream_in = NULL; - if (check_input_parameters(*sample_rate, *format, channel_count) != 0) + if (check_input_parameters(config->sample_rate, config->format, channel_count) != 0) return -EINVAL; in = (struct m0_stream_in *)calloc(1, sizeof(struct m0_stream_in)); @@ -1973,11 +2596,16 @@ static int adev_open_input_stream(struct audio_hw_device *dev, uint32_t devices, in->stream.read = in_read; in->stream.get_input_frames_lost = in_get_input_frames_lost; - in->requested_rate = *sample_rate; + in->requested_rate = config->sample_rate; memcpy(&in->config, &pcm_config_capture, sizeof(pcm_config_capture)); in->config.channels = channel_count; + in->main_channels = config->channel_mask; + + /* initialisation of preprocessor structure array is implicit with the calloc. + * same for in->aux_channels and in->aux_channels_changed */ + if (in->requested_rate != in->config.rate) { in->buf_provider.get_next_buffer = get_next_buffer; in->buf_provider.release_buffer = release_buffer; @@ -1999,7 +2627,6 @@ static int adev_open_input_stream(struct audio_hw_device *dev, uint32_t devices, in->device = devices; *stream_in = &in->stream; - LOGD("%s: X", __func__); return 0; err: @@ -2007,7 +2634,6 @@ static int adev_open_input_stream(struct audio_hw_device *dev, uint32_t devices, release_resampler(in->resampler); free(in); - *stream_in = NULL; return ret; } @@ -2015,10 +2641,15 @@ static void adev_close_input_stream(struct audio_hw_device *dev, struct audio_stream_in *stream) { struct m0_stream_in *in = (struct m0_stream_in *)stream; + int i; in_standby(&stream->common); - free(in->read_buf); + for (i = 0; i < in->num_preprocessors; i++) { + free(in->preprocessors[i].channel_configs); + } + + free(in->read_buf); if (in->resampler) { release_resampler(in->resampler); } @@ -2114,18 +2745,18 @@ static void adev_config_start(void *data, const XML_Char *elem, if (strcmp(elem, "device") == 0) { if (!name) { - LOGE("Unnamed device\n"); + ALOGE("Unnamed device\n"); return; } for (i = 0; i < sizeof(dev_names) / sizeof(dev_names[0]); i++) { if (strcmp(dev_names[i].name, name) == 0) { - LOGI("Allocating device %s\n", name); + ALOGI("Allocating device %s\n", name); dev_cfg = realloc(s->adev->dev_cfgs, (s->adev->num_dev_cfgs + 1) * sizeof(*dev_cfg)); if (!dev_cfg) { - LOGE("Unable to allocate dev_cfg\n"); + ALOGE("Unable to allocate dev_cfg\n"); return; } @@ -2140,7 +2771,7 @@ static void adev_config_start(void *data, const XML_Char *elem, } else if (strcmp(elem, "path") == 0) { if (s->path_len) - LOGW("Nested paths\n"); + ALOGW("Nested paths\n"); /* If this a path for a device it must have a role */ if (s->dev) { @@ -2150,7 +2781,7 @@ static void adev_config_start(void *data, const XML_Char *elem, } else if (strcmp(name, "off") == 0) { s->on = false; } else { - LOGW("Unknown path name %s\n", name); + ALOGW("Unknown path name %s\n", name); } } @@ -2158,20 +2789,20 @@ static void adev_config_start(void *data, const XML_Char *elem, struct route_setting *r; if (!name) { - LOGE("Unnamed control\n"); + ALOGE("Unnamed control\n"); return; } if (!val) { - LOGE("No value specified for %s\n", name); + ALOGE("No value specified for %s\n", name); return; } - LOGV("Parsing control %s => %s\n", name, val); + ALOGV("Parsing control %s => %s\n", name, val); r = realloc(s->path, sizeof(*r) * (s->path_len + 1)); if (!r) { - LOGE("Out of memory handling %s => %s\n", name, val); + ALOGE("Out of memory handling %s => %s\n", name, val); return; } @@ -2195,10 +2826,10 @@ static void adev_config_end(void *data, const XML_Char *name) if (strcmp(name, "path") == 0) { if (!s->path_len) - LOGW("Empty path\n"); + ALOGW("Empty path\n"); if (!s->dev) { - LOGV("Applying %d element default route\n", s->path_len); + ALOGV("Applying %d element default route\n", s->path_len); set_route_by_array(s->adev->mixer, s->path, s->path_len); @@ -2211,12 +2842,12 @@ static void adev_config_end(void *data, const XML_Char *name) /* Refactor! */ } else if (s->on) { - LOGV("%d element on sequence\n", s->path_len); + ALOGV("%d element on sequence\n", s->path_len); s->dev->on = s->path; s->dev->on_len = s->path_len; } else { - LOGV("%d element off sequence\n", s->path_len); + ALOGV("%d element off sequence\n", s->path_len); /* Apply it, we'll reenable anything that's wanted later */ set_route_by_array(s->adev->mixer, s->path, s->path_len); @@ -2247,16 +2878,16 @@ static int adev_config_parse(struct m0_audio_device *adev) property_get("ro.product.device", property, "tiny_hw"); snprintf(file, sizeof(file), "/system/etc/sound/%s", property); - LOGV("Reading configuration from %s\n", file); + ALOGV("Reading configuration from %s\n", file); f = fopen(file, "r"); if (!f) { - LOGE("Failed to open %s\n", file); + ALOGE("Failed to open %s\n", file); return -ENODEV; } p = XML_ParserCreate(NULL); if (!p) { - LOGE("Failed to create XML parser\n"); + ALOGE("Failed to create XML parser\n"); ret = -ENOMEM; goto out; } @@ -2270,14 +2901,14 @@ static int adev_config_parse(struct m0_audio_device *adev) while (!eof) { len = fread(file, 1, sizeof(file), f); if (ferror(f)) { - LOGE("I/O error reading config\n"); + ALOGE("I/O error reading config\n"); ret = -EIO; goto out_parser; } eof = feof(f); if (XML_Parse(p, file, len, eof) == XML_STATUS_ERROR) { - LOGE("Parse error at line %u:\n%s\n", + ALOGE("Parse error at line %u:\n%s\n", (unsigned int)XML_GetCurrentLineNumber(p), XML_ErrorString(XML_GetErrorCode(p))); ret = -EINVAL; @@ -2307,7 +2938,7 @@ static int adev_open(const hw_module_t* module, const char* name, return -ENOMEM; adev->hw_device.common.tag = HARDWARE_DEVICE_TAG; - adev->hw_device.common.version = 0; + adev->hw_device.common.version = AUDIO_DEVICE_API_VERSION_1_0; adev->hw_device.common.module = (struct hw_module_t *) module; adev->hw_device.common.close = adev_close; @@ -2327,28 +2958,19 @@ static int adev_open(const hw_module_t* module, const char* name, adev->hw_device.close_input_stream = adev_close_input_stream; adev->hw_device.dump = adev_dump; - adev->mixer = mixer_open(0); + adev->mixer = mixer_open(CARD_DEFAULT); if (!adev->mixer) { free(adev); - LOGE("Unable to open the mixer, aborting."); + ALOGE("Unable to open the mixer, aborting."); return -EINVAL; } - adev->mixer_ctls.aif2dacl_source = mixer_get_ctl_by_name(adev->mixer, "AIF2DACL Source"); - adev->mixer_ctls.aif2dacr_source = mixer_get_ctl_by_name(adev->mixer, "AIF2DACR Source"); - adev->mixer_ctls.aif2_mode = mixer_get_ctl_by_name(adev->mixer, "AIF2 Mode"); - adev->mixer_ctls.dac1l_mixer_aif1_switch = mixer_get_ctl_by_name(adev->mixer, "DAC1L Mixer AIF1.1 Switch"); - adev->mixer_ctls.dac1r_mixer_aif1_switch = mixer_get_ctl_by_name(adev->mixer, "DAC1R Mixer AIF1.1 Switch"); - adev->mixer_ctls.dac1l_mixer_aif2_switch = mixer_get_ctl_by_name(adev->mixer, "DAC1L Mixer AIF2 Switch"); - adev->mixer_ctls.dac1r_mixer_aif2_switch = mixer_get_ctl_by_name(adev->mixer, "DAC1R Mixer AIF2 Switch"); - adev->mixer_ctls.aif2dac_mux = mixer_get_ctl_by_name(adev->mixer, "AIF2DAC Mux"); - ret = adev_config_parse(adev); if (ret != 0) goto err_mixer; /* Set the default route before the PCM stream is opened */ - pthread_mutex_init(&adev->lock, NULL); + pthread_mutex_lock(&adev->lock); adev->mode = AUDIO_MODE_NORMAL; adev->devices = AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_IN_BUILTIN_MIC; select_devices(adev); @@ -2383,11 +3005,11 @@ static struct hw_module_methods_t hal_module_methods = { struct audio_module HAL_MODULE_INFO_SYM = { .common = { .tag = HARDWARE_MODULE_TAG, - .version_major = 1, - .version_minor = 0, + .module_api_version = AUDIO_MODULE_API_VERSION_0_1, + .hal_api_version = HARDWARE_HAL_API_VERSION, .id = AUDIO_HARDWARE_MODULE_ID, .name = "M0 audio HW HAL", - .author = "The Android Open Source Project", + .author = "The CyanogenMod Project", .methods = &hal_module_methods, }, }; diff --git a/audio/audio_hw.h b/audio/audio_hw.h index e264c4a1..3cd62dba 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -3,6 +3,7 @@ * Copyright (C) 2012 Wolfson Microelectronics plc * Copyright (C) 2012 The CyanogenMod Project * Daniel Hillenbrand + * Guillaume "XpLoDWilD" Lesniak * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,12 +26,28 @@ #define PORT_BT 2 #define PORT_CAPTURE 3 +#define PCM_WRITE pcm_write + #define PLAYBACK_PERIOD_SIZE 880 #define PLAYBACK_PERIOD_COUNT 8 +#define PLAYBACK_SHORT_PERIOD_COUNT 2 #define CAPTURE_PERIOD_SIZE 1056 #define CAPTURE_PERIOD_COUNT 2 +#define SHORT_PERIOD_SIZE 192 + +// +// deep buffer +// +/* screen on */ +#define DEEP_BUFFER_SHORT_PERIOD_SIZE 1056 +#define PLAYBACK_DEEP_BUFFER_SHORT_PERIOD_COUNT 4 +/* screen off */ +#define DEEP_BUFFER_LONG_PERIOD_SIZE 880 +#define PLAYBACK_DEEP_BUFFER_LONG_PERIOD_COUNT 8 + + /* minimum sleep time in out_write() when write threshold is not reached */ #define MIN_WRITE_SLEEP_US 5000 @@ -38,6 +55,8 @@ #define RESAMPLER_BUFFER_SIZE (4 * RESAMPLER_BUFFER_FRAMES) #define DEFAULT_OUT_SAMPLING_RATE 44100 +#define MM_LOW_POWER_SAMPLING_RATE 44100 +#define MM_FULL_POWER_SAMPLING_RATE 44100 #define DEFAULT_IN_SAMPLING_RATE 44100 /* sampling rate when using VX port for narrow band */ @@ -49,6 +68,35 @@ #define PRODUCT_DEVICE_PROPERTY "ro.product.device" #define PRODUCT_NAME_PROPERTY "ro.product.name" +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) + +#define STRING_TO_ENUM(string) { #string, string } + +struct string_to_enum { + const char *name; + uint32_t value; +}; + +const struct string_to_enum out_channels_name_to_enum_table[] = { + STRING_TO_ENUM(AUDIO_CHANNEL_OUT_STEREO), + STRING_TO_ENUM(AUDIO_CHANNEL_OUT_5POINT1), + STRING_TO_ENUM(AUDIO_CHANNEL_OUT_7POINT1), +}; + +enum pcm_type { + PCM_NORMAL = 0, + PCM_SPDIF, + PCM_HDMI, + PCM_TOTAL, +}; + +enum output_type { + OUTPUT_DEEP_BUF, // deep PCM buffers output stream + OUTPUT_LOW_LATENCY, // low latency output stream + OUTPUT_HDMI, + OUTPUT_TOTAL +}; + enum tty_modes { TTY_MODE_OFF, TTY_MODE_VCO, diff --git a/audio/ril_interface.c b/audio/ril_interface.c index 4e1e2a17..89a0aef4 100755 --- a/audio/ril_interface.c +++ b/audio/ril_interface.c @@ -14,8 +14,8 @@ * limitations under the License. */ -#define LOG_TAG "audio_hw_primary" -/*#define LOG_NDEBUG 0*/ +#define ALOG_TAG "audio_hw_primary" +/*#define ALOG_NDEBUG 0*/ #include #include @@ -72,7 +72,7 @@ static int ril_connect_if_required(struct ril_handle *ril) return 0; if (_ril_connect(ril->client) != RIL_CLIENT_ERR_SUCCESS) { - LOGE("ril_connect() failed"); + ALOGE("ril_connect() failed"); return -1; } @@ -94,7 +94,7 @@ int ril_open(struct ril_handle *ril) ril->handle = dlopen(RIL_CLIENT_LIBPATH, RTLD_NOW); if (!ril->handle) { - LOGE("Cannot open '%s'", RIL_CLIENT_LIBPATH); + ALOGE("Cannot open '%s'", RIL_CLIENT_LIBPATH); return -1; } @@ -115,14 +115,14 @@ int ril_open(struct ril_handle *ril) !_ril_is_connected || !_ril_disconnect || !_ril_set_call_volume || !_ril_set_call_audio_path || !_ril_set_call_clock_sync || !_ril_register_unsolicited_handler) { - LOGE("Cannot get symbols from '%s'", RIL_CLIENT_LIBPATH); + ALOGE("Cannot get symbols from '%s'", RIL_CLIENT_LIBPATH); dlclose(ril->handle); return -1; } ril->client = _ril_open_client(); if (!ril->client) { - LOGE("ril_open_client() failed"); + ALOGE("ril_open_client() failed"); dlclose(ril->handle); return -1; } @@ -148,7 +148,7 @@ int ril_close(struct ril_handle *ril) if ((_ril_disconnect(ril->client) != RIL_CLIENT_ERR_SUCCESS) || (_ril_close_client(ril->client) != RIL_CLIENT_ERR_SUCCESS)) { - LOGE("ril_disconnect() or ril_close_client() failed"); + ALOGE("ril_disconnect() or ril_close_client() failed"); return -1; } diff --git a/camerawrapper/CameraWrapper.cpp b/camerawrapper/CameraWrapper.cpp index d4661a0c..97f7e43b 100644 --- a/camerawrapper/CameraWrapper.cpp +++ b/camerawrapper/CameraWrapper.cpp @@ -80,14 +80,14 @@ typedef struct wrapper_camera_device { static int check_vendor_module() { int rv = 0; - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); if(gVendorModule) return 0; rv = hw_get_module("vendor-camera", (const hw_module_t **)&gVendorModule); if (rv) - LOGE("failed to open vendor camera module"); + ALOGE("failed to open vendor camera module"); return rv; } @@ -99,12 +99,13 @@ static char * camera_fixup_getparams(int id, const char * settings) params.unflatten(android::String8(settings)); // fix params here - params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]); +#warning "Reimplement KEY_SUPPORTED_ISO_MODES" +// params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]); android::String8 strParams = params.flatten(); char *ret = strdup(strParams.string()); - LOGD("%s: get parameters fixed up", __FUNCTION__); + ALOGD("%s: get parameters fixed up", __FUNCTION__); return ret; } @@ -113,6 +114,7 @@ char * camera_fixup_setparams(int id, const char * settings) android::CameraParameters params; params.unflatten(android::String8(settings)); +/* // fix params here if(params.get("iso")) { const char* isoMode = params.get(android::CameraParameters::KEY_ISO_MODE); @@ -125,11 +127,11 @@ char * camera_fixup_setparams(int id, const char * settings) else if(strcmp(isoMode, "ISO800") == 0) params.set(android::CameraParameters::KEY_ISO_MODE, "800"); } - +*/ android::String8 strParams = params.flatten(); char *ret = strdup(strParams.string()); - LOGD("%s: set parameters fixed up", __FUNCTION__); + ALOGD("%s: set parameters fixed up", __FUNCTION__); return ret; } @@ -140,7 +142,7 @@ char * camera_fixup_setparams(int id, const char * settings) int camera_set_preview_window(struct camera_device * device, struct preview_stream_ops *window) { - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return -EINVAL; @@ -155,8 +157,8 @@ void camera_set_callbacks(struct camera_device * device, camera_request_memory get_memory, void *user) { - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - LOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); if(!device) return; @@ -166,8 +168,8 @@ void camera_set_callbacks(struct camera_device * device, void camera_enable_msg_type(struct camera_device * device, int32_t msg_type) { - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - LOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); if(!device) return; @@ -177,8 +179,8 @@ void camera_enable_msg_type(struct camera_device * device, int32_t msg_type) void camera_disable_msg_type(struct camera_device * device, int32_t msg_type) { - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - LOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); if(!device) return; @@ -188,8 +190,8 @@ void camera_disable_msg_type(struct camera_device * device, int32_t msg_type) int camera_msg_type_enabled(struct camera_device * device, int32_t msg_type) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return 0; @@ -199,8 +201,8 @@ int camera_msg_type_enabled(struct camera_device * device, int32_t msg_type) int camera_start_preview(struct camera_device * device) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return -EINVAL; @@ -210,8 +212,8 @@ int camera_start_preview(struct camera_device * device) void camera_stop_preview(struct camera_device * device) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return; @@ -221,8 +223,8 @@ void camera_stop_preview(struct camera_device * device) int camera_preview_enabled(struct camera_device * device) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return -EINVAL; @@ -232,8 +234,8 @@ int camera_preview_enabled(struct camera_device * device) int camera_store_meta_data_in_buffers(struct camera_device * device, int enable) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return -EINVAL; @@ -243,8 +245,8 @@ int camera_store_meta_data_in_buffers(struct camera_device * device, int enable) int camera_start_recording(struct camera_device * device) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return EINVAL; @@ -254,8 +256,8 @@ int camera_start_recording(struct camera_device * device) void camera_stop_recording(struct camera_device * device) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return; @@ -266,8 +268,8 @@ void camera_stop_recording(struct camera_device * device) int camera_recording_enabled(struct camera_device * device) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return -EINVAL; @@ -278,8 +280,8 @@ int camera_recording_enabled(struct camera_device * device) void camera_release_recording_frame(struct camera_device * device, const void *opaque) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return; @@ -289,8 +291,8 @@ void camera_release_recording_frame(struct camera_device * device, int camera_auto_focus(struct camera_device * device) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return -EINVAL; @@ -301,8 +303,8 @@ int camera_auto_focus(struct camera_device * device) int camera_cancel_auto_focus(struct camera_device * device) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return -EINVAL; @@ -316,8 +318,8 @@ int camera_cancel_auto_focus(struct camera_device * device) int camera_take_picture(struct camera_device * device) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return -EINVAL; @@ -327,8 +329,8 @@ int camera_take_picture(struct camera_device * device) int camera_cancel_picture(struct camera_device * device) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return -EINVAL; @@ -338,8 +340,8 @@ int camera_cancel_picture(struct camera_device * device) int camera_set_parameters(struct camera_device * device, const char *params) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return -EINVAL; @@ -357,8 +359,8 @@ int camera_set_parameters(struct camera_device * device, const char *params) char* camera_get_parameters(struct camera_device * device) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return NULL; @@ -382,8 +384,8 @@ char* camera_get_parameters(struct camera_device * device) static void camera_put_parameters(struct camera_device *device, char *params) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(params) free(params); @@ -392,8 +394,8 @@ static void camera_put_parameters(struct camera_device *device, char *params) int camera_send_command(struct camera_device * device, int32_t cmd, int32_t arg1, int32_t arg2) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return -EINVAL; @@ -403,8 +405,8 @@ int camera_send_command(struct camera_device * device, void camera_release(struct camera_device * device) { - LOGV("%s", __FUNCTION__); - LOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + ALOGV("%s", __FUNCTION__); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); if(!device) return; @@ -427,7 +429,7 @@ int camera_device_close(hw_device_t* device) int ret = 0; wrapper_camera_device_t *wrapper_dev = NULL; - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); android::Mutex::Autolock lock(gCameraWrapperLock); @@ -470,7 +472,7 @@ int camera_device_open(const hw_module_t* module, const char* name, android::Mutex::Autolock lock(gCameraWrapperLock); - LOGV("camera_device open"); + ALOGV("camera_device open"); if (name != NULL) { if (check_vendor_module()) @@ -481,7 +483,7 @@ int camera_device_open(const hw_module_t* module, const char* name, if(cameraid > num_cameras) { - LOGE("camera service provided cameraid out of bounds, " + ALOGE("camera service provided cameraid out of bounds, " "cameraid = %d, num supported = %d", cameraid, num_cameras); rv = -EINVAL; @@ -491,7 +493,7 @@ int camera_device_open(const hw_module_t* module, const char* name, camera_device = (wrapper_camera_device_t*)malloc(sizeof(*camera_device)); if(!camera_device) { - LOGE("camera_device allocation fail"); + ALOGE("camera_device allocation fail"); rv = -ENOMEM; goto fail; } @@ -500,15 +502,15 @@ int camera_device_open(const hw_module_t* module, const char* name, if(rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name, (hw_device_t**)&(camera_device->vendor))) { - LOGE("vendor camera open fail"); + ALOGE("vendor camera open fail"); goto fail; } - LOGV("%s: got vendor camera device 0x%08X", __FUNCTION__, (uintptr_t)(camera_device->vendor)); + ALOGV("%s: got vendor camera device 0x%08X", __FUNCTION__, (uintptr_t)(camera_device->vendor)); camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops)); if(!camera_ops) { - LOGE("camera_ops allocation fail"); + ALOGE("camera_ops allocation fail"); rv = -ENOMEM; goto fail; } @@ -565,7 +567,7 @@ int camera_device_open(const hw_module_t* module, const char* name, int camera_get_number_of_cameras(void) { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); if (check_vendor_module()) return 0; return gVendorModule->get_number_of_cameras(); @@ -573,7 +575,7 @@ int camera_get_number_of_cameras(void) int camera_get_camera_info(int camera_id, struct camera_info *info) { - LOGV("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); if (check_vendor_module()) return 0; return gVendorModule->get_camera_info(camera_id, info); diff --git a/configs/audio_policy.conf b/configs/audio_policy.conf new file mode 100644 index 00000000..1012c26d --- /dev/null +++ b/configs/audio_policy.conf @@ -0,0 +1,82 @@ +# Global configuration section: lists input and output devices always present on the device +# as well as the output device selected by default. +# Devices are designated by a string that corresponds to the enum in audio.h + +global_configuration { + attached_output_devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER + default_output_device AUDIO_DEVICE_OUT_SPEAKER + attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BACK_MIC +} + +# audio hardware module section: contains descriptors for all audio hw modules present on the +# device. Each hw module node is named after the corresponding hw module library base name. +# For instance, "primary" corresponds to audio.primary..so. +# The "primary" module is mandatory and must include at least one output with +# AUDIO_OUTPUT_FLAG_PRIMARY flag. +# Each module descriptor contains one or more output profile descriptors and zero or more +# input profile descriptors. Each profile lists all the parameters supported by a given output +# or input stream category. +# The "channel_masks", "formats", "devices" and "flags" are specified using strings corresponding +# to enums in audio.h and audio_policy.h. They are concatenated by use of "|" without space or "\n". + +audio_hw_modules { + primary { + outputs { + primary { + sampling_rates 44100 + channel_masks AUDIO_CHANNEL_OUT_STEREO + formats AUDIO_FORMAT_PCM_16_BIT + devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_AUX_DIGITAL|AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET + flags AUDIO_OUTPUT_FLAG_PRIMARY + } + deep_buffer { + sampling_rates 44100 + channel_masks AUDIO_CHANNEL_OUT_STEREO + formats AUDIO_FORMAT_PCM_16_BIT + devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE + flags AUDIO_OUTPUT_FLAG_DEEP_BUFFER + } + hdmi { + sampling_rates 44100|48000 + channel_masks dynamic + formats AUDIO_FORMAT_PCM_16_BIT + devices AUDIO_DEVICE_OUT_AUX_DIGITAL + flags AUDIO_OUTPUT_FLAG_DIRECT + } + } + inputs { + primary { + sampling_rates 8000|11025|16000|22050|24000|32000|44100|48000 + channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO + formats AUDIO_FORMAT_PCM_16_BIT + devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET|AUDIO_DEVICE_IN_WIRED_HEADSET|AUDIO_DEVICE_IN_BACK_MIC + } + } + } + a2dp { + outputs { + a2dp { + sampling_rates 44100 + channel_masks AUDIO_CHANNEL_OUT_STEREO + formats AUDIO_FORMAT_PCM_16_BIT + devices AUDIO_DEVICE_OUT_ALL_A2DP + } + } + } + usb { + outputs { + usb_accessory { + sampling_rates 44100 + channel_masks AUDIO_CHANNEL_OUT_STEREO + formats AUDIO_FORMAT_PCM_16_BIT + devices AUDIO_DEVICE_OUT_USB_ACCESSORY + } + usb_device { + sampling_rates 44100 + channel_masks AUDIO_CHANNEL_OUT_STEREO + formats AUDIO_FORMAT_PCM_16_BIT + devices AUDIO_DEVICE_OUT_USB_DEVICE + } + } + } +} diff --git a/configs/media_codecs.xml b/configs/media_codecs.xml new file mode 100644 index 00000000..dfaf0a2c --- /dev/null +++ b/configs/media_codecs.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/extract-files.sh b/extract-files.sh deleted file mode 100755 index ca88c0cd..00000000 --- a/extract-files.sh +++ /dev/null @@ -1,473 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2012 The CyanogenMod 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. - -# This file is generated by device/common/generate-blob-scripts.sh - DO NOT EDIT - -DEVICE=i9300 -MANUFACTURER=samsung - -mkdir -p ../../../vendor/$MANUFACTURER/$DEVICE/proprietary - -adb root -sleep 3 - -adb pull /sbin/cbd ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/sbin/cbd - -adb pull /system/bin/bcm4334.hcd ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/bin/bcm4334.hcd -adb pull /system/bin/gps.cer ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/bin/gps.cer -adb pull /system/bin/gpsd ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/bin/gpsd -adb pull /system/bin/lpmkey ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/bin/lpmkey -adb pull /system/bin/playlpm ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/bin/playlpm -adb pull /system/bin/rild ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/bin/rild - -adb pull /system/cameradata/datapattern_420sp.yuv ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/cameradata/datapattern_420sp.yuv -adb pull /system/cameradata/datapattern_front_420sp.yuv ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/cameradata/datapattern_front_420sp.yuv - -adb pull /system/etc/audio/LVVEFS_Rx_Configuration.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/LVVEFS_Rx_Configuration.txt -adb pull /system/etc/audio/LVVEFS_Tx_Configuration.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/LVVEFS_Tx_Configuration.txt -adb pull /system/etc/audio/Rx_ControlParams_BLUETOOTH_HEADSET.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Rx_ControlParams_BLUETOOTH_HEADSET.txt -adb pull /system/etc/audio/Rx_ControlParams_EARPIECE_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Rx_ControlParams_EARPIECE_WIDEBAND.txt -adb pull /system/etc/audio/Rx_ControlParams_SECVOIP_BLUETOOTH_HEADSET.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Rx_ControlParams_SECVOIP_BLUETOOTH_HEADSET.txt -adb pull /system/etc/audio/Rx_ControlParams_SECVOIP_EARPIECE_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Rx_ControlParams_SECVOIP_EARPIECE_WIDEBAND.txt -adb pull /system/etc/audio/Rx_ControlParams_SECVOIP_SPEAKER_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Rx_ControlParams_SECVOIP_SPEAKER_WIDEBAND.txt -adb pull /system/etc/audio/Rx_ControlParams_SECVOIP_WIRED_HEADPHONE_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Rx_ControlParams_SECVOIP_WIRED_HEADPHONE_WIDEBAND.txt -adb pull /system/etc/audio/Rx_ControlParams_SECVOIP_WIRED_HEADSET_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Rx_ControlParams_SECVOIP_WIRED_HEADSET_WIDEBAND.txt -adb pull /system/etc/audio/Rx_ControlParams_SPEAKER_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Rx_ControlParams_SPEAKER_WIDEBAND.txt -adb pull /system/etc/audio/Rx_ControlParams_WIRED_HEADPHONE_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Rx_ControlParams_WIRED_HEADPHONE_WIDEBAND.txt -adb pull /system/etc/audio/Rx_ControlParams_WIRED_HEADSET_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Rx_ControlParams_WIRED_HEADSET_WIDEBAND.txt -adb pull /system/etc/audio/Tx_ControlParams_BLUETOOTH_HEADSET.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Tx_ControlParams_BLUETOOTH_HEADSET.txt -adb pull /system/etc/audio/Tx_ControlParams_EARPIECE_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Tx_ControlParams_EARPIECE_WIDEBAND.txt -adb pull /system/etc/audio/Tx_ControlParams_SECVOIP_BLUETOOTH_HEADSET.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Tx_ControlParams_SECVOIP_BLUETOOTH_HEADSET.txt -adb pull /system/etc/audio/Tx_ControlParams_SECVOIP_EARPIECE_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Tx_ControlParams_SECVOIP_EARPIECE_WIDEBAND.txt -adb pull /system/etc/audio/Tx_ControlParams_SECVOIP_SPEAKER_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Tx_ControlParams_SECVOIP_SPEAKER_WIDEBAND.txt -adb pull /system/etc/audio/Tx_ControlParams_SECVOIP_WIRED_HEADPHONE_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Tx_ControlParams_SECVOIP_WIRED_HEADPHONE_WIDEBAND.txt -adb pull /system/etc/audio/Tx_ControlParams_SECVOIP_WIRED_HEADSET_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Tx_ControlParams_SECVOIP_WIRED_HEADSET_WIDEBAND.txt -adb pull /system/etc/audio/Tx_ControlParams_SPEAKER_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Tx_ControlParams_SPEAKER_WIDEBAND.txt -adb pull /system/etc/audio/Tx_ControlParams_WIRED_HEADPHONE_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Tx_ControlParams_WIRED_HEADPHONE_WIDEBAND.txt -adb pull /system/etc/audio/Tx_ControlParams_WIRED_HEADSET_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio/Tx_ControlParams_WIRED_HEADSET_WIDEBAND.txt - -adb pull /system/etc/audio_VR/LVVEFS_Rx_Configuration.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio_VR/LVVEFS_Rx_Configuration.txt -adb pull /system/etc/audio_VR/LVVEFS_Tx_Configuration.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio_VR/LVVEFS_Tx_Configuration.txt -adb pull /system/etc/audio_VR/Rx_ControlParams_VR_BLUETOOTH_HEADSET.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio_VR/Rx_ControlParams_VR_BLUETOOTH_HEADSET.txt -adb pull /system/etc/audio_VR/Rx_ControlParams_VR_EARPIECE_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio_VR/Rx_ControlParams_VR_EARPIECE_WIDEBAND.txt -adb pull /system/etc/audio_VR/Rx_ControlParams_VR_SPEAKER_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio_VR/Rx_ControlParams_VR_SPEAKER_WIDEBAND.txt -adb pull /system/etc/audio_VR/Rx_ControlParams_VR_WIRED_HEADPHONE_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio_VR/Rx_ControlParams_VR_WIRED_HEADPHONE_WIDEBAND.txt -adb pull /system/etc/audio_VR/Rx_ControlParams_VR_WIRED_HEADSET_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio_VR/Rx_ControlParams_VR_WIRED_HEADSET_WIDEBAND.txt -adb pull /system/etc/audio_VR/Tx_ControlParams_VR_BLUETOOTH_HEADSET.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio_VR/Tx_ControlParams_VR_BLUETOOTH_HEADSET.txt -adb pull /system/etc/audio_VR/Tx_ControlParams_VR_EARPIECE_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio_VR/Tx_ControlParams_VR_EARPIECE_WIDEBAND.txt -adb pull /system/etc/audio_VR/Tx_ControlParams_VR_SPEAKER_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio_VR/Tx_ControlParams_VR_SPEAKER_WIDEBAND.txt -adb pull /system/etc/audio_VR/Tx_ControlParams_VR_WIRED_HEADPHONE_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio_VR/Tx_ControlParams_VR_WIRED_HEADPHONE_WIDEBAND.txt -adb pull /system/etc/audio_VR/Tx_ControlParams_VR_WIRED_HEADSET_WIDEBAND.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/audio_VR/Tx_ControlParams_VR_WIRED_HEADSET_WIDEBAND.txt - -adb pull /system/etc/firmware/RS_M9MO.bin ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/firmware/RS_M9MO.bin - -adb pull /system/etc/wifi/bcmdhd_apsta.bin_b1 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/bcmdhd_apsta.bin_b1 -adb pull /system/etc/wifi/bcmdhd_apsta.bin_b2 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/bcmdhd_apsta.bin_b2 -adb pull /system/etc/wifi/bcmdhd_mfg.bin_b0 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/bcmdhd_mfg.bin_b0 -adb pull /system/etc/wifi/bcmdhd_mfg.bin_b1 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/bcmdhd_mfg.bin_b1 -adb pull /system/etc/wifi/bcmdhd_mfg.bin_b2 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/bcmdhd_mfg.bin_b2 -adb pull /system/etc/wifi/bcmdhd_p2p.bin_b0 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/bcmdhd_p2p.bin_b0 -adb pull /system/etc/wifi/bcmdhd_p2p.bin_b1 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/bcmdhd_p2p.bin_b1 -adb pull /system/etc/wifi/bcmdhd_p2p.bin_b2 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/bcmdhd_p2p.bin_b2 -adb pull /system/etc/wifi/bcmdhd_sta.bin_b0 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/bcmdhd_sta.bin_b0 -adb pull /system/etc/wifi/bcmdhd_sta.bin_b1 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/bcmdhd_sta.bin_b1 -adb pull /system/etc/wifi/bcmdhd_sta.bin_b2 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/bcmdhd_sta.bin_b2 -adb pull /system/etc/wifi/nvram_mfg.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/nvram_mfg.txt -adb pull /system/etc/wifi/nvram_mfg.txt_murata ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/nvram_mfg.txt_murata -adb pull /system/etc/wifi/nvram_mfg.txt_murata_b2 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/nvram_mfg.txt_murata_b2 -adb pull /system/etc/wifi/nvram_mfg.txt_semcosh ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/nvram_mfg.txt_semcosh -adb pull /system/etc/wifi/nvram_net.txt ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/nvram_net.txt -adb pull /system/etc/wifi/nvram_net.txt_murata ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/nvram_net.txt_murata -adb pull /system/etc/wifi/nvram_net.txt_murata_b2 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/nvram_net.txt_murata_b2 -adb pull /system/etc/wifi/nvram_net.txt_semcosh ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/wifi/nvram_net.txt_semcosh - -adb pull /system/etc/srm.bin ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/srm.bin -adb pull /system/etc/Volume.db ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/etc/Volume.db - -adb pull /system/lib/egl/libEGL_mali.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/egl/libEGL_mali.so -adb pull /system/lib/egl/libGLES_android.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/egl/libGLES_android.so -adb pull /system/lib/egl/libGLESv1_CM_mali.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/egl/libGLESv1_CM_mali.so -adb pull /system/lib/egl/libGLESv2_mali.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/egl/libGLESv2_mali.so - -adb pull /system/lib/hw/audio.primary.smdk4x12.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/hw/audio.primary.smdk4x12.so -adb pull /system/lib/hw/audio.wfd.smdk4x12.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/hw/audio.wfd.smdk4x12.so -adb pull /system/lib/hw/audio_policy.smdk4x12.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/hw/audio_policy.smdk4x12.so -adb pull /system/lib/hw/vendor-camera.exynos4.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/hw/camera.smdk4x12.so -adb pull /system/lib/hw/gps.exynos4.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/hw/gps.exynos4.so -adb pull /system/lib/hw/gralloc.smdk4x12.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/hw/gralloc.smdk4x12.so -adb pull /system/lib/hw/sensors.smdk4x12.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/hw/sensors.smdk4x12.so -adb pull /system/lib/hw/hwcomposer.smdk4x12.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/hw/hwcomposer.smdk4x12.so - -adb pull /system/lib/libaudiopolicy_sec.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libaudiopolicy_sec.so -adb pull /system/lib/libcontrolcsc.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libcontrolcsc.so -adb pull /system/lib/liblvvefs.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/liblvvefs.so -adb pull /system/lib/libril.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libril.so -adb pull /system/lib/libsamsungRecord.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libsamsungRecord.so -adb pull /system/lib/lib_SamsungRec_V01005.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/lib_SamsungRec_V01005.so -adb pull /system/lib/lib_Samsung_Resampler.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/lib_Samsung_Resampler.so -adb pull /system/lib/lib_Samsung_SB_AM_for_ICS_v03004.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/lib_Samsung_SB_AM_for_ICS_v03004.so -adb pull /system/lib/libsamsungSoundbooster.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libsamsungSoundbooster.so -adb pull /system/lib/libsec-ril.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libsec-ril.so -adb pull /system/lib/libsecril-client.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libsecril-client.so -adb pull /system/lib/libtinyalsa.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libtinyalsa.so -adb pull /system/lib/libakm.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libakm.so -adb pull /system/lib/libGLESv1_CM.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libGLESv1_CM.so -adb pull /system/lib/libGLESv2.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libGLESv2.so -adb pull /system/lib/libGLESv2_dbg.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libGLESv2_dbg.so -adb pull /system/lib/libion.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libion.so -adb pull /system/lib/libMali.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libMali.so -adb pull /system/lib/libsecnativefeature.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libsecnativefeature.so -adb pull /system/lib/libUMP.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libUMP.so -adb pull /system/lib/libvdis.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libvdis.so -adb pull /system/lib/libQmageDecoder.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libQmageDecoder.so -adb pull /system/lib/libquramimagecodec.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libquramimagecodec.so -adb pull /system/lib/libviewracledf.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libviewracledf.so -adb pull /system/lib/libviewracledf_client.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libviewracledf_client.so -adb pull /system/lib/libviewracle_option_client.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libviewracle_option_client.so -adb pull /system/lib/libviewracle_option_server.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libviewracle_option_server.so -adb pull /system/lib/libviewraclesc.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libviewraclesc.so -adb pull /system/lib/libfimg.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libfimg.so -adb pull /system/lib/libhwconverter.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libhwconverter.so -adb pull /system/lib/libhwjpeg.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libhwjpeg.so -adb pull /system/lib/libcec.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libcec.so -adb pull /system/lib/libddc.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libddc.so -adb pull /system/lib/libedid.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libedid.so -adb pull /system/lib/libfimc.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libfimc.so -adb pull /system/lib/libhdmi.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libhdmi.so -adb pull /system/lib/libhdmiclient.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libhdmiclient.so -adb pull /system/lib/libTVOut.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libTVOut.so -adb pull /system/lib/libtvoutinterface.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libtvoutinterface.so -adb pull /system/lib/libtvout_jni.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libtvout_jni.so -adb pull /system/lib/libtvoutservice.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/lib/libtvoutservice.so - -adb pull /system/media/battery_batteryerror.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_batteryerror.qmg -adb pull /system/media/battery_charging_5.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_5.qmg -adb pull /system/media/battery_charging_10.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_10.qmg -adb pull /system/media/battery_charging_15.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_15.qmg -adb pull /system/media/battery_charging_20.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_20.qmg -adb pull /system/media/battery_charging_25.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_25.qmg -adb pull /system/media/battery_charging_30.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_30.qmg -adb pull /system/media/battery_charging_35.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_35.qmg -adb pull /system/media/battery_charging_40.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_40.qmg -adb pull /system/media/battery_charging_45.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_45.qmg -adb pull /system/media/battery_charging_50.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_50.qmg -adb pull /system/media/battery_charging_55.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_55.qmg -adb pull /system/media/battery_charging_60.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_60.qmg -adb pull /system/media/battery_charging_65.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_65.qmg -adb pull /system/media/battery_charging_70.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_70.qmg -adb pull /system/media/battery_charging_75.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_75.qmg -adb pull /system/media/battery_charging_80.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_80.qmg -adb pull /system/media/battery_charging_85.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_85.qmg -adb pull /system/media/battery_charging_90.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_90.qmg -adb pull /system/media/battery_charging_95.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_95.qmg -adb pull /system/media/battery_charging_100.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_charging_100.qmg -adb pull /system/media/battery_error.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/battery_error.qmg -adb pull /system/media/chargingwarning.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/chargingwarning.qmg -adb pull /system/media/Disconnected.qmg ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/media/Disconnected.qmg - -adb pull /system/usr/idc/melfas_ts.idc ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/idc/melfas_ts.idc -adb pull /system/usr/idc/qwerty.idc ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/idc/qwerty.idc -adb pull /system/usr/idc/qwerty2.idc ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/idc/qwerty2.idc -adb pull /system/usr/idc/sec_touchscreen.idc ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/idc/sec_touchscreen.idc - -adb pull /system/usr/keychars/Generic.kcm ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keychars/Generic.kcm -adb pull /system/usr/keychars/qwerty.kcm ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keychars/qwerty.kcm -adb pull /system/usr/keychars/qwerty2.kcm ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keychars/qwerty2.kcm -adb pull /system/usr/keychars/Virtual.kcm ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keychars/Virtual.kcm - -adb pull /system/usr/keylayout/AVRCP.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/AVRCP.kl -adb pull /system/usr/keylayout/Generic.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/Generic.kl -adb pull /system/usr/keylayout/gpio-keys.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/gpio-keys.kl -adb pull /system/usr/keylayout/max77693-muic.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/max77693-muic.kl -adb pull /system/usr/keylayout/qwerty.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/qwerty.kl -adb pull /system/usr/keylayout/samsung-keypad.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/samsung-keypad.kl -adb pull /system/usr/keylayout/sec_touchkey.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/sec_touchkey.kl -adb pull /system/usr/keylayout/sii9234_rcp.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/sii9234_rcp.kl -adb pull /system/usr/keylayout/Vendor_04e8_Product_7021.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/Vendor_04e8_Product_7021.kl -adb pull /system/usr/keylayout/Vendor_05ac_Product_0239.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/Vendor_05ac_Product_0239.kl -adb pull /system/usr/keylayout/Vendor_22b8_Product_093d.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/Vendor_22b8_Product_093d.kl -adb pull /system/usr/keylayout/Vendor_045e_Product_028e.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/Vendor_045e_Product_028e.kl -adb pull /system/usr/keylayout/Vendor_046d_Product_c216.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/Vendor_046d_Product_c216.kl -adb pull /system/usr/keylayout/Vendor_046d_Product_c294.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/Vendor_046d_Product_c294.kl -adb pull /system/usr/keylayout/Vendor_046d_Product_c299.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/Vendor_046d_Product_c299.kl -adb pull /system/usr/keylayout/Vendor_046d_Product_c532.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/Vendor_046d_Product_c532.kl -adb pull /system/usr/keylayout/Vendor_054c_Product_0268.kl ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/usr/keylayout/Vendor_054c_Product_0268.kl - -adb pull /system/vendor/firmware/SlimISP_GD.bin ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/vendor/firmware/SlimISP_GD.bin -adb pull /system/vendor/firmware/SlimISP_ZD.bin ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/vendor/firmware/SlimISP_ZD.bin -adb pull /system/vendor/firmware/fimc_is_fw.bin ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/vendor/firmware/fimc_is_fw.bin -adb pull /system/vendor/firmware/libpn544_fw.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/vendor/firmware/libpn544_fw.so -adb pull /system/vendor/firmware/mfc_fw.bin ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/vendor/firmware/mfc_fw.bin -adb pull /system/vendor/firmware/setfile.bin ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/system/vendor/firmware/setfile.bin - -(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/$DEVICE-vendor-blobs.mk -# Copyright (C) 2012 The CyanogenMod 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. - -# This file is generated by device/__MANUFACTURER__/__DEVICE__/extract-files.sh - DO NOT EDIT - -LOCAL_PATH := vendor/__MANUFACTURER__/__DEVICE__ - -# Prebuilt libraries that are needed to build open-source libraries -PRODUCT_COPY_FILES := \\ - \$(LOCAL_PATH)/proprietary/system/lib/libril.so:obj/lib/libril.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libsecril-client.so:obj/lib/libsecril-client.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libion.so:obj/lib/libion.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libUMP.so:obj/lib/libUMP.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libTVOut.so:obj/lib/libTVOut.so - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/sbin/cbd:root/sbin/cbd - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/bin/bcm4334.hcd:system/bin/bcm4334.hcd \\ - \$(LOCAL_PATH)/proprietary/system/bin/gps.cer:system/bin/gps.cer \\ - \$(LOCAL_PATH)/proprietary/system/bin/gpsd:system/bin/gpsd \\ - \$(LOCAL_PATH)/proprietary/system/bin/lpmkey:system/bin/lpmkey \\ - \$(LOCAL_PATH)/proprietary/system/bin/playlpm:system/bin/playlpm \\ - \$(LOCAL_PATH)/proprietary/system/bin/rild:system/bin/rild - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/cameradata/datapattern_420sp.yuv:system/cameradata/datapattern_420sp.yuv \\ - \$(LOCAL_PATH)/proprietary/system/cameradata/datapattern_front_420sp.yuv:system/cameradata/datapattern_front_420sp.yuv - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/LVVEFS_Rx_Configuration.txt:system/etc/audio/LVVEFS_Rx_Configuration.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/LVVEFS_Tx_Configuration.txt:system/etc/audio/LVVEFS_Tx_Configuration.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Rx_ControlParams_BLUETOOTH_HEADSET.txt:system/etc/audio/Rx_ControlParams_BLUETOOTH_HEADSET.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Rx_ControlParams_EARPIECE_WIDEBAND.txt:system/etc/audio/Rx_ControlParams_EARPIECE_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Rx_ControlParams_SECVOIP_BLUETOOTH_HEADSET.txt:system/etc/audio/Rx_ControlParams_SECVOIP_BLUETOOTH_HEADSET.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Rx_ControlParams_SECVOIP_EARPIECE_WIDEBAND.txt:system/etc/audio/Rx_ControlParams_SECVOIP_EARPIECE_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Rx_ControlParams_SECVOIP_SPEAKER_WIDEBAND.txt:system/etc/audio/Rx_ControlParams_SECVOIP_SPEAKER_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Rx_ControlParams_SECVOIP_WIRED_HEADPHONE_WIDEBAND.txt:system/etc/audio/Rx_ControlParams_SECVOIP_WIRED_HEADPHONE_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Rx_ControlParams_SECVOIP_WIRED_HEADSET_WIDEBAND.txt:system/etc/audio/Rx_ControlParams_SECVOIP_WIRED_HEADSET_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Rx_ControlParams_SPEAKER_WIDEBAND.txt:system/etc/audio/Rx_ControlParams_SPEAKER_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Rx_ControlParams_WIRED_HEADPHONE_WIDEBAND.txt:system/etc/audio/Rx_ControlParams_WIRED_HEADPHONE_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Rx_ControlParams_WIRED_HEADSET_WIDEBAND.txt:system/etc/audio/Rx_ControlParams_WIRED_HEADSET_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Tx_ControlParams_BLUETOOTH_HEADSET.txt:system/etc/audio/Tx_ControlParams_BLUETOOTH_HEADSET.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Tx_ControlParams_EARPIECE_WIDEBAND.txt:system/etc/audio/Tx_ControlParams_EARPIECE_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Tx_ControlParams_SECVOIP_BLUETOOTH_HEADSET.txt:system/etc/audio/Tx_ControlParams_SECVOIP_BLUETOOTH_HEADSET.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Tx_ControlParams_SECVOIP_EARPIECE_WIDEBAND.txt:system/etc/audio/Tx_ControlParams_SECVOIP_EARPIECE_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Tx_ControlParams_SECVOIP_SPEAKER_WIDEBAND.txt:system/etc/audio/Tx_ControlParams_SECVOIP_SPEAKER_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Tx_ControlParams_SECVOIP_WIRED_HEADPHONE_WIDEBAND.txt:system/etc/audio/Tx_ControlParams_SECVOIP_WIRED_HEADPHONE_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Tx_ControlParams_SECVOIP_WIRED_HEADSET_WIDEBAND.txt:system/etc/audio/Tx_ControlParams_SECVOIP_WIRED_HEADSET_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Tx_ControlParams_SPEAKER_WIDEBAND.txt:system/etc/audio/Tx_ControlParams_SPEAKER_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Tx_ControlParams_WIRED_HEADPHONE_WIDEBAND.txt:system/etc/audio/Tx_ControlParams_WIRED_HEADPHONE_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio/Tx_ControlParams_WIRED_HEADSET_WIDEBAND.txt:system/etc/audio/Tx_ControlParams_WIRED_HEADSET_WIDEBAND.txt - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio_VR/LVVEFS_Rx_Configuration.txt:system/etc/audio_VR/LVVEFS_Rx_Configuration.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio_VR/LVVEFS_Tx_Configuration.txt:system/etc/audio_VR/LVVEFS_Tx_Configuration.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio_VR/Rx_ControlParams_VR_BLUETOOTH_HEADSET.txt:system/etc/audio_VR/Rx_ControlParams_VR_BLUETOOTH_HEADSET.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio_VR/Rx_ControlParams_VR_EARPIECE_WIDEBAND.txt:system/etc/audio_VR/Rx_ControlParams_VR_EARPIECE_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio_VR/Rx_ControlParams_VR_SPEAKER_WIDEBAND.txt:system/etc/audio_VR/Rx_ControlParams_VR_SPEAKER_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio_VR/Rx_ControlParams_VR_WIRED_HEADPHONE_WIDEBAND.txt:system/etc/audio_VR/Rx_ControlParams_VR_WIRED_HEADPHONE_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio_VR/Rx_ControlParams_VR_WIRED_HEADSET_WIDEBAND.txt:system/etc/audio_VR/Rx_ControlParams_VR_WIRED_HEADSET_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio_VR/Tx_ControlParams_VR_BLUETOOTH_HEADSET.txt:system/etc/audio_VR/Tx_ControlParams_VR_BLUETOOTH_HEADSET.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio_VR/Tx_ControlParams_VR_EARPIECE_WIDEBAND.txt:system/etc/audio_VR/Tx_ControlParams_VR_EARPIECE_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio_VR/Tx_ControlParams_VR_SPEAKER_WIDEBAND.txt:system/etc/audio_VR/Tx_ControlParams_VR_SPEAKER_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio_VR/Tx_ControlParams_VR_WIRED_HEADPHONE_WIDEBAND.txt:system/etc/audio_VR/Tx_ControlParams_VR_WIRED_HEADPHONE_WIDEBAND.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/audio_VR/Tx_ControlParams_VR_WIRED_HEADSET_WIDEBAND.txt:system/etc/audio_VR/Tx_ControlParams_VR_WIRED_HEADSET_WIDEBAND.txt - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/etc/firmware/RS_M9MO.bin:system/etc/firmware/RS_M9MO.bin - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/bcmdhd_apsta.bin_b1:system/etc/wifi/bcmdhd_apsta.bin_b1 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/bcmdhd_apsta.bin_b2:system/etc/wifi/bcmdhd_apsta.bin_b2 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/bcmdhd_mfg.bin_b0:system/etc/wifi/bcmdhd_mfg.bin_b0 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/bcmdhd_mfg.bin_b1:system/etc/wifi/bcmdhd_mfg.bin_b1 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/bcmdhd_mfg.bin_b2:system/etc/wifi/bcmdhd_mfg.bin_b2 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/bcmdhd_p2p.bin_b0:system/etc/wifi/bcmdhd_p2p.bin_b0 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/bcmdhd_p2p.bin_b1:system/etc/wifi/bcmdhd_p2p.bin_b1 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/bcmdhd_p2p.bin_b2:system/etc/wifi/bcmdhd_p2p.bin_b2 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/bcmdhd_sta.bin_b0:system/etc/wifi/bcmdhd_sta.bin_b0 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/bcmdhd_sta.bin_b1:system/etc/wifi/bcmdhd_sta.bin_b1 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/bcmdhd_sta.bin_b2:system/etc/wifi/bcmdhd_sta.bin_b2 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/nvram_mfg.txt:system/etc/wifi/nvram_mfg.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/nvram_mfg.txt_murata:system/etc/wifi/nvram_mfg.txt_murata \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/nvram_mfg.txt_murata_b2:system/etc/wifi/nvram_mfg.txt_murata_b2 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/nvram_mfg.txt_semcosh:system/etc/wifi/nvram_mfg.txt_semcosh \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/nvram_net.txt:system/etc/wifi/nvram_net.txt \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/nvram_net.txt_murata:system/etc/wifi/nvram_net.txt_murata \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/nvram_net.txt_murata_b2:system/etc/wifi/nvram_net.txt_murata_b2 \\ - \$(LOCAL_PATH)/proprietary/system/etc/wifi/nvram_net.txt_semcosh:system/etc/wifi/nvram_net.txt_semcosh - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/etc/srm.bin:system/etc/srm.bin \\ - \$(LOCAL_PATH)/proprietary/system/etc/Volume.db:system/etc/Volume.db - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/lib/egl/libEGL_mali.so:system/lib/egl/libEGL_mali.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/egl/libGLES_android.so:system/lib/egl/libGLES_android.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/egl/libGLESv1_CM_mali.so:system/lib/egl/libGLESv1_CM_mali.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/egl/libGLESv2_mali.so:system/lib/egl/libGLESv2_mali.so - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/lib/hw/audio.primary.smdk4x12.so:system/lib/hw/audio.primary.smdk4x12.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/hw/audio.wfd.smdk4x12.so:system/lib/hw/audio.wfd.smdk4x12.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/hw/audio_policy.smdk4x12.so:system/lib/hw/audio_policy.smdk4x12.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/hw/camera.smdk4x12.so:system/lib/hw/vendor-camera.exynos4.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/hw/gps.exynos4.so:system/lib/hw/gps.exynos4.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/hw/gralloc.smdk4x12.so:system/lib/hw/gralloc.smdk4x12.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/hw/sensors.smdk4x12.so:system/lib/hw/sensors.smdk4x12.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/hw/hwcomposer.smdk4x12.so:system/lib/hw/hwcomposer.smdk4x12.so - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/lib/libaudiopolicy_sec.so:system/lib/libaudiopolicy_sec.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libcontrolcsc.so:system/lib/libcontrolcsc.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/liblvvefs.so:system/lib/liblvvefs.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libril.so:system/lib/libril.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libsamsungRecord.so:system/lib/libsamsungRecord.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/lib_SamsungRec_V01005.so:system/lib/lib_SamsungRec_V01005.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/lib_Samsung_Resampler.so:system/lib/lib_Samsung_Resampler.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/lib_Samsung_SB_AM_for_ICS_v03004.so:system/lib/lib_Samsung_SB_AM_for_ICS_v03004.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libsamsungSoundbooster.so:system/lib/libsamsungSoundbooster.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libsec-ril.so:system/lib/libsec-ril.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libsecril-client.so:system/lib/libsecril-client.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libtinyalsa.so:system/lib/libtinyalsa.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libakm.so:system/lib/libakm.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libGLESv1_CM.so:system/lib/libGLESv1_CM.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libGLESv2.so:system/lib/libGLESv2.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libGLESv2_dbg.so:system/lib/libGLESv2_dbg.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libion.so:system/lib/libion.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libMali.so:system/lib/libMali.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libsecnativefeature.so:system/lib/libsecnativefeature.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libUMP.so:system/lib/libUMP.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libvdis.so:system/lib/libvdis.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libQmageDecoder.so:system/lib/libQmageDecoder.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libquramimagecodec.so:system/lib/libquramimagecodec.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libviewracledf.so:system/lib/libviewracledf.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libviewracledf_client.so:system/lib/libviewracledf_client.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libviewracle_option_client.so:system/lib/libviewracle_option_client.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libviewracle_option_server.so:system/lib/libviewracle_option_server.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libviewraclesc.so:system/lib/libviewraclesc.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libfimg.so:system/lib/libfimg.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libhwconverter.so:system/lib/libhwconverter.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libhwjpeg.so:system/lib/libhwjpeg.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libcec.so:system/lib/libcec.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libddc.so:system/lib/libddc.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libedid.so:system/lib/libedid.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libfimc.so:system/lib/libfimc.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libhdmi.so:system/lib/libhdmi.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libhdmiclient.so:system/lib/libhdmiclient.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libTVOut.so:system/lib/libTVOut.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libtvoutinterface.so:system/lib/libtvoutinterface.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libtvout_jni.so:system/lib/libtvout_jni.so \\ - \$(LOCAL_PATH)/proprietary/system/lib/libtvoutservice.so:system/lib/libtvoutservice.so - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_batteryerror.qmg:system/media/battery_batteryerror.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_5.qmg:system/media/battery_charging_5.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_10.qmg:system/media/battery_charging_10.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_15.qmg:system/media/battery_charging_15.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_20.qmg:system/media/battery_charging_20.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_25.qmg:system/media/battery_charging_25.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_30.qmg:system/media/battery_charging_30.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_35.qmg:system/media/battery_charging_35.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_40.qmg:system/media/battery_charging_40.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_45.qmg:system/media/battery_charging_45.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_50.qmg:system/media/battery_charging_50.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_55.qmg:system/media/battery_charging_55.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_60.qmg:system/media/battery_charging_60.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_65.qmg:system/media/battery_charging_65.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_70.qmg:system/media/battery_charging_70.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_75.qmg:system/media/battery_charging_75.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_80.qmg:system/media/battery_charging_80.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_85.qmg:system/media/battery_charging_85.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_90.qmg:system/media/battery_charging_90.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_95.qmg:system/media/battery_charging_95.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_charging_100.qmg:system/media/battery_charging_100.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/battery_error.qmg:system/media/battery_error.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/chargingwarning.qmg:system/media/chargingwarning.qmg \\ - \$(LOCAL_PATH)/proprietary/system/media/Disconnected.qmg:system/media/Disconnected.qmg - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/usr/idc/melfas_ts.idc:system/usr/idc/melfas_ts.idc \\ - \$(LOCAL_PATH)/proprietary/system/usr/idc/qwerty.idc:system/usr/idc/qwerty.idc \\ - \$(LOCAL_PATH)/proprietary/system/usr/idc/qwerty2.idc:system/usr/idc/qwerty2.idc \\ - \$(LOCAL_PATH)/proprietary/system/usr/idc/sec_touchscreen.idc:system/usr/idc/sec_touchscreen.idc - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/usr/keychars/Generic.kcm:system/usr/keychars/Generic.kcm \\ - \$(LOCAL_PATH)/proprietary/system/usr/keychars/qwerty.kcm:system/usr/keychars/qwerty.kcm \\ - \$(LOCAL_PATH)/proprietary/system/usr/keychars/qwerty2.kcm:system/usr/keychars/qwerty2.kcm \\ - \$(LOCAL_PATH)/proprietary/system/usr/keychars/Virtual.kcm:system/usr/keychars/Virtual.kcm - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/AVRCP.kl:system/usr/keylayout/AVRCP.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/Generic.kl:system/usr/keylayout/Generic.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/gpio-keys.kl:system/usr/keylayout/gpio-keys.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/max77693-muic.kl:system/usr/keylayout/max77693-muic.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/qwerty.kl:system/usr/keylayout/qwerty.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/samsung-keypad.kl:system/usr/keylayout/samsung-keypad.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/sec_touchkey.kl:system/usr/keylayout/sec_touchkey.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/sii9234_rcp.kl:system/usr/keylayout/sii9234_rcp.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/Vendor_04e8_Product_7021.kl:system/usr/keylayout/Vendor_04e8_Product_7021.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/Vendor_05ac_Product_0239.kl:system/usr/keylayout/Vendor_05ac_Product_0239.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/Vendor_22b8_Product_093d.kl:system/usr/keylayout/Vendor_22b8_Product_093d.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/Vendor_045e_Product_028e.kl:system/usr/keylayout/Vendor_045e_Product_028e.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/Vendor_046d_Product_c216.kl:system/usr/keylayout/Vendor_046d_Product_c216.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/Vendor_046d_Product_c294.kl:system/usr/keylayout/Vendor_046d_Product_c294.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/Vendor_046d_Product_c299.kl:system/usr/keylayout/Vendor_046d_Product_c299.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/Vendor_046d_Product_c532.kl:system/usr/keylayout/Vendor_046d_Product_c532.kl \\ - \$(LOCAL_PATH)/proprietary/system/usr/keylayout/Vendor_054c_Product_0268.kl:system/usr/keylayout/Vendor_054c_Product_0268.kl - -PRODUCT_COPY_FILES += \\ - \$(LOCAL_PATH)/proprietary/system/vendor/firmware/SlimISP_GD.bin:system/vendor/firmware/SlimISP_GD.bin \\ - \$(LOCAL_PATH)/proprietary/system/vendor/firmware/SlimISP_ZD.bin:system/vendor/firmware/SlimISP_ZD.bin \\ - \$(LOCAL_PATH)/proprietary/system/vendor/firmware/fimc_is_fw.bin:system/vendor/firmware/fimc_is_fw.bin \\ - \$(LOCAL_PATH)/proprietary/system/vendor/firmware/libpn544_fw.so:system/vendor/firmware/libpn544_fw.so \\ - \$(LOCAL_PATH)/proprietary/system/vendor/firmware/mfc_fw.bin:system/vendor/firmware/mfc_fw.bin \\ - \$(LOCAL_PATH)/proprietary/system/vendor/firmware/setfile.bin:system/vendor/firmware/setfile.bin - -EOF - -(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/Android.mk -# Copyright (C) 2012 The CyanogenMod 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. - -# This file is generated by device/__MANUFACTURER__/__DEVICE__/extract-files.sh - DO NOT EDIT - -ifeq (\$(TARGET_DEVICE),i9300) -LOCAL_PATH:=\$(call my-dir) -endif - -EOF - -exec ./setup-makefiles.sh diff --git a/galaxys3_base.mk b/galaxys3_base.mk deleted file mode 100644 index a97214e8..00000000 --- a/galaxys3_base.mk +++ /dev/null @@ -1,216 +0,0 @@ -# -# Copyright (C) 2012 The CyanogenMod 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. -# - -DEVICE_PACKAGE_OVERLAYS += device/samsung/i9300/overlay - -$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk) - -# The gps config appropriate for this device -$(call inherit-product, device/common/gps/gps_us_supl.mk) - -# This device is xhdpi. However the platform doesn't -# currently contain all of the bitmaps at xhdpi density so -# we do this little trick to fall back to the hdpi version -# if the xhdpi doesn't exist. -PRODUCT_AAPT_CONFIG := normal hdpi xhdpi -PRODUCT_AAPT_PREF_CONFIG := xhdpi - -# Init files -PRODUCT_COPY_FILES := \ - device/samsung/i9300/init.bt.rc:root/init.bt.rc \ - device/samsung/i9300/init.smdk4x12.rc:root/init.smdk4x12.rc \ - device/samsung/i9300/init.smdk4x12.usb.rc:root/init.smdk4x12.usb.rc \ - device/samsung/i9300/lpm.rc:root/lpm.rc \ - device/samsung/i9300/ueventd.smdk4x12.rc:root/ueventd.smdk4x12.rc \ - device/samsung/i9300/ueventd.smdk4x12.rc:recovery/root/ueventd.smdk4x12.rc - -# Camera FW -PRODUCT_COPY_FILES += \ - device/samsung/i9300/80cfw:system/etc/init.d/80cfw - -# Audio -PRODUCT_COPY_FILES += \ - device/samsung/i9300/configs/tiny_hw.xml:system/etc/sound/GT-I9300 - -# Vold and Storage -PRODUCT_COPY_FILES += \ - device/samsung/i9300/configs/vold.fstab:system/etc/vold.fstab - -# Bluetooth configuration files -PRODUCT_COPY_FILES += \ - system/bluetooth/data/main.le.conf:system/etc/bluetooth/main.conf - -# Wifi -PRODUCT_COPY_FILES += \ - device/samsung/i9300/configs/wpa_supplicant.conf:system/etc/wifi/wpa_supplicant.conf - -PRODUCT_PROPERTY_OVERRIDES += \ - wifi.interface=wlan0 \ - wifi.supplicant_scan_interval=15 - -# Gps -PRODUCT_COPY_FILES += \ - device/samsung/i9300/configs/gps.conf:system/etc/gps.conf \ - device/samsung/i9300/configs/gps.xml:system/etc/gps.xml - -# Packages -PRODUCT_PACKAGES := \ - audio.primary.exynos4 \ - audio.a2dp.default \ - camera.exynos4 \ - Camera \ - macloader \ - com.android.future.usb.accessory \ - GalaxyS3Settings \ - SamsungServiceMode \ - tinymix \ - Torch - -# HAL -PRODUCT_PACKAGES += \ - nfc.exynos4 \ - lights.exynos4 - -# libgralloc_ump \ -# libhwconverter \ -# libfimg \ -# hwcomposer.exynos4 -# libhwjpeg \ -# libhdmi \ -# libfimc \ -# libcec \ -# libddc \ -# libedid \ -# libhdmiclient \ -# libTVOut -# libtinyalsa \ - -# NFC -PRODUCT_PACKAGES += \ - libnfc \ - libnfc_jni \ - Nfc \ - Tag - -PRODUCT_COPY_FILES += \ - packages/apps/Nfc/migrate_nfc.txt:system/etc/updatecmds/migrate_nfc.txt \ - device/sample/nxp/com.nxp.mifare.xml:system/etc/permissions/com.nxp.mifare.xml \ - frameworks/base/nfc-extras/com.android.nfc_extras.xml:system/etc/permissions/com.android.nfc_extras.xml \ - frameworks/base/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml - -# NFCEE access control -ifeq ($(TARGET_BUILD_VARIANT),user) - NFCEE_ACCESS_PATH := device/samsung/i9300/nfcee_access.xml -else - NFCEE_ACCESS_PATH := device/samsung/i9300/nfcee_access_debug.xml -endif - -PRODUCT_COPY_FILES += \ - $(NFCEE_ACCESS_PATH):system/etc/nfcee_access.xml - -PRODUCT_PACKAGES += \ - com.android.nfc_extras - -# MFC API -PRODUCT_PACKAGES += \ - libsecmfcdecapi \ - libsecmfcencapi - -# OMX -PRODUCT_PACKAGES += \ - libstagefrighthw \ - libSEC_OMX_Resourcemanager \ - libSEC_OMX_Core \ - libOMX.SEC.AVC.Decoder \ - libOMX.SEC.M4V.Decoder \ - libOMX.SEC.WMV.Decoder \ - libOMX.SEC.AVC.Encoder \ - libOMX.SEC.M4V.Encoder -# libOMX.SEC.VP8.Decoder - -PRODUCT_COPY_FILES += \ - device/samsung/i9300/configs/media_profiles.xml:system/etc/media_profiles.xml - -# RIL -PRODUCT_PROPERTY_OVERRIDES += \ - ro.telephony.ril_class=Smdk4210RIL \ - mobiledata.interfaces=pdp0,wlan0,gprs,ppp0 - -# Filesystem management tools -PRODUCT_PACKAGES += \ - static_busybox \ - make_ext4fs \ - setup_fs - -# Live Wallpapers -PRODUCT_PACKAGES += \ - Galaxy4 \ - HoloSpiralWallpaper \ - LiveWallpapers \ - LiveWallpapersPicker \ - MagicSmokeWallpapers \ - NoiseField \ - PhaseBeam \ - VisualizationWallpapers \ - librs_jni - -# These are the hardware-specific features -PRODUCT_COPY_FILES += \ - frameworks/base/data/etc/android.hardware.audio.low_latency.xml:system/etc/permissions/android.hardware.audio.low_latency.xml \ - frameworks/base/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml \ - frameworks/base/data/etc/android.hardware.camera.flash-autofocus.xml:system/etc/permissions/android.hardware.camera.flash-autofocus.xml \ - frameworks/base/data/etc/android.hardware.camera.front.xml:system/etc/permissions/android.hardware.camera.front.xml \ - frameworks/base/data/etc/android.hardware.camera.xml:system/etc/permissions/android.hardware.camera.xml \ - frameworks/base/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \ - frameworks/base/data/etc/android.hardware.location.xml:system/etc/permissions/android.hardware.location.xml \ - frameworks/base/data/etc/android.hardware.sensor.accelerometer.xml:system/etc/permissions/android.hardware.sensor.accelerometer.xml \ - frameworks/base/data/etc/android.hardware.sensor.compass.xml:system/etc/permissions/android.hardware.sensor.compass.xml \ - frameworks/base/data/etc/android.hardware.sensor.gyroscope.xml:system/etc/permissions/android.hardware.sensor.gyroscope.xml \ - frameworks/base/data/etc/android.hardware.sensor.light.xml:system/etc/permissions/android.hardware.sensor.light.xml \ - frameworks/base/data/etc/android.hardware.sensor.proximity.xml:system/etc/permissions/android.hardware.sensor.proximity.xml \ - frameworks/base/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml \ - frameworks/base/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \ - frameworks/base/data/etc/android.hardware.touchscreen.multitouch.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.xml \ - frameworks/base/data/etc/android.hardware.touchscreen.xml:system/etc/permissions/android.hardware.touchscreen.xml \ - frameworks/base/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml \ - frameworks/base/data/etc/android.hardware.usb.host.xml:system/etc/permissions/android.hardware.usb.host.xml \ - frameworks/base/data/etc/android.hardware.wifi.direct.xml:system/etc/permissions/android.hardware.wifi.direct.xml \ - frameworks/base/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \ - frameworks/base/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml \ - frameworks/base/data/etc/android.software.sip.xml:system/etc/permissions/android.software.sip.xml \ - frameworks/base/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml - -# Feature live wallpaper -PRODUCT_COPY_FILES += \ - packages/wallpapers/LivePicker/android.software.live_wallpaper.xml:system/etc/permissions/android.software.live_wallpaper.xml - -PRODUCT_PROPERTY_OVERRIDES += \ - ro.opengles.version=131072 \ - hwui.render_dirty_regions=false - -PRODUCT_TAGS += dalvik.gc.type-precise - -# Set default USB interface -PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ - persist.sys.usb.config=mtp - -$(call inherit-product, frameworks/base/build/phone-xhdpi-1024-dalvik-heap.mk) - -# Include exynos4 platform specific parts -TARGET_HAL_PATH := hardware/samsung/exynos4/hal -TARGET_OMX_PATH := hardware/samsung/exynos/multimedia/openmax -$(call inherit-product, hardware/samsung/exynos4x12.mk) -$(call inherit-product, vendor/cm/config/nfc_enhanced.mk) diff --git a/i9300.mk b/i9300.mk index fec48c0a..3390a8f5 100644 --- a/i9300.mk +++ b/i9300.mk @@ -14,9 +14,213 @@ # limitations under the License. # -# include galaxys3 common parts -$(call inherit-product, device/samsung/i9300/galaxys3_base.mk) +DEVICE_PACKAGE_OVERLAYS += device/samsung/i9300/overlay PRODUCT_BUILD_PROP_OVERRIDES += BUILD_UTC_DATE=0 +$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk) + +# The gps config appropriate for this device +$(call inherit-product, device/common/gps/gps_us_supl.mk) + +# This device is xhdpi. However the platform doesn't +# currently contain all of the bitmaps at xhdpi density so +# we do this little trick to fall back to the hdpi version +# if the xhdpi doesn't exist. +PRODUCT_AAPT_CONFIG := normal hdpi xhdpi +PRODUCT_AAPT_PREF_CONFIG := xhdpi + +# Init files +PRODUCT_COPY_FILES := \ + device/samsung/i9300/init.bt.rc:root/init.bt.rc \ + device/samsung/i9300/init.smdk4x12.rc:root/init.smdk4x12.rc \ + device/samsung/i9300/init.smdk4x12.usb.rc:root/init.smdk4x12.usb.rc \ + device/samsung/i9300/lpm.rc:root/lpm.rc \ + device/samsung/i9300/ueventd.smdk4x12.rc:root/ueventd.smdk4x12.rc \ + device/samsung/i9300/ueventd.smdk4x12.rc:recovery/root/ueventd.smdk4x12.rc + +# Camera FW +PRODUCT_COPY_FILES += \ + device/samsung/i9300/80cfw:system/etc/init.d/80cfw + +# Audio +PRODUCT_COPY_FILES += \ + device/samsung/i9300/configs/tiny_hw.xml:system/etc/sound/GT-I9300 \ + device/samsung/i9300/configs/audio_policy.conf:system/etc/audio_policy.conf + +# Vold and Storage +PRODUCT_COPY_FILES += \ + device/samsung/i9300/configs/vold.fstab:system/etc/vold.fstab + +# Bluetooth configuration files +PRODUCT_COPY_FILES += \ + system/bluetooth/data/main.le.conf:system/etc/bluetooth/main.conf + +# Wifi +PRODUCT_COPY_FILES += \ + device/samsung/i9300/configs/wpa_supplicant.conf:system/etc/wifi/wpa_supplicant.conf + +PRODUCT_PROPERTY_OVERRIDES += \ + wifi.interface=wlan0 \ + wifi.supplicant_scan_interval=15 + +# Gps +PRODUCT_COPY_FILES += \ + device/samsung/i9300/configs/gps.conf:system/etc/gps.conf \ + device/samsung/i9300/configs/gps.xml:system/etc/gps.xml + +# Packages +PRODUCT_PACKAGES := \ + audio.a2dp.default \ + audio.primary.smdk4x12 \ + audio.usb.default \ + camera.exynos4 \ + Camera \ + libsecril-client \ + macloader \ + TVOutDummy \ + com.android.future.usb.accessory \ + GalaxyS3Settings \ + SamsungServiceMode \ + tinymix +# Torch + +# HAL +PRODUCT_PACKAGES += \ + nfc.exynos4 \ + lights.exynos4 + +# libgralloc_ump \ +# libhwconverter \ +# libfimg \ +# hwcomposer.exynos4 +# libhwjpeg \ +# libhdmi \ +# libfimc \ +# libcec \ +# libddc \ +# libedid \ +# libhdmiclient \ +# libTVOut +# libtinyalsa \ + +# NFC +PRODUCT_PACKAGES += \ + libnfc \ + libnfc_jni \ + Nfc \ + Tag + +PRODUCT_COPY_FILES += \ + packages/apps/Nfc/migrate_nfc.txt:system/etc/updatecmds/migrate_nfc.txt \ + frameworks/base/nfc-extras/com.android.nfc_extras.xml:system/etc/permissions/com.android.nfc_extras.xml \ + frameworks/native/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml + +# NFCEE access control +ifeq ($(TARGET_BUILD_VARIANT),user) + NFCEE_ACCESS_PATH := device/samsung/i9300/nfcee_access.xml +else + NFCEE_ACCESS_PATH := device/samsung/i9300/nfcee_access_debug.xml +endif + +PRODUCT_COPY_FILES += \ + $(NFCEE_ACCESS_PATH):system/etc/nfcee_access.xml + +PRODUCT_PACKAGES += \ + com.android.nfc_extras + +# MFC API +PRODUCT_PACKAGES += \ + libsecmfcdecapi \ + libsecmfcencapi + +# OMX +PRODUCT_PACKAGES += \ + libstagefrighthw \ + libSEC_OMX_Resourcemanager \ + libSEC_OMX_Core \ + libOMX.SEC.AVC.Decoder \ + libOMX.SEC.M4V.Decoder \ + libOMX.SEC.WMV.Decoder \ + libOMX.SEC.AVC.Encoder \ + libOMX.SEC.M4V.Encoder +# libOMX.SEC.VP8.Decoder + +PRODUCT_COPY_FILES += \ + device/samsung/i9300/configs/media_profiles.xml:system/etc/media_profiles.xml \ + device/samsung/i9300/configs/media_codecs.xml:system/etc/media_codecs.xml + +# RIL +PRODUCT_PROPERTY_OVERRIDES += \ + ro.telephony.ril_class=Smdk4210RIL \ + mobiledata.interfaces=pdp0,wlan0,gprs,ppp0 \ + ro.ril.hsxpa=1 \ + ro.ril.gprsclass=10 + +# Filesystem management tools +PRODUCT_PACKAGES += \ + static_busybox \ + make_ext4fs \ + setup_fs + +# Live Wallpapers +PRODUCT_PACKAGES += \ + Galaxy4 \ + HoloSpiralWallpaper \ + LiveWallpapers \ + LiveWallpapersPicker \ + MagicSmokeWallpapers \ + NoiseField \ + PhaseBeam \ + VisualizationWallpapers \ + librs_jni + +# These are the hardware-specific features +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.audio.low_latency.xml:system/etc/permissions/android.hardware.audio.low_latency.xml \ + frameworks/native/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml \ + frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:system/etc/permissions/android.hardware.camera.flash-autofocus.xml \ + frameworks/native/data/etc/android.hardware.camera.front.xml:system/etc/permissions/android.hardware.camera.front.xml \ + frameworks/native/data/etc/android.hardware.camera.xml:system/etc/permissions/android.hardware.camera.xml \ + frameworks/native/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \ + frameworks/native/data/etc/android.hardware.location.xml:system/etc/permissions/android.hardware.location.xml \ + frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:system/etc/permissions/android.hardware.sensor.accelerometer.xml \ + frameworks/native/data/etc/android.hardware.sensor.compass.xml:system/etc/permissions/android.hardware.sensor.compass.xml \ + frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:system/etc/permissions/android.hardware.sensor.gyroscope.xml \ + frameworks/native/data/etc/android.hardware.sensor.light.xml:system/etc/permissions/android.hardware.sensor.light.xml \ + frameworks/native/data/etc/android.hardware.sensor.proximity.xml:system/etc/permissions/android.hardware.sensor.proximity.xml \ + frameworks/native/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml \ + frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \ + frameworks/native/data/etc/android.hardware.touchscreen.multitouch.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.xml \ + frameworks/native/data/etc/android.hardware.touchscreen.xml:system/etc/permissions/android.hardware.touchscreen.xml \ + frameworks/native/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml \ + frameworks/native/data/etc/android.hardware.usb.host.xml:system/etc/permissions/android.hardware.usb.host.xml \ + frameworks/native/data/etc/android.hardware.wifi.direct.xml:system/etc/permissions/android.hardware.wifi.direct.xml \ + frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \ + frameworks/native/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml \ + frameworks/native/data/etc/android.software.sip.xml:system/etc/permissions/android.software.sip.xml \ + frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml + +# Feature live wallpaper +PRODUCT_COPY_FILES += \ + packages/wallpapers/LivePicker/android.software.live_wallpaper.xml:system/etc/permissions/android.software.live_wallpaper.xml + +PRODUCT_PROPERTY_OVERRIDES += \ + ro.opengles.version=131072 \ + hwui.render_dirty_regions=false + +PRODUCT_TAGS += dalvik.gc.type-precise + +# Set default USB interface +PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ + persist.sys.usb.config=mtp + +$(call inherit-product, frameworks/native/build/phone-xhdpi-1024-dalvik-heap.mk) + +# Include exynos4 platform specific parts +TARGET_HAL_PATH := hardware/samsung/exynos4/hal +TARGET_OMX_PATH := hardware/samsung/exynos/multimedia/openmax +$(call inherit-product, hardware/samsung/exynos4x12.mk) +$(call inherit-product, vendor/cm/config/nfc_enhanced.mk) + $(call inherit-product-if-exists, vendor/samsung/i9300/i9300-vendor.mk) diff --git a/init.smdk4x12.rc b/init.smdk4x12.rc index 0d9051db..876a9a4f 100755 --- a/init.smdk4x12.rc +++ b/init.smdk4x12.rc @@ -2,15 +2,18 @@ import init.smdk4x12.usb.rc import init.bt.rc on early-init - export EXTERNAL_STORAGE /mnt/sdcard + export EXTERNAL_STORAGE /storage/sdcard0 export SECONDARY_STORAGE /mnt/extSdCard - mkdir /mnt/sdcard 0000 system system + mkdir /storage 0050 system sdcard_r + mkdir /storage/sdcard0 0000 system system + mkdir /mnt/extSdCard 0775 system system mkdir /mnt/usbdisk 0775 system system # for backwards compatibility - symlink /mnt/sdcard /sdcard + symlink /storage/sdcard0 /sdcard + symlink /storage/sdcard0 /mnt/sdcard symlink /mnt/extSdCard /extSdCard symlink /efs /factory @@ -71,8 +74,14 @@ on post-fs-data chmod 0644 /efs/redata.bin chmod 0644 /efs/h2k.dat +# Camera firmware + mkdir /data/cfw 0775 system system + chown system media /data/cfw/SlimISP_GD.bin + chmod 0775 /data/cfw/SlimISP_GD.bin + chown system media /data/cfw/SlimISP_ZD.bin + chmod 0775 /data/cfw/SlimISP_ZD.bin + # Camera - write /data/ISP_CV 1 chown system radio /sys/class/camera/rear/rear_camfw chown system radio /sys/class/camera/rear/rear_camtype chown system radio /sys/class/camera/rear/rear_flash @@ -80,15 +89,7 @@ on post-fs-data chown system radio /sys/class/camera/front/front_camfw chown system radio /sys/class/camera/front/front_camtype chown system radio /sys/class/flash/flash/flash_power - -# Camera Firmware - mkdir /data/cfw 0775 system system - chown system system /data/cfw - chmod 0775 /data/cfw - chown system system /data/cfw/SlimISP_GD.bin - chmod 0666 /data/cfw/SlimISP_GD.bin - chown system system /data/cfw/SlimISP_ZD.bin - chmod 0666 /data/cfw/SlimISP_ZD.bin + write /data/ISP_CV 1 # Permissions for bluetooth setprop ro.bt.bdaddr_path "/efs/bluetooth/bt_addr" @@ -231,19 +232,19 @@ on post-fs-data chown system radio /sys/class/sec/tsp/cmd # Permissions for Touchkey - chown system radio /sys/class/sec/sec_touchkey/enable_disable - chown system radio /sys/class/sec/sec_touchkey/touchkey_brightness - chown system radio /sys/class/sec/sec_touchkey/touchkey_menu - chown system radio /sys/class/sec/sec_touchkey/touchkey_back - chown system radio /sys/class/sec/sec_touchkey/touch_update - chown system radio /sys/class/sec/sec_touchkey/touch_version - chown system radio /sys/class/sec/sec_touchkey/touchkey_firm_version_panel - chown system radio /sys/class/sec/sec_touchkey/touchkey_firm_version_phone - chown system radio /sys/class/sec/sec_touchkey/touchkey_firm_update_status - chown system radio /sys/class/sec/sec_touchkey/touchkey_firm_update - chown system radio /sys/class/sec/sec_touchkey/touch_sensitivity - chown system radio /sys/class/sec/sec_touchkey/touchkey_threshold - chown system system /sys/devices/virtual/sec/sec_touchkey/brightness + chown system radio /sys/class/sec/sec_touchkey/enable_disable + chown system radio /sys/class/sec/sec_touchkey/touchkey_brightness + chown system radio /sys/class/sec/sec_touchkey/touchkey_menu + chown system radio /sys/class/sec/sec_touchkey/touchkey_back + chown system radio /sys/class/sec/sec_touchkey/touch_update + chown system radio /sys/class/sec/sec_touchkey/touch_version + chown system radio /sys/class/sec/sec_touchkey/touchkey_firm_version_panel + chown system radio /sys/class/sec/sec_touchkey/touchkey_firm_version_phone + chown system radio /sys/class/sec/sec_touchkey/touchkey_firm_update_status + chown system radio /sys/class/sec/sec_touchkey/touchkey_firm_update + chown system radio /sys/class/sec/sec_touchkey/touch_sensitivity + chown system radio /sys/class/sec/sec_touchkey/touchkey_threshold + chown system system /sys/devices/virtual/sec/sec_touchkey/brightness # Permissions for gpio_keys chown radio system /sys/class/sec/sec_key/wakeup_keys @@ -256,26 +257,26 @@ on post-fs-data chown system radio /sys/class/sec/switch/adc # SVC LED - chown system system /sys/class/sec/led/led_r - chown system system /sys/class/sec/led/led_g - chown system system /sys/class/sec/led/led_b - - chown system system /sys/class/leds/led_r/brightness - chown system system /sys/class/leds/led_g/brightness - chown system system /sys/class/leds/led_b/brightness - chown system system /sys/class/leds/led_r/delay_on - chown system system /sys/class/leds/led_g/delay_on - chown system system /sys/class/leds/led_b/delay_on - chown system system /sys/class/leds/led_r/delay_off - chown system system /sys/class/leds/led_g/delay_off - chown system system /sys/class/leds/led_b/delay_off - chown system system /sys/class/leds/led_r/blink - chown system system /sys/class/leds/led_g/blink - chown system system /sys/class/leds/led_b/blink - - chown system system /sys/class/sec/led/led_pattern - chown system system /sys/class/sec/led/led_blink - chown system system /sys/class/sec/led/led_br_lev + chown system system /sys/class/sec/led/led_r + chown system system /sys/class/sec/led/led_g + chown system system /sys/class/sec/led/led_b + + chown system system /sys/class/leds/led_r/brightness + chown system system /sys/class/leds/led_g/brightness + chown system system /sys/class/leds/led_b/brightness + chown system system /sys/class/leds/led_r/delay_on + chown system system /sys/class/leds/led_g/delay_on + chown system system /sys/class/leds/led_b/delay_on + chown system system /sys/class/leds/led_r/delay_off + chown system system /sys/class/leds/led_g/delay_off + chown system system /sys/class/leds/led_b/delay_off + chown system system /sys/class/leds/led_r/blink + chown system system /sys/class/leds/led_g/blink + chown system system /sys/class/leds/led_b/blink + + chown system system /sys/class/sec/led/led_pattern + chown system system /sys/class/sec/led/led_blink + chown system system /sys/class/sec/led/led_br_lev # # Input Events @@ -388,8 +389,8 @@ on boot symlink /dev/block/mmcblk0p4 /dev/block/param # serial keyboard port - chown root system /dev/ttySAC2 - chmod 0660 /dev/ttySAC2 + chown root system /dev/ttySAC2 + chmod 0660 /dev/ttySAC2 # touchscreen chown radio system /sys/class/sec/tsp/cmd @@ -407,18 +408,18 @@ on boot # serial keyboard daemon service sec_keyboard /system/bin/sec_keyboard /dev/ttySAC2 - class late_start - disabled - group system + class late_start + disabled + group system on property:ro.uart_debug=0 - start sec_keyboard + start sec_keyboard # create virtual SD card at /mnt/sdcard, based on the /data/media directory # daemon will drop to user/group system/media_rw after initializing # underlying files in /data/media wil be created with user and group media_rw (1023) service sdcard /system/bin/sdcard /data/media 1023 1023 - class late_start + class main # icd service icd /system/bin/icd @@ -432,8 +433,21 @@ service cpboot-daemon /sbin/cbd -d user root group radio cache inet misc audio sdcard_rw log +service p2p_supplicant /system/bin/wpa_supplicant \ + -Dnl80211 -iwlan0 -puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin \ + -c/data/misc/wifi/wpa_supplicant.conf + # we will start as root and wpa_supplicant will switch to user wifi + # after setting up the capabilities required for WEXT + # user wifi + # group wifi inet keystore + class main + socket wpa_wlan0 dgram 660 wifi wifi + disabled + oneshot + service wpa_supplicant /system/bin/wpa_supplicant \ - -Dnl80211 -iwlan0 -puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin + -Dnl80211 -iwlan0 -puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin \ + -c/data/misc/wifi/wpa_supplicant.conf # we will start as root and wpa_supplicant will switch to user wifi # after setting up the capabilities required for WEXT # user wifi @@ -454,9 +468,9 @@ service dhcpcd_p2p /system/bin/dhcpcd -aABKL oneshot service dhcpcd_bnep0 /system/bin/dhcpcd -ABKL - class main - disabled - oneshot + class main + disabled + oneshot service iprenew_wlan0 /system/bin/dhcpcd -n class main @@ -469,9 +483,9 @@ service iprenew_p2p /system/bin/dhcpcd -n oneshot service iprenew_bnep0 /system/bin/dhcpcd -n - class main - disabled - oneshot + class main + disabled + oneshot service macloader /system/bin/macloader class main @@ -490,8 +504,12 @@ service dmb /system/bin/dmbserver group radio inet misc audio camera graphics net_bt net_bt_admin sdcard_rw # TVout -service TvoutService_C /system/bin/bintvoutservice - class main - user system - group graphics +#service TvoutService_C /system/bin/bintvoutservice +# class main +# user system +# group graphics +service SecTVOutService /system/bin/TVOutDummy + class main + group graphics + oneshot diff --git a/init.smdk4x12.usb.rc b/init.smdk4x12.usb.rc index c45e7c96..e86a7bdc 100755 --- a/init.smdk4x12.usb.rc +++ b/init.smdk4x12.usb.rc @@ -1,97 +1,79 @@ on init - write /sys/class/android_usb/android0/iSerial $ro.serialno + write /sys/class/android_usb/android0/iSerial ${ro.serialno} write /sys/class/android_usb/android0/f_rndis/manufacturer Samsung write /sys/class/android_usb/android0/f_rndis/vendorID 04e8 write /sys/class/android_usb/android0/f_rndis/wceis 1 on boot - write /sys/class/android_usb/android0/iManufacturer $ro.product.manufacturer - write /sys/class/android_usb/android0/iProduct $ro.product.model - write /sys/class/android_usb/android0/iSerial $ro.serialno - write /sys/class/android_usb/f_mass_storage/inquiry_string "Samsung" + write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} + write /sys/class/android_usb/android0/iProduct ${ro.product.model} on property:sys.usb.config=mtp write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6860 - write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/idProduct 685c + write /sys/class/android_usb/android0/functions ${sys.usb.config} write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state $sys.usb.config + setprop sys.usb.state ${sys.usb.config} on property:sys.usb.config=mtp,adb write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 04e8 write /sys/class/android_usb/android0/idProduct 6860 - write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/functions ${sys.usb.config} write /sys/class/android_usb/android0/enable 1 start adbd - setprop sys.usb.state $sys.usb.config + setprop sys.usb.state ${sys.usb.config} on property:sys.usb.config=rndis write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 04e8 write /sys/class/android_usb/android0/idProduct 6863 - write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/functions ${sys.usb.config} write /sys/class/android_usb/android0/bDeviceClass 224 write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state $sys.usb.config + setprop sys.usb.state ${sys.usb.config} on property:sys.usb.config=rndis,adb write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 04e8 write /sys/class/android_usb/android0/idProduct 6864 - write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/functions ${sys.usb.config} write /sys/class/android_usb/android0/bDeviceClass 224 write /sys/class/android_usb/android0/enable 1 start adbd - setprop sys.usb.state $sys.usb.config + setprop sys.usb.state ${sys.usb.config} on property:sys.usb.config=ptp write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 04e8 write /sys/class/android_usb/android0/idProduct 6865 - write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/functions ${sys.usb.config} write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state $sys.usb.config + setprop sys.usb.state ${sys.usb.config} on property:sys.usb.config=ptp,adb write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 04e8 write /sys/class/android_usb/android0/idProduct 6866 - write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/functions ${sys.usb.config} write /sys/class/android_usb/android0/enable 1 start adbd - setprop sys.usb.state $sys.usb.config + setprop sys.usb.state ${sys.usb.config} on property:sys.usb.config=rndis,dm write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6862 - write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/idProduct 6864 + write /sys/class/android_usb/android0/functions ${sys.usb.config} write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state $sys.usb.config + setprop sys.usb.state ${sys.usb.config} on property:sys.usb.config=rndis,acm,dm write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6862 - write /sys/class/android_usb/android0/functions $sys.usb.config - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state $sys.usb.config - -on property:sys.usb.config=mass_storage - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 685B - write /sys/class/android_usb/android0/functions $sys.usb.config - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state $sys.usb.config - -on property:sys.usb.config=mass_storage,adb - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 685e - write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/idProduct 6864 + write /sys/class/android_usb/android0/functions ${sys.usb.config} + write /sys/class/android_usb/android0/f_acm/instances 1 write /sys/class/android_usb/android0/enable 1 - start adbd - setprop sys.usb.state $sys.usb.config + setprop sys.usb.state ${sys.usb.config} diff --git a/libsecril-client/Android.mk b/libsecril-client/Android.mk new file mode 100755 index 00000000..c9ec41f8 --- /dev/null +++ b/libsecril-client/Android.mk @@ -0,0 +1,22 @@ +# Copyright 2006 The Android Open Source Project + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) +LOCAL_MODULE_TAGS := eng + +LOCAL_SRC_FILES:= \ + secril-client.cpp + +LOCAL_SHARED_LIBRARIES := \ + libutils \ + libbinder \ + libcutils \ + libhardware_legacy + +LOCAL_CFLAGS := + +LOCAL_MODULE:= libsecril-client +LOCAL_PRELINK_MODULE := false +LOCAL_LDLIBS += -lpthread + +include $(BUILD_SHARED_LIBRARY) diff --git a/libsecril-client/secril-client.cpp b/libsecril-client/secril-client.cpp new file mode 100755 index 00000000..2dcd16bd --- /dev/null +++ b/libsecril-client/secril-client.cpp @@ -0,0 +1,1570 @@ +/** + * @file secril-client.cpp + * + * @author Myeongcheol Kim (mcmount.kim@samsung.com) + * + * @brief RIL client library for multi-client support + */ + +#define LOG_TAG "RILClient" +#define LOG_NDEBUG 0 + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "secril-client.h" +#include // For wakelock + + +#define RIL_CLIENT_WAKE_LOCK "client-interface" + +namespace android { + +//--------------------------------------------------------------------------- +// Defines +//--------------------------------------------------------------------------- +#define DBG 1 +#define RILD_PORT 7777 +#define MULTI_CLIENT_SOCKET_NAME "Multiclient" +#define MULTI_CLIENT_Q_SOCKET_NAME "QMulticlient" +#if defined(SEC_PRODUCT_FEATURE_RIL_CALL_DUALMODE_CDMAGSM) +#define MULTI_CLIENT_SOCKET_NAME_2 "Multiclient2" +#endif + +#define MAX_COMMAND_BYTES (8 * 1024) +#define REQ_POOL_SIZE 32 +#define TOKEN_POOL_SIZE 32 + +// Constants for response types +#define RESPONSE_SOLICITED 0 +#define RESPONSE_UNSOLICITED 1 + +#define max(a, b) ((a) > (b) ? (a) : (b)) + +#define REQ_OEM_HOOK_RAW RIL_REQUEST_OEM_HOOK_RAW +#define REQ_SET_CALL_VOLUME 101 +#define REQ_SET_AUDIO_PATH 102 +#define REQ_SET_CALL_CLOCK_SYNC 103 +#define REQ_SET_CALL_RECORDING 104 +#define REQ_SET_CALL_MUTE 105 +#define REQ_GET_CALL_MUTE 106 +#define REQ_SET_CALL_VT_CTRL 107 +#define REQ_SET_TWO_MIC_CTRL 108 +#define REQ_SET_DHA_CTRL 109 +#define REQ_SET_LOOPBACK 110 + +// OEM request function ID +#define OEM_FUNC_SOUND 0x08 + +// OEM request sub function ID +#define OEM_SND_SET_VOLUME_CTRL 0x03 +#define OEM_SND_SET_AUDIO_PATH 0x05 +#define OEM_SND_GET_AUDIO_PATH 0x06 +#define OEM_SND_SET_VIDEO_CALL_CTRL 0x07 +#define OEM_SND_SET_LOOPBACK_CTRL 0x08 +#define OEM_SND_SET_VOICE_RECORDING_CTRL 0x09 +#define OEM_SND_SET_CLOCK_CTRL 0x0A +#define OEM_SND_SET_MUTE 0x0B +#define OEM_SND_GET_MUTE 0x0C +#define OEM_SND_SET_TWO_MIC_CTL 0x0D +#define OEM_SND_SET_DHA_CTL 0x0E + +#define OEM_SND_TYPE_VOICE 0x01 // Receiver(0x00) + Voice(0x01) +#define OEM_SND_TYPE_SPEAKER 0x11 // SpeakerPhone(0x10) + Voice(0x01) +#define OEM_SND_TYPE_HEADSET 0x31 // Headset(0x30) + Voice(0x01) +#define OEM_SND_TYPE_BTVOICE 0x41 // BT(0x40) + Voice(0x01) + +#define OEM_SND_AUDIO_PATH_HANDSET 0x01 +#define OEM_SND_AUDIO_PATH_HEADSET 0x02 +#define OEM_SND_AUDIO_PATH_HFK 0x03 +#define OEM_SND_AUDIO_PATH_BLUETOOTH 0x04 +#define OEM_SND_AUDIO_PATH_STEREO_BLUETOOTH 0x05 +#define OEM_SND_AUDIO_PATH_SPEAKER 0x06 +#define OEM_SND_AUDIO_PATH_HEADPHONE 0x07 +#define OEM_SND_AUDIO_PATH_BT_NSEC_OFF 0x08 +#define OEM_SND_AUDIO_PATH_MIC1 0x09 +#define OEM_SND_AUDIO_PATH_MIC2 0x0A +#define OEM_SND_AUDIO_PATH_BT_WB 0x0B +#define OEM_SND_AUDIO_PATH_BT_WB_NSEC_OFF 0x0C + +//--------------------------------------------------------------------------- +// Type definitions +//--------------------------------------------------------------------------- +typedef struct _ReqHistory { + int token; // token used for request + uint32_t id; // request ID +} ReqHistory; + +typedef struct _ReqRespHandler { + uint32_t id; // request ID + RilOnComplete handler; // handler function +} ReqRespHandler; + +typedef struct _UnsolHandler { + uint32_t id; // unsolicited response ID + RilOnUnsolicited handler; // handler function +} UnsolHandler; + +typedef struct _RilClientPrv { + HRilClient parent; + uint8_t b_connect; // connected to server? + int sock; // socket + int pipefd[2]; + fd_set sock_rfds; // for read with select() + RecordStream *p_rs; + uint32_t token_pool; // each bit in token_pool used for token. + // so, pool size is 32. + pthread_t tid_reader; // socket reader thread id + ReqHistory history[TOKEN_POOL_SIZE]; // request history + ReqRespHandler req_handlers[REQ_POOL_SIZE]; // request response handler list + UnsolHandler unsol_handlers[REQ_POOL_SIZE]; // unsolicited response handler list + RilOnError err_cb; // error callback + void *err_cb_data; // error callback data + uint8_t b_del_handler; +} RilClientPrv; + + +//--------------------------------------------------------------------------- +// Local static function prototypes +//--------------------------------------------------------------------------- +static void * RxReaderFunc(void *param); +static int processRxBuffer(RilClientPrv *prv, void *buffer, size_t buflen); +static uint32_t AllocateToken(uint32_t *token_pool); +static void FreeToken(uint32_t *token_pool, uint32_t token); +static uint8_t IsValidToken(uint32_t *token_pool, uint32_t token); +static void DeallocateToken(uint32_t *token_pool, uint32_t token); +static int blockingWrite(int fd, const void *buffer, size_t len); +static int RecordReqHistory(RilClientPrv *prv, int token, uint32_t id); +static void ClearReqHistory(RilClientPrv *prv, int token); +static RilOnComplete FindReqHandler(RilClientPrv *prv, int token, uint32_t *id); +static RilOnUnsolicited FindUnsolHandler(RilClientPrv *prv, uint32_t id); +static int SendOemRequestHookRaw(HRilClient client, int req_id, char *data, size_t len); +static bool isValidSoundType(SoundType type); +static bool isValidAudioPath(AudioPath path); +static bool isValidSoundClockCondition(SoundClockCondition condition); +static bool isValidCallRecCondition(CallRecCondition condition); +static bool isValidMuteCondition(MuteCondition condition); +static bool isValidTwoMicCtrl(TwoMicSolDevice device, TwoMicSolReport report); +static char ConvertSoundType(SoundType type); +static char ConvertAudioPath(AudioPath path); + + +/** + * @fn int RegisterUnsolicitedHandler(HRilClient client, uint32_t id, RilOnUnsolicited handler) + * + * @params client: Client handle. + * id: Unsolicited response ID to which handler is registered. + * handler: Unsolicited handler. NULL for deregistration. + * + * @return 0 on success or error code. + */ +extern "C" +int RegisterUnsolicitedHandler(HRilClient client, uint32_t id, RilOnUnsolicited handler) { + RilClientPrv *client_prv; + int match_slot = -1; + int first_empty_slot = -1; + int i; + + if (client == NULL || client->prv == NULL) + return RIL_CLIENT_ERR_INVAL; + + client_prv = (RilClientPrv *)(client->prv); + + for (i = 0; i < REQ_POOL_SIZE; i++) { + // Check if there is matched handler. + if (id == client_prv->unsol_handlers[i].id) { + match_slot = i; + } + // Find first empty handler slot. + if (first_empty_slot == -1 && client_prv->unsol_handlers[i].id == 0) { + first_empty_slot = i; + } + } + + if (handler == NULL) { // Unregister. + if (match_slot >= 0) { + memset(&(client_prv->unsol_handlers[match_slot]), 0, sizeof(UnsolHandler)); + return RIL_CLIENT_ERR_SUCCESS; + } + else { + return RIL_CLIENT_ERR_SUCCESS; + } + } + else {// Register. + if (match_slot >= 0) { + client_prv->unsol_handlers[match_slot].handler = handler; // Just update. + } + else if (first_empty_slot >= 0) { + client_prv->unsol_handlers[first_empty_slot].id = id; + client_prv->unsol_handlers[first_empty_slot].handler = handler; + } + else { + return RIL_CLIENT_ERR_RESOURCE; + } + } + + return RIL_CLIENT_ERR_SUCCESS; +} + + +/** + * @fn int RegisterRequestCompleteHandler(HRilClient client, uint32_t id, RilOnComplete handler) + * + * @params client: Client handle. + * id: Request ID to which handler is registered. + * handler: Request complete handler. NULL for deregistration. + * + * @return 0 on success or error code. + */ +extern "C" +int RegisterRequestCompleteHandler(HRilClient client, uint32_t id, RilOnComplete handler) { + RilClientPrv *client_prv; + int match_slot = -1; + int first_empty_slot = -1; + int i; + + if (client == NULL || client->prv == NULL) + return RIL_CLIENT_ERR_INVAL; + + client_prv = (RilClientPrv *)(client->prv); + + for (i = 0; i < REQ_POOL_SIZE; i++) { + // Check if there is matched handler. + if (id == client_prv->req_handlers[i].id) { + match_slot = i; + } + // Find first empty handler slot. + if (first_empty_slot == -1 && client_prv->req_handlers[i].id == 0) { + first_empty_slot = i; + } + } + + if (handler == NULL) { // Unregister. + if (match_slot >= 0) { + memset(&(client_prv->req_handlers[match_slot]), 0, sizeof(ReqRespHandler)); + return RIL_CLIENT_ERR_SUCCESS; + } + else { + return RIL_CLIENT_ERR_SUCCESS; + } + } + else { // Register. + if (match_slot >= 0) { + client_prv->req_handlers[match_slot].handler = handler; // Just update. + } + else if (first_empty_slot >= 0) { + client_prv->req_handlers[first_empty_slot].id = id; + client_prv->req_handlers[first_empty_slot].handler = handler; + } + else { + return RIL_CLIENT_ERR_RESOURCE; + } + } + + return RIL_CLIENT_ERR_SUCCESS; +} + + +/** + * @fn int RegisterErrorCallback(HRilClient client, RilOnError cb, void *data) + * + * @params client: Client handle. + * cb: Error callback. NULL for unregistration. + * data: Callback data. + * + * @return 0 for success or error code. + */ +extern "C" +int RegisterErrorCallback(HRilClient client, RilOnError cb, void *data) { + RilClientPrv *client_prv; + + if (client == NULL || client->prv == NULL) + return RIL_CLIENT_ERR_INVAL; + + client_prv = (RilClientPrv *)(client->prv); + + client_prv->err_cb = cb; + client_prv->err_cb_data = data; + + return RIL_CLIENT_ERR_SUCCESS; +} + + +/** + * @fn HRilClient OpenClient_RILD(void) + * + * @params None. + * + * @return Client handle, NULL on error. + */ +extern "C" +HRilClient OpenClient_RILD(void) { + HRilClient client = (HRilClient)malloc(sizeof(struct RilClient)); + if (client == NULL) + return NULL; + + client->prv = (RilClientPrv *)malloc(sizeof(RilClientPrv)); + if (client->prv == NULL) { + free(client); + return NULL; + } + + memset(client->prv, 0, sizeof(RilClientPrv)); + + ((RilClientPrv *)(client->prv))->parent = client; + ((RilClientPrv *)(client->prv))->sock = -1; + + return client; +} + + +/** + * @fn int Connect_RILD(void) + * + * @params client: Client handle. + * + * @return 0, or error code. + */ +extern "C" +int Connect_RILD(HRilClient client) { + RilClientPrv *client_prv; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + // Open client socket and connect to server. + //client_prv->sock = socket_loopback_client(RILD_PORT, SOCK_STREAM); + client_prv->sock = socket_local_client(MULTI_CLIENT_SOCKET_NAME, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM ); + + if (client_prv->sock < 0) { + ALOGE("%s: Connecting failed. %s(%d)", __FUNCTION__, strerror(errno), errno); + return RIL_CLIENT_ERR_CONNECT; + } + + client_prv->b_connect = 1; + + if (fcntl(client_prv->sock, F_SETFL, O_NONBLOCK) < 0) { + close(client_prv->sock); + return RIL_CLIENT_ERR_IO; + } + + client_prv->p_rs = record_stream_new(client_prv->sock, MAX_COMMAND_BYTES); + + if (pipe(client_prv->pipefd) < 0) { + close(client_prv->sock); + ALOGE("%s: Creating command pipe failed. %s(%d)", __FUNCTION__, strerror(errno), errno); + return RIL_CLIENT_ERR_IO; + } + + if (fcntl(client_prv->pipefd[0], F_SETFL, O_NONBLOCK) < 0) { + close(client_prv->sock); + close(client_prv->pipefd[0]); + close(client_prv->pipefd[1]); + return RIL_CLIENT_ERR_IO; + } + + // Start socket read thread. + if (pthread_create(&(client_prv->tid_reader), NULL, RxReaderFunc, (void *)client_prv) != 0) { + close(client_prv->sock); + close(client_prv->pipefd[0]); + close(client_prv->pipefd[1]); + + memset(client_prv, 0, sizeof(RilClientPrv)); + client_prv->sock = -1; + ALOGE("%s: Can't create Reader thread. %s(%d)", __FUNCTION__, strerror(errno), errno); + return RIL_CLIENT_ERR_CONNECT; + } + + return RIL_CLIENT_ERR_SUCCESS; +} + +/** + * @fn int Connect_QRILD(void) + * + * @params client: Client handle. + * + * @return 0, or error code. + */ +extern "C" +int Connect_QRILD(HRilClient client) { + RilClientPrv *client_prv; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + // Open client socket and connect to server. + //client_prv->sock = socket_loopback_client(RILD_PORT, SOCK_STREAM); + client_prv->sock = socket_local_client(MULTI_CLIENT_Q_SOCKET_NAME, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM ); + + if (client_prv->sock < 0) { + ALOGE("%s: Connecting failed. %s(%d)", __FUNCTION__, strerror(errno), errno); + return RIL_CLIENT_ERR_CONNECT; + } + + client_prv->b_connect = 1; + + if (fcntl(client_prv->sock, F_SETFL, O_NONBLOCK) < 0) { + close(client_prv->sock); + return RIL_CLIENT_ERR_IO; + } + + client_prv->p_rs = record_stream_new(client_prv->sock, MAX_COMMAND_BYTES); + + if (pipe(client_prv->pipefd) < 0) { + close(client_prv->sock); + ALOGE("%s: Creating command pipe failed. %s(%d)", __FUNCTION__, strerror(errno), errno); + return RIL_CLIENT_ERR_IO; + } + + if (fcntl(client_prv->pipefd[0], F_SETFL, O_NONBLOCK) < 0) { + close(client_prv->sock); + close(client_prv->pipefd[0]); + close(client_prv->pipefd[1]); + return RIL_CLIENT_ERR_IO; + } + + // Start socket read thread. + if (pthread_create(&(client_prv->tid_reader), NULL, RxReaderFunc, (void *)client_prv) != 0) { + close(client_prv->sock); + close(client_prv->pipefd[0]); + close(client_prv->pipefd[1]); + + memset(client_prv, 0, sizeof(RilClientPrv)); + client_prv->sock = -1; + ALOGE("%s: Can't create Reader thread. %s(%d)", __FUNCTION__, strerror(errno), errno); + return RIL_CLIENT_ERR_CONNECT; + } + + return RIL_CLIENT_ERR_SUCCESS; +} + +#if defined(SEC_PRODUCT_FEATURE_RIL_CALL_DUALMODE_CDMAGSM) // mook_120209 Enable multiclient +/** + * @fn int Connect_RILD_Second(void) + * + * @params client: Client handle. + * + * @return 0, or error code. + */ +extern "C" +int Connect_RILD_Second(HRilClient client) { + RilClientPrv *client_prv; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + // Open client socket and connect to server. + //client_prv->sock = socket_loopback_client(RILD_PORT, SOCK_STREAM); + client_prv->sock = socket_local_client(MULTI_CLIENT_SOCKET_NAME_2, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM ); + + if (client_prv->sock < 0) { + ALOGE("%s: Connecting failed. %s(%d)", __FUNCTION__, strerror(errno), errno); + return RIL_CLIENT_ERR_CONNECT; + } + + client_prv->b_connect = 1; + + if (fcntl(client_prv->sock, F_SETFL, O_NONBLOCK) < 0) { + close(client_prv->sock); + return RIL_CLIENT_ERR_IO; + } + + client_prv->p_rs = record_stream_new(client_prv->sock, MAX_COMMAND_BYTES); + + if (pipe(client_prv->pipefd) < 0) { + close(client_prv->sock); + ALOGE("%s: Creating command pipe failed. %s(%d)", __FUNCTION__, strerror(errno), errno); + return RIL_CLIENT_ERR_IO; + } + + if (fcntl(client_prv->pipefd[0], F_SETFL, O_NONBLOCK) < 0) { + close(client_prv->sock); + close(client_prv->pipefd[0]); + close(client_prv->pipefd[1]); + return RIL_CLIENT_ERR_IO; + } + + // Start socket read thread. + if (pthread_create(&(client_prv->tid_reader), NULL, RxReaderFunc, (void *)client_prv) != 0) { + close(client_prv->sock); + close(client_prv->pipefd[0]); + close(client_prv->pipefd[1]); + + memset(client_prv, 0, sizeof(RilClientPrv)); + client_prv->sock = -1; + ALOGE("%s: Can't create Reader thread. %s(%d)", __FUNCTION__, strerror(errno), errno); + return RIL_CLIENT_ERR_CONNECT; + } + + return RIL_CLIENT_ERR_SUCCESS; +} +#endif + +/** + * @fn int isConnected_RILD(HRilClient client) + * + * @params client: Client handle. + * + * @return 0, or 1. + */ +extern "C" +int isConnected_RILD(HRilClient client) { + RilClientPrv *client_prv; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + return client_prv->b_connect == 1; +} + +/** + * @fn int Disconnect_RILD(HRilClient client) + * + * @params client: Client handle. + * + * @return 0 on success, or error code. + */ +extern "C" +int Disconnect_RILD(HRilClient client) { + RilClientPrv *client_prv; + int ret = 0; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + if (client_prv->sock == -1) + return RIL_CLIENT_ERR_SUCCESS; + + printf("[*] %s(): sock=%d\n", __FUNCTION__, client_prv->sock); + + if (client_prv->sock > 0) { + do { + ret = write(client_prv->pipefd[1], "close", strlen("close")); + } while (ret < 0 && errno == EINTR); + } + + client_prv->b_connect = 0; + + pthread_join(client_prv->tid_reader, NULL); + + return RIL_CLIENT_ERR_SUCCESS; +} + + +/** + * @fn int CloseClient_RILD(HRilClient client) + * + * @params client: Client handle. + * + * @return 0 on success, or error code. + */ +extern "C" +int CloseClient_RILD(HRilClient client) { + if (client == NULL || client->prv == NULL) { + ALOGE("%s: invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + Disconnect_RILD(client); + + free(client->prv); + free(client); + + return RIL_CLIENT_ERR_SUCCESS; +} + + +/** + * Set in-call volume. + */ +extern "C" +int SetCallVolume(HRilClient client, SoundType type, int vol_level) { + RilClientPrv *client_prv; + int ret; + char data[6] = {0,}; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + if (client_prv->sock < 0 ) { + ALOGE("%s: Not connected.", __FUNCTION__); + return RIL_CLIENT_ERR_CONNECT; + } + + if (isValidSoundType(type) == false) { + ALOGE("%s: Invalid sound type", __FUNCTION__); + return RIL_CLIENT_ERR_INVAL; + } + + // Make raw data + data[0] = OEM_FUNC_SOUND; + data[1] = OEM_SND_SET_VOLUME_CTRL; + data[2] = 0x00; // data length + data[3] = 0x06; // data length + data[4] = ConvertSoundType(type); // volume type + data[5] = vol_level; // volume level + + RegisterRequestCompleteHandler(client, REQ_SET_CALL_VOLUME, NULL); + + ret = SendOemRequestHookRaw(client, REQ_SET_CALL_VOLUME, data, sizeof(data)); + if (ret != RIL_CLIENT_ERR_SUCCESS) { + RegisterRequestCompleteHandler(client, REQ_SET_CALL_VOLUME, NULL); + } + + return ret; +} + + +/** + * Set external sound device path for noise reduction. + */ +extern "C" +int SetCallAudioPath(HRilClient client, AudioPath path, ExtraVolume mode) { + RilClientPrv *client_prv; + int ret; + char data[6] = {0,}; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + if (client_prv->sock < 0 ) { + ALOGE("%s: Not connected.", __FUNCTION__); + return RIL_CLIENT_ERR_CONNECT; + } + + if (isValidAudioPath(path) == false) { + ALOGE("%s: Invalid audio path", __FUNCTION__); + return RIL_CLIENT_ERR_INVAL; + } + + // Make raw data + data[0] = OEM_FUNC_SOUND; + data[1] = OEM_SND_SET_AUDIO_PATH; + data[2] = 0x00; // data length + data[3] = 0x06; // data length + data[4] = ConvertAudioPath(path); // audio path + data[5] = mode; // ExtraVolume + + RegisterRequestCompleteHandler(client, REQ_SET_AUDIO_PATH, NULL); + + ret = SendOemRequestHookRaw(client, REQ_SET_AUDIO_PATH, data, sizeof(data)); + if (ret != RIL_CLIENT_ERR_SUCCESS) { + RegisterRequestCompleteHandler(client, REQ_SET_AUDIO_PATH, NULL); + } + + return ret; +} + + +/** + * Set modem clock to master or slave. + */ +extern "C" +int SetCallClockSync(HRilClient client, SoundClockCondition condition) { + RilClientPrv *client_prv; + int ret; + char data[5] = {0,}; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + if (client_prv->sock < 0 ) { + ALOGE("%s: Not connected.", __FUNCTION__); + return RIL_CLIENT_ERR_CONNECT; + } + + if (isValidSoundClockCondition(condition) == false) { + ALOGE("%s: Invalid sound clock condition", __FUNCTION__); + return RIL_CLIENT_ERR_INVAL; + } + + // Make raw data + data[0] = OEM_FUNC_SOUND; + data[1] = OEM_SND_SET_CLOCK_CTRL; + data[2] = 0x00; // data length + data[3] = 0x05; // data length + data[4] = condition; + + RegisterRequestCompleteHandler(client, REQ_SET_CALL_CLOCK_SYNC, NULL); + + ret = SendOemRequestHookRaw(client, REQ_SET_CALL_CLOCK_SYNC, data, sizeof(data)); + if (ret != RIL_CLIENT_ERR_SUCCESS) { + RegisterRequestCompleteHandler(client, REQ_SET_CALL_CLOCK_SYNC, NULL); + } + + return ret; +} + +/** + * Set modem VTCall clock to master or slave. + */ +extern "C" +int SetVideoCallClockSync(HRilClient client, SoundClockCondition condition) { + RilClientPrv *client_prv; + int ret; + char data[5] = {0,}; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + if (client_prv->sock < 0 ) { + ALOGE("%s: Not connected.", __FUNCTION__); + return RIL_CLIENT_ERR_CONNECT; + } + + if (isValidSoundClockCondition(condition) == false) { + ALOGE("%s: Invalid sound clock condition", __FUNCTION__); + return RIL_CLIENT_ERR_INVAL; + } + + // Make raw data + data[0] = OEM_FUNC_SOUND; + data[1] = OEM_SND_SET_VIDEO_CALL_CTRL; + data[2] = 0x00; // data length + data[3] = 0x05; // data length + data[4] = condition; + + RegisterRequestCompleteHandler(client, REQ_SET_CALL_VT_CTRL, NULL); + + ret = SendOemRequestHookRaw(client, REQ_SET_CALL_VT_CTRL, data, sizeof(data)); + if (ret != RIL_CLIENT_ERR_SUCCESS) { + RegisterRequestCompleteHandler(client, REQ_SET_CALL_VT_CTRL, NULL); + } + + return ret; +} + +/** + * Set voice recording. + */ +extern "C" +int SetCallRecord(HRilClient client, CallRecCondition condition) { + RilClientPrv *client_prv; + int ret; + char data[5] = {0,}; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + if (client_prv->sock < 0 ) { + ALOGE("%s: Not connected.", __FUNCTION__); + return RIL_CLIENT_ERR_CONNECT; + } + + if (isValidCallRecCondition(condition) == false) { + ALOGE("%s: Invalid sound clock condition", __FUNCTION__); + return RIL_CLIENT_ERR_INVAL; + } + + // Make raw data + data[0] = OEM_FUNC_SOUND; + data[1] = OEM_SND_SET_VOICE_RECORDING_CTRL; + data[2] = 0x00; // data length + data[3] = 0x05; // data length + data[4] = condition; + + RegisterRequestCompleteHandler(client, REQ_SET_CALL_RECORDING, NULL); + + ret = SendOemRequestHookRaw(client, REQ_SET_CALL_RECORDING, data, sizeof(data)); + if (ret != RIL_CLIENT_ERR_SUCCESS) { + RegisterRequestCompleteHandler(client, REQ_SET_CALL_RECORDING, NULL); + } + + return ret; +} + +/** + * Set mute or unmute. + */ +extern "C" +int SetMute(HRilClient client, MuteCondition condition) { + RilClientPrv *client_prv; + int ret; + char data[5] = {0,}; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + if (client_prv->sock < 0 ) { + ALOGE("%s: Not connected.", __FUNCTION__); + return RIL_CLIENT_ERR_CONNECT; + } + + if (isValidMuteCondition(condition) == false) { + ALOGE("%s: Invalid sound clock condition", __FUNCTION__); + return RIL_CLIENT_ERR_INVAL; + } + + // Make raw data + data[0] = OEM_FUNC_SOUND; + data[1] = OEM_SND_SET_MUTE; + data[2] = 0x00; // data length + data[3] = 0x05; // data length + data[4] = condition; + + RegisterRequestCompleteHandler(client, REQ_SET_CALL_MUTE, NULL); + + ret = SendOemRequestHookRaw(client, REQ_SET_CALL_MUTE, data, sizeof(data)); + if (ret != RIL_CLIENT_ERR_SUCCESS) { + RegisterRequestCompleteHandler(client, REQ_SET_CALL_MUTE, NULL); + } + + return ret; +} + +/** + * Get mute state. + */ +extern "C" +int GetMute(HRilClient client, RilOnComplete handler) { + RilClientPrv *client_prv; + int ret; + char data[4] = {0,}; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + if (client_prv->sock < 0 ) { + ALOGE("%s: Not connected.", __FUNCTION__); + return RIL_CLIENT_ERR_CONNECT; + } + + client_prv->b_del_handler = 1; + + // Make raw data + data[0] = OEM_FUNC_SOUND; + data[1] = OEM_SND_GET_MUTE; + data[2] = 0x00; // data length + data[3] = 0x04; // data length + + RegisterRequestCompleteHandler(client, REQ_GET_CALL_MUTE, handler); + + ret = SendOemRequestHookRaw(client, REQ_GET_CALL_MUTE, data, sizeof(data)); + if (ret != RIL_CLIENT_ERR_SUCCESS) { + RegisterRequestCompleteHandler(client, REQ_GET_CALL_MUTE, NULL); + } + + return ret; +} + +extern "C" +int SetTwoMicControl(HRilClient client, TwoMicSolDevice device, TwoMicSolReport report) { + RilClientPrv *client_prv; + int ret; + char data[6] = {0,}; + + ALOGE(" + %s", __FUNCTION__); + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + if (client_prv->sock < 0 ) { + ALOGE("%s: Not connected.", __FUNCTION__); + return RIL_CLIENT_ERR_CONNECT; + } + + if (isValidTwoMicCtrl(device, report) == false) { + ALOGE("%s: Invalid sound set two params", __FUNCTION__); + return RIL_CLIENT_ERR_INVAL; + } + + // Make raw data + data[0] = OEM_FUNC_SOUND; + data[1] = OEM_SND_SET_TWO_MIC_CTL; + data[2] = 0x00; // data length + data[3] = 0x06; // data length + data[4] = device; + data[5] = report; + + RegisterRequestCompleteHandler(client, REQ_SET_TWO_MIC_CTRL, NULL); + + ret = SendOemRequestHookRaw(client, REQ_SET_TWO_MIC_CTRL, data, sizeof(data)); + if (ret != RIL_CLIENT_ERR_SUCCESS) { + RegisterRequestCompleteHandler(client, REQ_SET_TWO_MIC_CTRL, NULL); + } + + ALOGE(" - %s", __FUNCTION__); + + return ret; +} + +extern "C" +int SetDhaSolution(HRilClient client, DhaSolMode mode, DhaSolSelect select, char *parameter) { + RilClientPrv *client_prv; + int ret; + char data[30] = {0,}; + char tempPara[24]={0,}; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + if (client_prv->sock < 0 ) { + ALOGE("%s: Not connected.", __FUNCTION__); + return RIL_CLIENT_ERR_CONNECT; + } + + ALOGE("%s: DHA mode=%d, select=%d", __FUNCTION__,mode, select); + + // Make raw data + data[0] = OEM_FUNC_SOUND; + data[1] = OEM_SND_SET_DHA_CTL; + data[2] = 0x00; // data length + data[3] = 0x1E; // data length + data[4] = mode; + data[5] = select; + + memcpy(tempPara, parameter, 24); + for(int i=0; i<24; i++) + data[6+i]= tempPara[i]; + + RegisterRequestCompleteHandler(client, REQ_SET_DHA_CTRL, NULL); + + ret = SendOemRequestHookRaw(client, REQ_SET_DHA_CTRL, data, sizeof(data)); + if (ret != RIL_CLIENT_ERR_SUCCESS) { + RegisterRequestCompleteHandler(client, REQ_SET_DHA_CTRL, NULL); + } + + return ret; +} + +/** + * Set LoopbackTest mode, path. + */ +extern "C" +int SetLoopbackTest(HRilClient client, LoopbackMode mode, AudioPath path) { + RilClientPrv *client_prv; + int ret; + char data[6] = {0,}; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + if (client_prv->sock < 0 ) { + ALOGE("%s: Not connected.", __FUNCTION__); + return RIL_CLIENT_ERR_CONNECT; + } + + // Make raw data + data[0] = OEM_FUNC_SOUND; + data[1] = OEM_SND_SET_LOOPBACK_CTRL; + data[2] = 0x00; // data length + data[3] = 0x06; // data length + data[4] = mode; // Loopback Mode + data[5] = ConvertAudioPath(path); // Loopback path + + RegisterRequestCompleteHandler(client, REQ_SET_LOOPBACK, NULL); + + ret = SendOemRequestHookRaw(client, REQ_SET_LOOPBACK, data, sizeof(data)); + if (ret != RIL_CLIENT_ERR_SUCCESS) { + RegisterRequestCompleteHandler(client, REQ_SET_LOOPBACK, NULL); + } + + return ret; +} + + +/** + * @fn int InvokeOemRequestHookRaw(HRilClient client, char *data, size_t len) + * + * @params client: Client handle. + * data: Request data. + * len: Request data length. + * + * @return 0 for success or error code. On receiving RIL_CLIENT_ERR_AGAIN, + * caller should retry. + */ +extern "C" +int InvokeOemRequestHookRaw(HRilClient client, char *data, size_t len) { + RilClientPrv *client_prv; + + if (client == NULL || client->prv == NULL) { + ALOGE("%s: Invalid client %p", __FUNCTION__, client); + return RIL_CLIENT_ERR_INVAL; + } + + client_prv = (RilClientPrv *)(client->prv); + + if (client_prv->sock < 0 ) { + ALOGE("%s: Not connected.", __FUNCTION__); + return RIL_CLIENT_ERR_CONNECT; + } + + return SendOemRequestHookRaw(client, REQ_OEM_HOOK_RAW, data, len); +} + + +static int SendOemRequestHookRaw(HRilClient client, int req_id, char *data, size_t len) { + int token = 0; + int ret = 0; + uint32_t header = 0; + android::Parcel p; + RilClientPrv *client_prv; + int maxfd = -1; + + client_prv = (RilClientPrv *)(client->prv); + + // Allocate a token. + token = AllocateToken(&(client_prv->token_pool)); + if (token == 0) { + ALOGE("%s: No token.", __FUNCTION__); + return RIL_CLIENT_ERR_AGAIN; + } + + // Record token for the request sent. + if (RecordReqHistory(client_prv, token, req_id) != RIL_CLIENT_ERR_SUCCESS) { + goto error; + } + + // Make OEM request data. + p.writeInt32(RIL_REQUEST_OEM_HOOK_RAW); + p.writeInt32(token); + p.writeInt32(len); + p.write((void *)data, len); + + // DO TX: header(size). + header = htonl(p.dataSize()); + + if (DBG) ALOGD("%s(): token = %d\n", __FUNCTION__, token); + + ret = blockingWrite(client_prv->sock, (void *)&header, sizeof(header)); + if (ret < 0) { + ALOGE("%s: send request header failed. (%d)", __FUNCTION__, ret); + goto error; + } + + // Do TX: response data. + ret = blockingWrite(client_prv->sock, p.data(), p.dataSize()); + if (ret < 0) { + ALOGE("%s: send request data failed. (%d)", __FUNCTION__, ret); + goto error; + } + + return RIL_CLIENT_ERR_SUCCESS; + +error: + FreeToken(&(client_prv->token_pool), token); + ClearReqHistory(client_prv, token); + + return RIL_CLIENT_ERR_UNKNOWN; +} + + +static bool isValidSoundType(SoundType type) { + return (type >= SOUND_TYPE_VOICE && type <= SOUND_TYPE_BTVOICE); +} + + +static bool isValidAudioPath(AudioPath path) { + return (path >= SOUND_AUDIO_PATH_HANDSET && path <= OEM_SND_AUDIO_PATH_BT_WB_NSEC_OFF); +} + + +static bool isValidSoundClockCondition(SoundClockCondition condition) { + return (condition >= SOUND_CLOCK_STOP && condition <= SOUND_CLOCK_START); +} + +static bool isValidCallRecCondition(CallRecCondition condition) { + return (condition >= CALL_REC_STOP && condition <= CALL_REC_START); +} + +static bool isValidMuteCondition(MuteCondition condition) { + return (condition >= TX_UNMUTE && condition <= RXTX_MUTE); +} + +static bool isValidTwoMicCtrl(TwoMicSolDevice device, TwoMicSolReport report) { + return (device >= AUDIENCE && device <= FORTEMEDIA && report >= TWO_MIC_SOLUTION_OFF && report <= TWO_MIC_SOLUTION_ON ); +} + + +static char ConvertSoundType(SoundType type) { + switch (type) { + case SOUND_TYPE_VOICE: + return OEM_SND_TYPE_VOICE; + case SOUND_TYPE_SPEAKER: + return OEM_SND_TYPE_SPEAKER; + case SOUND_TYPE_HEADSET: + return OEM_SND_TYPE_HEADSET; + case SOUND_TYPE_BTVOICE: + return OEM_SND_TYPE_BTVOICE; + default: + return OEM_SND_TYPE_VOICE; + } +} + + +static char ConvertAudioPath(AudioPath path) { + switch (path) { + case SOUND_AUDIO_PATH_HANDSET: + return OEM_SND_AUDIO_PATH_HANDSET; + case SOUND_AUDIO_PATH_HEADSET: + return OEM_SND_AUDIO_PATH_HEADSET; + case SOUND_AUDIO_PATH_SPEAKER: + return OEM_SND_AUDIO_PATH_SPEAKER; + case SOUND_AUDIO_PATH_BLUETOOTH: + return OEM_SND_AUDIO_PATH_BLUETOOTH; + case SOUND_AUDIO_PATH_STEREO_BT: + return OEM_SND_AUDIO_PATH_STEREO_BLUETOOTH; + case SOUND_AUDIO_PATH_HEADPHONE: + return OEM_SND_AUDIO_PATH_HEADPHONE; + case SOUND_AUDIO_PATH_BLUETOOTH_NO_NR: + return OEM_SND_AUDIO_PATH_BT_NSEC_OFF; + case SOUND_AUDIO_PATH_MIC1: + return OEM_SND_AUDIO_PATH_MIC1; + case SOUND_AUDIO_PATH_MIC2: + return OEM_SND_AUDIO_PATH_MIC2; + case SOUND_AUDIO_PATH_BLUETOOTH_WB: + return OEM_SND_AUDIO_PATH_BT_WB; + case SOUND_AUDIO_PATH_BLUETOOTH_WB_NO_NR: + return OEM_SND_AUDIO_PATH_BT_WB_NSEC_OFF; + + default: + return OEM_SND_AUDIO_PATH_HANDSET; + } +} + + +static void * RxReaderFunc(void *param) { + RilClientPrv *client_prv = (RilClientPrv *)param; + int maxfd = 0; + int token = 0; + void *p_record = NULL; + size_t recordlen = 0; + int ret = 0; + int n; + + if (client_prv == NULL) + return NULL; + + maxfd = max(client_prv->sock, client_prv->pipefd[0]) + 1; + + printf("[*] %s() b_connect=%d, maxfd=%d\n", __FUNCTION__, client_prv->b_connect, maxfd); + while (client_prv->b_connect) { + FD_ZERO(&(client_prv->sock_rfds)); + + FD_SET(client_prv->sock, &(client_prv->sock_rfds)); + FD_SET(client_prv->pipefd[0], &(client_prv->sock_rfds)); + + if (DBG) ALOGD("[*] %s() b_connect=%d\n", __FUNCTION__, client_prv->b_connect); + if (select(maxfd, &(client_prv->sock_rfds), NULL, NULL, NULL) > 0) { + if (FD_ISSET(client_prv->sock, &(client_prv->sock_rfds))) { + // Read incoming data + for (;;) { + // loop until EAGAIN/EINTR, end of stream, or other error + ret = record_stream_get_next(client_prv->p_rs, &p_record, &recordlen); + if (ret == 0 && p_record == NULL) { // end-of-stream + break; + } + else if (ret < 0) { + break; + } + else if (ret == 0) { // && p_record != NULL + n = processRxBuffer(client_prv, p_record, recordlen); + if (n != RIL_CLIENT_ERR_SUCCESS) { + ALOGE("%s: processRXBuffer returns %d", __FUNCTION__, n); + } + } + else { + printf("[*] %s()\n", __FUNCTION__); + } + } + + if (ret == 0 || !(errno == EAGAIN || errno == EINTR)) { + // fatal error or end-of-stream + if (client_prv->sock > 0) { + close(client_prv->sock); + client_prv->sock = -1; + client_prv->b_connect = 0; + } + + if (client_prv->p_rs) + record_stream_free(client_prv->p_rs); + + // EOS + if (client_prv->err_cb) { + client_prv->err_cb(client_prv->err_cb_data, RIL_CLIENT_ERR_CONNECT); + return NULL; + } + + break; + } + } + if (FD_ISSET(client_prv->pipefd[0], &(client_prv->sock_rfds))) { + char end_cmd[10]; + + if (DBG) ALOGD("%s(): close\n", __FUNCTION__); + + if (read(client_prv->pipefd[0], end_cmd, sizeof(end_cmd)) > 0) { + close(client_prv->sock); + close(client_prv->pipefd[0]); + close(client_prv->pipefd[1]); + + client_prv->sock = -1; + client_prv->b_connect = 0; + } + } + } + } + + return NULL; +} + + +static int processUnsolicited(RilClientPrv *prv, Parcel &p) { + int32_t resp_id, len; + status_t status; + const void *data = NULL; + RilOnUnsolicited unsol_func = NULL; + + status = p.readInt32(&resp_id); + if (status != NO_ERROR) { + ALOGE("%s: read resp_id failed.", __FUNCTION__); + return RIL_CLIENT_ERR_IO; + } + + status = p.readInt32(&len); + if (status != NO_ERROR) { + //ALOGE("%s: read length failed. assume zero length.", __FUNCTION__); + len = 0; + } + + ALOGD("%s(): resp_id (%d), len(%d)\n", __FUNCTION__, resp_id, len); + + if (len) + data = p.readInplace(len); + + // Find unsolicited response handler. + unsol_func = FindUnsolHandler(prv, (uint32_t)resp_id); + if (unsol_func) { + unsol_func(prv->parent, data, len); + } + + return RIL_CLIENT_ERR_SUCCESS; +} + + +static int processSolicited(RilClientPrv *prv, Parcel &p) { + int32_t token, err, len; + status_t status; + const void *data = NULL; + RilOnComplete req_func = NULL; + int ret = RIL_CLIENT_ERR_SUCCESS; + uint32_t req_id = 0; + + if (DBG) ALOGD("%s()", __FUNCTION__); + + status = p.readInt32(&token); + if (status != NO_ERROR) { + ALOGE("%s: Read token fail. Status %d\n", __FUNCTION__, status); + return RIL_CLIENT_ERR_IO; + } + + if (IsValidToken(&(prv->token_pool), token) == 0) { + ALOGE("%s: Invalid Token", __FUNCTION__); + return RIL_CLIENT_ERR_INVAL; // Invalid token. + } + + status = p.readInt32(&err); + if (status != NO_ERROR) { + ALOGE("%s: Read err fail. Status %d\n", __FUNCTION__, status); + ret = RIL_CLIENT_ERR_IO; + goto error; + } + + // Don't go further for error response. + if (err != RIL_CLIENT_ERR_SUCCESS) { + ALOGE("%s: Error %d\n", __FUNCTION__, err); + if (prv->err_cb) + prv->err_cb(prv->err_cb_data, err); + ret = RIL_CLIENT_ERR_SUCCESS; + goto error; + } + + status = p.readInt32(&len); + if (status != NO_ERROR) { + /* no length field */ + len = 0; + } + + if (len) + data = p.readInplace(len); + + // Find request handler for the token. + // First, FindReqHandler() searches request history with the token + // and finds out a request ID. Then, it search request handler table + // with the request ID. + req_func = FindReqHandler(prv, token, &req_id); + if (req_func) + { + if (DBG) ALOGD("[*] Call handler"); + req_func(prv->parent, data, len); + + if(prv->b_del_handler) { + prv->b_del_handler = 0; + RegisterRequestCompleteHandler(prv->parent, req_id, NULL); + } + } else { + if (DBG) ALOGD("%s: No handler for token %d\n", __FUNCTION__, token); + } + +error: + FreeToken(&(prv->token_pool), token); + ClearReqHistory(prv, token); + return ret; +} + + +static int processRxBuffer(RilClientPrv *prv, void *buffer, size_t buflen) { + Parcel p; + int32_t response_type; + status_t status; + int ret = RIL_CLIENT_ERR_SUCCESS; + + acquire_wake_lock(PARTIAL_WAKE_LOCK, RIL_CLIENT_WAKE_LOCK); + + p.setData((uint8_t *)buffer, buflen); + + status = p.readInt32(&response_type); + if (DBG) ALOGD("%s: status %d response_type %d", __FUNCTION__, status, response_type); + + if (status != NO_ERROR) { + ret = RIL_CLIENT_ERR_IO; + goto EXIT; + } + + // FOr unsolicited response. + if (response_type == RESPONSE_UNSOLICITED) { + ret = processUnsolicited(prv, p); + } + // For solicited response. + else if (response_type == RESPONSE_SOLICITED) { + ret = processSolicited(prv, p); + if (ret != RIL_CLIENT_ERR_SUCCESS && prv->err_cb) { + prv->err_cb(prv->err_cb_data, ret); + } + } + else { + ret = RIL_CLIENT_ERR_INVAL; + } + +EXIT: + release_wake_lock(RIL_CLIENT_WAKE_LOCK); + return ret; +} + + +static uint32_t AllocateToken(uint32_t *token_pool) { + int i; + + // Token pool is full. + if (*token_pool == 0xFFFFFFFF) + return 0; + + for (i = 0; i < 32; i++) { + uint32_t new_token = 0x00000001 << i; + + if ((*token_pool & new_token) == 0) { + *token_pool |= new_token; + return new_token; + } + } + + return 0; +} + + +static void FreeToken(uint32_t *token_pool, uint32_t token) { + *token_pool &= ~token; +} + + +static uint8_t IsValidToken(uint32_t *token_pool, uint32_t token) { + if (token == 0) + return 0; + + if ((*token_pool & token) == token) + return 1; + else + return 0; +} + + +static int RecordReqHistory(RilClientPrv *prv, int token, uint32_t id) { + int i = 0; + + if (DBG) ALOGD("[*] %s(): token(%d), ID(%d)\n", __FUNCTION__, token, id); + for (i = 0; i < TOKEN_POOL_SIZE; i++) { + if (prv->history[i].token == 0) { + prv->history[i].token = token; + prv->history[i].id = id; + + if (DBG) ALOGD("[*] %s(): token(%d), ID(%d)\n", __FUNCTION__, token, id); + + return RIL_CLIENT_ERR_SUCCESS; + } + } + + ALOGE("%s: No free record for token %d", __FUNCTION__, token); + + return RIL_CLIENT_ERR_RESOURCE; +} + +static void ClearReqHistory(RilClientPrv *prv, int token) { + int i = 0; + + if (DBG) ALOGD("[*] %s(): token(%d)\n", __FUNCTION__, token); + for (i = 0; i < TOKEN_POOL_SIZE; i++) { + if (prv->history[i].token == token) { + memset(&(prv->history[i]), 0, sizeof(ReqHistory)); + break; + } + } +} + + +static RilOnUnsolicited FindUnsolHandler(RilClientPrv *prv, uint32_t id) { + int i; + + // Search unsolicited handler table. + for (i = 0; i < REQ_POOL_SIZE; i++) { + if (prv->unsol_handlers[i].id == id) + return prv->unsol_handlers[i].handler; + } + + return (RilOnUnsolicited)NULL; +} + + +static RilOnComplete FindReqHandler(RilClientPrv *prv, int token, uint32_t *id) { + int i = 0; + int j = 0; + + if (DBG) ALOGD("[*] %s(): token(%d)\n", __FUNCTION__, token); + + // Search request history. + for (i = 0; i < TOKEN_POOL_SIZE; i++) { + printf("[*] %s(): history_token(%d)\n", __FUNCTION__, prv->history[i].token); + if (prv->history[i].token == token) { + // Search request handler with request ID found. + for (j = 0; j < REQ_POOL_SIZE; j++) { + printf("[*] %s(): token(%d), req_id(%d), history_id(%d)\n", __FUNCTION__, token, prv->history[i].id, prv->history[i].id); + if (prv->req_handlers[j].id == prv->history[i].id) { + *id = prv->req_handlers[j].id; + return prv->req_handlers[j].handler; + } + } + } + } + + return NULL; +} + + +static void DeallocateToken(uint32_t *token_pool, uint32_t token) { + *token_pool &= !token; +} + + +static int blockingWrite(int fd, const void *buffer, size_t len) { + size_t writeOffset = 0; + const uint8_t *toWrite; + ssize_t written = 0; + + if (buffer == NULL) + return -1; + + toWrite = (const uint8_t *)buffer; + + while (writeOffset < len) { + do + { + written = write(fd, toWrite + writeOffset, len - writeOffset); + } while (written < 0 && errno == EINTR); + + if (written >= 0) { + writeOffset += written; + } + else { + ALOGE ("RIL Response: unexpected error on write errno:%d", errno); + printf("RIL Response: unexpected error on write errno:%d\n", errno); + close(fd); + return -1; + } + } + + return 0; +} + +} // namespace android + +// end of file + diff --git a/libsecril-client/secril-client.h b/libsecril-client/secril-client.h new file mode 100755 index 00000000..fb1729c0 --- /dev/null +++ b/libsecril-client/secril-client.h @@ -0,0 +1,293 @@ +/** + * @file secril-client.h + * + * @author Myeongcheol Kim (mcmount.kim@samsung.com) + * + * @brief RIL client library for multi-client support + */ + +#ifndef __SECRIL_CLIENT_H__ +#define __SECRIL_CLIENT_H__ + +#include +//#include "SecProductFeature_RIL.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct RilClient { + void *prv; +}; + +typedef struct RilClient * HRilClient; + + +//--------------------------------------------------------------------------- +// Defines +//--------------------------------------------------------------------------- +#define RIL_CLIENT_ERR_SUCCESS 0 +#define RIL_CLIENT_ERR_AGAIN 1 +#define RIL_CLIENT_ERR_INIT 2 // Client is not initialized +#define RIL_CLIENT_ERR_INVAL 3 // Invalid value +#define RIL_CLIENT_ERR_CONNECT 4 // Connection error +#define RIL_CLIENT_ERR_IO 5 // IO error +#define RIL_CLIENT_ERR_RESOURCE 6 // Resource not available +#define RIL_CLIENT_ERR_UNKNOWN 7 + + +//--------------------------------------------------------------------------- +// Type definitions +//--------------------------------------------------------------------------- + +typedef int (*RilOnComplete)(HRilClient handle, const void *data, size_t datalen); + +typedef int (*RilOnUnsolicited)(HRilClient handle, const void *data, size_t datalen); + +typedef int (*RilOnError)(void *data, int error); + + +//--------------------------------------------------------------------------- +// Client APIs +//--------------------------------------------------------------------------- + +/** + * Open RILD multi-client. + * Return is client handle, NULL on error. + */ +HRilClient OpenClient_RILD(void); + +/** + * Stop RILD multi-client. If client socket was connected, + * it will be disconnected. + */ +int CloseClient_RILD(HRilClient client); + +/** + * Connect to RIL deamon. One client task starts. + * Return is 0 or error code. + */ +int Connect_RILD(HRilClient client); + +/** + * Connect to QRIL deamon. One client task starts. + * Return is 0 or error code. + */ +int Connect_QRILD(HRilClient client); + +#if defined(SEC_PRODUCT_FEATURE_RIL_CALL_DUALMODE_CDMAGSM) +/** + * Connect to RIL deamon. One client task starts. + * Return is 0 or error code. + */ +int Connect_RILD_Second(HRilClient client); +#endif +/** + * check whether RILD is connected + * Returns 0 or 1 + */ +int isConnected_RILD(HRilClient client); + +/** + * Disconnect connection to RIL deamon(socket close). + * Return is 0 or error code. + */ +int Disconnect_RILD(HRilClient client); + +/** + * Register unsolicited response handler. If handler is NULL, + * the handler for the request ID is unregistered. + * The response handler is invoked in the client task context. + * Return is 0 or error code. + */ +int RegisterUnsolicitedHandler(HRilClient client, uint32_t id, RilOnUnsolicited handler); + +/** + * Register solicited response handler. If handler is NULL, + * the handler for the ID is unregistered. + * The response handler is invoked in the client task context. + * Return is 0 or error code. + */ +int RegisterRequestCompleteHandler(HRilClient client, uint32_t id, RilOnComplete handler); + +/** + * Register error callback. If handler is NULL, + * the callback is unregistered. + * The response handler is invoked in the client task context. + * Return is 0 or error code. + */ +int RegisterErrorCallback(HRilClient client, RilOnError cb, void *data); + +/** + * Invoke OEM request. Request ID is RIL_REQUEST_OEM_HOOK_RAW. + * Return is 0 or error code. For RIL_CLIENT_ERR_AGAIN caller should retry. + */ +int InvokeOemRequestHookRaw(HRilClient client, char *data, size_t len); + +/** + * Sound device types. + */ +typedef enum _SoundType { + SOUND_TYPE_VOICE, + SOUND_TYPE_SPEAKER, + SOUND_TYPE_HEADSET, + SOUND_TYPE_BTVOICE +} SoundType; + +/** + * External sound device path. + */ +typedef enum _AudioPath { + SOUND_AUDIO_PATH_HANDSET, + SOUND_AUDIO_PATH_HEADSET, + SOUND_AUDIO_PATH_SPEAKER, + SOUND_AUDIO_PATH_BLUETOOTH, + SOUND_AUDIO_PATH_STEREO_BT, + SOUND_AUDIO_PATH_HEADPHONE, + SOUND_AUDIO_PATH_BLUETOOTH_NO_NR, + SOUND_AUDIO_PATH_MIC1, + SOUND_AUDIO_PATH_MIC2, + SOUND_AUDIO_PATH_BLUETOOTH_WB, + SOUND_AUDIO_PATH_BLUETOOTH_WB_NO_NR +} AudioPath; + +/** + * ExtraVolume + */ +typedef enum _ExtraVolume { + ORIGINAL_PATH, + EXTRA_VOLUME_PATH +} ExtraVolume; + +/** + * Clock adjustment parameters. + */ +typedef enum _SoundClockCondition { + SOUND_CLOCK_STOP, + SOUND_CLOCK_START +} SoundClockCondition; + +/** + * Call record adjustment parameters. + */ +typedef enum _CallRecCondition { + CALL_REC_STOP, + CALL_REC_START +} CallRecCondition; + +/** + * Mute adjustment parameters. + */ +typedef enum _MuteCondition { + TX_UNMUTE, /* 0x00: TX UnMute */ + TX_MUTE, /* 0x01: TX Mute */ + RX_UNMUTE, /* 0x02: RX UnMute */ + RX_MUTE, /* 0x03: RX Mute */ + RXTX_UNMUTE, /* 0x04: RXTX UnMute */ + RXTX_MUTE, /* 0x05: RXTX Mute */ +} MuteCondition; + +/** + * Two mic Solution control + * Two MIC Solution Device + */ +typedef enum __TwoMicSolDevice { + AUDIENCE, + FORTEMEDIA +} TwoMicSolDevice; + +/** + * Two MIC Solution Report + */ +typedef enum __TwoMicSolReport { + TWO_MIC_SOLUTION_OFF, + TWO_MIC_SOLUTION_ON +} TwoMicSolReport; + +/** + * DHA Mode + */ +typedef enum __DhaSolMode { + DHA_MODE_OFF, + DHA_MODE_ON +} DhaSolMode; + +/** + * DHA Select + */ +typedef enum __DhaSolSelect { + DHA_SEL_LEFT, + DHA_SEL_RIGHT +} DhaSolSelect; + +/** + * LoopbackTest parameters. + */ +typedef enum __LoopbackMode { + LOOPBACK_END, + LOOPBACK_ON_PCM, + LOOPBACK_ON_PACKET +} LoopbackMode; + +typedef enum __LoopbackPath { + RECEIVER, + EARPHONE, + LOUDSPEAKER +} LoopbackPath; + + +/** + * Set in-call volume. + */ +int SetCallVolume(HRilClient client, SoundType type, int vol_level); + +/** + * Set external sound device path for noise reduction. + */ +int SetCallAudioPath(HRilClient client, AudioPath path, ExtraVolume mode); + +/** + * Set modem clock to master or slave. + */ +int SetCallClockSync(HRilClient client, SoundClockCondition condition); + +/** + * Set modem vtcall clock to master or slave. + */ +int SetVideoCallClockSync(HRilClient client, SoundClockCondition condition); + +/** + * Set voice call record + */ +int SetCallRecord(HRilClient client, CallRecCondition condition); + +/** + * Set mute or unmute + */ +int SetMute(HRilClient client, MuteCondition condition); + +/** + * Get mute state + */ +int GetMute(HRilClient client, RilOnComplete handler); + +int SetTwoMicControl(HRilClient client, TwoMicSolDevice device, TwoMicSolReport report); + +/** + * DHA Solution Set + */ +int SetDhaSolution(HRilClient client, DhaSolMode mode, DhaSolSelect select, char *parameter); + +/** + * Set Loopback Test Mode and Path + */ +int SetLoopbackTest(HRilClient client, LoopbackMode mode, AudioPath path); + +#ifdef __cplusplus +}; +#endif + +#endif // __SECRIL_CLIENT_H__ + +// end of file + diff --git a/macloader/macloader.cpp b/macloader/macloader.cpp index 887724a9..83ac114d 100644 --- a/macloader/macloader.cpp +++ b/macloader/macloader.cpp @@ -59,7 +59,7 @@ int main() { file = fopen(MACADDR_PATH, "r"); if(file == 0) { fprintf(stderr, "open(%s) failed\n", MACADDR_PATH); - LOGE("Can't open %s\n", MACADDR_PATH); + ALOGE("Can't open %s\n", MACADDR_PATH); return -1; } @@ -67,7 +67,7 @@ int main() { str = fgets(mac_addr_half, 9, file); if(str == 0) { fprintf(stderr, "fgets() from file %s failed\n", MACADDR_PATH); - LOGE("Can't read from %s\n", MACADDR_PATH); + ALOGE("Can't read from %s\n", MACADDR_PATH); return -1; } @@ -86,7 +86,7 @@ int main() { cidfile = fopen(CID_PATH, "w"); if(cidfile == 0) { fprintf(stderr, "open(%s) failed\n", CID_PATH); - LOGE("Can't open %s\n", CID_PATH); + ALOGE("Can't open %s\n", CID_PATH); return -1; } @@ -96,30 +96,30 @@ int main() { break; case MURATA: /* write murata to cid file */ - LOGI("Writing murata to %s\n", CID_PATH); + ALOGI("Writing murata to %s\n", CID_PATH); ret = fputs("murata", cidfile); break; case SEMCOSH: /* write semcosh to cid file */ - LOGI("Writing semcosh to %s\n", CID_PATH); + ALOGI("Writing semcosh to %s\n", CID_PATH); ret = fputs("semcosh", cidfile); break; case SEMCOVE: /* write semcove to cid file */ - LOGI("Writing semcove to %s\n", CID_PATH); + ALOGI("Writing semcove to %s\n", CID_PATH); ret = fputs("semcove", cidfile); break; } if(ret != 0) { fprintf(stderr, "fputs() to file %s failed\n", CID_PATH); - LOGE("Can't write to %s\n", CID_PATH); + ALOGE("Can't write to %s\n", CID_PATH); return -1; } fclose(cidfile); /* set permissions on cid file */ - LOGD("Setting permissions on %s\n", CID_PATH); + ALOGD("Setting permissions on %s\n", CID_PATH); amode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; ret = chmod(CID_PATH, amode); @@ -132,13 +132,13 @@ int main() { if(ret != 0) { fprintf(stderr, "chmod() on file %s failed\n", CID_PATH); - LOGE("Can't set permissions on %s\n", CID_PATH); + ALOGE("Can't set permissions on %s\n", CID_PATH); return ret; } } else { /* delete cid file if no specific type */ - LOGD("Deleting file %s\n", CID_PATH); + ALOGD("Deleting file %s\n", CID_PATH); remove(CID_PATH); } fclose(file); diff --git a/overlay/frameworks/base/core/res/res/values/arrays.xml b/overlay/frameworks/base/core/res/res/values/arrays.xml index 6d169e6e..fa336317 100644 --- a/overlay/frameworks/base/core/res/res/values/arrays.xml +++ b/overlay/frameworks/base/core/res/res/values/arrays.xml @@ -19,7 +19,7 @@ --> - + @string/reboot_reboot @string/reboot_recovery diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 7898049b..566221cd 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -40,10 +40,10 @@ true - com.google.android.location.NetworkLocationProvider + com.google.android.location.NetworkLocationProvider - com.google.android.location.GeocodeProvider + com.google.android.location.GeocodeProvider @@ -245,20 +245,14 @@ false - - com.google.android.location.NetworkLocationProvider - - - com.google.android.location.GeocodeProvider - true - true + - true + @@ -312,27 +306,5 @@ true - - - - - /sys/class/android_usb/f_mass_storage/lun0/file - - - true - - - 7 diff --git a/overlay/frameworks/base/core/res/res/xml/storage_list.xml b/overlay/frameworks/base/core/res/res/xml/storage_list.xml index a96fca93..7e2a3928 100644 --- a/overlay/frameworks/base/core/res/res/xml/storage_list.xml +++ b/overlay/frameworks/base/core/res/res/xml/storage_list.xml @@ -33,7 +33,7 @@ --> - +#include + +#include +#include +#include + +#include + +#include +#include + +__BEGIN_DECLS + +#define GRALLOC_API_VERSION 1 + +/** + * The id of this module + */ +#define GRALLOC_HARDWARE_MODULE_ID "gralloc" + +/** + * Name of the graphics device to open + */ + +#define GRALLOC_HARDWARE_GPU0 "gpu0" + +enum { + /* buffer is never read in software */ + GRALLOC_USAGE_SW_READ_NEVER = 0x00000000, + /* buffer is rarely read in software */ + GRALLOC_USAGE_SW_READ_RARELY = 0x00000002, + /* buffer is often read in software */ + GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003, + /* mask for the software read values */ + GRALLOC_USAGE_SW_READ_MASK = 0x0000000F, + + /* buffer is never written in software */ + GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000, + /* buffer is never written in software */ + GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020, + /* buffer is never written in software */ + GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030, + /* mask for the software write values */ + GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0, + + /* buffer will be used as an OpenGL ES texture */ + GRALLOC_USAGE_HW_TEXTURE = 0x00000100, + /* buffer will be used as an OpenGL ES render target */ + GRALLOC_USAGE_HW_RENDER = 0x00000200, + /* buffer will be used by the 2D hardware blitter */ + GRALLOC_USAGE_HW_2D = 0x00000400, + /* buffer will be used by the HWComposer HAL module */ + GRALLOC_USAGE_HW_COMPOSER = 0x00000800, + /* buffer will be used with the framebuffer device */ + GRALLOC_USAGE_HW_FB = 0x00001000, + /* buffer will be used with the HW video encoder */ + GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000, + /* mask for the software usage bit-mask */ + GRALLOC_USAGE_HW_MASK = 0x00011F00, + + /* buffer should be displayed full-screen on an external display when + * possible + */ + GRALLOC_USAGE_EXTERNAL_DISP = 0x00002000, + + /* Must have a hardware-protected path to external display sink for + * this buffer. If a hardware-protected path is not available, then + * either don't composite only this buffer (preferred) to the + * external sink, or (less desirable) do not route the entire + * composition to the external sink. + */ + GRALLOC_USAGE_PROTECTED = 0x00004000, + + /* implementation-specific private usage flags */ + GRALLOC_USAGE_PRIVATE_0 = 0x10000000, + GRALLOC_USAGE_PRIVATE_1 = 0x20000000, + GRALLOC_USAGE_PRIVATE_2 = 0x40000000, + GRALLOC_USAGE_PRIVATE_3 = 0x80000000, + GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000, + + /* SAMSUNG */ + GRALLOC_USAGE_HW_FIMC1 = 0x01000000, + GRALLOC_USAGE_HW_ION = 0x02000000, + GRALLOC_USAGE_YUV_ADDR = 0x04000000, + + /* SEC Private usage , for Overlay path at HWC */ + GRALLOC_USAGE_HWC_HWOVERLAY = 0x20000000, +}; + +/*****************************************************************************/ + +/** + * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM + * and the fields of this data structure must begin with hw_module_t + * followed by module specific information. + */ +typedef struct gralloc_module_t { + struct hw_module_t common; + + /* + * (*registerBuffer)() must be called before a buffer_handle_t that has not + * been created with (*alloc_device_t::alloc)() can be used. + * + * This is intended to be used with buffer_handle_t's that have been + * received in this process through IPC. + * + * This function checks that the handle is indeed a valid one and prepares + * it for use with (*lock)() and (*unlock)(). + * + * It is not necessary to call (*registerBuffer)() on a handle created + * with (*alloc_device_t::alloc)(). + * + * returns an error if this buffer_handle_t is not valid. + */ + int (*registerBuffer)(struct gralloc_module_t const* module, + buffer_handle_t handle); + + /* + * (*unregisterBuffer)() is called once this handle is no longer needed in + * this process. After this call, it is an error to call (*lock)(), + * (*unlock)(), or (*registerBuffer)(). + * + * This function doesn't close or free the handle itself; this is done + * by other means, usually through libcutils's native_handle_close() and + * native_handle_free(). + * + * It is an error to call (*unregisterBuffer)() on a buffer that wasn't + * explicitly registered first. + */ + int (*unregisterBuffer)(struct gralloc_module_t const* module, + buffer_handle_t handle); + + /* + * The (*lock)() method is called before a buffer is accessed for the + * specified usage. This call may block, for instance if the h/w needs + * to finish rendering or if CPU caches need to be synchronized. + * + * The caller promises to modify only pixels in the area specified + * by (l,t,w,h). + * + * The content of the buffer outside of the specified area is NOT modified + * by this call. + * + * If usage specifies GRALLOC_USAGE_SW_*, vaddr is filled with the address + * of the buffer in virtual memory. + * + * THREADING CONSIDERATIONS: + * + * It is legal for several different threads to lock a buffer from + * read access, none of the threads are blocked. + * + * However, locking a buffer simultaneously for write or read/write is + * undefined, but: + * - shall not result in termination of the process + * - shall not block the caller + * It is acceptable to return an error or to leave the buffer's content + * into an indeterminate state. + * + * If the buffer was created with a usage mask incompatible with the + * requested usage flags here, -EINVAL is returned. + * + */ + + int (*lock)(struct gralloc_module_t const* module, + buffer_handle_t handle, int usage, + int l, int t, int w, int h, + void** vaddr); + + + /* + * The (*unlock)() method must be called after all changes to the buffer + * are completed. + */ + + int (*unlock)(struct gralloc_module_t const* module, + buffer_handle_t handle); + +#ifdef EXYNOS4210_ENHANCEMENTS + int (*getphys) (struct gralloc_module_t const* module, + buffer_handle_t handle, void** paddr); +#endif + + /* reserved for future use */ + int (*perform)(struct gralloc_module_t const* module, + int operation, ... ); + + /* reserved for future use */ + void* reserved_proc[7]; +} gralloc_module_t; + +/*****************************************************************************/ + +/** + * Every device data structure must begin with hw_device_t + * followed by module specific public methods and attributes. + */ + +typedef struct alloc_device_t { + struct hw_device_t common; + + /* + * (*alloc)() Allocates a buffer in graphic memory with the requested + * parameters and returns a buffer_handle_t and the stride in pixels to + * allow the implementation to satisfy hardware constraints on the width + * of a pixmap (eg: it may have to be multiple of 8 pixels). + * The CALLER TAKES OWNERSHIP of the buffer_handle_t. + * + * Returns 0 on success or -errno on error. + */ + + int (*alloc)(struct alloc_device_t* dev, + int w, int h, int format, int usage, + buffer_handle_t* handle, int* stride); + + /* + * (*free)() Frees a previously allocated buffer. + * Behavior is undefined if the buffer is still mapped in any process, + * but shall not result in termination of the program or security breaches + * (allowing a process to get access to another process' buffers). + * THIS FUNCTION TAKES OWNERSHIP of the buffer_handle_t which becomes + * invalid after the call. + * + * Returns 0 on success or -errno on error. + */ + int (*free)(struct alloc_device_t* dev, + buffer_handle_t handle); + + /* This hook is OPTIONAL. + * + * If non NULL it will be caused by SurfaceFlinger on dumpsys + */ + void (*dump)(struct alloc_device_t *dev, char *buff, int buff_len); + + void* reserved_proc[7]; +} alloc_device_t; + + +/** convenience API for opening and closing a supported device */ + +static inline int gralloc_open(const struct hw_module_t* module, + struct alloc_device_t** device) { + return module->methods->open(module, + GRALLOC_HARDWARE_GPU0, (struct hw_device_t**)device); +} + +static inline int gralloc_close(struct alloc_device_t* device) { + return device->common.close(&device->common); +} + +__END_DECLS + +#endif // ANDROID_GRALLOC_INTERFACE_H diff --git a/overlay/packages/apps/Phone/res/values/config.xml b/overlay/packages/apps/Phone/res/values/config.xml index 28ff0a05..f788afe3 100644 --- a/overlay/packages/apps/Phone/res/values/config.xml +++ b/overlay/packages/apps/Phone/res/values/config.xml @@ -18,8 +18,8 @@ for different hardware or product builds. --> - true + - dualmic_enabled=true=false + diff --git a/overlay/packages/apps/Settings/res/values/config.xml b/overlay/packages/apps/Settings/res/values/config.xml index f2c22fd5..ab33e19c 100644 --- a/overlay/packages/apps/Settings/res/values/config.xml +++ b/overlay/packages/apps/Settings/res/values/config.xml @@ -17,8 +17,8 @@ - true + - true + diff --git a/recovery.fstab b/recovery.fstab index cbae7e76..69ebfd4d 100644 --- a/recovery.fstab +++ b/recovery.fstab @@ -8,4 +8,5 @@ /preload ext4 /dev/block/mmcblk0p10 /modem emmc /dev/block/mmcblk0p7 -/extsdcard vfat /dev/block/mmcblk1p1 +/sdcard datamedia /dev/null +/external_sd vfat /dev/block/mmcblk1p1 diff --git a/secril_multi/Oem_ril_sap.h b/secril_multi/Oem_ril_sap.h new file mode 100755 index 00000000..7184ad8d --- /dev/null +++ b/secril_multi/Oem_ril_sap.h @@ -0,0 +1,284 @@ +/* + * Copyright (C) 2009 Samsung Electronics, Co. Ltd. + * All rights reserved. + * + * Oem_ril_sap.h + * + * author: young jin Park (lucky29.park@samsung.com) + * data : 20100129 +*/ + +#ifndef __OEM_RIL_SAP_H__ +#define __OEM_RIL_SAP_H__ + +/** + * OEM request header data(for RIL_REQUEST_OEM_HOOK_RAW) + +typedef struct _OemReqDataHdr +{ + char func_id; + char sub_func_id; + char len; +} __attribute__((packed)) OemReqDataHdr; + + + * OEM request data(for RIL_REQUEST_OEM_HOOK_RAW) + +typedef struct _OemReqData +{ + OemReqDataHdr hdr; + char *payload; +} __attribute__((packed)) OemReqData; + +**/ + +/* -- OEM RIL SAP Main Cmd --*/ +#define OEM_FUNCTION_ID_SAP 0x14 + +/* -- OEM RIL SAP SUB FUNCTION ID -- */ + +#define OEM_SAP_CONNECT 0x01 +/** OEM_SAP_CONNECT + Req - Format info + 1. MSG ID (1 byte) + + Res - Format info + 1. MSG ID (1 byte) + 2. CONNECTION STATUS (1 byte) + 3. MAX MSG SIZE (2 byte) + + Noti(Unsol) - Format info + 1. DISCONNECT TYPE (1 byte) +**/ + +#define OEM_SAP_STATUS 0x02 +/** OEM_SAP_STATUS + Req - Format info + non. + + Res - Format info + 1. SAP Status (1 byte) + + Noti(Unsol) - Format info + 1. Card Status (1 byte) +**/ + +#define OEM_SAP_READER_STATUS 0x03 +/** OEM_SAP_READER_STATUS + Req - Format info + non. + + Res - Format info + 1. Result code (1 byte) + 2. Card reader status (1 byte) + + Noti(Unsol) - Format info + non. +**/ + +#define OEM_SAP_SIM_POWER 0x04 +/** OEM_SAP_SIM_POWER + Req - Format info + 1. MSG ID (1 byte) + + Res - Format info + 1. MSG ID (1 byte) + 2. Result code (1 byte) + + Noti(Unsol) - Format info + non. +**/ + +#define OEM_SAP_TRANSFER_ATR 0x05 +/** OEM_SAP_TRANSFER_ATR + Req - Format info + non. + + Res - Format info + 1. Result code (1 byte) + 2. ATR length (2 byte) + 3. ATR (variables) + + Noti(Unsol) - Format info + non. +**/ + +#define OEM_SAP_TRANSFER_APDU 0x06 +/** OEM_SAP_TRANSFER_APDU + Req - Format info + 1. APDU length(2 byte) + 2. commadn apdu or apdu_7816 (variables) + + Res - Format info + 1. Result code (1 byte) + 2. Res APDU length (2 byte) + 3. Res APDU (variables) + + Noti(Unsol) - Format info + non. +**/ + +#define OEM_SAP_SET_PROTOCOL 0x07 +/** OEM_SAP_SET_PROTOCOL + Req - Format info + 1. Transport protocol (1 byte) + + Res - Format info + 1. Result code (1 byte) + + Noti(Unsol) - Format info + non. +**/ + + +/*MAX_MSG_SIZE */ +#define MAX_MSG_SIZE 512 // 256->512 + +/* MSG_ID Table */ +#define OEM_SAP_CONNECT_REQ 0x00 /*Client -> Server*/ +#define OEM_SAP_CONNECT_RESP 0x01 /*Server -> Client */ +#define OEM_SAP_DISCONNECT_REQ 0x02 /*Client -> Server*/ +#define OEM_SAP_DISCONNECT_RESP 0x03 /*Server -> Client */ +#define OEM_SAP_DISCONNECT_IND 0x04 /*Server -> Client */ +#define OEM_SAP_TRANSFER_APDU_REQ 0x05 /*Client -> Server*/ +#define OEM_SAP_TRANSFER_APDU_RESP 0x06 /*Server -> Client */ +#define OEM_SAP_TRANSFER_ATR_REQ 0x07 /*Client -> Server*/ +#define OEM_SAP_TRANSFER_ATR_RESP 0x08 /*Server -> Client */ +#define OEM_SAP_POWER_SIM_OFF_REQ 0x09 /*Client -> Server*/ +#define OEM_SAP_POWER_SIM_OFF_RESP 0x0A /*Server -> Client */ +#define OEM_SAP_POWER_SIM_ON_REQ 0x0B /*Client -> Server*/ +#define OEM_SAP_POWER_SIM_ON_RESP 0x0C /*Server -> Client */ +#define OEM_SAP_RESET_SIM_REQ 0x0D /*Client -> Server*/ +#define OEM_SAP_RESET_SIM_RESP 0x0E /*Server -> Client */ +#define OEM_SAP_TRANSFER_CARD_READER_STATUS_REQ 0x0F /*Client -> Server*/ +#define OEM_SAP_TRANSFER_CARD_READER_STATUS_RESP 0x10 /*Server -> Client */ +#define OEM_SAP_STATUS_IND 0x11 /*Client -> Server*/ +#define OEM_SAP_ERROR_RESP 0x12 /*Server -> Client */ +#define OEM_SAP_SET_TRANSPORT_PROTOCOL_REQ 0x13 /*Client -> Server*/ +#define OEM_SAP_SET_TRANSPORT_PROTOCOL_RESP 0x14 /*Server -> Client */ + +/*CONNECTIN STATUS */ +#define OEM_SAP_CONNECT_OK 0x00 +#define OEM_SAP_CONNECT_UNABLE_ESTABLISH 0x01 +#define OEM_SAP_CONNECT_NOT_SUPPORT_MAX_SIZE 0x02 +#define OEM_SAP_CONNECT_TOO_SMALL_MAX_SIZE 0x03 + +/*DISCONNECT TYPE */ +#define OEM_SAP_DISCONNECT_TYPE_GRACEFUL 0x00 +#define OEM_SAP_DISCONNECT_TYPE_IMMEDIATE 0x01 + +/*SAP STATUS */ +#define OEM_SAP_STATUS_UNKNOWN 0x00 +#define OEM_SAP_STATUS_NO_SIM 0x01 +#define OEM_SAP_STATUS_NOT_READY 0x02 +#define OEM_SAP_STATUS_READY 0x03 +#define OEM_SAP_STATUS_CONNECTED 0x04 + +/*CARD STATUS */ +#define OEM_SAP_CARD_STATUS_UNKNOWN 0x00 +#define OEM_SAP_CARD_STATUS_RESET 0x01 +#define OEM_SAP_CARD_STATUS_NOT_ACCESSIBLE 0x02 +#define OEM_SAP_CARD_STATUS_REMOVED 0x03 +#define OEM_SAP_CARD_STATUS_INSERTED 0x04 +#define OEM_SAP_CARD_STATUS_RECOVERED 0x05 + +/*RESULT CODE */ +#define OEM_SAP_RESULT_OK 0x00 +#define OEM_SAP_RESULT_NO_REASON 0x01 +#define OEM_SAP_RESULT_CARD_NOT_ACCESSIBLE 0x02 +#define OEM_SAP_RESULT_CARD_ALREADY_POWER_OFF 0x03 +#define OEM_SAP_RESULT_REMOVED 0x04 +#define OEM_SAP_RESULT_ALREADY_POWER_ON 0x05 +#define OEM_SAP_RESULT_DATA_NOT_AVAILABLE 0x06 +#define OEM_SAP_RESULT_NOT_SUPPORT 0x07 + +/*TRANSPORT PROTOCOL*/ +#define OEM_SAP_TRANSPORT_PROTOCOL_T_ZERO 0x00 +#define OEM_SAP_TRANSPORT_PROTOCOL_T_ONE 0x01 + + +typedef struct { + uint8_t func_id; + uint8_t cmd; + uint16_t len; +} __attribute__((packed)) oem_ril_sap_hdr; + +typedef struct { + uint8_t msg_id; +} __attribute__((packed)) ril_sap_req_sap_connect; + + +typedef struct { + uint16_t apdu_len; + uint8_t apdu[MAX_MSG_SIZE]; +} __attribute__((packed)) ril_sap_req_transfer_apdu; + +typedef struct { + uint8_t transport_protocol; +} __attribute__((packed)) ril_sap_req_transport_protocol; + + +typedef struct { + uint8_t msg_id; +} __attribute__((packed)) ril_sap_req_sim_power; + + +typedef struct { + uint8_t msg_id; + uint8_t connection_status; + uint16_t max_msg_size; +} __attribute__((packed)) ril_sap_res_connect; + +typedef struct { + uint8_t sap_status; +} __attribute__((packed)) ril_sap_res_sap_status; + +typedef struct { + uint8_t result_code; + uint16_t atr_len; + uint8_t atr[MAX_MSG_SIZE]; +} __attribute__((packed)) ril_sap_res_transfer_atr; + +typedef struct { + uint8_t result_code; + uint16_t res_apdu_len; + uint8_t res_apdu[MAX_MSG_SIZE]; +} __attribute__((packed)) ril_sap_res_transfer_apdu; + +typedef struct { + uint8_t result_code; +} __attribute__((packed)) ril_sap_res_transport_protocol; + +typedef struct { + uint8_t msg_id; + uint8_t result_code; +} __attribute__((packed)) ril_sap_res_sim_power; + +typedef struct { + uint8_t result_code; + uint8_t card_reader_status; +} __attribute__((packed)) ril_sap_res_card_reader_status; + +typedef struct { + uint8_t disconnect_type; +} __attribute__((packed)) unsol_sap_connect; + +typedef struct { + uint8_t card_status; +} __attribute__((packed)) unsol_sap_status; + +typedef union { + unsol_sap_connect connect; + unsol_sap_status status; +} __attribute__((packed)) unsol_sap_parameters; + +typedef struct { + uint8_t sub_id; + unsol_sap_parameters param; +} __attribute__((packed)) unsol_sap_notification; + + + + +#endif + diff --git a/setup-makefiles.sh b/setup-makefiles.sh deleted file mode 100755 index a3ee9b02..00000000 --- a/setup-makefiles.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2012 The CyanogenMod 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. - -DEVICE=i9300 -MANUFACTURER=samsung - -mkdir -p ../../../vendor/$MANUFACTURER/$DEVICE - -(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/$DEVICE-vendor.mk -# Copyright (C) 2012 The CyanogenMod 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. - -# Pick up overlay for features that depend on non-open-source files -DEVICE_PACKAGE_OVERLAYS := vendor/__MANUFACTURER__/__DEVICE__/overlay - -\$(call inherit-product, vendor/__MANUFACTURER__/__DEVICE__/__DEVICE__-vendor-blobs.mk) -EOF - -(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/BoardConfigVendor.mk -# Copyright (C) 2012 The CyanogenMod 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. - -# This file is generated by device/__MANUFACTURER__/__DEVICE__/setup-makefiles.sh - -USE_CAMERA_STUB := false -BOARD_USES_GENERIC_AUDIO := false - -EOF diff --git a/system.prop b/system.prop index bc667390..8f98f1d9 100644 --- a/system.prop +++ b/system.prop @@ -6,5 +6,3 @@ rild.libpath=/system/lib/libsec-ril.so rild.libargs=-d /dev/ttyS0 ro.sf.lcd_density=320 ro.lcd_min_brightness=20 -ro.ril.hsxpa=1 -ro.ril.gprsclass=10