diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h index d83a33cef..7d3fcf2a8 100644 --- a/include/utils/ResourceTypes.h +++ b/include/utils/ResourceTypes.h @@ -1101,16 +1101,22 @@ struct ResTable_config return false; } - // Return true if 'this' can be considered a match for the parameters in + // Return true if 'this' can be considered a match for the parameters in // 'settings'. + // Note this is asymetric. A default piece of data will match every request + // but a request for the default should not match odd specifics + // (ie, request with no mcc should not match a particular mcc's data) + // settings is the requested settings inline bool match(const ResTable_config& settings) const { if (imsi != 0) { - if (settings.mcc != 0 && mcc != 0 - && mcc != settings.mcc) { + if ((settings.mcc != 0 && mcc != 0 + && mcc != settings.mcc) || + (settings.mcc == 0 && mcc != 0)) { return false; } - if (settings.mnc != 0 && mnc != 0 - && mnc != settings.mnc) { + if ((settings.mnc != 0 && mnc != 0 + && mnc != settings.mnc) || + (settings.mnc == 0 && mnc != 0)) { return false; } } diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp index 74271ba3b..5f407a990 100644 --- a/libs/utils/Threads.cpp +++ b/libs/utils/Threads.cpp @@ -896,6 +896,7 @@ void ReadWriteLock::unlockForRead() { mLock.lock(); if (mNumReaders == 0) { + mLock.unlock(); LOG(LOG_WARN, "thread", "WARNING: unlockForRead requested, but not locked\n"); return; @@ -961,6 +962,7 @@ void ReadWriteLock::unlockForWrite() { mLock.lock(); if (mNumWriters == 0) { + mLock.unlock(); LOG(LOG_WARN, "thread", "WARNING: unlockForWrite requested, but not locked\n"); return; @@ -972,7 +974,7 @@ void ReadWriteLock::unlockForWrite() //printf(" wrlk held %.3f msec\n", // (double) mDebugTimer.durationUsecs() / 1000.0); #endif - // mWriteWaiter.signal(); // should other writers get first dibs? + mWriteWaiter.signal(); // should other writers get first dibs? //printf("+++ signaling readers (if any)\n"); mReadWaiter.broadcast(); // wake all readers (if any) mLock.unlock();