diff options
-rw-r--r-- | camera/libcameraservice/CameraService.cpp | 1 | ||||
-rw-r--r-- | camera/libcameraservice/CameraService.h | 1 | ||||
-rw-r--r-- | core/java/android/widget/BaseExpandableListAdapter.java | 4 | ||||
-rw-r--r-- | core/java/android/widget/HeterogeneousExpandableList.java | 27 | ||||
-rw-r--r-- | docs/html/guide/topics/resources/providing-resources.jd | 11 | ||||
-rw-r--r-- | include/camera/Camera.h | 1 | ||||
-rw-r--r-- | include/media/IMediaRecorder.h | 2 | ||||
-rw-r--r-- | include/media/PVMediaRecorder.h | 2 | ||||
-rw-r--r-- | include/media/stagefright/AudioPlayer.h | 4 | ||||
-rw-r--r-- | libs/camera/Camera.cpp | 1 | ||||
-rw-r--r-- | media/libmedia/IMediaRecorder.cpp | 2 | ||||
-rw-r--r-- | media/libmediaplayerservice/MediaRecorderClient.cpp | 2 | ||||
-rw-r--r-- | media/libmediaplayerservice/MediaRecorderClient.h | 2 | ||||
-rw-r--r-- | media/libstagefright/AudioPlayer.cpp | 66 | ||||
-rw-r--r-- | media/libstagefright/codecs/aacdec/AACDecoder.cpp | 110 | ||||
-rw-r--r-- | media/libstagefright/include/AACDecoder.h | 4 | ||||
-rw-r--r-- | services/java/com/android/server/PackageManagerService.java | 3 |
17 files changed, 161 insertions, 82 deletions
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index 2690182..118249e 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -1,7 +1,6 @@ /* ** ** Copyright (C) 2008, The Android Open Source Project -** Copyright (C) 2008 HTC Inc. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. diff --git a/camera/libcameraservice/CameraService.h b/camera/libcameraservice/CameraService.h index bc49b1d..75e96c6 100644 --- a/camera/libcameraservice/CameraService.h +++ b/camera/libcameraservice/CameraService.h @@ -1,7 +1,6 @@ /* ** ** Copyright (C) 2008, The Android Open Source Project -** Copyright (C) 2008 HTC Inc. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. diff --git a/core/java/android/widget/BaseExpandableListAdapter.java b/core/java/android/widget/BaseExpandableListAdapter.java index 396b7ae..b4d6ad7 100644 --- a/core/java/android/widget/BaseExpandableListAdapter.java +++ b/core/java/android/widget/BaseExpandableListAdapter.java @@ -43,14 +43,14 @@ public abstract class BaseExpandableListAdapter implements ExpandableListAdapter } /** - * {@see DataSetObservable#notifyInvalidated()} + * @see DataSetObservable#notifyInvalidated() */ public void notifyDataSetInvalidated() { mDataSetObservable.notifyInvalidated(); } /** - * {@see DataSetObservable#notifyChanged()} + * @see DataSetObservable#notifyChanged() */ public void notifyDataSetChanged() { mDataSetObservable.notifyChanged(); diff --git a/core/java/android/widget/HeterogeneousExpandableList.java b/core/java/android/widget/HeterogeneousExpandableList.java index 1292733..e7e0933 100644 --- a/core/java/android/widget/HeterogeneousExpandableList.java +++ b/core/java/android/widget/HeterogeneousExpandableList.java @@ -23,12 +23,13 @@ import android.view.ViewGroup; * Additional methods that when implemented make an * {@link ExpandableListAdapter} take advantage of the {@link Adapter} view type * mechanism. - * - * An {@link ExpandableListAdapter} declares one view type for its group items + * <p> + * An {@link ExpandableListAdapter} declares it has one view type for its group items * and one view type for its child items. Although adapted for most {@link ExpandableListView}s, - * these values should be tuned heterogeneous {@link ExpandableListView}s. Lists that contain - * different types of group and/or child item views, should use an adapter that implements this - * interface. This way, the recycled views that will be provided to + * these values should be tuned for heterogeneous {@link ExpandableListView}s. + * </p> + * Lists that contain different types of group and/or child item views, should use an adapter that + * implements this interface. This way, the recycled views that will be provided to * {@link android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup)} * and * {@link android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup)} @@ -48,7 +49,7 @@ public interface HeterogeneousExpandableList { * . Note: Integers must be in the range 0 to {@link #getGroupTypeCount} - 1. * {@link android.widget.Adapter#IGNORE_ITEM_VIEW_TYPE} can also be returned. * @see android.widget.Adapter#IGNORE_ITEM_VIEW_TYPE - * @see getGroupTypeCount() + * @see #getGroupTypeCount() */ int getGroupType(int groupPosition); @@ -65,7 +66,7 @@ public interface HeterogeneousExpandableList { * Note: Integers must be in the range 0 to {@link #getChildTypeCount} - 1. * {@link android.widget.Adapter#IGNORE_ITEM_VIEW_TYPE} can also be returned. * @see android.widget.Adapter#IGNORE_ITEM_VIEW_TYPE - * @see getChildTypeCount() + * @see #getChildTypeCount() */ int getChildType(int groupPosition, int childPosition); @@ -78,13 +79,11 @@ public interface HeterogeneousExpandableList { * . If the adapter always returns the same type of View for all group items, this method should * return 1. * </p> - * <p> * This method will only be called when the adapter is set on the {@link AdapterView}. - * </p> * * @return The number of types of group Views that will be created by this adapter. - * @see getChildTypeCount() - * @see getGroupType() + * @see #getChildTypeCount() + * @see #getGroupType(int) */ int getGroupTypeCount(); @@ -97,13 +96,11 @@ public interface HeterogeneousExpandableList { * , for any group. If the adapter always returns the same type of View for * all child items, this method should return 1. * </p> - * <p> * This method will only be called when the adapter is set on the {@link AdapterView}. - * </p> * * @return The total number of types of child Views that will be created by this adapter. - * @see getGroupTypeCount() - * @see getChildType() + * @see #getGroupTypeCount() + * @see #getChildType(int, int) */ int getChildTypeCount(); } diff --git a/docs/html/guide/topics/resources/providing-resources.jd b/docs/html/guide/topics/resources/providing-resources.jd index 7e2f8a0..1d6ab25 100644 --- a/docs/html/guide/topics/resources/providing-resources.jd +++ b/docs/html/guide/topics/resources/providing-resources.jd @@ -450,8 +450,8 @@ application during runtime.</p> to match the device density.</li> </ul> <p><em>Added in API Level 4.</em></p> - <p>There is thus a 4:3 scaling factor between each density, so a 9x9 bitmap - in ldpi is 12x12 in mdpi and 16x16 in hdpi.</p> + <p>There is thus a 3:4:6 scaling ratio between the three densities, so a 9x9 bitmap + in ldpi is 12x12 in mdpi and 18x18 in hdpi.</p> <p>When Android selects which resource files to use, it handles screen density differently than the other qualifiers. In step 1 of <a href="#BestMatch">How Android finds the best @@ -895,7 +895,7 @@ drawable-port-ldpi/ drawable-port-notouch-12key/ </pre> <p class="note"><strong>Exception:</strong> Screen pixel density is the one qualifier that is not -eliminated due to a contradiction. Even though the screen density of the device is mdpi, +eliminated due to a contradiction. Even though the screen density of the device is hdpi, <code>drawable-port-ldpi/</code> is not eliminated because every screen density is considered to be a match at this point. More information is available in the <a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple @@ -922,9 +922,8 @@ drawable-en-notouch-12key/ <strike>drawable-port-notouch-12key/</strike> </pre> <p class="note"><strong>Exception:</strong> If the qualifier in question is screen pixel density, -Android -selects the option that most closely matches the device, and the selection process is complete. -In general, Android prefers scaling down a larger original image to scaling up a smaller +Android selects the option that most closely matches the device screen density. +In general, Android prefers scaling down a larger original image to scaling up a smaller original image. See <a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>.</p> </li> diff --git a/include/camera/Camera.h b/include/camera/Camera.h index ee2b30c..57968e3 100644 --- a/include/camera/Camera.h +++ b/include/camera/Camera.h @@ -1,6 +1,5 @@ /* * Copyright (C) 2008 The Android Open Source Project - * Copyright (C) 2008 HTC Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/media/IMediaRecorder.h b/include/media/IMediaRecorder.h index 24ac82b..73bf2ee 100644 --- a/include/media/IMediaRecorder.h +++ b/include/media/IMediaRecorder.h @@ -1,6 +1,6 @@ /* ** - ** Copyright 2008, HTC Inc. + ** Copyright 2008, 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. diff --git a/include/media/PVMediaRecorder.h b/include/media/PVMediaRecorder.h index 4f17c1a..2a1298a 100644 --- a/include/media/PVMediaRecorder.h +++ b/include/media/PVMediaRecorder.h @@ -1,6 +1,6 @@ /* ** - ** Copyright 2008, HTC Inc. + ** Copyright 2008, 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. diff --git a/include/media/stagefright/AudioPlayer.h b/include/media/stagefright/AudioPlayer.h index 9af5871..9a09586 100644 --- a/include/media/stagefright/AudioPlayer.h +++ b/include/media/stagefright/AudioPlayer.h @@ -86,6 +86,10 @@ private: bool mStarted; + bool mIsFirstBuffer; + status_t mFirstBufferResult; + MediaBuffer *mFirstBuffer; + sp<MediaPlayerBase::AudioSink> mAudioSink; static void AudioCallback(int event, void *user, void *info); diff --git a/libs/camera/Camera.cpp b/libs/camera/Camera.cpp index f19c502..30ee7c4 100644 --- a/libs/camera/Camera.cpp +++ b/libs/camera/Camera.cpp @@ -1,7 +1,6 @@ /* ** ** Copyright (C) 2008, The Android Open Source Project -** Copyright (C) 2008 HTC Inc. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. diff --git a/media/libmedia/IMediaRecorder.cpp b/media/libmedia/IMediaRecorder.cpp index 2bc2a7e..1de9f9b 100644 --- a/media/libmedia/IMediaRecorder.cpp +++ b/media/libmedia/IMediaRecorder.cpp @@ -1,6 +1,6 @@ /* ** - ** Copyright 2008, HTC Inc. + ** Copyright 2008, 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. diff --git a/media/libmediaplayerservice/MediaRecorderClient.cpp b/media/libmediaplayerservice/MediaRecorderClient.cpp index c507669..12de0d9 100644 --- a/media/libmediaplayerservice/MediaRecorderClient.cpp +++ b/media/libmediaplayerservice/MediaRecorderClient.cpp @@ -1,5 +1,5 @@ /* - ** Copyright 2008, HTC Inc. + ** Copyright 2008, 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. diff --git a/media/libmediaplayerservice/MediaRecorderClient.h b/media/libmediaplayerservice/MediaRecorderClient.h index e07306b..805005d 100644 --- a/media/libmediaplayerservice/MediaRecorderClient.h +++ b/media/libmediaplayerservice/MediaRecorderClient.h @@ -1,6 +1,6 @@ /* ** - ** Copyright 2008, HTC Inc. + ** Copyright 2008, 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. diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp index bcf2463..c27cfc8 100644 --- a/media/libstagefright/AudioPlayer.cpp +++ b/media/libstagefright/AudioPlayer.cpp @@ -23,6 +23,7 @@ #include <media/stagefright/AudioPlayer.h> #include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> +#include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaSource.h> #include <media/stagefright/MetaData.h> @@ -41,6 +42,9 @@ AudioPlayer::AudioPlayer(const sp<MediaPlayerBase::AudioSink> &audioSink) mReachedEOS(false), mFinalStatus(OK), mStarted(false), + mIsFirstBuffer(false), + mFirstBufferResult(OK), + mFirstBuffer(NULL), mAudioSink(audioSink) { } @@ -68,6 +72,24 @@ status_t AudioPlayer::start(bool sourceAlreadyStarted) { } } + // We allow an optional INFO_FORMAT_CHANGED at the very beginning + // of playback, if there is one, getFormat below will retrieve the + // updated format, if there isn't, we'll stash away the valid buffer + // of data to be used on the first audio callback. + + CHECK(mFirstBuffer == NULL); + + mFirstBufferResult = mSource->read(&mFirstBuffer); + if (mFirstBufferResult == INFO_FORMAT_CHANGED) { + LOGV("INFO_FORMAT_CHANGED!!!"); + + CHECK(mFirstBuffer == NULL); + mFirstBufferResult = OK; + mIsFirstBuffer = false; + } else { + mIsFirstBuffer = true; + } + sp<MetaData> format = mSource->getFormat(); const char *mime; bool success = format->findCString(kKeyMIMEType, &mime); @@ -87,7 +109,14 @@ status_t AudioPlayer::start(bool sourceAlreadyStarted) { DEFAULT_AUDIOSINK_BUFFERCOUNT, &AudioPlayer::AudioSinkCallback, this); if (err != OK) { - mSource->stop(); + if (mFirstBuffer != NULL) { + mFirstBuffer->release(); + mFirstBuffer = NULL; + } + + if (!sourceAlreadyStarted) { + mSource->stop(); + } return err; } @@ -108,7 +137,14 @@ status_t AudioPlayer::start(bool sourceAlreadyStarted) { delete mAudioTrack; mAudioTrack = NULL; - mSource->stop(); + if (mFirstBuffer != NULL) { + mFirstBuffer->release(); + mFirstBuffer = NULL; + } + + if (!sourceAlreadyStarted) { + mSource->stop(); + } return err; } @@ -159,6 +195,12 @@ void AudioPlayer::stop() { // Make sure to release any buffer we hold onto so that the // source is able to stop(). + + if (mFirstBuffer != NULL) { + mFirstBuffer->release(); + mFirstBuffer = NULL; + } + if (mInputBuffer != NULL) { LOGV("AudioPlayer releasing input buffer."); @@ -243,6 +285,14 @@ size_t AudioPlayer::fillBuffer(void *data, size_t size) { Mutex::Autolock autoLock(mLock); if (mSeeking) { + if (mIsFirstBuffer) { + if (mFirstBuffer != NULL) { + mFirstBuffer->release(); + mFirstBuffer = NULL; + } + mIsFirstBuffer = false; + } + options.setSeekTo(mSeekTimeUs); if (mInputBuffer != NULL) { @@ -255,7 +305,17 @@ size_t AudioPlayer::fillBuffer(void *data, size_t size) { } if (mInputBuffer == NULL) { - status_t err = mSource->read(&mInputBuffer, &options); + status_t err; + + if (mIsFirstBuffer) { + mInputBuffer = mFirstBuffer; + mFirstBuffer = NULL; + err = mFirstBufferResult; + + mIsFirstBuffer = false; + } else { + err = mSource->read(&mInputBuffer, &options); + } CHECK((err == OK && mInputBuffer != NULL) || (err != OK && mInputBuffer == NULL)); diff --git a/media/libstagefright/codecs/aacdec/AACDecoder.cpp b/media/libstagefright/codecs/aacdec/AACDecoder.cpp index 2bc4448..8ae1135 100644 --- a/media/libstagefright/codecs/aacdec/AACDecoder.cpp +++ b/media/libstagefright/codecs/aacdec/AACDecoder.cpp @@ -15,6 +15,7 @@ */ #include "AACDecoder.h" +#define LOG_TAG "AACDecoder" #include "../../include/ESDS.h" @@ -36,26 +37,33 @@ AACDecoder::AACDecoder(const sp<MediaSource> &source) mAnchorTimeUs(0), mNumSamplesOutput(0), mInputBuffer(NULL) { -} -AACDecoder::~AACDecoder() { - if (mStarted) { - stop(); - } + sp<MetaData> srcFormat = mSource->getFormat(); - delete mConfig; - mConfig = NULL; -} + int32_t sampleRate; + CHECK(srcFormat->findInt32(kKeySampleRate, &sampleRate)); -status_t AACDecoder::start(MetaData *params) { - CHECK(!mStarted); + mMeta = new MetaData; + mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW); - mBufferGroup = new MediaBufferGroup; - mBufferGroup->add_buffer(new MediaBuffer(2048 * 2)); + // We'll always output stereo, regardless of how many channels are + // present in the input due to decoder limitations. + mMeta->setInt32(kKeyChannelCount, 2); + mMeta->setInt32(kKeySampleRate, sampleRate); + int64_t durationUs; + if (srcFormat->findInt64(kKeyDuration, &durationUs)) { + mMeta->setInt64(kKeyDuration, durationUs); + } + mMeta->setCString(kKeyDecoderComponent, "AACDecoder"); + + mInitCheck = initCheck(); +} + +status_t AACDecoder::initCheck() { + memset(mConfig, 0, sizeof(tPVMP4AudioDecoderExternal)); mConfig->outputFormat = OUTPUTFORMAT_16PCM_INTERLEAVED; - mConfig->aacPlusUpsamplingFactor = 0; - mConfig->aacPlusEnabled = false; + mConfig->aacPlusEnabled = 1; // The software decoder doesn't properly support mono output on // AACplus files. Always output stereo. @@ -64,8 +72,11 @@ status_t AACDecoder::start(MetaData *params) { UInt32 memRequirements = PVMP4AudioDecoderGetMemRequirements(); mDecoderBuf = malloc(memRequirements); - CHECK_EQ(PVMP4AudioDecoderInitLibrary(mConfig, mDecoderBuf), - MP4AUDEC_SUCCESS); + status_t err = PVMP4AudioDecoderInitLibrary(mConfig, mDecoderBuf); + if (err != MP4AUDEC_SUCCESS) { + LOGE("Failed to initialize MP4 audio decoder"); + return UNKNOWN_ERROR; + } uint32_t type; const void *data; @@ -83,18 +94,29 @@ status_t AACDecoder::start(MetaData *params) { mConfig->pInputBuffer = (UChar *)codec_specific_data; mConfig->inputBufferCurrentLength = codec_specific_data_size; mConfig->inputBufferMaxLength = 0; - mConfig->inputBufferUsedLength = 0; - mConfig->remainderBits = 0; - - mConfig->pOutputBuffer = NULL; - mConfig->pOutputBuffer_plus = NULL; - mConfig->repositionFlag = false; if (PVMP4AudioDecoderConfig(mConfig, mDecoderBuf) != MP4AUDEC_SUCCESS) { return ERROR_UNSUPPORTED; } } + return OK; +} + +AACDecoder::~AACDecoder() { + if (mStarted) { + stop(); + } + + delete mConfig; + mConfig = NULL; +} + +status_t AACDecoder::start(MetaData *params) { + CHECK(!mStarted); + + mBufferGroup = new MediaBufferGroup; + mBufferGroup->add_buffer(new MediaBuffer(4096 * 2)); mSource->start(); @@ -127,28 +149,7 @@ status_t AACDecoder::stop() { } sp<MetaData> AACDecoder::getFormat() { - sp<MetaData> srcFormat = mSource->getFormat(); - - int32_t sampleRate; - CHECK(srcFormat->findInt32(kKeySampleRate, &sampleRate)); - - sp<MetaData> meta = new MetaData; - meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW); - - // We'll always output stereo, regardless of how many channels are - // present in the input due to decoder limitations. - meta->setInt32(kKeyChannelCount, 2); - - meta->setInt32(kKeySampleRate, sampleRate); - - int64_t durationUs; - if (srcFormat->findInt64(kKeyDuration, &durationUs)) { - meta->setInt64(kKeyDuration, durationUs); - } - - meta->setCString(kKeyDecoderComponent, "AACDecoder"); - - return meta; + return mMeta; } status_t AACDecoder::read( @@ -200,13 +201,32 @@ status_t AACDecoder::read( mConfig->remainderBits = 0; mConfig->pOutputBuffer = static_cast<Int16 *>(buffer->data()); - mConfig->pOutputBuffer_plus = NULL; + mConfig->pOutputBuffer_plus = &mConfig->pOutputBuffer[2048]; mConfig->repositionFlag = false; Int decoderErr = PVMP4AudioDecodeFrame(mConfig, mDecoderBuf); + // Check on the sampling rate to see whether it is changed. + int32_t sampleRate; + CHECK(mMeta->findInt32(kKeySampleRate, &sampleRate)); + if (mConfig->samplingRate != sampleRate) { + mMeta->setInt32(kKeySampleRate, mConfig->samplingRate); + LOGW("Sample rate was %d, but now is %d", + sampleRate, mConfig->samplingRate); + buffer->release(); + mInputBuffer->release(); + mInputBuffer = NULL; + return INFO_FORMAT_CHANGED; + } + size_t numOutBytes = mConfig->frameLength * sizeof(int16_t) * mConfig->desiredChannels; + if (mConfig->aacPlusUpsamplingFactor == 2) { + if (mConfig->desiredChannels == 1) { + memcpy(&mConfig->pOutputBuffer[1024], &mConfig->pOutputBuffer[2048], numOutBytes * 2); + } + numOutBytes *= 2; + } if (decoderErr != MP4AUDEC_SUCCESS) { LOGW("AAC decoder returned error %d, substituting silence", decoderErr); diff --git a/media/libstagefright/include/AACDecoder.h b/media/libstagefright/include/AACDecoder.h index f09addd..200f93c 100644 --- a/media/libstagefright/include/AACDecoder.h +++ b/media/libstagefright/include/AACDecoder.h @@ -25,6 +25,7 @@ struct tPVMP4AudioDecoderExternal; namespace android { struct MediaBufferGroup; +struct MetaData; struct AACDecoder : public MediaSource { AACDecoder(const sp<MediaSource> &source); @@ -41,6 +42,7 @@ protected: virtual ~AACDecoder(); private: + sp<MetaData> mMeta; sp<MediaSource> mSource; bool mStarted; @@ -50,9 +52,11 @@ private: void *mDecoderBuf; int64_t mAnchorTimeUs; int64_t mNumSamplesOutput; + status_t mInitCheck; MediaBuffer *mInputBuffer; + status_t initCheck(); AACDecoder(const AACDecoder &); AACDecoder &operator=(const AACDecoder &); }; diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java index 49d2a76..0b84c8d 100644 --- a/services/java/com/android/server/PackageManagerService.java +++ b/services/java/com/android/server/PackageManagerService.java @@ -6222,11 +6222,10 @@ class PackageManagerService extends IPackageManager.Stub { File dataDir = new File(pkg.applicationInfo.dataDir); dataDir.delete(); } + schedulePackageCleaning(packageName); } synchronized (mPackages) { if (deletedPs != null) { - schedulePackageCleaning(packageName); - if ((flags&PackageManager.DONT_DELETE_DATA) == 0) { if (outInfo != null) { outInfo.removedUid = mSettings.removePackageLP(packageName); |