summaryrefslogtreecommitdiffstats
path: root/src/utils/qdroidutils.cpp
diff options
context:
space:
mode:
authorRainer Keller <rainer.keller@digia.com>2013-10-17 16:01:30 +0200
committerRainer Keller <rainer.keller@digia.com>2013-10-17 17:08:57 +0300
commit5c15d009309c62646165e074ed49f86c073bf30b (patch)
treec38ab223bd6c9da7a440b4d7543af0a2ee84c60e /src/utils/qdroidutils.cpp
parent7b09f72dcc5f8c0f3a698af420fcb35ad697da88 (diff)
Add error handling to existing audio functions
Change-Id: Icb7113f1a251b076f49c052bebee3fbd2e6139e8 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/utils/qdroidutils.cpp')
-rw-r--r--src/utils/qdroidutils.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/utils/qdroidutils.cpp b/src/utils/qdroidutils.cpp
index 31ed09c..9a5d18d 100644
--- a/src/utils/qdroidutils.cpp
+++ b/src/utils/qdroidutils.cpp
@@ -1,5 +1,6 @@
#include "qdroidutils.h"
#include <unistd.h>
+#include <QDebug>
#ifdef Q_OS_ANDROID_NO_SDK
#include <cutils/android_reboot.h>
@@ -55,8 +56,11 @@ void QDroidUtils::powerOffSystem()
void QDroidUtils::setMasterVolume(int volume)
{
#ifdef Q_OS_ANDROID_NO_SDK
+ android::status_t rc;
volume = qBound(0, volume, 100);
- android::AudioSystem::setMasterVolume(android::AudioSystem::linearToLog(volume));
+ rc = android::AudioSystem::setMasterVolume(android::AudioSystem::linearToLog(volume));
+ if (rc != android::NO_ERROR)
+ qWarning() << Q_FUNC_INFO << "Error while setting audio properties.";
#endif
}
@@ -70,7 +74,10 @@ void QDroidUtils::setMasterVolume(int volume)
void QDroidUtils::setMasterMute(bool mute)
{
#ifdef Q_OS_ANDROID_NO_SDK
- android::AudioSystem::setMasterMute(mute);
+ android::status_t rc;
+ rc = android::AudioSystem::setMasterMute(mute);
+ if (rc != android::NO_ERROR)
+ qWarning() << Q_FUNC_INFO << "Error while setting audio properties.";
#endif
}
@@ -118,9 +125,12 @@ void QDroidUtils::setMasterMute(bool mute)
void QDroidUtils::setStreamVolume(AudioStreamType streamType, int volume)
{
#ifdef Q_OS_ANDROID_NO_SDK
+ android::status_t rc;
volume = qBound(0, volume, 100);
- android::AudioSystem::setStreamVolume(audio_stream_type_t(streamType),
+ rc = android::AudioSystem::setStreamVolume(audio_stream_type_t(streamType),
android::AudioSystem::linearToLog(volume), 0);
+ if (rc != android::NO_ERROR)
+ qWarning() << Q_FUNC_INFO << "Error while setting audio properties.";
#endif
}
@@ -133,7 +143,10 @@ void QDroidUtils::setStreamVolume(AudioStreamType streamType, int volume)
void QDroidUtils::setStreamMute(AudioStreamType streamType, bool mute)
{
#ifdef Q_OS_ANDROID_NO_SDK
- android::AudioSystem::setStreamMute(audio_stream_type_t(streamType), mute);
+ android::status_t rc;
+ rc = android::AudioSystem::setStreamMute(audio_stream_type_t(streamType), mute);
+ if (rc != android::NO_ERROR)
+ qWarning() << Q_FUNC_INFO << "Error while setting audio properties.";
#endif
}