diff options
| -rw-r--r-- | api/current.xml | 21 | ||||
| -rw-r--r-- | core/java/android/app/ActivityManager.java | 11 | ||||
| -rw-r--r-- | core/java/android/preference/PreferenceManager.java | 4 | ||||
| -rw-r--r-- | docs/html/guide/topics/data/data-storage.jd | 4 | ||||
| -rw-r--r-- | include/media/stagefright/MPEG4Writer.h | 5 | ||||
| -rw-r--r-- | include/media/stagefright/MetaData.h | 1 | ||||
| -rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 204 | ||||
| -rw-r--r-- | media/libstagefright/MPEG4Writer.cpp | 251 | ||||
| -rw-r--r-- | media/libstagefright/include/AwesomePlayer.h | 3 | ||||
| -rw-r--r-- | services/java/com/android/server/PackageManagerService.java | 6 | ||||
| -rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 2 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/PhoneBase.java | 2 | ||||
| -rwxr-xr-x | telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java | 2 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java | 2 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/gsm/GSMPhone.java | 4 |
15 files changed, 194 insertions, 328 deletions
diff --git a/api/current.xml b/api/current.xml index f7a59540c6b4..3d91a7e38545 100644 --- a/api/current.xml +++ b/api/current.xml @@ -21704,17 +21704,6 @@ visibility="public" > </field> -<field name="FLAG_HEAVY_WEIGHT" - type="int" - transient="false" - volatile="false" - value="1" - static="true" - final="true" - deprecated="not deprecated" - visibility="public" -> -</field> <field name="IMPORTANCE_BACKGROUND" type="int" transient="false" @@ -21825,16 +21814,6 @@ visibility="public" > </field> -<field name="flags" - type="int" - transient="false" - volatile="false" - static="false" - final="false" - deprecated="not deprecated" - visibility="public" -> -</field> <field name="importance" type="int" transient="false" diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index d5741fc4bc47..4736404d9b0f 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -755,14 +755,17 @@ public class ActivityManager { public String pkgList[]; /** - * Constant for {@link #flags}: this is a heavy-weight process, - * meaning it will not be killed while in the background. + * Constant for {@link #flags}: this is an app that is unable to + * correctly save its state when going to the background, + * so it can not be killed while in the background. + * @hide */ - public static final int FLAG_HEAVY_WEIGHT = 1<<0; + public static final int FLAG_CANT_SAVE_STATE = 1<<0; /** * Flags of information. May be any of - * {@link #FLAG_HEAVY_WEIGHT}. + * {@link #FLAG_CANT_SAVE_STATE}. + * @hide */ public int flags; diff --git a/core/java/android/preference/PreferenceManager.java b/core/java/android/preference/PreferenceManager.java index 2b2094693f78..fa838976fed9 100644 --- a/core/java/android/preference/PreferenceManager.java +++ b/core/java/android/preference/PreferenceManager.java @@ -443,7 +443,7 @@ public class PreferenceManager { pm.setSharedPreferencesMode(sharedPreferencesMode); pm.inflateFromResource(context, resId, null); - defaultValueSp.edit().putBoolean(KEY_HAS_SET_DEFAULT_VALUES, true).commit(); + defaultValueSp.edit().putBoolean(KEY_HAS_SET_DEFAULT_VALUES, true).apply(); } } @@ -481,7 +481,7 @@ public class PreferenceManager { private void setNoCommit(boolean noCommit) { if (!noCommit && mEditor != null) { - mEditor.commit(); + mEditor.apply(); } mNoCommit = noCommit; diff --git a/docs/html/guide/topics/data/data-storage.jd b/docs/html/guide/topics/data/data-storage.jd index 293a0579ef67..e20d1ed22761 100644 --- a/docs/html/guide/topics/data/data-storage.jd +++ b/docs/html/guide/topics/data/data-storage.jd @@ -115,7 +115,7 @@ public class Calc extends Activity { public static final String PREFS_NAME = "MyPrefsFile"; @Override - protected void onCreate(Bundle state){ + protected void onCreate(Bundle state){ super.onCreate(state); . . . @@ -374,7 +374,7 @@ android.database.sqlite.SQLiteOpenHelper#onCreate(SQLiteDatabase) onCreate()} me can execute a SQLite command to create tables in the database. For example:</p> <pre> -public class MyDbOpenHelper extends SQLiteOpenHelper { +public class DictionaryOpenHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 2; private static final String DICTIONARY_TABLE_NAME = "dictionary"; diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h index 52b93e189346..70bd8e8fdd95 100644 --- a/include/media/stagefright/MPEG4Writer.h +++ b/include/media/stagefright/MPEG4Writer.h @@ -62,6 +62,7 @@ private: class Track; FILE *mFile; + bool mUse4ByteNalLength; bool mUse32BitOffset; bool mPaused; bool mStarted; @@ -135,6 +136,10 @@ private: void setDriftTimeUs(int64_t driftTimeUs); int64_t getDriftTimeUs(); + // Return whether the nal length is 4 bytes or 2 bytes + // Only makes sense for H.264/AVC + bool useNalLengthFour(); + void lock(); void unlock(); diff --git a/include/media/stagefright/MetaData.h b/include/media/stagefright/MetaData.h index 3b31e6814889..0b6201ce8e02 100644 --- a/include/media/stagefright/MetaData.h +++ b/include/media/stagefright/MetaData.h @@ -79,6 +79,7 @@ enum { // Set this key to enable authoring files in 64-bit offset kKey64BitFileOffset = 'fobt', // int32_t (bool) + kKey2ByteNalLength = '2NAL', // int32_t (bool) // Identify the file output format for authoring // Please see <media/mediarecorder.h> for the supported diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 2681dc3bf6e0..c13726ba6b8c 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -50,6 +50,9 @@ namespace android { +static int64_t kLowWaterMarkUs = 2000000ll; // 2secs +static int64_t kHighWaterMarkUs = 10000000ll; // 10secs + struct AwesomeEvent : public TimedEventQueue::Event { AwesomeEvent( AwesomePlayer *player, @@ -450,6 +453,25 @@ void AwesomePlayer::notifyListener_l(int msg, int ext1, int ext2) { } } +// Returns true iff cached duration is available/applicable. +bool AwesomePlayer::getCachedDuration_l(int64_t *durationUs, bool *eos) { + off_t totalSize; + + if (mRTSPController != NULL) { + *durationUs = mRTSPController->getQueueDurationUs(eos); + return true; + } else if (mCachedSource != NULL && mDurationUs >= 0 + && mCachedSource->getSize(&totalSize) == OK) { + int64_t bitrate = totalSize * 8000000ll / mDurationUs; // in bits/sec + + size_t cachedDataRemaining = mCachedSource->approxDataRemaining(eos); + *durationUs = cachedDataRemaining * 8000000ll / bitrate; + return true; + } + + return false; +} + void AwesomePlayer::onBufferingUpdate() { Mutex::Autolock autoLock(mLock); if (!mBufferingEventPending) { @@ -457,78 +479,82 @@ void AwesomePlayer::onBufferingUpdate() { } mBufferingEventPending = false; - int kLowWaterMarkSecs = 2; - int kHighWaterMarkSecs = 10; - - if (mRTSPController != NULL) { + if (mCachedSource != NULL) { bool eos; - int64_t queueDurationUs = mRTSPController->getQueueDurationUs(&eos); + size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&eos); - LOGV("queueDurationUs = %.2f secs", queueDurationUs / 1E6); + if (eos) { + notifyListener_l(MEDIA_BUFFERING_UPDATE, 100); + } else { + off_t size; + if (mDurationUs >= 0 && mCachedSource->getSize(&size) == OK) { + int64_t bitrate = size * 8000000ll / mDurationUs; // in bits/sec - if ((mFlags & PLAYING) && !eos - && (queueDurationUs < kLowWaterMarkSecs * 1000000ll)) { - LOGI("rtsp cache is running low, pausing."); - mFlags |= CACHE_UNDERRUN; - pause_l(); - notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START); - } else if ((mFlags & CACHE_UNDERRUN) - && (eos || queueDurationUs > kHighWaterMarkSecs * 1000000ll)) { - LOGI("rtsp cache has filled up, resuming."); - mFlags &= ~CACHE_UNDERRUN; - play_l(); - notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_END); - } + size_t cachedSize = mCachedSource->cachedSize(); + int64_t cachedDurationUs = cachedSize * 8000000ll / bitrate; - postBufferingEvent_l(); - return; - } + int percentage = 100.0 * (double)cachedDurationUs / mDurationUs; + if (percentage > 100) { + percentage = 100; + } - if (mCachedSource == NULL) { - return; + notifyListener_l(MEDIA_BUFFERING_UPDATE, percentage); + } else { + // We don't know the bitrate of the stream, use absolute size + // limits to maintain the cache. + + const size_t kLowWaterMarkBytes = 400000; + const size_t kHighWaterMarkBytes = 1000000; + + if ((mFlags & PLAYING) && !eos + && (cachedDataRemaining < kLowWaterMarkBytes)) { + LOGI("cache is running low (< %d) , pausing.", + kLowWaterMarkBytes); + mFlags |= CACHE_UNDERRUN; + pause_l(); + notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START); + } else if (eos || cachedDataRemaining > kHighWaterMarkBytes) { + if (mFlags & CACHE_UNDERRUN) { + LOGI("cache has filled up (> %d), resuming.", + kHighWaterMarkBytes); + mFlags &= ~CACHE_UNDERRUN; + play_l(); + notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_END); + } else if (mFlags & PREPARING) { + LOGV("cache has filled up (> %d), prepare is done", + kHighWaterMarkBytes); + finishAsyncPrepare_l(); + } + } + } + } } + int64_t cachedDurationUs; bool eos; - size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&eos); - - size_t lowWatermark = 400000; - size_t highWatermark = 1000000; - - if (eos) { - notifyListener_l(MEDIA_BUFFERING_UPDATE, 100); - } else { - off_t size; - if (mDurationUs >= 0 && mCachedSource->getSize(&size) == OK) { - int64_t bitrate = size * 8000000ll / mDurationUs; // in bits/sec - - size_t cachedSize = mCachedSource->cachedSize(); - int64_t cachedDurationUs = cachedSize * 8000000ll / bitrate; - - int percentage = 100.0 * (double)cachedDurationUs / mDurationUs; - if (percentage > 100) { - percentage = 100; + if (getCachedDuration_l(&cachedDurationUs, &eos)) { + if ((mFlags & PLAYING) && !eos + && (cachedDurationUs < kLowWaterMarkUs)) { + LOGI("cache is running low (%.2f secs) , pausing.", + cachedDurationUs / 1E6); + mFlags |= CACHE_UNDERRUN; + pause_l(); + notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START); + } else if (eos || cachedDurationUs > kHighWaterMarkUs) { + if (mFlags & CACHE_UNDERRUN) { + LOGI("cache has filled up (%.2f secs), resuming.", + cachedDurationUs / 1E6); + mFlags &= ~CACHE_UNDERRUN; + play_l(); + notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_END); + } else if (mFlags & PREPARING) { + LOGV("cache has filled up (%.2f secs), prepare is done", + cachedDurationUs / 1E6); + finishAsyncPrepare_l(); } - - notifyListener_l(MEDIA_BUFFERING_UPDATE, percentage); - - lowWatermark = kLowWaterMarkSecs * bitrate / 8; - highWatermark = kHighWaterMarkSecs * bitrate / 8; } } - if ((mFlags & PLAYING) && !eos && (cachedDataRemaining < lowWatermark)) { - LOGI("cache is running low (< %d) , pausing.", lowWatermark); - mFlags |= CACHE_UNDERRUN; - pause_l(); - notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START); - } else if ((mFlags & CACHE_UNDERRUN) - && (eos || cachedDataRemaining > highWatermark)) { - LOGI("cache has filled up (> %d), resuming.", highWatermark); - mFlags &= ~CACHE_UNDERRUN; - play_l(); - notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_END); - } - postBufferingEvent_l(); } @@ -1437,45 +1463,49 @@ bool AwesomePlayer::ContinuePreparation(void *cookie) { } void AwesomePlayer::onPrepareAsyncEvent() { - { - Mutex::Autolock autoLock(mLock); + Mutex::Autolock autoLock(mLock); - if (mFlags & PREPARE_CANCELLED) { - LOGI("prepare was cancelled before doing anything"); - abortPrepare(UNKNOWN_ERROR); - return; - } + if (mFlags & PREPARE_CANCELLED) { + LOGI("prepare was cancelled before doing anything"); + abortPrepare(UNKNOWN_ERROR); + return; + } - if (mUri.size() > 0) { - status_t err = finishSetDataSource_l(); + if (mUri.size() > 0) { + status_t err = finishSetDataSource_l(); - if (err != OK) { - abortPrepare(err); - return; - } + if (err != OK) { + abortPrepare(err); + return; } + } - if (mVideoTrack != NULL && mVideoSource == NULL) { - status_t err = initVideoDecoder(); + if (mVideoTrack != NULL && mVideoSource == NULL) { + status_t err = initVideoDecoder(); - if (err != OK) { - abortPrepare(err); - return; - } + if (err != OK) { + abortPrepare(err); + return; } + } - if (mAudioTrack != NULL && mAudioSource == NULL) { - status_t err = initAudioDecoder(); + if (mAudioTrack != NULL && mAudioSource == NULL) { + status_t err = initAudioDecoder(); - if (err != OK) { - abortPrepare(err); - return; - } + if (err != OK) { + abortPrepare(err); + return; } } - Mutex::Autolock autoLock(mLock); + if (mCachedSource != NULL || mRTSPController != NULL) { + postBufferingEvent_l(); + } else { + finishAsyncPrepare_l(); + } +} +void AwesomePlayer::finishAsyncPrepare_l() { if (mIsAsyncPrepare) { if (mVideoWidth < 0 || mVideoHeight < 0) { notifyListener_l(MEDIA_SET_VIDEO_SIZE, 0, 0); @@ -1491,8 +1521,6 @@ void AwesomePlayer::onPrepareAsyncEvent() { mFlags |= PREPARED; mAsyncPrepareEvent = NULL; mPreparedCondition.broadcast(); - - postBufferingEvent_l(); } status_t AwesomePlayer::suspend() { diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp index 5dcbc22d66ab..806836d82c6a 100644 --- a/media/libstagefright/MPEG4Writer.cpp +++ b/media/libstagefright/MPEG4Writer.cpp @@ -32,7 +32,6 @@ #include <media/stagefright/MediaSource.h> #include <media/stagefright/Utils.h> #include <media/mediarecorder.h> -#include <cutils/properties.h> #include "include/ESDS.h" @@ -113,7 +112,6 @@ private: size_t mNumStssTableEntries; List<int32_t> mStssTableEntries; - List<int64_t> mChunkDurations; size_t mNumSttsTableEntries; struct SttsTableEntry { @@ -167,12 +165,6 @@ private: void trackProgressStatus(int64_t timeUs, status_t err = OK); void initTrackingProgressStatus(MetaData *params); - // Utilities for collecting statistical data - void logStatisticalData(bool isAudio); - void findMinAvgMaxSampleDurationMs( - int32_t *min, int32_t *avg, int32_t *max); - void findMinMaxChunkDurations(int64_t *min, int64_t *max); - void getCodecSpecificDataFromInputFormatIfPossible(); // Determine the track time scale @@ -193,10 +185,9 @@ private: Track &operator=(const Track &); }; -#define USE_NALLEN_FOUR 1 - MPEG4Writer::MPEG4Writer(const char *filename) : mFile(fopen(filename, "wb")), + mUse4ByteNalLength(true), mUse32BitOffset(true), mPaused(false), mStarted(false), @@ -209,6 +200,7 @@ MPEG4Writer::MPEG4Writer(const char *filename) MPEG4Writer::MPEG4Writer(int fd) : mFile(fdopen(fd, "wb")), + mUse4ByteNalLength(true), mUse32BitOffset(true), mPaused(false), mStarted(false), @@ -360,11 +352,11 @@ status_t MPEG4Writer::start(MetaData *param) { } } - // System property can overwrite the file offset bits parameter - char value[PROPERTY_VALUE_MAX]; - if (property_get("media.stagefright.record-64bits", value, NULL) - && (!strcmp(value, "1") || !strcasecmp(value, "true"))) { - mUse32BitOffset = false; + int32_t use2ByteNalLength; + if (param && + param->findInt32(kKey2ByteNalLength, &use2ByteNalLength) && + use2ByteNalLength) { + mUse4ByteNalLength = false; } mStartTimestampUs = -1; @@ -639,32 +631,30 @@ off_t MPEG4Writer::addLengthPrefixedSample_l(MediaBuffer *buffer) { size_t length = buffer->range_length(); -#if USE_NALLEN_FOUR - uint8_t x = length >> 24; - fwrite(&x, 1, 1, mFile); - x = (length >> 16) & 0xff; - fwrite(&x, 1, 1, mFile); - x = (length >> 8) & 0xff; - fwrite(&x, 1, 1, mFile); - x = length & 0xff; - fwrite(&x, 1, 1, mFile); -#else - CHECK(length < 65536); - - uint8_t x = length >> 8; - fwrite(&x, 1, 1, mFile); - x = length & 0xff; - fwrite(&x, 1, 1, mFile); -#endif - - fwrite((const uint8_t *)buffer->data() + buffer->range_offset(), - 1, length, mFile); + if (mUse4ByteNalLength) { + uint8_t x = length >> 24; + fwrite(&x, 1, 1, mFile); + x = (length >> 16) & 0xff; + fwrite(&x, 1, 1, mFile); + x = (length >> 8) & 0xff; + fwrite(&x, 1, 1, mFile); + x = length & 0xff; + fwrite(&x, 1, 1, mFile); + + fwrite((const uint8_t *)buffer->data() + buffer->range_offset(), + 1, length, mFile); + mOffset += length + 4; + } else { + CHECK(length < 65536); -#if USE_NALLEN_FOUR - mOffset += length + 4; -#else - mOffset += length + 2; -#endif + uint8_t x = length >> 8; + fwrite(&x, 1, 1, mFile); + x = length & 0xff; + fwrite(&x, 1, 1, mFile); + fwrite((const uint8_t *)buffer->data() + buffer->range_offset(), + 1, length, mFile); + mOffset += length + 2; + } return old_offset; } @@ -1204,46 +1194,6 @@ void *MPEG4Writer::Track::ThreadWrapper(void *me) { return (void *) err; } -#include <ctype.h> -static void hexdump(const void *_data, size_t size) { - const uint8_t *data = (const uint8_t *)_data; - size_t offset = 0; - while (offset < size) { - printf("0x%04x ", offset); - - size_t n = size - offset; - if (n > 16) { - n = 16; - } - - for (size_t i = 0; i < 16; ++i) { - if (i == 8) { - printf(" "); - } - - if (offset + i < size) { - printf("%02x ", data[offset + i]); - } else { - printf(" "); - } - } - - printf(" "); - - for (size_t i = 0; i < n; ++i) { - if (isprint(data[offset + i])) { - printf("%c", data[offset + i]); - } else { - printf("."); - } - } - - printf("\n"); - - offset += 16; - } -} - static void getNalUnitType(uint8_t byte, uint8_t* type) { LOGV("getNalUnitType: %d", byte); @@ -1415,7 +1365,6 @@ status_t MPEG4Writer::Track::parseAVCCodecSpecificData( status_t MPEG4Writer::Track::makeAVCCodecSpecificData( const uint8_t *data, size_t size) { - // hexdump(data, size); if (mCodecSpecificData != NULL) { LOGE("Already have codec specific data"); @@ -1446,11 +1395,11 @@ status_t MPEG4Writer::Track::makeAVCCodecSpecificData( header[3] = mLevelIdc; // 6-bit '111111' followed by 2-bit to lengthSizeMinuusOne -#if USE_NALLEN_FOUR - header[4] = 0xfc | 3; // length size == 4 bytes -#else - header[4] = 0xfc | 1; // length size == 2 bytes -#endif + if (mOwner->useNalLengthFour()) { + header[4] = 0xfc | 3; // length size == 4 bytes + } else { + header[4] = 0xfc | 1; // length size == 2 bytes + } // 3-bit '111' followed by 5-bit numSequenceParameterSets int nSequenceParamSets = mSeqParamSets.size(); @@ -1487,15 +1436,6 @@ status_t MPEG4Writer::Track::makeAVCCodecSpecificData( return OK; } -static bool collectStatisticalData() { - char value[PROPERTY_VALUE_MAX]; - if (property_get("media.stagefright.record-stats", value, NULL) - && (!strcmp(value, "1") || !strcasecmp(value, "true"))) { - return true; - } - return false; -} - status_t MPEG4Writer::Track::threadEntry() { int32_t count = 0; const int64_t interleaveDurationUs = mOwner->interleaveDuration(); @@ -1512,7 +1452,6 @@ status_t MPEG4Writer::Track::threadEntry() { int64_t timestampUs; sp<MetaData> meta_data; - bool collectStats = collectStatisticalData(); mNumSamples = 0; status_t err = OK; @@ -1575,14 +1514,14 @@ status_t MPEG4Writer::Track::threadEntry() { if (mIsAvc) StripStartcode(copy); - size_t sampleSize; - sampleSize = mIsAvc -#if USE_NALLEN_FOUR - ? copy->range_length() + 4 -#else - ? copy->range_length() + 2 -#endif - : copy->range_length(); + size_t sampleSize = copy->range_length(); + if (mIsAvc) { + if (mOwner->useNalLengthFour()) { + sampleSize += 4; + } else { + sampleSize += 2; + } + } // Max file size or duration handling mMdatSizeBytes += sampleSize; @@ -1722,9 +1661,6 @@ status_t MPEG4Writer::Track::threadEntry() { } else { if (timestampUs - chunkTimestampUs > interleaveDurationUs) { ++nChunks; - if (collectStats) { - mChunkDurations.push_back(timestampUs - chunkTimestampUs); - } if (nChunks == 1 || // First chunk (--(mStscTableEntries.end()))->samplesPerChunk != mChunkSamples.size()) { @@ -1767,7 +1703,6 @@ status_t MPEG4Writer::Track::threadEntry() { LOGI("Received total/0-length (%d/%d) buffers and encoded %d frames. - %s", count, nZeroLengthFrames, mNumSamples, mIsAudio? "audio": "video"); - logStatisticalData(mIsAudio); if (err == ERROR_END_OF_STREAM) { return OK; } @@ -1792,17 +1727,6 @@ void MPEG4Writer::trackProgressStatus( CHECK(nTracks < 64); // Arbitrary number int32_t trackNum = 0; -#if 0 - // In the worst case, we can put the trackNum - // along with MEDIA_RECORDER_INFO_COMPLETION_STATUS - // to report the progress. - for (List<Track *>::iterator it = mTracks.begin(); - it != mTracks.end(); ++it, ++trackNum) { - if (track == (*it)) { - break; - } - } -#endif CHECK(trackNum < nTracks); trackNum <<= 16; @@ -1829,91 +1753,6 @@ void MPEG4Writer::trackProgressStatus( } } -void MPEG4Writer::Track::findMinAvgMaxSampleDurationMs( - int32_t *min, int32_t *avg, int32_t *max) { - CHECK(!mSampleSizes.empty()); - int32_t avgSampleDurationMs = mTrackDurationUs / 1000 / mNumSamples; - int32_t minSampleDurationMs = 0x7FFFFFFF; - int32_t maxSampleDurationMs = 0; - for (List<SttsTableEntry>::iterator it = mSttsTableEntries.begin(); - it != mSttsTableEntries.end(); ++it) { - int32_t sampleDurationMs = - (static_cast<int32_t>(it->sampleDurationUs) + 500) / 1000; - if (sampleDurationMs > maxSampleDurationMs) { - maxSampleDurationMs = sampleDurationMs; - } else if (sampleDurationMs < minSampleDurationMs) { - minSampleDurationMs = sampleDurationMs; - } - LOGI("sample duration: %d ms", sampleDurationMs); - } - CHECK(minSampleDurationMs != 0); - CHECK(avgSampleDurationMs != 0); - CHECK(maxSampleDurationMs != 0); - *min = minSampleDurationMs; - *avg = avgSampleDurationMs; - *max = maxSampleDurationMs; -} - -// Don't count the last duration -void MPEG4Writer::Track::findMinMaxChunkDurations(int64_t *min, int64_t *max) { - int64_t duration = mOwner->interleaveDuration(); - int64_t minChunkDuration = duration; - int64_t maxChunkDuration = duration; - if (mChunkDurations.size() > 1) { - for (List<int64_t>::iterator it = mChunkDurations.begin(); - it != --mChunkDurations.end(); ++it) { - if (minChunkDuration > (*it)) { - minChunkDuration = (*it); - } else if (maxChunkDuration < (*it)) { - maxChunkDuration = (*it); - } - } - } - *min = minChunkDuration; - *max = maxChunkDuration; -} - -void MPEG4Writer::Track::logStatisticalData(bool isAudio) { - if (mTrackDurationUs <= 0 || mSampleSizes.empty()) { - LOGI("nothing is recorded"); - return; - } - - bool collectStats = collectStatisticalData(); - - if (collectStats) { - LOGI("%s track - duration %lld us, total %d frames", - isAudio? "audio": "video", mTrackDurationUs, - mNumSamples); - int32_t min, avg, max; - findMinAvgMaxSampleDurationMs(&min, &avg, &max); - LOGI("min/avg/max sample duration (ms): %d/%d/%d", min, avg, max); - if (!isAudio) { - float avgFps = 1000.0 / avg; - float minFps = 1000.0 / max; - float maxFps = 1000.0 / min; - LOGI("min/avg/max frame rate (fps): %.2f/%.2f/%.2f", - minFps, avgFps, maxFps); - } - - int64_t totalBytes = 0; - for (List<size_t>::iterator it = mSampleSizes.begin(); - it != mSampleSizes.end(); ++it) { - totalBytes += (*it); - } - float bitRate = (totalBytes * 8000000.0) / mTrackDurationUs; - LOGI("avg bit rate (bps): %.2f", bitRate); - - int64_t duration = mOwner->interleaveDuration(); - if (duration != 0) { // If interleaving is enabled - int64_t minChunk, maxChunk; - findMinMaxChunkDurations(&minChunk, &maxChunk); - LOGI("min/avg/max chunk duration (ms): %lld/%lld/%lld", - minChunk, duration, maxChunk); - } - } -} - void MPEG4Writer::setDriftTimeUs(int64_t driftTimeUs) { LOGV("setDriftTimeUs: %lld us", driftTimeUs); Mutex::Autolock autolock(mLock); @@ -1926,6 +1765,10 @@ int64_t MPEG4Writer::getDriftTimeUs() { return mDriftTimeUs; } +bool MPEG4Writer::useNalLengthFour() { + return mUse4ByteNalLength; +} + void MPEG4Writer::Track::bufferChunk(int64_t timestampUs) { LOGV("bufferChunk"); diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h index 55e2c3651a9e..f47deb8489ee 100644 --- a/media/libstagefright/include/AwesomePlayer.h +++ b/media/libstagefright/include/AwesomePlayer.h @@ -238,6 +238,9 @@ private: void onCheckAudioStatus(); void onPrepareAsyncEvent(); void abortPrepare(status_t err); + void finishAsyncPrepare_l(); + + bool getCachedDuration_l(int64_t *durationUs, bool *eos); status_t finishSetDataSource_l(); diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java index f5862dfedac8..e3480a888771 100644 --- a/services/java/com/android/server/PackageManagerService.java +++ b/services/java/com/android/server/PackageManagerService.java @@ -2022,7 +2022,11 @@ class PackageManagerService extends IPackageManager.Stub { ActivityInfo ai = getActivityInfo(pa.mActivity, flags); if (DEBUG_PREFERRED) { Log.v(TAG, "Got preferred activity:"); - ai.dump(new LogPrinter(Log.INFO, TAG), " "); + if (ai != null) { + ai.dump(new LogPrinter(Log.VERBOSE, TAG), " "); + } else { + Log.v(TAG, " null"); + } } if (ai != null) { for (int j=0; j<N; j++) { diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 30dc5ea84ec3..89a162764b15 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -6801,7 +6801,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen app.pid, app.getPackageList()); currApp.uid = app.info.uid; if (mHeavyWeightProcess == app) { - currApp.flags |= ActivityManager.RunningAppProcessInfo.FLAG_HEAVY_WEIGHT; + currApp.flags |= ActivityManager.RunningAppProcessInfo.FLAG_CANT_SAVE_STATE; } int adj = app.curAdj; if (adj >= EMPTY_APP_ADJ) { diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java index 74601e620be4..ff28773df5c2 100644 --- a/telephony/java/com/android/internal/telephony/PhoneBase.java +++ b/telephony/java/com/android/internal/telephony/PhoneBase.java @@ -286,7 +286,7 @@ public abstract class PhoneBase extends Handler implements Phone { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences.Editor editor = sp.edit(); editor.putBoolean(DNS_SERVER_CHECK_DISABLED_KEY, b); - editor.commit(); + editor.apply(); } /** diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java index c21b6d986523..4508e9a4d741 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java +++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java @@ -1405,7 +1405,7 @@ public class CDMAPhone extends PhoneBase { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences.Editor editor = sp.edit(); editor.putString(VM_NUMBER_CDMA, number); - editor.commit(); + editor.apply(); } /** diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java index 8eaf4a27f462..dceff2a956b6 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java @@ -127,7 +127,7 @@ final class CdmaSMSDispatcher extends SMSDispatcher { mPhone.getContext()); SharedPreferences.Editor editor = sp.edit(); editor.putInt(CDMAPhone.VM_COUNT_CDMA, voicemailCount); - editor.commit(); + editor.apply(); ((CDMAPhone) mPhone).updateMessageWaitingIndicator(voicemailCount); handled = true; } else if (((SmsEnvelope.TELESERVICE_WMT == teleService) || diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java index c7b1e5cd3c52..e5ca51932641 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java +++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java @@ -807,7 +807,7 @@ public class GSMPhone extends PhoneBase { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences.Editor editor = sp.edit(); editor.putString(VM_NUMBER, number); - editor.commit(); + editor.apply(); setVmSimImsi(getSubscriberId()); } @@ -830,7 +830,7 @@ public class GSMPhone extends PhoneBase { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences.Editor editor = sp.edit(); editor.putString(VM_SIM_IMSI, imsi); - editor.commit(); + editor.apply(); } public String getVoiceMailAlphaTag() { |