diff options
| -rw-r--r-- | core/res/res/layout/recent_apps_dialog.xml | 12 | ||||
| -rw-r--r-- | core/res/res/values/strings.xml | 4 | ||||
| -rw-r--r-- | libs/surfaceflinger/LayerBase.cpp | 93 | ||||
| -rw-r--r-- | media/java/android/media/AudioService.java | 81 | ||||
| -rw-r--r-- | media/libstagefright/HTTPDataSource.cpp | 7 | ||||
| -rw-r--r-- | media/libstagefright/HTTPStream.cpp | 34 | ||||
| -rw-r--r-- | services/java/com/android/server/PackageManagerService.java | 2 | ||||
| -rw-r--r-- | services/java/com/android/server/connectivity/Tethering.java | 8 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/CommandException.java | 3 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/RILConstants.java | 3 |
10 files changed, 133 insertions, 114 deletions
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/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/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/telephony/java/com/android/internal/telephony/CommandException.java b/telephony/java/com/android/internal/telephony/CommandException.java index a5d11cf250d8..eb0a440dff25 100644 --- a/telephony/java/com/android/internal/telephony/CommandException.java +++ b/telephony/java/com/android/internal/telephony/CommandException.java @@ -37,6 +37,7 @@ public class CommandException extends RuntimeException { OP_NOT_ALLOWED_DURING_VOICE_CALL, OP_NOT_ALLOWED_BEFORE_REG_NW, SMS_FAIL_RETRY, + ILLEGAL_SIM_OR_ME, } public CommandException(Error e) { @@ -68,6 +69,8 @@ public class CommandException extends RuntimeException { return new CommandException(Error.OP_NOT_ALLOWED_BEFORE_REG_NW); case RILConstants.SMS_SEND_FAIL_RETRY: return new CommandException(Error.SMS_FAIL_RETRY); + case RILConstants.ILLEGAL_SIM_OR_ME: + return new CommandException(Error.ILLEGAL_SIM_OR_ME); default: Log.e("GSM", "Unrecognized RIL errno " + ril_errno); return new CommandException(Error.INVALID_RESPONSE); diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 4d8c7ec86e87..01f4ab274c13 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -45,6 +45,9 @@ public interface RILConstants { int OP_NOT_ALLOWED_BEFORE_REG_NW = 9; /* request is not allowed before device registers to network */ int SMS_SEND_FAIL_RETRY = 10; /* send sms fail and need retry */ + int ILLEGAL_SIM_OR_ME = 15; /* network selection failure due + to wrong SIM/ME and no + retries needed */ /* NETWORK_MODE_* See ril.h RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE */ int NETWORK_MODE_WCDMA_PREF = 0; /* GSM/WCDMA (WCDMA preferred) */ |