Loading cmds/keystore/netkeystore.c +3 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ #include "netkeystore.h" #include "keymgmt.h" #define DBG 1 #define CMD_PUT_WITH_FILE "putfile" typedef void CMD_FUNC(LPC_MARSHAL *cmd, LPC_MARSHAL *reply); Loading Loading @@ -397,12 +398,12 @@ int main(const int argc, const char *argv[]) // read the command, execute and send the result back. if(read_marshal(s, &cmd)) goto err; LOGI("new connection\n"); if (DBG) LOGD("new connection\n"); execute(&cmd, &reply); write_marshal(s, &reply); err: memset(&reply, 0, sizeof(LPC_MARSHAL)); LOGI("closing connection\n"); if (DBG) LOGD("closing connection\n"); close(s); } Loading include/utils/Asset.h +12 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ public: virtual ~Asset(void); static int32_t getGlobalCount(); static String8 getAssetAllocations(); /* used when opening an asset */ typedef enum AccessMode { Loading Loading @@ -109,6 +110,12 @@ public: */ virtual int openFileDescriptor(off_t* outStart, off_t* outLength) const = 0; /* * Return whether this asset's buffer is allocated in RAM (not mmapped). * Note: not virtual so it is safe to call even when being destroyed. */ virtual bool isAllocated(void) const { return false; } /* * Get a string identifying the asset's source. This might be a full * path, it might be a colon-separated list of identifiers. Loading Loading @@ -197,6 +204,9 @@ private: AccessMode mAccessMode; // how the asset was opened String8 mAssetSource; // debug string Asset* mNext; // linked list. Asset* mPrev; }; Loading Loading @@ -239,6 +249,7 @@ public: virtual off_t getLength(void) const { return mLength; } virtual off_t getRemainingLength(void) const { return mLength-mOffset; } virtual int openFileDescriptor(off_t* outStart, off_t* outLength) const; virtual bool isAllocated(void) const { return mBuf != NULL; } private: off_t mStart; // absolute file offset of start of chunk Loading Loading @@ -295,6 +306,7 @@ public: virtual off_t getLength(void) const { return mUncompressedLen; } virtual off_t getRemainingLength(void) const { return mUncompressedLen-mOffset; } virtual int openFileDescriptor(off_t* outStart, off_t* outLength) const { return -1; } virtual bool isAllocated(void) const { return mBuf != NULL; } private: off_t mStart; // offset to start of compressed data Loading libs/audioflinger/AudioFlinger.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -202,8 +202,8 @@ void AudioFlinger::setA2dpEnabled_l(bool enable) SortedVector < sp<MixerThread::Track> > tracks; SortedVector < wp<MixerThread::Track> > activeTracks; LOGV_IF(enable, "set output to A2DP\n"); LOGV_IF(!enable, "set output to hardware audio\n"); LOGD_IF(enable, "set output to A2DP\n"); LOGD_IF(!enable, "set output to hardware audio\n"); // Transfer tracks playing on MUSIC stream from one mixer to the other if (enable) { Loading @@ -212,6 +212,7 @@ void AudioFlinger::setA2dpEnabled_l(bool enable) } else { mA2dpMixerThread->getTracks_l(tracks, activeTracks); mHardwareMixerThread->putTracks_l(tracks, activeTracks); mA2dpMixerThread->mOutput->standby(); } mA2dpEnabled = enable; mNotifyA2dpChange = true; Loading libs/utils/Asset.cpp +53 −5 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include <utils/ZipUtils.h> #include <utils/ZipFileRO.h> #include <utils/Log.h> #include <utils/threads.h> #include <string.h> #include <memory.h> Loading @@ -40,24 +41,71 @@ using namespace android; # define O_BINARY 0 #endif static volatile int32_t gCount = 0; static Mutex gAssetLock; static int32_t gCount = 0; static Asset* gHead = NULL; static Asset* gTail = NULL; int32_t Asset::getGlobalCount() { AutoMutex _l(gAssetLock); return gCount; } String8 Asset::getAssetAllocations() { AutoMutex _l(gAssetLock); String8 res; Asset* cur = gHead; while (cur != NULL) { if (cur->isAllocated()) { res.append(" "); res.append(cur->getAssetSource()); off_t size = (cur->getLength()+512)/1024; char buf[64]; sprintf(buf, ": %dK\n", (int)size); res.append(buf); } cur = cur->mNext; } return res; } Asset::Asset(void) : mAccessMode(ACCESS_UNKNOWN) { int count = android_atomic_inc(&gCount)+1; //LOGI("Creating Asset %p #%d\n", this, count); AutoMutex _l(gAssetLock); gCount++; mNext = mPrev = NULL; if (gTail == NULL) { gHead = gTail = this; } else { mPrev = gTail; gTail->mNext = this; gTail = this; } //LOGI("Creating Asset %p #%d\n", this, gCount); } Asset::~Asset(void) { int count = android_atomic_dec(&gCount); //LOGI("Destroying Asset in %p #%d\n", this, count); AutoMutex _l(gAssetLock); gCount--; if (gHead == this) { gHead = mNext; } if (gTail == this) { gTail = mPrev; } if (mNext != NULL) { mNext->mPrev = mPrev; } if (mPrev != NULL) { mPrev->mNext = mNext; } mNext = mPrev = NULL; //LOGI("Destroying Asset in %p #%d\n", this, gCount); } /* Loading vpn/java/android/net/vpn/VpnManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,8 @@ public class VpnManager { public static final int VPN_ERROR_CHALLENGE = 4; /** Error code to indicate an error of remote server hanging up. */ public static final int VPN_ERROR_REMOTE_HUNG_UP = 5; /** Error code to indicate an error of losing connectivity. */ public static final int VPN_ERROR_CONNECTION_LOST = 6; private static final int VPN_ERROR_NO_ERROR = 0; public static final String PROFILES_PATH = "/data/misc/vpn/profiles"; Loading Loading
cmds/keystore/netkeystore.c +3 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ #include "netkeystore.h" #include "keymgmt.h" #define DBG 1 #define CMD_PUT_WITH_FILE "putfile" typedef void CMD_FUNC(LPC_MARSHAL *cmd, LPC_MARSHAL *reply); Loading Loading @@ -397,12 +398,12 @@ int main(const int argc, const char *argv[]) // read the command, execute and send the result back. if(read_marshal(s, &cmd)) goto err; LOGI("new connection\n"); if (DBG) LOGD("new connection\n"); execute(&cmd, &reply); write_marshal(s, &reply); err: memset(&reply, 0, sizeof(LPC_MARSHAL)); LOGI("closing connection\n"); if (DBG) LOGD("closing connection\n"); close(s); } Loading
include/utils/Asset.h +12 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ public: virtual ~Asset(void); static int32_t getGlobalCount(); static String8 getAssetAllocations(); /* used when opening an asset */ typedef enum AccessMode { Loading Loading @@ -109,6 +110,12 @@ public: */ virtual int openFileDescriptor(off_t* outStart, off_t* outLength) const = 0; /* * Return whether this asset's buffer is allocated in RAM (not mmapped). * Note: not virtual so it is safe to call even when being destroyed. */ virtual bool isAllocated(void) const { return false; } /* * Get a string identifying the asset's source. This might be a full * path, it might be a colon-separated list of identifiers. Loading Loading @@ -197,6 +204,9 @@ private: AccessMode mAccessMode; // how the asset was opened String8 mAssetSource; // debug string Asset* mNext; // linked list. Asset* mPrev; }; Loading Loading @@ -239,6 +249,7 @@ public: virtual off_t getLength(void) const { return mLength; } virtual off_t getRemainingLength(void) const { return mLength-mOffset; } virtual int openFileDescriptor(off_t* outStart, off_t* outLength) const; virtual bool isAllocated(void) const { return mBuf != NULL; } private: off_t mStart; // absolute file offset of start of chunk Loading Loading @@ -295,6 +306,7 @@ public: virtual off_t getLength(void) const { return mUncompressedLen; } virtual off_t getRemainingLength(void) const { return mUncompressedLen-mOffset; } virtual int openFileDescriptor(off_t* outStart, off_t* outLength) const { return -1; } virtual bool isAllocated(void) const { return mBuf != NULL; } private: off_t mStart; // offset to start of compressed data Loading
libs/audioflinger/AudioFlinger.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -202,8 +202,8 @@ void AudioFlinger::setA2dpEnabled_l(bool enable) SortedVector < sp<MixerThread::Track> > tracks; SortedVector < wp<MixerThread::Track> > activeTracks; LOGV_IF(enable, "set output to A2DP\n"); LOGV_IF(!enable, "set output to hardware audio\n"); LOGD_IF(enable, "set output to A2DP\n"); LOGD_IF(!enable, "set output to hardware audio\n"); // Transfer tracks playing on MUSIC stream from one mixer to the other if (enable) { Loading @@ -212,6 +212,7 @@ void AudioFlinger::setA2dpEnabled_l(bool enable) } else { mA2dpMixerThread->getTracks_l(tracks, activeTracks); mHardwareMixerThread->putTracks_l(tracks, activeTracks); mA2dpMixerThread->mOutput->standby(); } mA2dpEnabled = enable; mNotifyA2dpChange = true; Loading
libs/utils/Asset.cpp +53 −5 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include <utils/ZipUtils.h> #include <utils/ZipFileRO.h> #include <utils/Log.h> #include <utils/threads.h> #include <string.h> #include <memory.h> Loading @@ -40,24 +41,71 @@ using namespace android; # define O_BINARY 0 #endif static volatile int32_t gCount = 0; static Mutex gAssetLock; static int32_t gCount = 0; static Asset* gHead = NULL; static Asset* gTail = NULL; int32_t Asset::getGlobalCount() { AutoMutex _l(gAssetLock); return gCount; } String8 Asset::getAssetAllocations() { AutoMutex _l(gAssetLock); String8 res; Asset* cur = gHead; while (cur != NULL) { if (cur->isAllocated()) { res.append(" "); res.append(cur->getAssetSource()); off_t size = (cur->getLength()+512)/1024; char buf[64]; sprintf(buf, ": %dK\n", (int)size); res.append(buf); } cur = cur->mNext; } return res; } Asset::Asset(void) : mAccessMode(ACCESS_UNKNOWN) { int count = android_atomic_inc(&gCount)+1; //LOGI("Creating Asset %p #%d\n", this, count); AutoMutex _l(gAssetLock); gCount++; mNext = mPrev = NULL; if (gTail == NULL) { gHead = gTail = this; } else { mPrev = gTail; gTail->mNext = this; gTail = this; } //LOGI("Creating Asset %p #%d\n", this, gCount); } Asset::~Asset(void) { int count = android_atomic_dec(&gCount); //LOGI("Destroying Asset in %p #%d\n", this, count); AutoMutex _l(gAssetLock); gCount--; if (gHead == this) { gHead = mNext; } if (gTail == this) { gTail = mPrev; } if (mNext != NULL) { mNext->mPrev = mPrev; } if (mPrev != NULL) { mPrev->mNext = mNext; } mNext = mPrev = NULL; //LOGI("Destroying Asset in %p #%d\n", this, gCount); } /* Loading
vpn/java/android/net/vpn/VpnManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,8 @@ public class VpnManager { public static final int VPN_ERROR_CHALLENGE = 4; /** Error code to indicate an error of remote server hanging up. */ public static final int VPN_ERROR_REMOTE_HUNG_UP = 5; /** Error code to indicate an error of losing connectivity. */ public static final int VPN_ERROR_CONNECTION_LOST = 6; private static final int VPN_ERROR_NO_ERROR = 0; public static final String PROFILES_PATH = "/data/misc/vpn/profiles"; Loading