diff options
| -rw-r--r-- | core/java/android/app/SearchDialog.java | 1 | ||||
| -rw-r--r-- | core/java/android/widget/ListView.java | 8 | ||||
| -rw-r--r-- | core/java/android/widget/RelativeLayout.java | 44 | ||||
| -rw-r--r-- | include/ui/Camera.h | 7 | ||||
| -rw-r--r-- | packages/TtsService/jni/android_tts_SynthProxy.cpp | 14 | ||||
| -rwxr-xr-x | packages/TtsService/src/android/tts/TtsService.java | 42 |
6 files changed, 69 insertions, 47 deletions
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index 77fce62..6ddf50f 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -1322,6 +1322,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS String query = intent.getStringExtra(SearchManager.QUERY); setUserQuery(query); + mSearchAutoComplete.showDropDown(); } /** diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index 6532125..f8a6f89 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -3264,9 +3264,13 @@ public class ListView extends AbsListView { if (mChoiceMode == CHOICE_MODE_MULTIPLE) { mCheckStates.put(position, value); } else { - boolean oldValue = mCheckStates.get(position, false); + // Clear the old value: if something was selected and value == false + // then it is unselected mCheckStates.clear(); - if (!oldValue) { + // If value == true, select the appropriate position + // this may end up selecting the value we just cleared but this way + // we don't have to first to a get(position) + if (value) { mCheckStates.put(position, true); } } diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index 68dafa1..b2aa574 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -40,7 +40,6 @@ import java.util.Comparator; import java.util.SortedSet; import java.util.TreeSet; import java.util.LinkedList; -import java.util.ArrayList; import java.util.HashSet; /** @@ -279,6 +278,17 @@ public class RelativeLayout extends ViewGroup { graph.getSortedViews(mSortedVerticalChildren, ABOVE, BELOW, ALIGN_BASELINE, ALIGN_TOP, ALIGN_BOTTOM); graph.getSortedViews(mSortedHorizontalChildren, LEFT_OF, RIGHT_OF, ALIGN_LEFT, ALIGN_RIGHT); + + if (DEBUG_GRAPH) { + d(LOG_TAG, "=== Ordered list of vertical children"); + for (View view : mSortedVerticalChildren) { + DependencyGraph.printViewId(getResources(), view); + } + d(LOG_TAG, "=== Ordered list of horizontal children"); + for (View view : mSortedHorizontalChildren) { + DependencyGraph.printViewId(getResources(), view); + } + } } @Override @@ -333,7 +343,6 @@ public class RelativeLayout extends ViewGroup { ignore = findViewById(mIgnoreGravity); } - View[] views = mSortedVerticalChildren; int count = views.length; for (int i = 0; i < count; i++) { @@ -755,7 +764,7 @@ public class RelativeLayout extends ViewGroup { private View getRelatedView(int[] rules, int relation) { int id = rules[relation]; if (id != 0) { - View v = findViewById(id); + View v = mGraph.mNodes.get(id).view; if (v == null) { return null; } @@ -763,7 +772,7 @@ public class RelativeLayout extends ViewGroup { // Find the first non-GONE view up the chain while (v.getVisibility() == View.GONE) { rules = ((LayoutParams) v.getLayoutParams()).getRules(); - v = v.findViewById(rules[relation]); + v = mGraph.mNodes.get((rules[relation])).view; if (v == null) { return null; } @@ -1100,12 +1109,6 @@ public class RelativeLayout extends ViewGroup { private static class DependencyGraph { /** - * List of views with no id. These views cannot be dependencies of - * other views, so treat the apart for faster processing. - */ - private ArrayList<View> mNakedRoots = new ArrayList<View>(); - - /** * List of nodes in the graph. Each node is identified by its * view id (see View#getId()). */ @@ -1129,7 +1132,6 @@ public class RelativeLayout extends ViewGroup { } nodes.clear(); - mNakedRoots.clear(); mRoots.clear(); } @@ -1139,13 +1141,7 @@ public class RelativeLayout extends ViewGroup { * @param view The view to be added as a node to the graph. */ void add(View view) { - final int id = view.getId(); - - if (id != View.NO_ID) { - mNodes.put(id, Node.acquire(view)); - } else { - mNakedRoots.add(view); - } + mNodes.put(view.getId(), Node.acquire(view)); } /** @@ -1162,12 +1158,6 @@ public class RelativeLayout extends ViewGroup { final LinkedList<Node> roots = findRoots(rules); int index = 0; - final ArrayList<View> nakedRoots = mNakedRoots; - final int count = nakedRoots.size(); - for ( ; index < count; index++) { - sorted[index] = nakedRoots.get(index); - } - while (roots.size() > 0) { final Node node = roots.removeFirst(); final View view = node.view; @@ -1259,17 +1249,13 @@ public class RelativeLayout extends ViewGroup { * @param rules The list of rules to take into account. */ void log(Resources resources, int... rules) { - for (View view : mNakedRoots) { - printViewId(resources, view); - } - final LinkedList<Node> roots = findRoots(rules); for (Node node : roots) { printNode(resources, node); } } - private static void printViewId(Resources resources, View view) { + static void printViewId(Resources resources, View view) { if (view.getId() != View.NO_ID) { d(LOG_TAG, resources.getResourceEntryName(view.getId())); } else { diff --git a/include/ui/Camera.h b/include/ui/Camera.h index 564a1db..bbc21c4 100644 --- a/include/ui/Camera.h +++ b/include/ui/Camera.h @@ -94,11 +94,6 @@ public: virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr) = 0; }; -typedef void (*shutter_callback)(void *cookie); -typedef void (*frame_callback)(const sp<IMemory>& mem, void *cookie); -typedef void (*autofocus_callback)(bool focused, void *cookie); -typedef void (*error_callback)(status_t err, void *cookie); - class Camera : public BnCameraClient, public IBinder::DeathRecipient { public: @@ -163,6 +158,8 @@ public: private: Camera(); + Camera(const Camera&); + Camera& operator=(const Camera); virtual void binderDied(const wp<IBinder>& who); class DeathNotifier: public IBinder::DeathRecipient diff --git a/packages/TtsService/jni/android_tts_SynthProxy.cpp b/packages/TtsService/jni/android_tts_SynthProxy.cpp index 0aa4fa5..0dafcc1 100644 --- a/packages/TtsService/jni/android_tts_SynthProxy.cpp +++ b/packages/TtsService/jni/android_tts_SynthProxy.cpp @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +#define LOG_NDEBUG 0 #include <stdio.h> #include <unistd.h> @@ -168,7 +168,7 @@ void prepAudioTrack(SynthProxyJniStorage* pJniData, static tts_callback_status ttsSynthDoneCB(void *& userdata, uint32_t rate, AudioSystem::audio_format format, int channel, int8_t *&wav, size_t &bufferSize, tts_synth_status status) { - LOGI("ttsSynthDoneCallback: %d bytes", bufferSize); + LOGV("ttsSynthDoneCallback: %d bytes", bufferSize); if (userdata == NULL){ LOGE("userdata == NULL"); @@ -178,7 +178,7 @@ static tts_callback_status ttsSynthDoneCB(void *& userdata, uint32_t rate, SynthProxyJniStorage* pJniData = (SynthProxyJniStorage*)(pForAfter->jniStorage); if (pForAfter->usageMode == USAGEMODE_PLAY_IMMEDIATELY){ - LOGI("Direct speech"); + LOGV("Direct speech"); if (wav == NULL) { delete pForAfter; @@ -189,16 +189,16 @@ static tts_callback_status ttsSynthDoneCB(void *& userdata, uint32_t rate, prepAudioTrack(pJniData, rate, format, channel); if (pJniData->mAudioOut) { pJniData->mAudioOut->write(wav, bufferSize); - LOGI("AudioTrack wrote: %d bytes", bufferSize); + //LOGV("AudioTrack wrote: %d bytes", bufferSize); } else { - LOGI("Can't play, null audiotrack"); + LOGE("Can't play, null audiotrack"); } } } else if (pForAfter->usageMode == USAGEMODE_WRITE_TO_FILE) { - LOGI("Save to file"); + LOGV("Save to file"); if (wav == NULL) { delete pForAfter; - LOGI("Null: speech has completed"); + LOGV("Null: speech has completed"); } if (bufferSize > 0){ fwrite(wav, 1, bufferSize, pForAfter->outputFile); diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java index 21f56f8..a6a2dd3 100755 --- a/packages/TtsService/src/android/tts/TtsService.java +++ b/packages/TtsService/src/android/tts/TtsService.java @@ -170,6 +170,39 @@ public class TtsService extends Service implements OnCompletionListener { } + private String getDefaultLanguage() { + String defaultLang = android.provider.Settings.Secure.getString(mResolver, + android.provider.Settings.Secure.TTS_DEFAULT_LANG); + if (defaultLang == null) { + return TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_LANG; + } else { + return defaultLang; + } + } + + + private String getDefaultCountry() { + String defaultCountry = android.provider.Settings.Secure.getString(mResolver, + android.provider.Settings.Secure.TTS_DEFAULT_COUNTRY); + if (defaultCountry == null) { + return TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_COUNTRY; + } else { + return defaultCountry; + } + } + + + private String getDefaultLocVariant() { + String defaultVar = android.provider.Settings.Secure.getString(mResolver, + android.provider.Settings.Secure.TTS_DEFAULT_VARIANT); + if (defaultVar == null) { + return TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT; + } else { + return defaultVar; + } + } + + private void setSpeechRate(int rate) { if (isDefaultEnforced()) { nativeSynth.setSpeechRate(getDefaultRate()); @@ -185,15 +218,16 @@ public class TtsService extends Service implements OnCompletionListener { private void setLanguage(String lang, String country, String variant) { - Log.v("TTS", "TtsService.setLanguage("+lang+", "+country+", "+variant+")"); + Log.v("TTS", "TtsService.setLanguage(" + lang + ", " + country + ", " + variant + ")"); if (isDefaultEnforced()) { - nativeSynth.setLanguage(lang, country, variant); + nativeSynth.setLanguage(getDefaultLanguage(), getDefaultCountry(), + getDefaultLocVariant()); } else { - // TODO handle default language - nativeSynth.setLanguage("eng", "USA", ""); + nativeSynth.setLanguage(lang, country, variant); } } + /** * Adds a sound resource to the TTS. * |
