Merge "Camera: API1: Improve ZSL mode activation heuristics" into nyc-mr1-dev
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index 411519d..34445e0 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -831,14 +831,15 @@
mProcessSize = (mSamplingRate * 20) / 1000;
char value[PROPERTY_VALUE_MAX];
- property_get("gsm.operator.iso-country", value, "");
- if (strcmp(value,"us") == 0 ||
- strcmp(value,"ca") == 0) {
+ if (property_get("gsm.operator.iso-country", value, "") == 0) {
+ property_get("gsm.sim.operator.iso-country", value, "");
+ }
+ if (strstr(value, "us") != NULL ||
+ strstr(value, "ca") != NULL) {
mRegion = ANSI;
- } else if (strcmp(value,"jp") == 0) {
+ } else if (strstr(value, "jp") != NULL) {
mRegion = JAPAN;
- } else if (strcmp(value,"uk") == 0 ||
- strcmp(value,"uk,uk") == 0) {
+ } else if (strstr(value, "uk") != NULL) {
mRegion = UK;
} else {
mRegion = CEPT;
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index 1cbcaa9..ff5c4d4 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -2682,9 +2682,12 @@
status_t MediaCodec::connectToSurface(const sp<Surface> &surface) {
status_t err = OK;
if (surface != NULL) {
+ uint64_t oldId, newId;
if (mSurface != NULL
- && surface->getConsumerName() == mSurface->getConsumerName()) {
- ALOGI("connecting to native window with same name. Assuming no change of surface");
+ && surface->getUniqueId(&newId) == NO_ERROR
+ && mSurface->getUniqueId(&oldId) == NO_ERROR
+ && newId == oldId) {
+ ALOGI("[%s] connecting to the same surface. Nothing to do.", mComponentName.c_str());
return ALREADY_EXISTS;
}