Merge "Fix timer and RtcpEncoder mutex nesting" into udc-qpr-dev am: 27467d304b

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/ImsMedia/+/25418378

Change-Id: I991d32917f5bc9d104faf9a5819eb2afd3316f15
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/OWNERS b/OWNERS
index 88957dc..116f70a 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,3 +1,4 @@
+# Bug component: 108161
 jayachandranc@google.com
 amruthr@google.com
 seheele@google.com
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtcpConfig.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtcpConfig.cpp
index 1e196a1..0534918 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtcpConfig.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtcpConfig.cpp
@@ -20,7 +20,7 @@
 
 RtcpConfig::RtcpConfig(const RtcpConfig& config)
 {
-    this->canonicalName = String8(config.canonicalName.string());
+    this->canonicalName = String8(config.canonicalName.c_str());
     this->transmitPort = config.transmitPort;
     this->intervalSec = config.intervalSec;
     this->rtcpXrBlockTypes = config.rtcpXrBlockTypes;
@@ -32,7 +32,7 @@
 {
     if (this != &config)
     {
-        this->canonicalName = String8(config.canonicalName.string());
+        this->canonicalName = String8(config.canonicalName.c_str());
         this->transmitPort = config.transmitPort;
         this->intervalSec = config.intervalSec;
         this->rtcpXrBlockTypes = config.rtcpXrBlockTypes;
@@ -105,7 +105,7 @@
         return err;
     }
 
-    canonicalName = String8(name.string());
+    canonicalName = String8(name.c_str());
 
     err = in->readInt32(&transmitPort);
     if (err != NO_ERROR)
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtpConfig.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtpConfig.cpp
index 93c6492..49967d0 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtpConfig.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtpConfig.cpp
@@ -53,7 +53,7 @@
     type = config->type;
     direction = config->direction;
     accessNetwork = config->accessNetwork;
-    remoteAddress = String8(config->remoteAddress.string());
+    remoteAddress = String8(config->remoteAddress.c_str());
     remotePort = config->remotePort;
     rtcpConfig = config->rtcpConfig;
     dscp = config->dscp;
@@ -68,7 +68,7 @@
     type = config.type;
     direction = config.direction;
     accessNetwork = config.accessNetwork;
-    remoteAddress = String8(config.remoteAddress.string());
+    remoteAddress = String8(config.remoteAddress.c_str());
     remotePort = config.remotePort;
     rtcpConfig = config.rtcpConfig;
     dscp = config.dscp;
@@ -85,7 +85,7 @@
         type = config.type;
         direction = config.direction;
         accessNetwork = config.accessNetwork;
-        remoteAddress = String8(config.remoteAddress.string());
+        remoteAddress = String8(config.remoteAddress.c_str());
         remotePort = config.remotePort;
         rtcpConfig = config.rtcpConfig;
         dscp = config.dscp;
@@ -247,7 +247,7 @@
     }
     else if (err == NO_ERROR)
     {
-        remoteAddress = String8(address.string());
+        remoteAddress = String8(address.c_str());
     }
     else
     {
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/VideoConfig.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/VideoConfig.cpp
index afd6bf0..ff010ad 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/VideoConfig.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/VideoConfig.cpp
@@ -373,7 +373,7 @@
         return err;
     }
 
-    pauseImagePath = String8(path.string());
+    pauseImagePath = String8(path.c_str());
 
     err = in->readInt32(&deviceOrientationDegree);
     if (err != NO_ERROR)
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextManager.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextManager.cpp
index 0d39824..2f9c5cf 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextManager.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextManager.cpp
@@ -209,7 +209,7 @@
         {
             android::String16 text;
             parcel.readString16(&text);
-            android::String8* rttText = new String8(text.string());
+            android::String8* rttText = new String8(text.c_str());
             ImsMediaEventHandler::SendEvent(
                     "TEXT_REQUEST_EVENT", nMsg, sessionId, reinterpret_cast<uint64_t>(rttText));
         }
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextSourceNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextSourceNode.cpp
index 2dd4baf..8232e30 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextSourceNode.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextSourceNode.cpp
@@ -154,7 +154,7 @@
     IMLOGD2("[SendRtt] size[%u], listSize[%d]", text->length(), mDataQueue.GetCount());
 
     uint8_t tempBuffer[MAX_RTT_LEN] = {'\0'};
-    memcpy(tempBuffer, text->string(), text->length());
+    memcpy(tempBuffer, text->c_str(), text->length());
 
     std::lock_guard<std::mutex> guard(mMutex);
     AddData(tempBuffer, text->length(), 0, false, 0);
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp
index 38b7177..8a3dd3f 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp
@@ -73,7 +73,7 @@
 
 void ImsMediaVideoSource::SetImagePath(const android::String8& path)
 {
-    IMLOGD1("[SetImagePath] path[%s]", path.string());
+    IMLOGD1("[SetImagePath] path[%s]", path.c_str());
     mImagePath = path;
 }
 
diff --git a/tests/native/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNodeTest.cpp b/tests/native/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNodeTest.cpp
index 0be56b6..6bab856 100644
--- a/tests/native/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNodeTest.cpp
+++ b/tests/native/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNodeTest.cpp
@@ -60,7 +60,7 @@
         ASSERT_TRUE(type != kImsMediaEventNotifyError);
         String8* text = reinterpret_cast<String8*>(param1);
         ASSERT_TRUE(text != nullptr);
-        mReceivedText.setTo(*text);
+        mReceivedText = *text;
 
         if (mReceivedText == strCharReplacement)
         {
@@ -147,7 +147,7 @@
             MEDIASUBTYPE_UNDEFINED, reinterpret_cast<uint8_t*>(tempBuffer1.get()), 3, 0, true, 0);
 
     std::unique_ptr<char> tempBuffer2(new char[testString.length()]);
-    memcpy(tempBuffer2.get(), testString.string(), testString.length());
+    memcpy(tempBuffer2.get(), testString.c_str(), testString.length());
 
     mNode->OnDataFromFrontNode(MEDIASUBTYPE_UNDEFINED,
             reinterpret_cast<uint8_t*>(tempBuffer2.get()), testString.length(), 1, false, 1);
@@ -175,7 +175,7 @@
     {
         String8 text = *iter;
         std::unique_ptr<char> tempBuffer(new char[text.length()]);
-        memcpy(tempBuffer.get(), text.string(), text.length());
+        memcpy(tempBuffer.get(), text.c_str(), text.length());
 
         mNode->OnDataFromFrontNode(MEDIASUBTYPE_UNDEFINED,
                 reinterpret_cast<uint8_t*>(tempBuffer.get()), text.length(), index, false, index);
@@ -199,7 +199,7 @@
     testString1.append(testString2);
 
     std::unique_ptr<char> tempBuffer(new char[testString1.length()]);
-    memcpy(tempBuffer.get(), testString1.string(), testString1.length());
+    memcpy(tempBuffer.get(), testString1.c_str(), testString1.length());
 
     mNode->OnDataFromFrontNode(MEDIASUBTYPE_UNDEFINED, reinterpret_cast<uint8_t*>(tempBuffer.get()),
             testString1.length(), 1, true, 1);
@@ -218,13 +218,13 @@
     String8 testString2 = String8("world");
 
     std::unique_ptr<char> tempBuffer1(new char[testString1.length()]);
-    memcpy(tempBuffer1.get(), testString1.string(), testString1.length());
+    memcpy(tempBuffer1.get(), testString1.c_str(), testString1.length());
 
     mNode->OnDataFromFrontNode(MEDIASUBTYPE_UNDEFINED,
             reinterpret_cast<uint8_t*>(tempBuffer1.get()), testString1.length(), 1, false, 1);
 
     std::unique_ptr<char> tempBuffer2(new char[testString2.length()]);
-    memcpy(tempBuffer2.get(), testString2.string(), testString2.length());
+    memcpy(tempBuffer2.get(), testString2.c_str(), testString2.length());
 
     mNode->OnDataFromFrontNode(MEDIASUBTYPE_UNDEFINED,
             reinterpret_cast<uint8_t*>(tempBuffer2.get()), testString2.length(), 0, false, 0);
@@ -254,7 +254,7 @@
     const uint32_t seq2 = numLost;
 
     std::unique_ptr<char> tempBuffer1(new char[testString1.length()]);
-    memcpy(tempBuffer1.get(), testString1.string(), testString1.length());
+    memcpy(tempBuffer1.get(), testString1.c_str(), testString1.length());
 
     mNode->OnDataFromFrontNode(MEDIASUBTYPE_UNDEFINED,
             reinterpret_cast<uint8_t*>(tempBuffer1.get()), testString1.length(), seq1, true, seq1);
@@ -262,7 +262,7 @@
     EXPECT_EQ(mFakeCallback->getReceivedText(), testString1);
 
     std::unique_ptr<char> tempBuffer2(new char[testString2.length()]);
-    memcpy(tempBuffer2.get(), testString2.string(), testString2.length());
+    memcpy(tempBuffer2.get(), testString2.c_str(), testString2.length());
 
     mNode->OnDataFromFrontNode(MEDIASUBTYPE_UNDEFINED,
             reinterpret_cast<uint8_t*>(tempBuffer2.get()), testString2.length(), seq2, true, seq2);
@@ -299,7 +299,7 @@
     }
 
     std::unique_ptr<char> tempBuffer(new char[testString2.length()]);
-    memcpy(tempBuffer.get(), testString2.string(), testString2.length());
+    memcpy(tempBuffer.get(), testString2.c_str(), testString2.length());
 
     mNode->OnDataFromFrontNode(MEDIASUBTYPE_UNDEFINED, reinterpret_cast<uint8_t*>(tempBuffer.get()),
             testString2.length(), 0, true, 0);
diff --git a/tests/native/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextSourceNodeTest.cpp b/tests/native/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextSourceNodeTest.cpp
index b7d5b73..e64f53d 100644
--- a/tests/native/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextSourceNodeTest.cpp
+++ b/tests/native/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextSourceNodeTest.cpp
@@ -172,7 +172,7 @@
 
     mCondition.wait_timeout(kTextInterval);
     mNode->ProcessData();
-    EXPECT_EQ(memcmp(mFakeNode->getData(), testText1.string(), testText1.length()), 0);
+    EXPECT_EQ(memcmp(mFakeNode->getData(), testText1.c_str(), testText1.length()), 0);
 
     mCondition.wait_timeout(kTextInterval);
     mNode->ProcessData();
@@ -194,7 +194,7 @@
 
     mCondition.wait_timeout(kTextInterval);
     mNode->ProcessData();
-    EXPECT_EQ(memcmp(mFakeNode->getData(), testText2.string(), testText2.length()), 0);
+    EXPECT_EQ(memcmp(mFakeNode->getData(), testText2.c_str(), testText2.length()), 0);
 
     mCondition.wait_timeout(kTextInterval);
     mNode->ProcessData();
@@ -216,7 +216,7 @@
 
     mCondition.wait_timeout(kTextInterval);
     mNode->ProcessData();
-    EXPECT_EQ(memcmp(mFakeNode->getData(), testText3.string(), testText3.length()), 0);
+    EXPECT_EQ(memcmp(mFakeNode->getData(), testText3.c_str(), testText3.length()), 0);
 
     mCondition.wait_timeout(kTextInterval);
     mNode->ProcessData();
@@ -238,7 +238,7 @@
 
     mCondition.wait_timeout(kTextInterval);
     mNode->ProcessData();
-    EXPECT_EQ(memcmp(mFakeNode->getData(), testText4.string(), testText4.length()), 0);
+    EXPECT_EQ(memcmp(mFakeNode->getData(), testText4.c_str(), testText4.length()), 0);
 
     mCondition.wait_timeout(kTextInterval);
     mNode->ProcessData();
@@ -269,7 +269,7 @@
 
     mCondition.wait_timeout(kTextInterval);
     mNode->ProcessData();
-    EXPECT_EQ(memcmp(mFakeNode->getData(), testText5.string(), testText5.length()), 0);
+    EXPECT_EQ(memcmp(mFakeNode->getData(), testText5.c_str(), testText5.length()), 0);
 
     mCondition.wait_timeout(kTextInterval);
     mNode->ProcessData();
diff --git a/tests/unit/Android.bp b/tests/unit/Android.bp
index c6f4149..498f5e1 100644
--- a/tests/unit/Android.bp
+++ b/tests/unit/Android.bp
@@ -32,7 +32,7 @@
         "platform-test-annotations",
         "testables",
         "testng",
-        "truth-prebuilt",
+        "truth",
     ],
     certificate: "platform",
     test_suites: ["device-tests"],