summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.xml46
-rw-r--r--core/java/android/content/Intent.java4
-rw-r--r--core/java/android/webkit/WebView.java26
-rw-r--r--core/res/res/layout/recent_apps_dialog.xml12
-rw-r--r--core/res/res/values/strings.xml4
-rw-r--r--libs/audioflinger/A2dpAudioInterface.cpp2
-rw-r--r--libs/surfaceflinger/LayerBase.cpp93
-rw-r--r--media/java/android/media/AudioService.java81
-rw-r--r--media/libstagefright/HTTPDataSource.cpp7
-rw-r--r--media/libstagefright/HTTPStream.cpp34
-rw-r--r--media/libstagefright/OMXCodec.cpp14
-rw-r--r--services/java/com/android/server/PackageManagerService.java2
-rw-r--r--services/java/com/android/server/connectivity/Tethering.java8
-rw-r--r--services/java/com/android/server/status/StatusBarPolicy.java2
14 files changed, 202 insertions, 133 deletions
diff --git a/api/current.xml b/api/current.xml
index 8cffff1b2fe9..db28cba78d4e 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -27144,7 +27144,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="fd" type="android.os.ParcelFileDescriptor">
+<parameter name="newState" type="android.os.ParcelFileDescriptor">
</parameter>
</method>
</interface>
@@ -37923,6 +37923,28 @@
visibility="public"
>
</field>
+<field name="ACTION_EXTERNAL_APPLICATIONS_AVAILABLE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="ACTION_FACTORY_TEST"
type="java.lang.String"
transient="false"
@@ -38890,6 +38912,28 @@
visibility="public"
>
</field>
+<field name="EXTRA_CHANGED_PACKAGE_LIST"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.extra.changed_package_list&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_CHANGED_UID_LIST"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.extra.changed_uid_list&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="EXTRA_DATA_REMOVED"
type="java.lang.String"
transient="false"
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 13494f820a89..ed548c560548 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1395,7 +1395,6 @@ public class Intent implements Parcelable, Cloneable {
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
- * @hide
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE =
@@ -1420,7 +1419,6 @@ public class Intent implements Parcelable, Cloneable {
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
- * @hide
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE =
@@ -2243,7 +2241,6 @@ public class Intent implements Parcelable, Cloneable {
* {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE},
* {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE}
* and contains a string array of all of the components that have changed.
- * @hide
*/
public static final String EXTRA_CHANGED_PACKAGE_LIST =
"android.intent.extra.changed_package_list";
@@ -2254,7 +2251,6 @@ public class Intent implements Parcelable, Cloneable {
* {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE}
* and contains an integer array of uids of all of the components
* that have changed.
- * @hide
*/
public static final String EXTRA_CHANGED_UID_LIST =
"android.intent.extra.changed_uid_list";
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index ff233d2c656c..e2f5de4be743 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -3219,18 +3219,14 @@ public class WebView extends AbsoluteLayout
}
}
- private void drawExtras(Canvas canvas, int extras) {
+ private void drawExtras(Canvas canvas, int extras, boolean animationsRunning) {
// If mNativeClass is 0, we should not reach here, so we do not
// need to check it again.
- // Currently for each draw we compute the animation values;
- // We may in the future decide to do that independently.
- if (nativeEvaluateLayersAnimations()) {
- // If we have unfinished (or unstarted) animations,
- // we ask for a repaint.
- invalidate();
+ if (animationsRunning) {
+ canvas.setDrawFilter(mWebViewCore.mZoomFilter);
}
-
nativeDrawExtras(canvas, extras);
+ canvas.setDrawFilter(null);
}
private void drawCoreAndCursorRing(Canvas canvas, int color,
@@ -3315,8 +3311,18 @@ public class WebView extends AbsoluteLayout
canvas.scale(mActualScale, mActualScale);
}
+ boolean UIAnimationsRunning = false;
+ // Currently for each draw we compute the animation values;
+ // We may in the future decide to do that independently.
+ if (mNativeClass != 0 && nativeEvaluateLayersAnimations()) {
+ UIAnimationsRunning = true;
+ // If we have unfinished (or unstarted) animations,
+ // we ask for a repaint.
+ invalidate();
+ }
mWebViewCore.drawContentPicture(canvas, color,
- (animateZoom || mPreviewZoomOnly), animateScroll);
+ (animateZoom || mPreviewZoomOnly || UIAnimationsRunning),
+ animateScroll);
if (mNativeClass == 0) return;
// decide which adornments to draw
int extras = DRAW_EXTRAS_NONE;
@@ -3337,7 +3343,7 @@ public class WebView extends AbsoluteLayout
} else if (drawCursorRing) {
extras = DRAW_EXTRAS_CURSOR_RING;
}
- drawExtras(canvas, extras);
+ drawExtras(canvas, extras, UIAnimationsRunning);
if (extras == DRAW_EXTRAS_CURSOR_RING) {
if (mTouchMode == TOUCH_SHORTPRESS_START_MODE) {
diff --git a/core/res/res/layout/recent_apps_dialog.xml b/core/res/res/layout/recent_apps_dialog.xml
index 6bacc5869cdf..03340cdfaf34 100644
--- a/core/res/res/layout/recent_apps_dialog.xml
+++ b/core/res/res/layout/recent_apps_dialog.xml
@@ -26,6 +26,15 @@
android:paddingBottom="3dip"
android:orientation="vertical">
+ <!-- Title -->
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ style="?android:attr/windowTitleStyle"
+ android:layout_marginTop="5dip"
+ android:layout_marginBottom="15dip"
+ android:text="@android:string/recent_tasks_title" />
+
<!-- This is only intended to be visible when all buttons (below) are invisible -->
<TextView
android:id="@+id/no_applications_message"
@@ -44,7 +53,8 @@
<LinearLayout
android:layout_width="320dip"
android:layout_height="wrap_content"
- android:orientation="horizontal" >
+ android:orientation="horizontal"
+ >
<include
layout="@android:layout/recent_apps_icon"
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 45d7aeae4f4b..a76c70cf0174 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -279,7 +279,9 @@
<!-- Shutdown Confirmation Dialog. When the user chooses to power off the phone, there will be a confirmation dialog. This is the message. -->
<string name="shutdown_confirm">Your phone will shut down.</string>
- <!-- Recent Tasks dialog -->
+ <!-- Recent Tasks dialog: title -->
+ <string name="recent_tasks_title">Recent</string>
+ <!-- Recent Tasks dialog: message when there are no recent applications -->
<string name="no_recent_tasks">No recent applications.</string>
<!-- Title of the Global Actions Dialog -->
diff --git a/libs/audioflinger/A2dpAudioInterface.cpp b/libs/audioflinger/A2dpAudioInterface.cpp
index 747d0e4ce316..995e31ca0797 100644
--- a/libs/audioflinger/A2dpAudioInterface.cpp
+++ b/libs/audioflinger/A2dpAudioInterface.cpp
@@ -302,7 +302,7 @@ ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t
Error:
// Simulate audio output timing in case of error
- usleep(bytes * 1000000 / frameSize() / sampleRate());
+ usleep(((bytes * 1000 )/ frameSize() / sampleRate()) * 1000);
return status;
}
diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp
index efbc77a28958..a8b735ef6a53 100644
--- a/libs/surfaceflinger/LayerBase.cpp
+++ b/libs/surfaceflinger/LayerBase.cpp
@@ -437,64 +437,49 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const
Region::const_iterator it = clip.begin();
Region::const_iterator const end = clip.end();
- if (UNLIKELY(transformed()
- || !(mFlags & DisplayHardware::DRAW_TEXTURE_EXTENSION) ))
- {
- //StopWatch watch("GL transformed");
- const GLfixed texCoords[4][2] = {
- { 0, 0 },
- { 0, 0x10000 },
- { 0x10000, 0x10000 },
- { 0x10000, 0 }
- };
-
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
-
- // the texture's source is rotated
- switch (texture.transform) {
- case HAL_TRANSFORM_ROT_90:
- glTranslatef(0, 1, 0);
- glRotatef(-90, 0, 0, 1);
- break;
- case HAL_TRANSFORM_ROT_180:
- glTranslatef(1, 1, 0);
- glRotatef(-180, 0, 0, 1);
- break;
- case HAL_TRANSFORM_ROT_270:
- glTranslatef(1, 0, 0);
- glRotatef(-270, 0, 0, 1);
- break;
- }
- if (texture.NPOTAdjust) {
- glScalef(texture.wScale, texture.hScale, 1.0f);
- }
+ //StopWatch watch("GL transformed");
+ const GLfixed texCoords[4][2] = {
+ { 0, 0 },
+ { 0, 0x10000 },
+ { 0x10000, 0x10000 },
+ { 0x10000, 0 }
+ };
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glVertexPointer(2, GL_FIXED, 0, mVertices);
- glTexCoordPointer(2, GL_FIXED, 0, texCoords);
+ glMatrixMode(GL_TEXTURE);
+ glLoadIdentity();
+
+ // the texture's source is rotated
+ switch (texture.transform) {
+ case HAL_TRANSFORM_ROT_90:
+ glTranslatef(0, 1, 0);
+ glRotatef(-90, 0, 0, 1);
+ break;
+ case HAL_TRANSFORM_ROT_180:
+ glTranslatef(1, 1, 0);
+ glRotatef(-180, 0, 0, 1);
+ break;
+ case HAL_TRANSFORM_ROT_270:
+ glTranslatef(1, 0, 0);
+ glRotatef(-270, 0, 0, 1);
+ break;
+ }
- while (it != end) {
- const Rect& r = *it++;
- const GLint sy = fbHeight - (r.top + r.height());
- glScissor(r.left, sy, r.width(), r.height());
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- }
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- } else {
- GLint crop[4] = { 0, height, width, -height };
- glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
- int x = tx();
- int y = ty();
- y = fbHeight - (y + height);
- while (it != end) {
- const Rect& r = *it++;
- const GLint sy = fbHeight - (r.top + r.height());
- glScissor(r.left, sy, r.width(), r.height());
- glDrawTexiOES(x, y, 0, width, height);
- }
+ if (texture.NPOTAdjust) {
+ glScalef(texture.wScale, texture.hScale, 1.0f);
+ }
+
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glVertexPointer(2, GL_FIXED, 0, mVertices);
+ glTexCoordPointer(2, GL_FIXED, 0, texCoords);
+
+ while (it != end) {
+ const Rect& r = *it++;
+ const GLint sy = fbHeight - (r.top + r.height());
+ glScissor(r.left, sy, r.width(), r.height());
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
void LayerBase::validateTexture(GLint textureName) const
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index df0705999067..97b96bc16113 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -41,6 +41,8 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
import android.provider.Settings.System;
+import android.telephony.PhoneStateListener;
+import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.VolumePanel;
@@ -305,6 +307,11 @@ public class AudioService extends IAudioService.Stub {
intentFilter = new IntentFilter(Intent.ACTION_MEDIA_BUTTON);
intentFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
context.registerReceiver(mMediaButtonReceiver, intentFilter);
+
+ // Register for phone state monitoring
+ TelephonyManager tmgr = (TelephonyManager)
+ context.getSystemService(Context.TELEPHONY_SERVICE);
+ tmgr.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
}
private void createAudioSystemThread() {
@@ -707,7 +714,6 @@ public class AudioService extends IAudioService.Stub {
}
if (mode != mMode) {
if (AudioSystem.setPhoneState(mode) == AudioSystem.AUDIO_STATUS_OK) {
- checkForUndispatchedAudioFocusChange(mMode, mode);
mMode = mode;
synchronized(mSetModeDeathHandlers) {
@@ -1903,21 +1909,36 @@ public class AudioService extends IAudioService.Stub {
//==========================================================================================
// AudioFocus
//==========================================================================================
- /**
- * Flag to indicate that the top of the audio focus stack needs to recover focus
- * but hasn't been signaled yet.
+
+ /* constant to identify focus stack entry that is used to hold the focus while the phone
+ * is ringing or during a call
*/
- private boolean mHasUndispatchedAudioFocus = false;
+ private final static String IN_VOICE_COMM_FOCUS_ID = "AudioFocus_For_Phone_Ring_And_Calls";
- private void checkForUndispatchedAudioFocusChange(int prevMode, int newMode) {
- // when exiting a call
- if ((prevMode == AudioSystem.MODE_IN_CALL) && (newMode != AudioSystem.MODE_IN_CALL)) {
- // check for undispatched remote control focus gain
- if (mHasUndispatchedAudioFocus) {
- notifyTopOfAudioFocusStack();
+ private PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
+ @Override
+ public void onCallStateChanged(int state, String incomingNumber) {
+ if (state == TelephonyManager.CALL_STATE_RINGING) {
+ //Log.v(TAG, " CALL_STATE_RINGING");
+ int ringVolume = AudioService.this.getStreamVolume(AudioManager.STREAM_RING);
+ if (ringVolume > 0) {
+ requestAudioFocus(AudioManager.STREAM_RING,
+ AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,
+ null, null /* both allowed to be null only for this clientId */,
+ IN_VOICE_COMM_FOCUS_ID /*clientId*/);
+ }
+ } else if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
+ //Log.v(TAG, " CALL_STATE_OFFHOOK");
+ requestAudioFocus(AudioManager.STREAM_RING,
+ AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,
+ null, null /* both allowed to be null only for this clientId */,
+ IN_VOICE_COMM_FOCUS_ID /*clientId*/);
+ } else if (state == TelephonyManager.CALL_STATE_IDLE) {
+ //Log.v(TAG, " CALL_STATE_IDLE");
+ abandonAudioFocus(null, IN_VOICE_COMM_FOCUS_ID);
}
}
- }
+ };
private void notifyTopOfAudioFocusStack() {
// notify the top of the stack it gained focus
@@ -1926,13 +1947,10 @@ public class AudioService extends IAudioService.Stub {
try {
mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(
AudioManager.AUDIOFOCUS_GAIN, mFocusStack.peek().mClientId);
- mHasUndispatchedAudioFocus = false;
} catch (RemoteException e) {
Log.e(TAG, "Failure to signal gain of audio control focus due to "+ e);
e.printStackTrace();
}
- } else {
- mHasUndispatchedAudioFocus = true;
}
}
}
@@ -1966,7 +1984,7 @@ public class AudioService extends IAudioService.Stub {
* Display in the log the current entries in the audio focus stack
*/
private void dumpFocusStack(PrintWriter pw) {
- pw.println("Audio Focus stack entries:");
+ pw.println("\nAudio Focus stack entries:");
synchronized(mFocusStack) {
Iterator<FocusStackEntry> stackIterator = mFocusStack.iterator();
while(stackIterator.hasNext()) {
@@ -2038,9 +2056,9 @@ public class AudioService extends IAudioService.Stub {
* Returns true if the system is in a state where the focus can be reevaluated, false otherwise.
*/
private boolean canReassignAudioFocus() {
- // focus requests are rejected during a phone call
- if (getMode() == AudioSystem.MODE_IN_CALL) {
- Log.i(TAG, " AudioFocus can't be reassigned during a call, exiting");
+ // focus requests are rejected during a phone call or when the phone is ringing
+ // this is equivalent to IN_VOICE_COMM_FOCUS_ID having the focus
+ if (!mFocusStack.isEmpty() && IN_VOICE_COMM_FOCUS_ID.equals(mFocusStack.peek().mClientId)) {
return false;
}
return true;
@@ -2077,7 +2095,9 @@ public class AudioService extends IAudioService.Stub {
// the main stream type for the audio focus request is currently not used. It may
// potentially be used to handle multiple stream type-dependent audio focuses.
- if ((cb == null) || !cb.pingBinder()) {
+ // we need a valid binder callback for clients other than the AudioService's phone
+ // state listener
+ if (!IN_VOICE_COMM_FOCUS_ID.equals(clientId) && ((cb == null) || !cb.pingBinder())) {
Log.i(TAG, " AudioFocus DOA client for requestAudioFocus(), exiting");
return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
}
@@ -2119,14 +2139,17 @@ public class AudioService extends IAudioService.Stub {
}//synchronized(mFocusStack)
// handle the potential premature death of the new holder of the focus
- // (premature death == death before abandoning focus)
- // Register for client death notification
- AudioFocusDeathHandler afdh = new AudioFocusDeathHandler(cb);
- try {
- cb.linkToDeath(afdh, 0);
- } catch (RemoteException e) {
- // client has already died!
- Log.w(TAG, " AudioFocus requestAudioFocus() could not link to "+cb+" binder death");
+ // (premature death == death before abandoning focus) for a client which is not the
+ // AudioService's phone state listener
+ if (!IN_VOICE_COMM_FOCUS_ID.equals(clientId)) {
+ // Register for client death notification
+ AudioFocusDeathHandler afdh = new AudioFocusDeathHandler(cb);
+ try {
+ cb.linkToDeath(afdh, 0);
+ } catch (RemoteException e) {
+ // client has already died!
+ Log.w(TAG, "AudioFocus requestAudioFocus() could not link to "+cb+" binder death");
+ }
}
return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
@@ -2212,7 +2235,7 @@ public class AudioService extends IAudioService.Stub {
* Display in the log the current entries in the remote control focus stack
*/
private void dumpRCStack(PrintWriter pw) {
- pw.println("Remote Control stack entries:");
+ pw.println("\nRemote Control stack entries:");
synchronized(mRCStack) {
Iterator<RemoteControlStackEntry> stackIterator = mRCStack.iterator();
while(stackIterator.hasNext()) {
diff --git a/media/libstagefright/HTTPDataSource.cpp b/media/libstagefright/HTTPDataSource.cpp
index a0b199374afb..cca60624b1df 100644
--- a/media/libstagefright/HTTPDataSource.cpp
+++ b/media/libstagefright/HTTPDataSource.cpp
@@ -39,6 +39,13 @@ status_t HTTPDataSource::connectWithRedirectsAndRange(off_t rangeStart) {
int numRedirectsRemaining = 5;
while (numRedirectsRemaining-- > 0) {
+ {
+ Mutex::Autolock autoLock(mStateLock);
+ if (mState == DISCONNECTED) {
+ return UNKNOWN_ERROR;
+ }
+ }
+
status_t err = mHttp->connect(host.c_str(), port);
if (err != OK) {
diff --git a/media/libstagefright/HTTPStream.cpp b/media/libstagefright/HTTPStream.cpp
index 1e06f03f1a4d..6145ec225157 100644
--- a/media/libstagefright/HTTPStream.cpp
+++ b/media/libstagefright/HTTPStream.cpp
@@ -68,6 +68,11 @@ status_t HTTPStream::connect(const char *server, int port) {
return UNKNOWN_ERROR;
}
+ struct timeval tv;
+ tv.tv_usec = 0;
+ tv.tv_sec = 5;
+ CHECK_EQ(0, setsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)));
+
mState = CONNECTING;
int s = mSocket;
@@ -150,30 +155,6 @@ status_t HTTPStream::send(const char *data) {
return send(data, strlen(data));
}
-static ssize_t recvWithTimeout(
- int s, void *data, size_t size) {
- fd_set rs, es;
- FD_ZERO(&rs);
- FD_ZERO(&es);
- FD_SET(s, &rs);
- FD_SET(s, &es);
-
- struct timeval tv;
- tv.tv_sec = 5; // 5 sec timeout
- tv.tv_usec = 0;
-
- int res = select(s + 1, &rs, NULL, &es, &tv);
-
- if (res < 0) {
- return -1;
- } else if (res == 0) {
- errno = ETIMEDOUT;
- return -1;
- }
-
- return recv(s, data, size, 0);
-}
-
// A certain application spawns a local webserver that sends invalid responses,
// specifically it terminates header line with only a newline instead of the
// CRLF (carriage-return followed by newline) required by the HTTP specs.
@@ -192,7 +173,7 @@ status_t HTTPStream::receive_line(char *line, size_t size) {
for (;;) {
char c;
- ssize_t n = recvWithTimeout(mSocket, &c, 1);
+ ssize_t n = recv(mSocket, &c, 1, 0);
if (n < 0) {
if (errno == EINTR) {
continue;
@@ -310,8 +291,7 @@ status_t HTTPStream::receive_header(int *http_status) {
ssize_t HTTPStream::receive(void *data, size_t size) {
size_t total = 0;
while (total < size) {
- ssize_t n = recvWithTimeout(
- mSocket, (char *)data + total, size - total);
+ ssize_t n = recv(mSocket, (char *)data + total, size - total, 0);
if (n < 0) {
if (errno == EINTR) {
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 873c2aa575b4..2c94965c2429 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -2004,9 +2004,12 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) {
(const uint8_t *)srcBuffer->data() + srcBuffer->range_offset(),
srcBuffer->range_length());
+ int64_t lastBufferTimeUs;
+ CHECK(srcBuffer->meta_data()->findInt64(kKeyTime, &lastBufferTimeUs));
+ CHECK(timestampUs >= 0);
+
if (offset == 0) {
- CHECK(srcBuffer->meta_data()->findInt64(kKeyTime, &timestampUs));
- CHECK(timestampUs >= 0);
+ timestampUs = lastBufferTimeUs;
}
offset += srcBuffer->range_length();
@@ -2019,6 +2022,13 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) {
if (!(mQuirks & kSupportsMultipleFramesPerInputBuffer)) {
break;
}
+
+ int64_t coalescedDurationUs = lastBufferTimeUs - timestampUs;
+
+ if (coalescedDurationUs > 250000ll) {
+ // Don't coalesce more than 250ms worth of encoded data at once.
+ break;
+ }
}
if (n > 1) {
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 5d0c4e3355cc..076b0e2a8799 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -1295,7 +1295,7 @@ class PackageManagerService extends IPackageManager.Stub {
System.arraycopy(cur, 0, ret, 0, i);
}
if (i < (N-1)) {
- System.arraycopy(cur, i, ret, i+1, N-i-1);
+ System.arraycopy(cur, i + 1, ret, i, N - i - 1);
}
return ret;
}
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index f335287412a0..b43b86c5abba 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -35,6 +35,7 @@ import android.net.NetworkUtils;
import android.os.BatteryManager;
import android.os.Binder;
import android.os.Environment;
+import android.os.HandlerThread;
import android.os.IBinder;
import android.os.INetworkManagementService;
import android.os.Looper;
@@ -75,7 +76,8 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
private String[] mTetherableWifiRegexs;
private String[] mUpstreamIfaceRegexs;
- private Looper mLooper; // given to us at construction time..
+ private Looper mLooper;
+ private HandlerThread mThread;
private HashMap<String, TetherInterfaceSM> mIfaces; // all tethered/tetherable ifaces
@@ -123,6 +125,10 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
mIfaces = new HashMap<String, TetherInterfaceSM>();
+ // make our own thread so we don't anr the system
+ mThread = new HandlerThread("Tethering");
+ mThread.start();
+ mLooper = mThread.getLooper();
mTetherMasterSM = new TetherMasterSM("TetherMaster", mLooper);
mTetherMasterSM.start();
diff --git a/services/java/com/android/server/status/StatusBarPolicy.java b/services/java/com/android/server/status/StatusBarPolicy.java
index 465ff2e4508f..82050ecb580e 100644
--- a/services/java/com/android/server/status/StatusBarPolicy.java
+++ b/services/java/com/android/server/status/StatusBarPolicy.java
@@ -1176,7 +1176,7 @@ public class StatusBarPolicy {
final int ringerMode = audioManager.getRingerMode();
final boolean visible = ringerMode == AudioManager.RINGER_MODE_SILENT ||
ringerMode == AudioManager.RINGER_MODE_VIBRATE;
- final int iconId = audioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_RINGER)
+ final int iconId = (ringerMode == AudioManager.RINGER_MODE_VIBRATE)
? com.android.internal.R.drawable.stat_sys_ringer_vibrate
: com.android.internal.R.drawable.stat_sys_ringer_silent;