summaryrefslogtreecommitdiffstats
path: root/media/java/android
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2010-09-21 16:53:20 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-21 16:53:20 -0700
commitdab59d1534e50f3c818c96f34f29389f818f077b (patch)
treeff1b6b58a770fcd89b6ad5394dbc403a82a833aa /media/java/android
parent76f609118574a76b10cb90bcf061b15546bc38ee (diff)
parent6943b94b8f267c83060946bae0961efc30444dee (diff)
downloadframeworks_base-dab59d1534e50f3c818c96f34f29389f818f077b.zip
frameworks_base-dab59d1534e50f3c818c96f34f29389f818f077b.tar.gz
frameworks_base-dab59d1534e50f3c818c96f34f29389f818f077b.tar.bz2
am 6943b94b: am a6dc4699: Merge "Fix issue 2913071." into gingerbread
Merge commit '6943b94b8f267c83060946bae0961efc30444dee' * commit '6943b94b8f267c83060946bae0961efc30444dee': Fix issue 2913071.
Diffstat (limited to 'media/java/android')
-rwxr-xr-xmedia/java/android/media/Visualizer.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/media/java/android/media/Visualizer.java b/media/java/android/media/Visualizer.java
index 453fc04..33222ff 100755
--- a/media/java/android/media/Visualizer.java
+++ b/media/java/android/media/Visualizer.java
@@ -218,13 +218,16 @@ public class Visualizer {
public int setEnabled(boolean enabled)
throws IllegalStateException {
synchronized (mStateLock) {
- if ((enabled && mState != STATE_INITIALIZED) ||
- (!enabled && mState != STATE_ENABLED)) {
+ if (mState == STATE_UNINITIALIZED) {
throw(new IllegalStateException("setEnabled() called in wrong state: "+mState));
}
- int status = native_setEnabled(enabled);
- if (status == SUCCESS) {
- mState = enabled ? STATE_ENABLED : STATE_INITIALIZED;
+ int status = SUCCESS;
+ if ((enabled && (mState == STATE_INITIALIZED)) ||
+ (!enabled && (mState == STATE_ENABLED))) {
+ status = native_setEnabled(enabled);
+ if (status == SUCCESS) {
+ mState = enabled ? STATE_ENABLED : STATE_INITIALIZED;
+ }
}
return status;
}