Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit c93a898

Browse files
committed
Version 1.12.1 alexa-client-sdk
Changes in this update: **Bug Fixes** * Fixed a bug where the same URL was being requested twice when streaming iHeartRadio. Now, a single request is sent. * Corrected pause/resume handling in `ProgressTimer` so that extra `ProgressReportDelayElapsed` events are not sent to AVS. **Known Issues** * Music playback history isn't being displayed in the Alexa app for certain account and device types. * On GCC 8+, issues related to `-Wclass-memaccess` will trigger warnings. However, this won't cause the build to fail and these warnings can be ignored. * Android error ("libDefaultClient.so" not found) can be resolved by upgrading to ADB version 1.0.40 * When network connection is lost, lost connection status is not returned via local TTS. * `ACL` may encounter issues if audio attachments are received but not consumed. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * The Alexa app doesn't always indicate when a device is successfully connected via Bluetooth. * Connecting a product to streaming media via Bluetooth will sometimes stop media playback within the source application. Resuming playback through the source application or toggling next/previous will correct playback. * When a source device is streaming silence via Bluetooth, the Alexa app indicates that audio content is streaming. * The Bluetooth agent assumes that the Bluetooth adapter is always connected to a power source. Disconnecting from a power source during operation is not yet supported. * On some products, interrupted Bluetooth playback may not resume if other content is locally streamed. * `make integration` is currently not available for Android. In order to run integration tests on Android, you'll need to manually upload the test binary file along with any input file. At that point, the adb can be used to run the integration tests. * On Raspberry Pi running Android Things with HDMI output audio, beginning of speech is truncated when Alexa responds to user text-to-speech (TTS). * When the sample app is restarted and the network connection is lost, the Reminder TTS message does not play. Instead, the default alarm tone will play twice.
1 parent ea3ebdb commit c93a898

49 files changed

Lines changed: 1302 additions & 500 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ACL/src/Transport/DownchannelHandler.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -13,8 +13,8 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16+
#include <AVSCommon/Utils/HTTP/HttpResponseCode.h>
1617
#include <AVSCommon/Utils/HTTP2/HTTP2MimeResponseDecoder.h>
17-
#include <AVSCommon/Utils/LibcurlUtils/HttpResponseCodes.h>
1818
#include <AVSCommon/Utils/Logger/Logger.h>
1919

2020
#include "ACL/Transport/DownchannelHandler.h"
@@ -24,6 +24,7 @@
2424
namespace alexaClientSDK {
2525
namespace acl {
2626

27+
using namespace avsCommon::utils::http;
2728
using namespace avsCommon::utils::http2;
2829

2930
/// Downchannel URL
@@ -105,18 +106,23 @@ void DownchannelHandler::onActivity() {
105106

106107
bool DownchannelHandler::onReceiveResponseCode(long responseCode) {
107108
ACSDK_DEBUG5(LX(__func__).d("responseCode", responseCode));
108-
switch (responseCode) {
109+
switch (intToHTTPResponseCode(responseCode)) {
109110
case HTTPResponseCode::HTTP_RESPONSE_CODE_UNDEFINED:
110111
case HTTPResponseCode::SUCCESS_NO_CONTENT:
111-
case HTTPResponseCode::REDIRECTION_START_CODE:
112-
case HTTPResponseCode::REDIRECTION_END_CODE:
113-
case HTTPResponseCode::BAD_REQUEST:
114-
case HTTPResponseCode::SERVER_INTERNAL_ERROR:
112+
case HTTPResponseCode::SUCCESS_END_CODE:
113+
case HTTPResponseCode::REDIRECTION_MULTIPLE_CHOICES:
114+
case HTTPResponseCode::REDIRECTION_MOVED_PERMANENTLY:
115+
case HTTPResponseCode::REDIRECTION_FOUND:
116+
case HTTPResponseCode::REDIRECTION_SEE_ANOTHER:
117+
case HTTPResponseCode::REDIRECTION_TEMPORARY_REDIRECT:
118+
case HTTPResponseCode::REDIRECTION_PERMANENT_REDIRECT:
119+
case HTTPResponseCode::CLIENT_ERROR_BAD_REQUEST:
120+
case HTTPResponseCode::SERVER_ERROR_INTERNAL:
115121
break;
116122
case HTTPResponseCode::SUCCESS_OK:
117123
m_context->onDownchannelConnected();
118124
break;
119-
case HTTPResponseCode::FORBIDDEN:
125+
case HTTPResponseCode::CLIENT_ERROR_FORBIDDEN:
120126
m_context->onForbidden(m_authToken);
121127
break;
122128
}

ACL/src/Transport/HTTP2Transport.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2016-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -17,9 +17,9 @@
1717
#include <functional>
1818
#include <random>
1919

20+
#include <AVSCommon/Utils/HTTP/HttpResponseCode.h>
2021
#include <AVSCommon/Utils/HTTP2/HTTP2MimeRequestEncoder.h>
2122
#include <AVSCommon/Utils/HTTP2/HTTP2MimeResponseDecoder.h>
22-
#include <AVSCommon/Utils/LibcurlUtils/HttpResponseCodes.h>
2323
#include <AVSCommon/Utils/Logger/Logger.h>
2424
#include <AVSCommon/Utils/Timing/TimeUtils.h>
2525
#include <ACL/Transport/PostConnectInterface.h>
@@ -428,7 +428,7 @@ void HTTP2Transport::onForbidden(const std::string& authToken) {
428428
}
429429

430430
std::shared_ptr<HTTP2RequestInterface> HTTP2Transport::createAndSendRequest(const HTTP2RequestConfig& cfg) {
431-
ACSDK_DEBUG5(LX(__func__).d("type", cfg.getRequestType()).d("url", cfg.getUrl()));
431+
ACSDK_DEBUG5(LX(__func__).d("type", cfg.getRequestType()).sensitive("url", cfg.getUrl()));
432432
return m_http2Connection->createAndSendRequest(cfg);
433433
}
434434

ACL/src/Transport/MessageRequestHandler.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -17,9 +17,9 @@
1717
#include <functional>
1818
#include <unordered_map>
1919

20+
#include <AVSCommon/Utils/HTTP/HttpResponseCode.h>
2021
#include <AVSCommon/Utils/HTTP2/HTTP2MimeRequestEncoder.h>
2122
#include <AVSCommon/Utils/HTTP2/HTTP2MimeResponseDecoder.h>
22-
#include <AVSCommon/Utils/LibcurlUtils/HttpResponseCodes.h>
2323
#include <AVSCommon/Utils/Logger/Logger.h>
2424

2525
#include "ACL/Transport/HTTP2Transport.h"
@@ -31,6 +31,7 @@ namespace acl {
3131

3232
using namespace avsCommon::avs::attachment;
3333
using namespace avsCommon::sdkInterfaces;
34+
using namespace avsCommon::utils::http;
3435
using namespace avsCommon::utils::http2;
3536

3637
/// URL to send events to
@@ -246,7 +247,7 @@ bool MessageRequestHandler::onReceiveResponseCode(long responseCode) {
246247

247248
reportMessageRequestAcknowledged();
248249

249-
if (HTTPResponseCode::FORBIDDEN == responseCode) {
250+
if (HTTPResponseCode::CLIENT_ERROR_FORBIDDEN == intToHTTPResponseCode(responseCode)) {
250251
m_context->onForbidden(m_authToken);
251252
}
252253

@@ -264,7 +265,7 @@ void MessageRequestHandler::onResponseFinished(HTTP2ResponseFinishedStatus statu
264265
reportMessageRequestAcknowledged();
265266
reportMessageRequestFinished();
266267

267-
if (m_responseCode != HTTPResponseCode::SUCCESS_OK && !nonMimeBody.empty()) {
268+
if ((intToHTTPResponseCode(m_responseCode) != HTTPResponseCode::SUCCESS_OK) && !nonMimeBody.empty()) {
268269
m_messageRequest->exceptionReceived(nonMimeBody);
269270
}
270271

@@ -289,9 +290,9 @@ void MessageRequestHandler::onResponseFinished(HTTP2ResponseFinishedStatus statu
289290
{HTTPResponseCode::HTTP_RESPONSE_CODE_UNDEFINED, MessageRequestObserverInterface::Status::INTERNAL_ERROR},
290291
{HTTPResponseCode::SUCCESS_OK, MessageRequestObserverInterface::Status::SUCCESS},
291292
{HTTPResponseCode::SUCCESS_NO_CONTENT, MessageRequestObserverInterface::Status::SUCCESS_NO_CONTENT},
292-
{HTTPResponseCode::BAD_REQUEST, MessageRequestObserverInterface::Status::BAD_REQUEST},
293-
{HTTPResponseCode::FORBIDDEN, MessageRequestObserverInterface::Status::INVALID_AUTH},
294-
{HTTPResponseCode::SERVER_INTERNAL_ERROR, MessageRequestObserverInterface::Status::SERVER_INTERNAL_ERROR_V2}};
293+
{HTTPResponseCode::CLIENT_ERROR_BAD_REQUEST, MessageRequestObserverInterface::Status::BAD_REQUEST},
294+
{HTTPResponseCode::CLIENT_ERROR_FORBIDDEN, MessageRequestObserverInterface::Status::INVALID_AUTH},
295+
{HTTPResponseCode::SERVER_ERROR_INTERNAL, MessageRequestObserverInterface::Status::SERVER_INTERNAL_ERROR_V2}};
295296

296297
auto result = MessageRequestObserverInterface::Status::INTERNAL_ERROR;
297298

ACL/src/Transport/PingHandler.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -13,15 +13,16 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16+
#include <AVSCommon/Utils/HTTP/HttpResponseCode.h>
1617
#include <AVSCommon/Utils/Logger/Logger.h>
17-
#include <AVSCommon/Utils/LibcurlUtils/HttpResponseCodes.h>
1818

1919
#include "ACL/Transport/HTTP2Transport.h"
2020
#include "ACL/Transport/PingHandler.h"
2121

2222
namespace alexaClientSDK {
2323
namespace acl {
2424

25+
using namespace avsCommon::utils::http;
2526
using namespace avsCommon::utils::http2;
2627

2728
/// URL to send pings to
@@ -90,7 +91,8 @@ void PingHandler::reportPingAcknowledged() {
9091
ACSDK_DEBUG5(LX(__func__));
9192
if (!m_wasPingAcknowledgedReported) {
9293
m_wasPingAcknowledgedReported = true;
93-
m_context->onPingRequestAcknowledged(HTTPResponseCode::SUCCESS_NO_CONTENT == m_responseCode);
94+
m_context->onPingRequestAcknowledged(
95+
HTTPResponseCode::SUCCESS_NO_CONTENT == intToHTTPResponseCode(m_responseCode));
9496
}
9597
}
9698

@@ -107,7 +109,7 @@ HTTP2SendDataResult PingHandler::onSendData(char* bytes, size_t size) {
107109
bool PingHandler::onReceiveResponseCode(long responseCode) {
108110
ACSDK_DEBUG5(LX(__func__).d("responseCode", responseCode));
109111

110-
if (HTTPResponseCode::FORBIDDEN == responseCode) {
112+
if (HTTPResponseCode::CLIENT_ERROR_FORBIDDEN == intToHTTPResponseCode(responseCode)) {
111113
m_context->onForbidden(m_authToken);
112114
}
113115

ACL/test/Transport/Common/MockHTTP2Connection.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ namespace utils {
2121
namespace http2 {
2222
namespace test {
2323

24+
using namespace avsCommon::utils::http;
25+
2426
MockHTTP2Connection::MockHTTP2Connection(std::string dURL, std::string pingURL) :
2527
m_downchannelURL{dURL},
2628
m_pingURL{pingURL},
@@ -50,7 +52,7 @@ std::shared_ptr<HTTP2RequestInterface> MockHTTP2Connection::createAndSendRequest
5052
std::lock_guard<std::mutex> lock(m_postRequestMutex);
5153
m_postRequestQueue.push_back(request);
5254
if (m_postResponseCode != HTTPResponseCode::HTTP_RESPONSE_CODE_UNDEFINED) {
53-
request->getSink()->onReceiveResponseCode(m_postResponseCode);
55+
request->getSink()->onReceiveResponseCode(responseCodeToInt(m_postResponseCode));
5456
}
5557
if (m_postRequestQueue.size() > m_maxPostRequestsEnqueued) {
5658
m_maxPostRequestsEnqueued = m_postRequestQueue.size();
@@ -120,7 +122,8 @@ std::shared_ptr<MockHTTP2Request> MockHTTP2Connection::waitForPostRequest(const
120122
auto request = m_postRequestQueue.back();
121123

122124
// Need to send 200 to MIME decoder in order for it parse the message.
123-
request->getMimeDecoder()->onReceiveResponseCode(SUCCESS_OK);
125+
request->getMimeDecoder()->onReceiveResponseCode(
126+
static_cast<std::underlying_type<HTTPResponseCode>::type>(HTTPResponseCode::SUCCESS_OK));
124127

125128
// Feed the header lines to the MIME decoder.
126129
for (auto headerLine : request->getSource()->getRequestHeaderLines()) {

ACL/test/Transport/HTTP2TransportTest.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -28,8 +28,8 @@
2828
#include <AVSCommon/AVS/Attachment/AttachmentManager.h>
2929
#include <AVSCommon/AVS/Attachment/AttachmentUtils.h>
3030
#include <AVSCommon/Utils/PromiseFuturePair.h>
31+
#include <AVSCommon/Utils/HTTP/HttpResponseCode.h>
3132
#include <AVSCommon/Utils/HTTP2/HTTP2RequestConfig.h>
32-
#include <AVSCommon/Utils/LibcurlUtils/HttpResponseCodes.h>
3333

3434
#include "MockAuthDelegate.h"
3535
#include "MockHTTP2Connection.h"
@@ -49,6 +49,7 @@ using namespace avsCommon::avs;
4949
using namespace avsCommon::avs::attachment;
5050
using namespace avsCommon::sdkInterfaces;
5151
using namespace avsCommon::utils;
52+
using namespace avsCommon::utils::http;
5253
using namespace avsCommon::utils::http2;
5354
using namespace avsCommon::utils::http2::test;
5455
using namespace ::testing;
@@ -478,7 +479,7 @@ TEST_F(HTTP2TransportTest, retryOnDownchannelConnectionFailure) {
478479

479480
// The Mock HTTP2Request replies to any downchannel request with a 500.
480481
ASSERT_TRUE(m_mockHttp2Connection->respondToDownchannelRequests(
481-
static_cast<long>(SERVER_INTERNAL_ERROR), false, RESPONSE_TIMEOUT));
482+
static_cast<long>(HTTPResponseCode::SERVER_ERROR_INTERNAL), false, RESPONSE_TIMEOUT));
482483

483484
// Wait for a long time (up to 10 second), terminating the wait when the mock of HTTP2Connection receives a second
484485
// attempt to create a downchannel request.
@@ -738,7 +739,7 @@ TEST_F(HTTP2TransportTest, onSendCompletedNotification) {
738739
HTTP2ResponseFinishedStatus::TIMEOUT,
739740
MessageRequestObserverInterface::Status::TIMEDOUT)},
740741
{std::make_tuple(
741-
HTTPResponseCode::BAD_REQUEST,
742+
HTTPResponseCode::CLIENT_ERROR_BAD_REQUEST,
742743
static_cast<HTTP2ResponseFinishedStatus>(-1),
743744
MessageRequestObserverInterface::Status::INTERNAL_ERROR)},
744745
{std::make_tuple(
@@ -762,15 +763,15 @@ TEST_F(HTTP2TransportTest, onSendCompletedNotification) {
762763
HTTP2ResponseFinishedStatus::COMPLETE,
763764
MessageRequestObserverInterface::Status::SERVER_OTHER_ERROR)},
764765
{std::make_tuple(
765-
HTTPResponseCode::BAD_REQUEST,
766+
HTTPResponseCode::CLIENT_ERROR_BAD_REQUEST,
766767
HTTP2ResponseFinishedStatus::COMPLETE,
767768
MessageRequestObserverInterface::Status::BAD_REQUEST)},
768769
{std::make_tuple(
769-
HTTPResponseCode::FORBIDDEN,
770+
HTTPResponseCode::CLIENT_ERROR_FORBIDDEN,
770771
HTTP2ResponseFinishedStatus::COMPLETE,
771772
MessageRequestObserverInterface::Status::INVALID_AUTH)},
772773
{std::make_tuple(
773-
HTTPResponseCode::SERVER_INTERNAL_ERROR,
774+
HTTPResponseCode::SERVER_ERROR_INTERNAL,
774775
HTTP2ResponseFinishedStatus::COMPLETE,
775776
MessageRequestObserverInterface::Status::SERVER_INTERNAL_ERROR_V2)},
776777
{std::make_tuple(
@@ -837,7 +838,7 @@ TEST_F(HTTP2TransportTest, onExceptionReceivedNon200Content) {
837838

838839
auto request = m_mockHttp2Connection->waitForPostRequest(RESPONSE_TIMEOUT);
839840
ASSERT_NE(request, nullptr);
840-
request->getSink()->onReceiveResponseCode(HTTPResponseCode::SERVER_INTERNAL_ERROR);
841+
request->getSink()->onReceiveResponseCode(HTTPResponseCode::SERVER_ERROR_INTERNAL);
841842
request->getSink()->onReceiveData(NON_MIME_PAYLOAD.c_str(), NON_MIME_PAYLOAD.size());
842843
request->getSink()->onResponseFinished(HTTP2ResponseFinishedStatus::COMPLETE);
843844

@@ -1078,7 +1079,7 @@ TEST_F(HTTP2TransportTest, tearDownPingFailure) {
10781079
auto pingRequest = m_mockHttp2Connection->waitForPingRequest(RESPONSE_TIMEOUT);
10791080
ASSERT_TRUE(pingRequest);
10801081
m_mockHttp2Connection->dequePingRequest();
1081-
pingRequest->getSink()->onReceiveResponseCode(HTTPResponseCode::BAD_REQUEST);
1082+
pingRequest->getSink()->onReceiveResponseCode(HTTPResponseCode::CLIENT_ERROR_BAD_REQUEST);
10821083
pingRequest->getSink()->onResponseFinished(HTTP2ResponseFinishedStatus::COMPLETE);
10831084
});
10841085

ACL/test/Transport/MockHTTP2Connection.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -28,8 +28,8 @@
2828

2929
#include <ACL/Transport/MessageConsumerInterface.h>
3030
#include <AVSCommon/Utils/PromiseFuturePair.h>
31+
#include <AVSCommon/Utils/HTTP/HttpResponseCode.h>
3132
#include <AVSCommon/Utils/HTTP2/HTTP2ConnectionInterface.h>
32-
#include <AVSCommon/Utils/LibcurlUtils/HttpResponseCodes.h>
3333

3434
#include "MockHTTP2Request.h"
3535

@@ -133,7 +133,7 @@ class MockHTTP2Connection : public HTTP2ConnectionInterface {
133133
* @param responseCode The HTTP response code to reply to the request. If set to @c
134134
* HTTPResponseCode::HTTP_RESPONSE_CODE_UNDEFINED, a response code will not be sent.
135135
*/
136-
void setResponseToPOSTRequests(HTTPResponseCode responseCode);
136+
void setResponseToPOSTRequests(http::HTTPResponseCode responseCode);
137137

138138
/**
139139
* Retrieve the first HTTP2 request made on the downchannel.
@@ -253,7 +253,7 @@ class MockHTTP2Connection : public HTTP2ConnectionInterface {
253253
PromiseFuturePair<void> m_receivedPauseOnSend;
254254

255255
/// The response code to be replied for every POST request received.
256-
HTTPResponseCode m_postResponseCode;
256+
http::HTTPResponseCode m_postResponseCode;
257257

258258
/// The maximum number of POST requests in the queue at any given time.
259259
std::size_t m_maxPostRequestsEnqueued;

AVSCommon/SDKInterfaces/include/AVSCommon/SDKInterfaces/CapabilitiesObserverInterface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -113,7 +113,7 @@ inline std::ostream& operator<<(std::ostream& stream, const CapabilitiesObserver
113113
case CapabilitiesObserverInterface::Error::SERVER_INTERNAL_ERROR:
114114
return stream << "SERVER_INTERNAL_ERROR";
115115
case CapabilitiesObserverInterface::Error::BAD_REQUEST:
116-
return stream << "BAD_REQUEST";
116+
return stream << "CLIENT_ERROR_BAD_REQUEST";
117117
}
118118
return stream << "Unknown CapabilitiesObserverInterface::Error!: " << error;
119119
}

0 commit comments

Comments
 (0)