diff options
| -rw-r--r-- | core/java/android/os/Environment.java | 1 | ||||
| -rw-r--r-- | core/java/android/widget/Toast.java | 96 | ||||
| -rw-r--r-- | core/java/com/android/internal/app/PlatLogoActivity.java | 4 | ||||
| -rw-r--r-- | core/res/res/drawable-nodpi/platlogo.png | bin | 45232 -> 83490 bytes | |||
| -rw-r--r-- | media/libstagefright/httplive/LiveSession.cpp | 10 | ||||
| -rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 26 |
6 files changed, 80 insertions, 57 deletions
diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java index 904b2e940a4d..ec5030c7f5db 100644 --- a/core/java/android/os/Environment.java +++ b/core/java/android/os/Environment.java @@ -416,6 +416,7 @@ public class Environment { * <p>See {@link #getExternalStorageDirectory()} for more information. */ public static boolean isExternalStorageRemovable() { + if (isExternalStorageEmulated()) return false; return Resources.getSystem().getBoolean( com.android.internal.R.bool.config_externalStorageRemovable); } diff --git a/core/java/android/widget/Toast.java b/core/java/android/widget/Toast.java index 29ca49a96558..a8f9f62222c2 100644 --- a/core/java/android/widget/Toast.java +++ b/core/java/android/widget/Toast.java @@ -33,6 +33,8 @@ import android.view.WindowManagerImpl; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; +import java.lang.ref.WeakReference; + /** * A toast is a view containing a quick little message for the user. The toast class * helps you create and show those. @@ -67,7 +69,6 @@ public class Toast { */ public static final int LENGTH_LONG = 1; - final Handler mHandler = new Handler(); final Context mContext; final TN mTN; int mDuration; @@ -87,7 +88,7 @@ public class Toast { */ public Toast(Context context) { mContext = context; - mTN = new TN(); + mTN = new TN(this); mY = context.getResources().getDimensionPixelSize( com.android.internal.R.dimen.toast_y_offset); } @@ -101,13 +102,10 @@ public class Toast { } INotificationManager service = getService(); - String pkg = mContext.getPackageName(); - TN tn = mTN; - try { - service.enqueueToast(pkg, tn, mDuration); + service.enqueueToast(pkg, mTN, mDuration); } catch (RemoteException e) { // Empty } @@ -313,7 +311,9 @@ public class Toast { return sService; } - private class TN extends ITransientNotification.Stub { + private static class TN extends ITransientNotification.Stub { + final Handler mHandler = new Handler(); + final Runnable mShow = new Runnable() { public void run() { handleShow(); @@ -327,10 +327,12 @@ public class Toast { }; private final WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(); + private final WeakReference<Toast> mToast; WindowManagerImpl mWM; - TN() { + TN(Toast toast) { + mToast = new WeakReference<Toast>(toast); // XXX This should be changed to use a Dialog, with a Theme.Toast // defined that sets up the layout params appropriately. final WindowManager.LayoutParams params = mParams; @@ -362,49 +364,53 @@ public class Toast { } public void handleShow() { - if (localLOGV) Log.v(TAG, "HANDLE SHOW: " + this + " mView=" + mView - + " mNextView=" + mNextView); - if (mView != mNextView) { - // remove the old view if necessary - handleHide(); - mView = mNextView; - mWM = WindowManagerImpl.getDefault(); - final int gravity = mGravity; - mParams.gravity = gravity; - if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL) { - mParams.horizontalWeight = 1.0f; + final Toast toast = mToast.get(); + if (toast != null) { + if (localLOGV) Log.v(TAG, "HANDLE SHOW: " + this + " mView=" + toast.mView + + " mNextView=" + toast.mNextView); + if (toast.mView != toast.mNextView) { + // remove the old view if necessary + handleHide(); + toast.mView = toast.mNextView; + mWM = WindowManagerImpl.getDefault(); + final int gravity = toast.mGravity; + mParams.gravity = gravity; + if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL) { + mParams.horizontalWeight = 1.0f; + } + if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.FILL_VERTICAL) { + mParams.verticalWeight = 1.0f; + } + mParams.x = toast.mX; + mParams.y = toast.mY; + mParams.verticalMargin = toast.mVerticalMargin; + mParams.horizontalMargin = toast.mHorizontalMargin; + if (toast.mView.getParent() != null) { + if (localLOGV) Log.v(TAG, "REMOVE! " + toast.mView + " in " + this); + mWM.removeView(toast.mView); + } + if (localLOGV) Log.v(TAG, "ADD! " + toast.mView + " in " + this); + mWM.addView(toast.mView, mParams); + toast.trySendAccessibilityEvent(); } - if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.FILL_VERTICAL) { - mParams.verticalWeight = 1.0f; - } - mParams.x = mX; - mParams.y = mY; - mParams.verticalMargin = mVerticalMargin; - mParams.horizontalMargin = mHorizontalMargin; - if (mView.getParent() != null) { - if (localLOGV) Log.v( - TAG, "REMOVE! " + mView + " in " + this); - mWM.removeView(mView); - } - if (localLOGV) Log.v(TAG, "ADD! " + mView + " in " + this); - mWM.addView(mView, mParams); - trySendAccessibilityEvent(); } } public void handleHide() { - if (localLOGV) Log.v(TAG, "HANDLE HIDE: " + this + " mView=" + mView); - if (mView != null) { - // note: checking parent() just to make sure the view has - // been added... i have seen cases where we get here when - // the view isn't yet added, so let's try not to crash. - if (mView.getParent() != null) { - if (localLOGV) Log.v( - TAG, "REMOVE! " + mView + " in " + this); - mWM.removeView(mView); + final Toast toast = mToast.get(); + if (toast != null) { + if (localLOGV) Log.v(TAG, "HANDLE HIDE: " + this + " mView=" + toast.mView); + if (toast.mView != null) { + // note: checking parent() just to make sure the view has + // been added... i have seen cases where we get here when + // the view isn't yet added, so let's try not to crash. + if (toast.mView.getParent() != null) { + if (localLOGV) Log.v(TAG, "REMOVE! " + toast.mView + " in " + this); + mWM.removeView(toast.mView); + } + + toast.mView = null; } - - mView = null; } } } diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java index e1c5564bd528..9fbbb3d9c655 100644 --- a/core/java/com/android/internal/app/PlatLogoActivity.java +++ b/core/java/com/android/internal/app/PlatLogoActivity.java @@ -29,11 +29,11 @@ public class PlatLogoActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mToast = Toast.makeText(this, "Zombie art by Jack Larson", Toast.LENGTH_SHORT); + mToast = Toast.makeText(this, "REZZZZZZZ...", Toast.LENGTH_SHORT); ImageView content = new ImageView(this); content.setImageResource(com.android.internal.R.drawable.platlogo); - content.setScaleType(ImageView.ScaleType.FIT_CENTER); + content.setScaleType(ImageView.ScaleType.CENTER_INSIDE); setContentView(content); } diff --git a/core/res/res/drawable-nodpi/platlogo.png b/core/res/res/drawable-nodpi/platlogo.png Binary files differindex e5af35684dc3..67e6ac318008 100644 --- a/core/res/res/drawable-nodpi/platlogo.png +++ b/core/res/res/drawable-nodpi/platlogo.png diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp index 5979be6ae3bb..e731080c8046 100644 --- a/media/libstagefright/httplive/LiveSession.cpp +++ b/media/libstagefright/httplive/LiveSession.cpp @@ -493,8 +493,14 @@ rinse_repeat: CHECK(buffer != NULL); - CHECK_EQ((status_t)OK, - decryptBuffer(mSeqNumber - firstSeqNumberInPlaylist, buffer)); + err = decryptBuffer(mSeqNumber - firstSeqNumberInPlaylist, buffer); + + if (err != OK) { + LOGE("decryptBuffer failed w/ error %d", err); + + mDataSource->queueEOS(err); + return; + } if (buffer->size() == 0 || buffer->data()[0] != 0x47) { // Not a transport stream??? diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 0548b4d5b341..df21399e226c 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -61,7 +61,6 @@ import android.os.WorkSource; import android.provider.Settings; import android.util.EventLog; import android.util.Log; -import android.util.Slog; import android.app.backup.IBackupManager; import android.bluetooth.BluetoothAdapter; import android.content.BroadcastReceiver; @@ -1671,10 +1670,18 @@ public class WifiStateMachine extends HierarchicalStateMachine { nwService.startAccessPoint((WifiConfiguration) message.obj, mInterfaceName, SOFTAP_IFACE); - } catch(Exception e) { - Log.e(TAG, "Exception in startAccessPoint()"); - sendMessage(obtainMessage(CMD_UNLOAD_DRIVER, WIFI_AP_STATE_FAILED, 0)); - break; + } catch (Exception e) { + Log.e(TAG, "Exception in softap start " + e); + try { + nwService.stopAccessPoint(); + nwService.startAccessPoint((WifiConfiguration) message.obj, + mInterfaceName, + SOFTAP_IFACE); + } catch (Exception ee) { + Log.e(TAG, "Exception during softap restart : " + ee); + sendMessage(obtainMessage(CMD_UNLOAD_DRIVER, WIFI_AP_STATE_FAILED, 0)); + break; + } } Log.d(TAG, "Soft AP start successful"); setWifiApState(WIFI_AP_STATE_ENABLED); @@ -2824,13 +2831,16 @@ public class WifiStateMachine extends HierarchicalStateMachine { mInterfaceName, SOFTAP_IFACE); } catch(Exception e) { - Log.e(TAG, "Exception in nwService during soft AP set"); + Log.e(TAG, "Exception in softap set " + e); try { nwService.stopAccessPoint(); + nwService.startAccessPoint((WifiConfiguration) message.obj, + mInterfaceName, + SOFTAP_IFACE); } catch (Exception ee) { - Slog.e(TAG, "Could not stop AP, :" + ee); + Log.e(TAG, "Could not restart softap after set failed " + ee); + sendMessage(obtainMessage(CMD_UNLOAD_DRIVER, WIFI_AP_STATE_FAILED, 0)); } - sendMessage(obtainMessage(CMD_UNLOAD_DRIVER, WIFI_AP_STATE_FAILED, 0)); } break; /* Fail client mode operation when soft AP is enabled */ |