diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index 8279914f976a7..b63e97fdc4a97 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -563,7 +563,19 @@ status_t CameraService::Client::setOverlay() status_t ret = NO_ERROR; if (mSurface != 0) { if (mOverlayRef.get() == NULL) { - mOverlayRef = mSurface->createOverlay(w, h, OVERLAY_FORMAT_DEFAULT); + + // FIXME: + // Surfaceflinger may hold onto the previous overlay reference for some + // time after we try to destroy it. retry a few times. In the future, we + // should make the destroy call block, or possibly specify that we can + // wait in the createOverlay call if the previous overlay is in the + // process of being destroyed. + for (int retry = 0; retry < 50; ++retry) { + mOverlayRef = mSurface->createOverlay(w, h, OVERLAY_FORMAT_DEFAULT); + if (mOverlayRef != NULL) break; + LOGD("Overlay create failed - retrying"); + usleep(20000); + } if ( mOverlayRef.get() == NULL ) { LOGE("Overlay Creation Failed!"); diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c index 4a71dc66a9c49..9c2becf34f508 100644 --- a/cmds/dumpstate/dumpstate.c +++ b/cmds/dumpstate/dumpstate.c @@ -110,7 +110,7 @@ static void dumpstate(int full) { PRINT("------ PACKAGE UID ERRORS ------"); DUMP("/data/system/uiderrors.txt"); - dump_kernel_log("/data/dontpanic/last_kmsg", "RAMCONSOLE"); + dump_kernel_log("/data/dontpanic/last_kmsg", "LAST KMSG"); dump_kernel_log("/data/dontpanic/apanic_console", "PANIC CONSOLE"); dump_kernel_log("/data/dontpanic/apanic_threads", diff --git a/core/java/android/accounts/AuthenticatorBindHelper.java b/core/java/android/accounts/AuthenticatorBindHelper.java index 91e23ab8aca05..2ca1f0e492cd6 100644 --- a/core/java/android/accounts/AuthenticatorBindHelper.java +++ b/core/java/android/accounts/AuthenticatorBindHelper.java @@ -146,7 +146,7 @@ public class AuthenticatorBindHelper { Log.v(TAG, "there are no more callbacks for service " + authenticatorType + ", unbinding service"); } - unbindFromService(authenticatorType); + unbindFromServiceLocked(authenticatorType); } else { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "leaving service " + authenticatorType @@ -161,7 +161,10 @@ public class AuthenticatorBindHelper { } } - private void unbindFromService(String authenticatorType) { + /** + * You must synchronized on mServiceConnections before calling this + */ + private void unbindFromServiceLocked(String authenticatorType) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "unbindService from " + authenticatorType); } @@ -217,15 +220,18 @@ public class AuthenticatorBindHelper { // post a message for each service user to tell them that the service is disconnected, // and unbind from the service. synchronized (mServiceConnections) { - for (Callback callback : mServiceUsers.get(mAuthenticatorType)) { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "the service became disconnected, scheduling a " - + "disconnected message for " - + mAuthenticatorType); + final ArrayList callbackList = mServiceUsers.get(mAuthenticatorType); + if (callbackList != null) { + for (Callback callback : callbackList) { + if (Log.isLoggable(TAG, Log.VERBOSE)) { + Log.v(TAG, "the service became disconnected, scheduling a " + + "disconnected message for " + + mAuthenticatorType); + } + mHandler.obtainMessage(mMessageWhatDisconnected, callback).sendToTarget(); } - mHandler.obtainMessage(mMessageWhatDisconnected, callback).sendToTarget(); + unbindFromServiceLocked(mAuthenticatorType); } - unbindFromService(mAuthenticatorType); } } } diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index 933c2fc2fa794..697ac7654f94c 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -1314,13 +1314,13 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // source. this is because GlobalSearch may not have permission to launch the // intent, and to avoid the extra step of going through GlobalSearch. if (mGlobalSearchMode) { + launchGlobalSearchIntent(intent); if (mStoredComponentName != null) { // If we're embedded in an application, dismiss the dialog. // This ensures that if the intent is handled by the current // activity, it's not obscured by the dialog. dismiss(); } - launchGlobalSearchIntent(intent); } else { // If the intent was created from a suggestion, it will always have an explicit // component here. diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 9c23746494a4f..39a74acee888e 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -287,9 +287,13 @@ public final class BluetoothDevice implements Parcelable { /** A bond attempt failed because of repeated attempts * @hide */ public static final int UNBOND_REASON_REPEATED_ATTEMPTS = 7; + /** A bond attempt failed because we received an Authentication Cancel + * by remote end + * @hide */ + public static final int UNBOND_REASON_REMOTE_AUTH_CANCELED = 8; /** An existing bond was explicitly revoked * @hide */ - public static final int UNBOND_REASON_REMOVED = 8; + public static final int UNBOND_REASON_REMOVED = 9; /** The user will be prompted to enter a pin * @hide */ diff --git a/core/java/android/pim/vcard/ContactStruct.java b/core/java/android/pim/vcard/ContactStruct.java index b6a453af9e675..36e5e233d6a32 100644 --- a/core/java/android/pim/vcard/ContactStruct.java +++ b/core/java/android/pim/vcard/ContactStruct.java @@ -698,6 +698,7 @@ public class ContactStruct { mPhotoList = new ArrayList(1); } final PhotoData photoData = new PhotoData(0, null, photoBytes); + mPhotoList.add(photoData); } /** diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index da1918a83bee6..c0b9a6843ea17 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -54,6 +54,7 @@ class BluetoothEventLoop { private static final int EVENT_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY = 1; private static final int EVENT_RESTART_BLUETOOTH = 2; private static final int EVENT_PAIRING_CONSENT_DELAYED_ACCEPT = 3; + private static final int EVENT_AGENT_CANCEL = 4; private static final int CREATE_DEVICE_ALREADY_EXISTS = 1; private static final int CREATE_DEVICE_SUCCESS = 0; @@ -90,6 +91,22 @@ class BluetoothEventLoop { mBluetoothService.setPairingConfirmation(address, true); } break; + case EVENT_AGENT_CANCEL: + // Set the Bond State to BOND_NONE. + // We always have only 1 device in BONDING state. + String[] devices = + mBluetoothService.getBondState().listInState(BluetoothDevice.BOND_BONDING); + if (devices.length == 0) { + break; + } else if (devices.length > 1) { + Log.e(TAG, " There is more than one device in the Bonding State"); + break; + } + address = devices[0]; + mBluetoothService.getBondState().setBondState(address, + BluetoothDevice.BOND_NONE, + BluetoothDevice.UNBOND_REASON_REMOTE_AUTH_CANCELED); + break; } } }; @@ -544,6 +561,10 @@ class BluetoothEventLoop { private void onAgentCancel() { Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_CANCEL); mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); + + mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_AGENT_CANCEL), + 1500); + return; } diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java index 6d4d1527a9292..7ebd91dd4d741 100644 --- a/core/java/android/server/BluetoothService.java +++ b/core/java/android/server/BluetoothService.java @@ -571,7 +571,7 @@ public class BluetoothService extends IBluetooth.Stub { return state.intValue(); } - private synchronized String[] listInState(int state) { + /*package*/ synchronized String[] listInState(int state) { ArrayList result = new ArrayList(mState.size()); for (Map.Entry e : mState.entrySet()) { if (e.getValue().intValue() == state) { diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 4c91b6bc5cd7b..eb3e52398825c 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6189,7 +6189,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility final int drawingCacheBackgroundColor = mDrawingCacheBackgroundColor; final boolean opaque = drawingCacheBackgroundColor != 0 || isOpaque(); - final boolean translucentWindow = attachInfo.mTranslucentWindow; + final boolean translucentWindow = attachInfo != null && attachInfo.mTranslucentWindow; if (width <= 0 || height <= 0 || // Projected bitmap size in bytes diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 78999fa51bbab..916fc2d78cb52 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -262,6 +262,13 @@ public interface WindowManagerPolicy { */ boolean isVisibleLw(); + /** + * Like {@link #isVisibleLw}, but also counts a window that is currently + * "hidden" behind the keyguard as visible. This allows us to apply + * things like window flags that impact the keyguard. + */ + boolean isVisibleOrBehindKeyguardLw(); + /** * Is this window currently visible to the user on-screen? It is * displayed either if it is visible or it is currently running an diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 9040edb7a58c2..6fd7657979023 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -158,4 +158,6 @@ false + + false diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java index f6a1be73328fb..c8fa4c39ad03f 100644 --- a/services/java/com/android/server/LocationManagerService.java +++ b/services/java/com/android/server/LocationManagerService.java @@ -382,7 +382,12 @@ public class LocationManagerService extends ILocationManager.Stub implements Run } public void locationCallbackFinished(ILocationListener listener) { - Receiver receiver = getReceiver(listener); + //Do not use getReceiver here as that will add the ILocationListener to + //the receiver list if it is not found. If it is not found then the + //LocationListener was removed when it had a pending broadcast and should + //not be added back. + IBinder binder = listener.asBinder(); + Receiver receiver = mReceivers.get(binder); if (receiver != null) { synchronized (receiver) { // so wakelock calls will succeed @@ -921,6 +926,12 @@ public class LocationManagerService extends ILocationManager.Stub implements Run try { if (mReceivers.remove(receiver.mKey) != null && receiver.isListener()) { receiver.getListener().asBinder().unlinkToDeath(receiver, 0); + synchronized(receiver) { + if(receiver.mPendingBroadcasts > 0) { + decrementPendingBroadcasts(); + receiver.mPendingBroadcasts = 0; + } + } } // Record which providers were associated with this listener diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 67b8a855ed6bb..00636c400ae52 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -7573,6 +7573,21 @@ public class WindowManagerService extends IWindowManager.Stub && !mExiting && !mDestroying; } + /** + * Like {@link #isVisibleLw}, but also counts a window that is currently + * "hidden" behind the keyguard as visible. This allows us to apply + * things like window flags that impact the keyguard. + * XXX I am starting to think we need to have ANOTHER visibility flag + * for this "hidden behind keyguard" state rather than overloading + * mPolicyVisibility. Ungh. + */ + public boolean isVisibleOrBehindKeyguardLw() { + final AppWindowToken atoken = mAppToken; + return mSurface != null && !mAttachedHidden + && (atoken == null ? mPolicyVisibility : !atoken.hiddenRequested) + && !mExiting && !mDestroying; + } + /** * Is this window visible, ignoring its app token? It is not visible * if there is no surface, or we are in the process of running an exit animation diff --git a/services/java/com/android/server/status/StatusBarPolicy.java b/services/java/com/android/server/status/StatusBarPolicy.java index 3d1fb83ee1327..d590c40286122 100644 --- a/services/java/com/android/server/status/StatusBarPolicy.java +++ b/services/java/com/android/server/status/StatusBarPolicy.java @@ -272,6 +272,7 @@ public class StatusBarPolicy { private IBinder mDataIcon; private IconData mDataData; private boolean mDataIconVisible; + private boolean mHspaDataDistinguishable; // ringer volume private IBinder mVolumeIcon; @@ -517,6 +518,14 @@ public class StatusBarPolicy { filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); filter.addAction(TtyIntent.TTY_ENABLED_CHANGE_ACTION); mContext.registerReceiver(mIntentReceiver, filter, null, mHandler); + + // load config to determine if to distinguish Hspa data icon + try { + mHspaDataDistinguishable = mContext.getResources().getBoolean( + com.android.internal.R.bool.config_hspa_data_distinguishable); + } catch (Exception e) { + mHspaDataDistinguishable = false; + } } public static void installIcons(Context context, StatusBarService service) { @@ -960,7 +969,11 @@ public class StatusBarPolicy { case TelephonyManager.NETWORK_TYPE_HSDPA: case TelephonyManager.NETWORK_TYPE_HSUPA: case TelephonyManager.NETWORK_TYPE_HSPA: - mDataIconList = sDataNetType_h; + if (mHspaDataDistinguishable) { + mDataIconList = sDataNetType_h; + } else { + mDataIconList = sDataNetType_3g; + } break; case TelephonyManager.NETWORK_TYPE_CDMA: // display 1xRTT for IS95A/B