diff options
| -rw-r--r-- | api/current.xml | 11 | ||||
| -rw-r--r-- | common/java/com/android/common/speech/LoggingEvents.java | 3 | ||||
| -rw-r--r-- | core/java/android/app/SearchDialog.java | 13 | ||||
| -rw-r--r-- | core/java/android/speech/RecognizerResultsIntent.java | 104 | ||||
| -rw-r--r-- | core/jni/CursorWindow.cpp | 17 | ||||
| -rw-r--r-- | core/jni/CursorWindow.h | 5 | ||||
| -rw-r--r-- | include/media/stagefright/OMXCodec.h | 1 | ||||
| -rw-r--r-- | location/java/android/location/ILocationProvider.aidl | 1 | ||||
| -rw-r--r-- | location/java/android/location/LocationProviderImpl.java | 9 | ||||
| -rwxr-xr-x | location/java/com/android/internal/location/GpsLocationProvider.java | 4 | ||||
| -rw-r--r-- | location/java/com/android/internal/location/LocationProviderProxy.java | 10 | ||||
| -rw-r--r-- | location/java/com/android/internal/location/MockProvider.java | 4 | ||||
| -rw-r--r-- | media/libmediaplayerservice/MetadataRetrieverClient.cpp | 23 | ||||
| -rw-r--r-- | media/libmediaplayerservice/MetadataRetrieverClient.h | 2 | ||||
| -rw-r--r-- | media/libstagefright/OMXCodec.cpp | 13 | ||||
| -rw-r--r-- | media/libstagefright/colorconversion/SoftwareRenderer.cpp | 11 |
16 files changed, 154 insertions, 77 deletions
diff --git a/api/current.xml b/api/current.xml index 2fbd37492522..9bd5c0119887 100644 --- a/api/current.xml +++ b/api/current.xml @@ -78032,17 +78032,6 @@ visibility="public" > </method> -<method name="isEnabled" - return="boolean" - abstract="true" - native="false" - synchronized="false" - static="false" - final="false" - deprecated="not deprecated" - visibility="public" -> -</method> <method name="removeListener" return="void" abstract="true" diff --git a/common/java/com/android/common/speech/LoggingEvents.java b/common/java/com/android/common/speech/LoggingEvents.java index eb9476f93ee7..3b3ecb85be87 100644 --- a/common/java/com/android/common/speech/LoggingEvents.java +++ b/common/java/com/android/common/speech/LoggingEvents.java @@ -16,9 +16,6 @@ package com.android.common.speech; -import android.content.Intent; -import android.content.Context; - /** * Logging event constants used for Voice Search and VoiceIME. These are the * keys and values of extras to be specified in logging broadcast intents. diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index 3dfbe7184f90..ec9f3b4fc56d 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -903,15 +903,14 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS if (mSearchable == null) { return; } + SearchableInfo searchable = mSearchable; + // First stop the existing search before starting voice search, or else we'll end + // up showing the search dialog again once we return to the app. + cancel(); try { - // First stop the existing search before starting voice search, or else we'll end - // up showing the search dialog again once we return to the app. - ((SearchManager) getContext().getSystemService(Context.SEARCH_SERVICE)). - stopSearch(); - - if (mSearchable.getVoiceSearchLaunchWebSearch()) { + if (searchable.getVoiceSearchLaunchWebSearch()) { getContext().startActivity(mVoiceWebSearchIntent); - } else if (mSearchable.getVoiceSearchLaunchRecognizer()) { + } else if (searchable.getVoiceSearchLaunchRecognizer()) { Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent); getContext().startActivity(appSearchIntent); } diff --git a/core/java/android/speech/RecognizerResultsIntent.java b/core/java/android/speech/RecognizerResultsIntent.java new file mode 100644 index 000000000000..2310a07d4755 --- /dev/null +++ b/core/java/android/speech/RecognizerResultsIntent.java @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.speech; + +import java.util.ArrayList; + +/** + * Constants for intents related to showing speech recognition results. + * + * These constants should not be needed for normal utilization of speech recognition. They + * would only be called if you wanted to trigger a view of voice search results in your + * application, or implemented if you wanted to offer a different view for voice search results + * with your application. + * + * The standard behavior here for someone receiving an {@link #ACTION_VOICE_SEARCH_RESULTS} is to + * first retrieve the list of {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS}, and use any provided + * HTML for that result in {@link #EXTRA_VOICE_SEARCH_RESULT_HTML}, if available, to display + * the search results. If that is not available, then the corresponding url for that result in + * {@link #EXTRA_VOICE_SEARCH_RESULT_URLS} should be used. And if even that is not available, + * then a search url should be constructed from the actual recognition result string. + * + * @hide for making public in a later release + */ +public class RecognizerResultsIntent { + private RecognizerResultsIntent() { + // Not for instantiating. + } + + /** + * Intent that can be sent by implementations of voice search to display the results of + * a search in, for example, a web browser. + * + * This intent should always be accompanied by at least + * {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS}, and optionally but recommended, + * {@link #EXTRA_VOICE_SEARCH_RESULT_URLS}, and sometimes + * {@link #EXTRA_VOICE_SEARCH_RESULT_HTML}. These are three parallel arrays, where a + * recognition result string at index N of {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS} should + * be accompanied by a url to use for searching based on that string at index N of + * {@link #EXTRA_VOICE_SEARCH_RESULT_URLS}, and, possibly, the full html to display for + * that result at index N of {@link #EXTRA_VOICE_SEARCH_RESULT_HTML}. + * + * @hide for making public in a later release + */ + public static final String ACTION_VOICE_SEARCH_RESULTS = + "android.speech.action.VOICE_SEARCH_RESULTS"; + + /** + * The key to an extra {@link ArrayList} of {@link String}s that contains the list of + * recognition alternates from voice search, in order from highest to lowest confidence. + * + * @hide for making public in a later release + */ + public static final String EXTRA_VOICE_SEARCH_RESULT_STRINGS = + "android.speech.extras.VOICE_SEARCH_RESULT_STRINGS"; + + /** + * The key to an extra {@link ArrayList} of {@link String}s that contains the search urls + * to use, if available, for the recognition alternates provided in + * {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS}. This list should always be the same size as the + * one provided in {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS} - if a result cannot provide a + * search url, that entry in this ArrayList should be <code>null</code>, and the implementor of + * {@link #ACTION_VOICE_SEARCH_RESULTS} should execute a search of its own choosing, + * based on the recognition result string. + * + * @hide for making public in a later release + */ + public static final String EXTRA_VOICE_SEARCH_RESULT_URLS = + "android.speech.extras.VOICE_SEARCH_RESULT_URLS"; + + /** + * The key to an extra {@link ArrayList} of {@link String}s that contains the html content to + * use, if available, for the recognition alternates provided in + * {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS}. This list should always be the same size as the + * one provided in {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS} - if a result cannot provide + * html, that entry in this list should be <code>null</code>, and the implementor of + * {@link #ACTION_VOICE_SEARCH_RESULTS} should back off to the corresponding url provided in + * {@link #EXTRA_VOICE_SEARCH_RESULT_URLS}, if available, or else should execute a search of + * its own choosing, based on the recognition result string. + * + * Currently this html content should be expected in the form of an "inline:" uri for the + * Browser. In the future this may change to a "content://" uri or some other identifier. + * Anyone who reads this extra should confirm that a result is in fact an "inline:" uri and + * back off to the urls or strings gracefully if it is not, thus maintaining future backwards + * compatibility if this changes. + * + * @hide not to be exposed immediately as the implementation details may change + */ + public static final String EXTRA_VOICE_SEARCH_RESULT_HTML = + "android.speech.extras.VOICE_SEARCH_RESULT_HTML"; +} diff --git a/core/jni/CursorWindow.cpp b/core/jni/CursorWindow.cpp index 694514e9a440..78779214b6ed 100644 --- a/core/jni/CursorWindow.cpp +++ b/core/jni/CursorWindow.cpp @@ -18,7 +18,8 @@ #define LOG_TAG "CursorWindow" #include <utils/Log.h> -#include <binder/MemoryDealer.h> +#include <binder/MemoryHeapBase.h> +#include <binder/MemoryBase.h> #include <assert.h> #include <string.h> @@ -37,7 +38,7 @@ CursorWindow::CursorWindow(size_t maxSize) : { } -bool CursorWindow::setMemory(sp<IMemory> memory) +bool CursorWindow::setMemory(const sp<IMemory>& memory) { mMemory = memory; mData = (uint8_t *) memory->pointer(); @@ -47,7 +48,6 @@ bool CursorWindow::setMemory(sp<IMemory> memory) mHeader = (window_header_t *) mData; // Make the window read-only - mHeap = NULL; ssize_t size = memory->size(); mSize = size; mMaxSize = size; @@ -60,9 +60,10 @@ bool CursorWindow::initBuffer(bool localOnly) { //TODO Use a non-memory dealer mmap region for localOnly - mHeap = new MemoryDealer(mMaxSize, "CursorWindow"); - if (mHeap != NULL) { - mMemory = mHeap->allocate(mMaxSize); + sp<MemoryHeapBase> heap; + heap = new MemoryHeapBase(mMaxSize, 0, "CursorWindow"); + if (heap != NULL) { + mMemory = new MemoryBase(heap, 0, mMaxSize); if (mMemory != NULL) { mData = (uint8_t *) mMemory->pointer(); if (mData) { @@ -75,10 +76,10 @@ bool CursorWindow::initBuffer(bool localOnly) return true; } } - LOGE("memory dealer allocation failed"); + LOGE("CursorWindow heap allocation failed"); return false; } else { - LOGE("failed to create the memory dealer"); + LOGE("failed to create the CursorWindow heap"); return false; } } diff --git a/core/jni/CursorWindow.h b/core/jni/CursorWindow.h index e98b00996c36..3fcb56022720 100644 --- a/core/jni/CursorWindow.h +++ b/core/jni/CursorWindow.h @@ -21,7 +21,7 @@ #include <stddef.h> #include <stdint.h> -#include <binder/MemoryDealer.h> +#include <binder/IMemory.h> #include <utils/RefBase.h> #include <jni.h> @@ -101,7 +101,7 @@ class CursorWindow public: CursorWindow(size_t maxSize); CursorWindow(){} - bool setMemory(sp<IMemory>); + bool setMemory(const sp<IMemory>&); ~CursorWindow(); bool initBuffer(bool localOnly); @@ -189,7 +189,6 @@ private: size_t mSize; size_t mMaxSize; window_header_t * mHeader; - sp<MemoryDealer> mHeap; sp<IMemory> mMemory; /** diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h index 82dd2b52f0f3..f8bc7ab0bfbb 100644 --- a/include/media/stagefright/OMXCodec.h +++ b/include/media/stagefright/OMXCodec.h @@ -95,6 +95,7 @@ private: kRequiresAllocateBufferOnOutputPorts = 32, kRequiresFlushBeforeShutdown = 64, kDefersOutputBufferAllocation = 128, + kDecoderLiesAboutNumberOfChannels = 256, }; struct BufferInfo { diff --git a/location/java/android/location/ILocationProvider.aidl b/location/java/android/location/ILocationProvider.aidl index 7da16e455fd1..9fe6ab41fc4a 100644 --- a/location/java/android/location/ILocationProvider.aidl +++ b/location/java/android/location/ILocationProvider.aidl @@ -37,7 +37,6 @@ interface ILocationProvider { int getAccuracy(); void enable(); void disable(); - boolean isEnabled(); int getStatus(out Bundle extras); long getStatusUpdateTime(); void enableLocationTracking(boolean enable); diff --git a/location/java/android/location/LocationProviderImpl.java b/location/java/android/location/LocationProviderImpl.java index 9a3624eadc1a..7148a02f96ba 100644 --- a/location/java/android/location/LocationProviderImpl.java +++ b/location/java/android/location/LocationProviderImpl.java @@ -75,10 +75,6 @@ public abstract class LocationProviderImpl extends LocationProvider { LocationProviderImpl.this.disable(); } - public boolean isEnabled() { - return LocationProviderImpl.this.isEnabled(); - } - public int getStatus(Bundle extras) { return LocationProviderImpl.this.getStatus(extras); } @@ -138,11 +134,6 @@ public abstract class LocationProviderImpl extends LocationProvider { public abstract void disable(); /** - * Returns true if the provider is currently enabled - */ - public abstract boolean isEnabled(); - - /** * Returns a information on the status of this provider. * {@link #OUT_OF_SERVICE} is returned if the provider is * out of service, and this is not expected to change in the near diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java index 9d678825978f..c8809a2f11ca 100755 --- a/location/java/com/android/internal/location/GpsLocationProvider.java +++ b/location/java/com/android/internal/location/GpsLocationProvider.java @@ -571,10 +571,6 @@ public class GpsLocationProvider extends ILocationProvider.Stub { } } - public boolean isEnabled() { - return mEnabled; - } - public int getStatus(Bundle extras) { if (extras != null) { extras.putInt("satellites", mSvCount); diff --git a/location/java/com/android/internal/location/LocationProviderProxy.java b/location/java/com/android/internal/location/LocationProviderProxy.java index 89337b369d6f..2e0be8914cff 100644 --- a/location/java/com/android/internal/location/LocationProviderProxy.java +++ b/location/java/com/android/internal/location/LocationProviderProxy.java @@ -40,6 +40,7 @@ public class LocationProviderProxy implements IBinder.DeathRecipient { private final String mName; private final ILocationProvider mProvider; private boolean mLocationTracking = false; + private boolean mEnabled = false; private long mMinTime = 0; private boolean mDead; @@ -152,6 +153,7 @@ public class LocationProviderProxy implements IBinder.DeathRecipient { public void enable() { try { mProvider.enable(); + mEnabled = true; } catch (RemoteException e) { Log.e(TAG, "enable failed", e); } @@ -160,18 +162,14 @@ public class LocationProviderProxy implements IBinder.DeathRecipient { public void disable() { try { mProvider.disable(); + mEnabled = false; } catch (RemoteException e) { Log.e(TAG, "disable failed", e); } } public boolean isEnabled() { - try { - return mProvider.isEnabled(); - } catch (RemoteException e) { - Log.e(TAG, "isEnabled failed", e); - return false; - } + return mEnabled; } public int getStatus(Bundle extras) { diff --git a/location/java/com/android/internal/location/MockProvider.java b/location/java/com/android/internal/location/MockProvider.java index 2614f827a15d..7d9e86cab359 100644 --- a/location/java/com/android/internal/location/MockProvider.java +++ b/location/java/com/android/internal/location/MockProvider.java @@ -95,10 +95,6 @@ public class MockProvider extends ILocationProvider.Stub { return mStatusUpdateTime; } - public boolean isEnabled() { - return mEnabled; - } - public int getAccuracy() { return mAccuracy; } diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.cpp b/media/libmediaplayerservice/MetadataRetrieverClient.cpp index 162bebbad560..550b84dfb347 100644 --- a/media/libmediaplayerservice/MetadataRetrieverClient.cpp +++ b/media/libmediaplayerservice/MetadataRetrieverClient.cpp @@ -28,7 +28,8 @@ #include <string.h> #include <cutils/atomic.h> #include <cutils/properties.h> -#include <binder/MemoryDealer.h> +#include <binder/MemoryBase.h> +#include <binder/MemoryHeapBase.h> #include <android_runtime/ActivityManager.h> #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> @@ -62,8 +63,6 @@ MetadataRetrieverClient::MetadataRetrieverClient(pid_t pid) { LOGV("MetadataRetrieverClient constructor pid(%d)", pid); mPid = pid; - mThumbnailDealer = NULL; - mAlbumArtDealer = NULL; mThumbnail = NULL; mAlbumArt = NULL; mRetriever = NULL; @@ -94,8 +93,6 @@ void MetadataRetrieverClient::disconnect() LOGV("disconnect from pid %d", mPid); Mutex::Autolock lock(mLock); mRetriever.clear(); - mThumbnailDealer.clear(); - mAlbumArtDealer.clear(); mThumbnail.clear(); mAlbumArt.clear(); mMode = METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL; @@ -242,7 +239,6 @@ sp<IMemory> MetadataRetrieverClient::captureFrame() LOGV("captureFrame"); Mutex::Autolock lock(mLock); mThumbnail.clear(); - mThumbnailDealer.clear(); if (mRetriever == NULL) { LOGE("retriever is not initialized"); return NULL; @@ -253,16 +249,15 @@ sp<IMemory> MetadataRetrieverClient::captureFrame() return NULL; } size_t size = sizeof(VideoFrame) + frame->mSize; - mThumbnailDealer = new MemoryDealer(size, "MetadataRetrieverClient"); - if (mThumbnailDealer == NULL) { + sp<MemoryHeapBase> heap = new MemoryHeapBase(size, 0, "MetadataRetrieverClient"); + if (heap == NULL) { LOGE("failed to create MemoryDealer"); delete frame; return NULL; } - mThumbnail = mThumbnailDealer->allocate(size); + mThumbnail = new MemoryBase(heap, 0, size); if (mThumbnail == NULL) { LOGE("not enough memory for VideoFrame size=%u", size); - mThumbnailDealer.clear(); delete frame; return NULL; } @@ -283,7 +278,6 @@ sp<IMemory> MetadataRetrieverClient::extractAlbumArt() LOGV("extractAlbumArt"); Mutex::Autolock lock(mLock); mAlbumArt.clear(); - mAlbumArtDealer.clear(); if (mRetriever == NULL) { LOGE("retriever is not initialized"); return NULL; @@ -294,16 +288,15 @@ sp<IMemory> MetadataRetrieverClient::extractAlbumArt() return NULL; } size_t size = sizeof(MediaAlbumArt) + albumArt->mSize; - mAlbumArtDealer = new MemoryDealer(size, "MetadataRetrieverClient"); - if (mAlbumArtDealer == NULL) { + sp<MemoryHeapBase> heap = new MemoryHeapBase(size, 0, "MetadataRetrieverClient"); + if (heap == NULL) { LOGE("failed to create MemoryDealer object"); delete albumArt; return NULL; } - mAlbumArt = mAlbumArtDealer->allocate(size); + mAlbumArt = new MemoryBase(heap, 0, size); if (mAlbumArt == NULL) { LOGE("not enough memory for MediaAlbumArt size=%u", size); - mAlbumArtDealer.clear(); delete albumArt; return NULL; } diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.h b/media/libmediaplayerservice/MetadataRetrieverClient.h index 8cb8ad13f1b0..4aab94fa7573 100644 --- a/media/libmediaplayerservice/MetadataRetrieverClient.h +++ b/media/libmediaplayerservice/MetadataRetrieverClient.h @@ -63,8 +63,6 @@ private: int mMode; // Keep the shared memory copy of album art and capture frame (for thumbnail) - sp<MemoryDealer> mAlbumArtDealer; - sp<MemoryDealer> mThumbnailDealer; sp<IMemory> mAlbumArt; sp<IMemory> mThumbnail; }; diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index e17fbb8ed31e..90bbdfe5b083 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -290,6 +290,7 @@ uint32_t OMXCodec::getComponentQuirks(const char *componentName) { } if (!strcmp(componentName, "OMX.TI.MP3.decode")) { quirks |= kNeedsFlushBeforeDisable; + quirks |= kDecoderLiesAboutNumberOfChannels; } if (!strcmp(componentName, "OMX.TI.AAC.decode")) { quirks |= kNeedsFlushBeforeDisable; @@ -2817,7 +2818,9 @@ void OMXCodec::initOutputFormat(const sp<MetaData> &inputFormat) { if ((OMX_U32)numChannels != params.nChannels) { LOGW("Codec outputs a different number of channels than " - "the input stream contains."); + "the input stream contains (contains %d channels, " + "codec outputs %ld channels).", + numChannels, params.nChannels); } mOutputFormat->setCString( @@ -2825,8 +2828,12 @@ void OMXCodec::initOutputFormat(const sp<MetaData> &inputFormat) { // Use the codec-advertised number of channels, as some // codecs appear to output stereo even if the input data is - // mono. - mOutputFormat->setInt32(kKeyChannelCount, params.nChannels); + // mono. If we know the codec lies about this information, + // use the actual number of channels instead. + mOutputFormat->setInt32( + kKeyChannelCount, + (mQuirks & kDecoderLiesAboutNumberOfChannels) + ? numChannels : params.nChannels); // The codec-reported sampleRate is not reliable... mOutputFormat->setInt32(kKeySampleRate, sampleRate); diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp index ef6ede02b029..ed91eea954fc 100644 --- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp +++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp @@ -20,6 +20,7 @@ #include "../include/SoftwareRenderer.h" #include <binder/MemoryHeapBase.h> +#include <binder/MemoryHeapPmem.h> #include <media/stagefright/MediaDebug.h> #include <ui/ISurface.h> @@ -38,8 +39,16 @@ SoftwareRenderer::SoftwareRenderer( mDecodedWidth(decodedWidth), mDecodedHeight(decodedHeight), mFrameSize(mDecodedWidth * mDecodedHeight * 2), // RGB565 - mMemoryHeap(new MemoryHeapBase(2 * mFrameSize)), mIndex(0) { + // TODO: How do I allocate physical memory on Droid? + mMemoryHeap = new MemoryHeapBase("/dev/pmem_adsp", 2 * mFrameSize); + if (mMemoryHeap->heapID() < 0) { + LOGI("Creating physical memory heap failed, reverting to regular heap."); + mMemoryHeap = new MemoryHeapBase(2 * mFrameSize); + } else { + mMemoryHeap = new MemoryHeapPmem(mMemoryHeap); + } + CHECK(mISurface.get() != NULL); CHECK(mDecodedWidth > 0); CHECK(mDecodedHeight > 0); |