summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2014-06-03 01:16:18 (GMT)
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2014-06-03 01:16:18 (GMT)
commit418ac5ee222c2734af677d92cf318f2b033fd7bd (patch)
tree08e2e3db703c977325d4d0fb15d01831a888b5eb
parentaecf604ef14f07e078c309b015c2333e22640789 (diff)
parentce2b95ae200332495b348be07f77fe60b6c23dcc (diff)
downloadandroid_frameworks_ex-stable/cm-11.0.zip
android_frameworks_ex-stable/cm-11.0.tar.gz
android_frameworks_ex-stable/cm-11.0.tar.bz2
Android 4.4.3 release 1
-rw-r--r--carousel/test/res/values-am/strings.xml2
-rw-r--r--carousel/test/res/values-ca/strings.xml2
-rw-r--r--variablespeed/jni/jni_entry.cc7
-rw-r--r--variablespeed/jni/variablespeed.cc19
-rw-r--r--variablespeed/jni/variablespeed.h1
-rw-r--r--variablespeed/src/com/android/ex/variablespeed/MediaPlayerProxy.java1
-rw-r--r--variablespeed/src/com/android/ex/variablespeed/SingleThreadedMediaPlayerProxy.java5
-rw-r--r--variablespeed/src/com/android/ex/variablespeed/VariableSpeed.java9
8 files changed, 35 insertions, 11 deletions
diff --git a/carousel/test/res/values-am/strings.xml b/carousel/test/res/values-am/strings.xml
index 5f4b961..f1e8da2 100644
--- a/carousel/test/res/values-am/strings.xml
+++ b/carousel/test/res/values-am/strings.xml
@@ -21,7 +21,7 @@
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="music_demo_activity_label" msgid="4382090808250495841">"የሙዚቃ Carousel"</string>
<string name="carousel_test_activity_label" msgid="6014624482213318747">"የCarousel ፍተሻ"</string>
- <string name="carousel_test_activity_description" msgid="1632693812604375483">"የCarouselን ጥቅም የሚያሳይ ትግበራ"</string>
+ <string name="carousel_test_activity_description" msgid="1632693812604375483">"የCarouselን ጥቅም የሚያሳይ መተግበሪያ"</string>
<string name="task_switcher_activity_label" msgid="714620143340933546">"ክንውን ቀያያሪ"</string>
<string name="recent_tasks_title" msgid="1030287226205477117">"የቅርብ ጊዜ ትግበራዎች"</string>
<string name="no_recent_tasks" msgid="6884096266670555780">"ምንም የቅርብ ጊዜ ክንውን የለም"</string>
diff --git a/carousel/test/res/values-ca/strings.xml b/carousel/test/res/values-ca/strings.xml
index 15d758c..9f85f5e 100644
--- a/carousel/test/res/values-ca/strings.xml
+++ b/carousel/test/res/values-ca/strings.xml
@@ -21,7 +21,7 @@
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="music_demo_activity_label" msgid="4382090808250495841">"MusicCarousel"</string>
<string name="carousel_test_activity_label" msgid="6014624482213318747">"CarouselTest"</string>
- <string name="carousel_test_activity_description" msgid="1632693812604375483">"Una aplicació per mostrar l\'ús de Carousel"</string>
+ <string name="carousel_test_activity_description" msgid="1632693812604375483">"Una aplicació per mostrar com es fa servir l\'expositor giratori"</string>
<string name="task_switcher_activity_label" msgid="714620143340933546">"TaskSwitcher"</string>
<string name="recent_tasks_title" msgid="1030287226205477117">"Aplicacions usades recentment"</string>
<string name="no_recent_tasks" msgid="6884096266670555780">"No hi ha tasques recents"</string>
diff --git a/variablespeed/jni/jni_entry.cc b/variablespeed/jni/jni_entry.cc
index 368d230..d679475 100644
--- a/variablespeed/jni/jni_entry.cc
+++ b/variablespeed/jni/jni_entry.cc
@@ -81,9 +81,12 @@ JNI_METHOD(initializeEngine, void) (JNIEnv*, jclass,
float initialRate, size_t decodeInitialSize, size_t decodeMaxSize,
size_t startPositionMillis, int audioStreamType) {
MethodLog _("initializeEngine");
- AudioEngine::SetEngine(new AudioEngine(targetFrames,
+ AudioEngine *engine = new AudioEngine(targetFrames,
windowDuration, windowOverlapDuration, maxPlayBufferCount, initialRate,
- decodeInitialSize, decodeMaxSize, startPositionMillis, audioStreamType));
+ decodeInitialSize, decodeMaxSize, startPositionMillis, audioStreamType);
+ if (!AudioEngine::CompareAndSetEngine(NULL, engine)) {
+ delete engine;
+ }
}
JNI_METHOD(shutdownEngine, void) (JNIEnv*, jclass) {
diff --git a/variablespeed/jni/variablespeed.cc b/variablespeed/jni/variablespeed.cc
index 73ac609..4bdbbcc 100644
--- a/variablespeed/jni/variablespeed.cc
+++ b/variablespeed/jni/variablespeed.cc
@@ -129,14 +129,21 @@ void AudioEngine::SetEngine(AudioEngine* engine) {
audioEngine_ = engine;
}
+bool AudioEngine::CompareAndSetEngine(AudioEngine* expect, AudioEngine* update) {
+ android::Mutex::Autolock autoLock(publishEngineLock_);
+ if (audioEngine_ == expect) {
+ DeleteEngine();
+ audioEngine_ = update;
+ return true;
+ }
+ return false;
+}
+
void AudioEngine::DeleteEngine() {
- if (audioEngine_ == NULL) {
- LOGE("you haven't initialized the audio engine");
- CHECK(false);
- return;
+ if (audioEngine_ != NULL) {
+ delete audioEngine_;
+ audioEngine_ = NULL;
}
- delete audioEngine_;
- audioEngine_ = NULL;
}
// ****************************************************************************
diff --git a/variablespeed/jni/variablespeed.h b/variablespeed/jni/variablespeed.h
index 07cba0f..b48dbc2 100644
--- a/variablespeed/jni/variablespeed.h
+++ b/variablespeed/jni/variablespeed.h
@@ -64,6 +64,7 @@ class AudioEngine {
static AudioEngine* GetEngine();
static void SetEngine(AudioEngine* engine);
+ static bool CompareAndSetEngine(AudioEngine* expect, AudioEngine* update);
static void DeleteEngine();
private:
diff --git a/variablespeed/src/com/android/ex/variablespeed/MediaPlayerProxy.java b/variablespeed/src/com/android/ex/variablespeed/MediaPlayerProxy.java
index 8489dc1..3b7b576 100644
--- a/variablespeed/src/com/android/ex/variablespeed/MediaPlayerProxy.java
+++ b/variablespeed/src/com/android/ex/variablespeed/MediaPlayerProxy.java
@@ -42,6 +42,7 @@ public interface MediaPlayerProxy {
int getDuration();
void seekTo(int startPosition);
void start();
+ boolean isReadyToPlay();
boolean isPlaying();
int getCurrentPosition();
void pause();
diff --git a/variablespeed/src/com/android/ex/variablespeed/SingleThreadedMediaPlayerProxy.java b/variablespeed/src/com/android/ex/variablespeed/SingleThreadedMediaPlayerProxy.java
index 17692f7..c9a9741 100644
--- a/variablespeed/src/com/android/ex/variablespeed/SingleThreadedMediaPlayerProxy.java
+++ b/variablespeed/src/com/android/ex/variablespeed/SingleThreadedMediaPlayerProxy.java
@@ -85,6 +85,11 @@ public class SingleThreadedMediaPlayerProxy implements MediaPlayerProxy {
}
@Override
+ public synchronized boolean isReadyToPlay() {
+ return mDelegate.isReadyToPlay();
+ }
+
+ @Override
public synchronized boolean isPlaying() {
return mDelegate.isPlaying();
}
diff --git a/variablespeed/src/com/android/ex/variablespeed/VariableSpeed.java b/variablespeed/src/com/android/ex/variablespeed/VariableSpeed.java
index 5c93d26..e44a375 100644
--- a/variablespeed/src/com/android/ex/variablespeed/VariableSpeed.java
+++ b/variablespeed/src/com/android/ex/variablespeed/VariableSpeed.java
@@ -337,9 +337,16 @@ public class VariableSpeed implements MediaPlayerProxy {
}
@Override
+ public boolean isReadyToPlay() {
+ synchronized (lock) {
+ return !mHasBeenReleased && mHasDuration;
+ }
+ }
+
+ @Override
public boolean isPlaying() {
synchronized (lock) {
- return mHasStartedPlayback && !hasPlaybackFinished();
+ return isReadyToPlay() && mHasStartedPlayback && !hasPlaybackFinished();
}
}