Merge "Adding a feature to indicate that the device possesses low-latency audio. The specific criteria for low-latency audio are defined in the CDD, but since that hasn't yet been settled for Gingerbread, this change doesn't go into details. We can do a docs change later once GB CDD is final." into gingerbread
diff --git a/core/java/android/pim/RecurrenceSet.java b/core/java/android/pim/RecurrenceSet.java
index 635323e..f5e1bac 100644
--- a/core/java/android/pim/RecurrenceSet.java
+++ b/core/java/android/pim/RecurrenceSet.java
@@ -181,7 +181,9 @@
boolean inUtc = start.parse(dtstart);
boolean allDay = start.allDay;
- if (inUtc) {
+ // We force TimeZone to UTC for "all day recurring events" as the server is sending no
+ // TimeZone in DTSTART for them
+ if (inUtc || allDay) {
tzid = Time.TIMEZONE_UTC;
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 7490a7a..7098bf3 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2950,16 +2950,28 @@
if (rangeY > 0 || getOverscrollMode() == OVERSCROLL_ALWAYS) {
if (y < 0 && oldY >= 0) {
mEdgeGlowTop.onAbsorb((int) mScroller.getCurrVelocity());
+ if (!mEdgeGlowBottom.isFinished()) {
+ mEdgeGlowBottom.onRelease();
+ }
} else if (y > rangeY && oldY <= rangeY) {
mEdgeGlowBottom.onAbsorb((int) mScroller.getCurrVelocity());
+ if (!mEdgeGlowTop.isFinished()) {
+ mEdgeGlowTop.onRelease();
+ }
}
}
if (rangeX > 0) {
if (x < 0 && oldX >= 0) {
mEdgeGlowLeft.onAbsorb((int) mScroller.getCurrVelocity());
+ if (!mEdgeGlowRight.isFinished()) {
+ mEdgeGlowRight.onRelease();
+ }
} else if (x > rangeX && oldX <= rangeX) {
mEdgeGlowRight.onAbsorb((int) mScroller.getCurrVelocity());
+ if (!mEdgeGlowLeft.isFinished()) {
+ mEdgeGlowLeft.onRelease();
+ }
}
}
}
@@ -5548,8 +5560,14 @@
final int pulledToX = oldX + deltaX;
if (pulledToX < 0) {
mEdgeGlowLeft.onPull((float) deltaX / getWidth());
+ if (!mEdgeGlowRight.isFinished()) {
+ mEdgeGlowRight.onRelease();
+ }
} else if (pulledToX > rangeX) {
mEdgeGlowRight.onPull((float) deltaX / getWidth());
+ if (!mEdgeGlowLeft.isFinished()) {
+ mEdgeGlowLeft.onRelease();
+ }
}
}
@@ -5557,8 +5575,14 @@
final int pulledToY = oldY + deltaY;
if (pulledToY < 0) {
mEdgeGlowTop.onPull((float) deltaY / getHeight());
+ if (!mEdgeGlowBottom.isFinished()) {
+ mEdgeGlowBottom.onRelease();
+ }
} else if (pulledToY > rangeY) {
mEdgeGlowBottom.onPull((float) deltaY / getHeight());
+ if (!mEdgeGlowTop.isFinished()) {
+ mEdgeGlowTop.onRelease();
+ }
}
}
}
diff --git a/core/tests/coretests/src/android/pim/RecurrenceSetTest.java b/core/tests/coretests/src/android/pim/RecurrenceSetTest.java
index 64cd6c4..5d01ba0 100644
--- a/core/tests/coretests/src/android/pim/RecurrenceSetTest.java
+++ b/core/tests/coretests/src/android/pim/RecurrenceSetTest.java
@@ -46,7 +46,7 @@
String recurrence = "DTSTART;VALUE=DATE:20090821\nDTEND;VALUE=DATE:20090822\n"
+ "RRULE:FREQ=YEARLY;WKST=SU";
verifyPopulateContentValues(recurrence, "FREQ=YEARLY;WKST=SU", null,
- null, null, 1250812800000L, null, "P1D", 1);
+ null, null, 1250812800000L, "UTC", "P1D", 1);
}
// Test 2 day all-day event
@@ -55,7 +55,7 @@
String recurrence = "DTSTART;VALUE=DATE:20090821\nDTEND;VALUE=DATE:20090823\n"
+ "RRULE:FREQ=YEARLY;WKST=SU";
verifyPopulateContentValues(recurrence, "FREQ=YEARLY;WKST=SU", null,
- null, null, 1250812800000L, null, "P2D", 1);
+ null, null, 1250812800000L, "UTC", "P2D", 1);
}
// run populateContentValues and verify the results
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index 03a6bbb..5505f14 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -65,8 +65,8 @@
{
pContext->mCaptureIdx = 0;
pContext->mCurrentBuf = 0;
- memset(pContext->mCaptureBuf[0], 0, VISUALIZER_CAPTURE_SIZE_MAX);
- memset(pContext->mCaptureBuf[1], 0, VISUALIZER_CAPTURE_SIZE_MAX);
+ memset(pContext->mCaptureBuf[0], 0x80, VISUALIZER_CAPTURE_SIZE_MAX);
+ memset(pContext->mCaptureBuf[1], 0x80, VISUALIZER_CAPTURE_SIZE_MAX);
}
//----------------------------------------------------------------------------
diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp
index 0f3e245..88b8c86 100644
--- a/media/libmedia/AudioEffect.cpp
+++ b/media/libmedia/AudioEffect.cpp
@@ -228,24 +228,32 @@
void *replyData)
{
if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) {
+ LOGV("command() bad status %d", mStatus);
return INVALID_OPERATION;
}
+ if ((cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) &&
+ (replySize == NULL || *replySize != sizeof(status_t) || replyData == NULL)) {
+ return BAD_VALUE;
+ }
+
status_t status = mIEffect->command(cmdCode, cmdSize, cmdData, replySize, replyData);
if (status != NO_ERROR) {
return status;
}
- status = *(status_t *)replyData;
- if (status != NO_ERROR) {
- return status;
+
+ if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) {
+ status = *(status_t *)replyData;
+ if (status != NO_ERROR) {
+ return status;
+ }
+ if (cmdCode == EFFECT_CMD_ENABLE) {
+ android_atomic_or(1, &mEnabled);
+ } else {
+ android_atomic_and(~1, &mEnabled);
+ }
}
- if (cmdCode == EFFECT_CMD_ENABLE) {
- android_atomic_or(1, &mEnabled);
- }
- if (cmdCode == EFFECT_CMD_DISABLE) {
- android_atomic_and(~1, &mEnabled);
- }
return status;
}
diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp
index 39552b6..68f2e9b 100644
--- a/media/libmedia/Visualizer.cpp
+++ b/media/libmedia/Visualizer.cpp
@@ -169,11 +169,13 @@
status_t status = NO_ERROR;
if (mEnabled) {
uint32_t replySize = mCaptureSize;
- status_t status = command(VISU_CMD_CAPTURE, 0, NULL, &replySize, waveform);
+ status = command(VISU_CMD_CAPTURE, 0, NULL, &replySize, waveform);
+ LOGV("getWaveForm() command returned %d", status);
if (replySize == 0) {
status = NOT_ENOUGH_DATA;
}
} else {
+ LOGV("getWaveForm() disabled");
memset(waveform, 0x80, mCaptureSize);
}
return status;
@@ -191,7 +193,7 @@
status_t status = NO_ERROR;
if (mEnabled) {
uint8_t buf[mCaptureSize];
- status_t status = getWaveForm(buf);
+ status = getWaveForm(buf);
if (status == NO_ERROR) {
status = doFft(fft, buf);
}
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index ba1e218..e6c2f7e 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -1541,20 +1541,52 @@
int32_t isSync = false;
meta_data->findInt32(kKeyIsSyncFrame, &isSync);
+ /*
+ * The original timestamp found in the data buffer will be modified as below:
+ *
+ * There is a playback offset into this track if the track's start time
+ * is not the same as the movie start time, which will be recorded in edst
+ * box of the output file. The playback offset is to make sure that the
+ * starting time of the audio/video tracks are synchronized. Although the
+ * track's media timestamp may be subject to various modifications
+ * as outlined below, the track's playback offset time remains unchanged
+ * once the first data buffer of the track is received.
+ *
+ * The media time stamp will be calculated by subtracting the playback offset
+ * (and potential pause durations) from the original timestamp in the buffer.
+ *
+ * If this track is a video track for a real-time recording application with
+ * both audio and video tracks, its media timestamp will subject to further
+ * modification based on the media clock of the audio track. This modification
+ * is needed for the purpose of maintaining good audio/video synchronization.
+ *
+ * If the recording session is paused and resumed multiple times, the track
+ * media timestamp will be modified as if the recording session had never been
+ * paused at all during playback of the recorded output file. In other words,
+ * the output file will have no memory of pause/resume durations.
+ *
+ */
CHECK(meta_data->findInt64(kKeyTime, ×tampUs));
+ LOGV("%s timestampUs: %lld", mIsAudio? "Audio": "Video", timestampUs);
////////////////////////////////////////////////////////////////////////////////
if (mSampleSizes.empty()) {
mStartTimestampUs = timestampUs;
mOwner->setStartTimestampUs(mStartTimestampUs);
+ previousPausedDurationUs = mStartTimestampUs;
}
if (mResumed) {
- previousPausedDurationUs += (timestampUs - mTrackDurationUs - lastDurationUs);
+ int64_t durExcludingEarlierPausesUs = timestampUs - previousPausedDurationUs;
+ CHECK(durExcludingEarlierPausesUs >= 0);
+ int64_t pausedDurationUs = durExcludingEarlierPausesUs - mTrackDurationUs;
+ CHECK(pausedDurationUs >= lastDurationUs);
+ previousPausedDurationUs += pausedDurationUs - lastDurationUs;
mResumed = false;
}
timestampUs -= previousPausedDurationUs;
+ CHECK(timestampUs >= 0);
if (mIsRealTimeRecording && !mIsAudio) {
// The minor adjustment on the timestamp is heuristic/experimental
// We are adjusting the timestamp to reduce the fluctuation of the duration
@@ -1590,8 +1622,8 @@
}
}
- LOGV("time stamp: %lld and previous paused duration %lld",
- timestampUs, previousPausedDurationUs);
+ LOGV("%s media time stamp: %lld and previous paused duration %lld",
+ mIsAudio? "Audio": "Video", timestampUs, previousPausedDurationUs);
if (timestampUs > mTrackDurationUs) {
mTrackDurationUs = timestampUs;
}
@@ -1873,6 +1905,7 @@
// First elst entry: specify the starting time offset
int64_t offsetUs = mStartTimestampUs - moovStartTimeUs;
+ LOGV("OffsetUs: %lld", offsetUs);
int32_t seg = (offsetUs * mvhdTimeScale + 5E5) / 1E6;
mOwner->writeInt32(seg); // in mvhd timecale
mOwner->writeInt32(-1); // starting time offset
diff --git a/media/libstagefright/NuHTTPDataSource.cpp b/media/libstagefright/NuHTTPDataSource.cpp
index ab9285d..fcbfdac 100644
--- a/media/libstagefright/NuHTTPDataSource.cpp
+++ b/media/libstagefright/NuHTTPDataSource.cpp
@@ -96,6 +96,11 @@
return connect(host, port, path, headers, offset);
}
+static bool IsRedirectStatusCode(int httpStatus) {
+ return httpStatus == 301 || httpStatus == 302
+ || httpStatus == 303 || httpStatus == 307;
+}
+
status_t NuHTTPDataSource::connect(
const char *host, unsigned port, const char *path,
const String8 &headers,
@@ -161,7 +166,7 @@
return err;
}
- if (httpStatus == 302) {
+ if (IsRedirectStatusCode(httpStatus)) {
string value;
CHECK(mHTTP.find_header_value("Location", &value));
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 4c15c94..72daa64 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -91,6 +91,7 @@
import android.view.Display;
import android.view.WindowManager;
+import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
@@ -8304,7 +8305,8 @@
mPastSignatures.clear();
try {
- FileOutputStream str = new FileOutputStream(mSettingsFilename);
+ BufferedOutputStream str = new BufferedOutputStream(new FileOutputStream(
+ mSettingsFilename));
//XmlSerializer serializer = XmlUtils.serializerInstance();
XmlSerializer serializer = new FastXmlSerializer();
@@ -8401,7 +8403,7 @@
File tempFile = new File(mPackageListFilename.toString() + ".tmp");
JournaledFile journal = new JournaledFile(mPackageListFilename, tempFile);
- str = new FileOutputStream(journal.chooseForWrite());
+ str = new BufferedOutputStream(new FileOutputStream(journal.chooseForWrite()));
try {
StringBuilder sb = new StringBuilder();
for (PackageSetting pkg : mPackages.values()) {
diff --git a/telephony/java/com/android/internal/telephony/sip/SipPhone.java b/telephony/java/com/android/internal/telephony/sip/SipPhone.java
index 45e6ccd..c0f2993 100755
--- a/telephony/java/com/android/internal/telephony/sip/SipPhone.java
+++ b/telephony/java/com/android/internal/telephony/sip/SipPhone.java
@@ -633,6 +633,18 @@
}
@Override
+ public void onCallEstablished(SipAudioCall call) {
+ call.startAudio();
+ onChanged(call);
+ }
+
+ @Override
+ public void onCallHeld(SipAudioCall call) {
+ call.startAudio();
+ onChanged(call);
+ }
+
+ @Override
public void onChanged(SipAudioCall call) {
synchronized (SipPhone.class) {
Call.State newState = getCallStateFrom(call);
@@ -652,7 +664,6 @@
}
foregroundCall.switchWith(ringingCall);
}
- if (newState == Call.State.ACTIVE) call.startAudio();
setState(newState);
}
mOwner.onConnectionStateChanged(SipConnection.this);
diff --git a/voip/jni/rtp/AudioGroup.cpp b/voip/jni/rtp/AudioGroup.cpp
index 7cf06137..81d4dfc 100644
--- a/voip/jni/rtp/AudioGroup.cpp
+++ b/voip/jni/rtp/AudioGroup.cpp
@@ -86,6 +86,8 @@
void decode(int tick);
private:
+ bool isNatAddress(struct sockaddr_storage *addr);
+
enum {
NORMAL = 0,
SEND_ONLY = 1,
@@ -316,6 +318,16 @@
sizeof(mRemote));
}
+bool AudioStream::isNatAddress(struct sockaddr_storage *addr) {
+ if (addr->ss_family != AF_INET) return false;
+ struct sockaddr_in *s4 = (struct sockaddr_in *)addr;
+ unsigned char *d = (unsigned char *) &s4->sin_addr;
+ if ((d[0] == 10)
+ || ((d[0] == 172) && (d[1] & 0x10))
+ || ((d[0] == 192) && (d[1] == 168))) return true;
+ return false;
+}
+
void AudioStream::decode(int tick)
{
char c;
@@ -363,8 +375,21 @@
MSG_TRUNC | MSG_DONTWAIT) >> 1;
} else {
__attribute__((aligned(4))) uint8_t buffer[2048];
- length = recv(mSocket, buffer, sizeof(buffer),
- MSG_TRUNC | MSG_DONTWAIT);
+ struct sockaddr_storage src_addr;
+ socklen_t addrlen;
+ length = recvfrom(mSocket, buffer, sizeof(buffer),
+ MSG_TRUNC|MSG_DONTWAIT, (sockaddr*)&src_addr, &addrlen);
+
+ // The following if clause is for fixing the target address if
+ // proxy server did not replace the NAT address with its media
+ // port in SDP. Although it is proxy server's responsibility for
+ // replacing the connection address with correct one, we will change
+ // the target address as we detect the difference for now until we
+ // know the best way to get rid of this issue.
+ if ((memcmp((void*)&src_addr, (void*)&mRemote, addrlen) != 0) &&
+ isNatAddress(&mRemote)) {
+ memcpy((void*)&mRemote, (void*)&src_addr, addrlen);
+ }
// Do we need to check SSRC, sequence, and timestamp? They are not
// reliable but at least they can be used to identify duplicates?