diff options
-rw-r--r-- | api/16.txt | 42 | ||||
-rw-r--r-- | api/current.txt | 3 | ||||
-rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 23 | ||||
-rw-r--r-- | core/java/android/app/IActivityManager.java | 3 | ||||
-rw-r--r-- | core/java/android/app/PendingIntent.java | 14 | ||||
-rw-r--r-- | core/java/android/content/Intent.java | 11 | ||||
-rw-r--r-- | core/java/android/widget/RemoteViews.java | 112 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java | 3 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java | 31 | ||||
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 18 | ||||
-rwxr-xr-x | services/java/com/android/server/am/ActivityStack.java | 4 |
11 files changed, 197 insertions, 67 deletions
@@ -676,6 +676,7 @@ package android { field public static final int measureAllChildren = 16843018; // 0x101010a field public static final int measureWithLargestChild = 16843476; // 0x10102d4 field public static final int mediaRouteButtonStyle = 16843693; // 0x10103ad + field public static final int mediaRouteTypes = 16843694; // 0x10103ae field public static final int menuCategory = 16843230; // 0x10101de field public static final int mimeType = 16842790; // 0x1010026 field public static final int minDate = 16843583; // 0x101033f @@ -3688,6 +3689,8 @@ package android.app { ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet); ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet, int); method public int getRouteTypes(); + method public void onAttachedToWindow(); + method public void onDetachedFromWindow(); method public void setExtendedSettingsClickListener(android.view.View.OnClickListener); method public void setRouteTypes(int); method public void showDialog(); @@ -3759,6 +3762,7 @@ package android.app { public static class Notification.BigPictureStyle extends android.app.Notification.Style { ctor public Notification.BigPictureStyle(); ctor public Notification.BigPictureStyle(android.app.Notification.Builder); + method public android.app.Notification.BigPictureStyle bigLargeIcon(android.graphics.Bitmap); method public android.app.Notification.BigPictureStyle bigPicture(android.graphics.Bitmap); method public android.app.Notification build(); method public android.app.Notification.BigPictureStyle setBigContentTitle(java.lang.CharSequence); @@ -5827,7 +5831,6 @@ package android.content { field public static final int FLAG_ACTIVITY_CLEAR_TASK = 32768; // 0x8000 field public static final int FLAG_ACTIVITY_CLEAR_TOP = 67108864; // 0x4000000 field public static final int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 524288; // 0x80000 - field public static final int FLAG_ACTIVITY_CLOSE_SYSTEM_DIALOGS = 8192; // 0x2000 field public static final int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 8388608; // 0x800000 field public static final int FLAG_ACTIVITY_FORWARD_RESULT = 33554432; // 0x2000000 field public static final int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY = 1048576; // 0x100000 @@ -11537,6 +11540,7 @@ package android.media { method public abstract void onRouteSelected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo); method public abstract void onRouteUngrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup); method public abstract void onRouteUnselected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo); + method public abstract void onRouteVolumeChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); } public static class MediaRouter.RouteCategory { @@ -11564,10 +11568,21 @@ package android.media { method public android.graphics.drawable.Drawable getIconDrawable(); method public java.lang.CharSequence getName(); method public java.lang.CharSequence getName(android.content.Context); + method public int getPlaybackStream(); + method public int getPlaybackType(); method public java.lang.CharSequence getStatus(); method public int getSupportedTypes(); method public java.lang.Object getTag(); + method public int getVolume(); + method public int getVolumeHandling(); + method public int getVolumeMax(); + method public void requestSetVolume(int); + method public void requestUpdateVolume(int); method public void setTag(java.lang.Object); + field public static final int PLAYBACK_TYPE_LOCAL = 0; // 0x0 + field public static final int PLAYBACK_TYPE_REMOTE = 1; // 0x1 + field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0 + field public static final int PLAYBACK_VOLUME_VARIABLE = 1; // 0x1 } public static class MediaRouter.SimpleCallback extends android.media.MediaRouter.Callback { @@ -11579,15 +11594,29 @@ package android.media { method public void onRouteSelected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo); method public void onRouteUngrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup); method public void onRouteUnselected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo); + method public void onRouteVolumeChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo); } public static class MediaRouter.UserRouteInfo extends android.media.MediaRouter.RouteInfo { + method public android.media.RemoteControlClient getRemoteControlClient(); method public void setIconDrawable(android.graphics.drawable.Drawable); method public void setIconResource(int); method public void setName(java.lang.CharSequence); method public void setName(int); + method public void setPlaybackStream(int); + method public void setPlaybackType(int); method public void setRemoteControlClient(android.media.RemoteControlClient); method public void setStatus(java.lang.CharSequence); + method public void setVolume(int); + method public void setVolumeCallback(android.media.MediaRouter.VolumeCallback); + method public void setVolumeHandling(int); + method public void setVolumeMax(int); + } + + public static abstract class MediaRouter.VolumeCallback { + ctor public MediaRouter.VolumeCallback(); + method public abstract void onVolumeSetRequest(android.media.MediaRouter.RouteInfo, int); + method public abstract void onVolumeUpdateRequest(android.media.MediaRouter.RouteInfo, int); } public class MediaScannerConnection implements android.content.ServiceConnection { @@ -22816,10 +22845,18 @@ package android.view { public abstract class ActionProvider { ctor public ActionProvider(android.content.Context); method public boolean hasSubMenu(); + method public boolean isVisible(); method public abstract deprecated android.view.View onCreateActionView(); method public android.view.View onCreateActionView(android.view.MenuItem); method public boolean onPerformDefaultAction(); method public void onPrepareSubMenu(android.view.SubMenu); + method public boolean overridesItemVisibility(); + method public void refreshVisibility(); + method public void setVisibilityListener(android.view.ActionProvider.VisibilityListener); + } + + public static abstract interface ActionProvider.VisibilityListener { + method public abstract void onActionProviderVisibilityChanged(boolean); } public final class Choreographer { @@ -28146,8 +28183,11 @@ package android.widget { method public void setString(int, java.lang.String, java.lang.String); method public void setTextColor(int, int); method public void setTextViewCompoundDrawables(int, int, int, int, int); + method public void setTextViewCompoundDrawablesRelative(int, int, int, int, int); method public void setTextViewText(int, java.lang.CharSequence); + method public void setTextViewTextSize(int, int, float); method public void setUri(int, java.lang.String, android.net.Uri); + method public void setViewPadding(int, int, int, int, int); method public void setViewVisibility(int, int); method public void showNext(int); method public void showPrevious(int); diff --git a/api/current.txt b/api/current.txt index f5cced9..bc97e81 100644 --- a/api/current.txt +++ b/api/current.txt @@ -3689,6 +3689,8 @@ package android.app { ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet); ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet, int); method public int getRouteTypes(); + method public void onAttachedToWindow(); + method public void onDetachedFromWindow(); method public void setExtendedSettingsClickListener(android.view.View.OnClickListener); method public void setRouteTypes(int); method public void showDialog(); @@ -5829,7 +5831,6 @@ package android.content { field public static final int FLAG_ACTIVITY_CLEAR_TASK = 32768; // 0x8000 field public static final int FLAG_ACTIVITY_CLEAR_TOP = 67108864; // 0x4000000 field public static final int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 524288; // 0x80000 - field public static final int FLAG_ACTIVITY_CLOSE_SYSTEM_DIALOGS = 8192; // 0x2000 field public static final int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 8388608; // 0x800000 field public static final int FLAG_ACTIVITY_FORWARD_RESULT = 33554432; // 0x2000000 field public static final int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY = 1048576; // 0x100000 diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 2ed93f4..e12fa19 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -1617,6 +1617,16 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } + case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + IIntentSender r = IIntentSender.Stub.asInterface( + data.readStrongBinder()); + boolean res = isIntentSenderAnActivity(r); + reply.writeNoException(); + reply.writeInt(res ? 1 : 0); + return true; + } + case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); Configuration config = Configuration.CREATOR.createFromParcel(data); @@ -3753,6 +3763,19 @@ class ActivityManagerProxy implements IActivityManager return res; } + public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(sender.asBinder()); + mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0); + reply.readException(); + boolean res = reply.readInt() != 0; + data.recycle(); + reply.recycle(); + return res; + } + public void updatePersistentConfiguration(Configuration values) throws RemoteException { Parcel data = Parcel.obtain(); diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 609a047..031e39b 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -338,6 +338,8 @@ public interface IActivityManager extends IInterface { public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException; + public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException; + public void updatePersistentConfiguration(Configuration values) throws RemoteException; public long[] getProcessPss(int[] pids) throws RemoteException; @@ -603,4 +605,5 @@ public interface IActivityManager extends IInterface { int FINISH_ACTIVITY_AFFINITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+148; int GET_LAUNCHED_FROM_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+149; int UNSTABLE_PROVIDER_DIED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+150; + int IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+151; } diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index aa366b6..8adc8a2 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -631,6 +631,20 @@ public final class PendingIntent implements Parcelable { } /** + * @hide + * Check whether this PendingIntent will launch an Activity. + */ + public boolean isActivity() { + try { + return ActivityManagerNative.getDefault() + .isIntentSenderAnActivity(mTarget); + } catch (RemoteException e) { + // Should never happen. + return false; + } + } + + /** * Comparison operator on two PendingIntent objects, such that true * is returned then they both represent the same operation from the * same package. This allows you to use {@link #getActivity}, diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 76dfac4..3fdf451 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -3105,17 +3105,6 @@ public class Intent implements Parcelable, Cloneable { */ public static final int FLAG_ACTIVITY_TASK_ON_HOME = 0X00004000; /** - * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, - * upon starting the activity the system will also clear any system dialogs that - * are currently shown. This is intended primarily for any actions that are - * associated with buttons in a notification: tapping on the button to launch - * the activity needs to also dismiss the notification window (which is one - * of the system dialogs); setting this flag on the Intent associated with that - * action will ensure that and other system dialogs are dismissed so that the - * user arrives in the new activity. - */ - public static final int FLAG_ACTIVITY_CLOSE_SYSTEM_DIALOGS = 0X00002000; - /** * If set, when sending a broadcast only registered receivers will be * called -- no BroadcastReceiver components will be launched. */ diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index beb87cd..e29000d 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -125,7 +125,10 @@ public class RemoteViews implements Parcelable, Filter { * setting on click extras and setting on click pending intents. The former is enabled, * and the latter disabled when this flag is true. */ - private boolean mIsWidgetCollectionChild = false; + private boolean mIsWidgetCollectionChild = false; + + private static final OnClickHandler DEFAULT_ON_CLICK_HANDLER = new OnClickHandler(); + private OnClickHandler mOnClickHandler = DEFAULT_ON_CLICK_HANDLER; /** * This annotation indicates that a subclass of View is alllowed to be used @@ -149,29 +152,9 @@ public class RemoteViews implements Parcelable, Filter { } } - /** - * Base class for all actions that can be performed on an - * inflated view. - * - * SUBCLASSES MUST BE IMMUTABLE SO CLONE WORKS!!!!! - */ - private abstract static class Action implements Parcelable { - public abstract void apply(View root, ViewGroup rootParent) throws ActionException; - - public int describeContents() { - return 0; - } - - /** - * Overridden by each class to report on it's own memory usage - */ - public void updateMemoryUsageEstimate(MemoryUsageCounter counter) { - // We currently only calculate Bitmap memory usage, so by default, don't do anything - // here - return; - } - - protected boolean startIntentSafely(View view, PendingIntent pendingIntent, + /** @hide */ + public static class OnClickHandler { + public boolean onClickHandler(View view, PendingIntent pendingIntent, Intent fillInIntent) { try { // TODO: Unregister this handler if PendingIntent.FLAG_ONE_SHOT? @@ -193,6 +176,30 @@ public class RemoteViews implements Parcelable, Filter { } return true; } + } + + /** + * Base class for all actions that can be performed on an + * inflated view. + * + * SUBCLASSES MUST BE IMMUTABLE SO CLONE WORKS!!!!! + */ + private abstract static class Action implements Parcelable { + public abstract void apply(RemoteViews owner, View root, + ViewGroup rootParent) throws ActionException; + + public int describeContents() { + return 0; + } + + /** + * Overridden by each class to report on it's own memory usage + */ + public void updateMemoryUsageEstimate(MemoryUsageCounter counter) { + // We currently only calculate Bitmap memory usage, so by default, don't do anything + // here + return; + } public void setBitmapCache(BitmapCache bitmapCache) { // Do nothing @@ -222,7 +229,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) { + public void apply(RemoteViews owner, View root, ViewGroup rootParent) { final View view = root.findViewById(viewId); if (!(view instanceof AdapterView<?>)) return; @@ -253,7 +260,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) { + public void apply(RemoteViews owner, View root, ViewGroup rootParent) { final View target = root.findViewById(viewId); if (target == null) return; @@ -265,6 +272,7 @@ public class RemoteViews implements Parcelable, Filter { if (target == root) { target.setTagInternal(com.android.internal.R.id.fillInIntent, fillInIntent); } else if (target != null && fillInIntent != null) { + final OnClickHandler clicker = owner.mOnClickHandler; OnClickListener listener = new OnClickListener() { public void onClick(View v) { // Insure that this view is a child of an AdapterView @@ -302,7 +310,7 @@ public class RemoteViews implements Parcelable, Filter { rect.bottom = (int) ((pos[1] + v.getHeight()) * appScale + 0.5f); fillInIntent.setSourceBounds(rect); - startIntentSafely(v, pendingIntent, fillInIntent); + clicker.onClickHandler(v, pendingIntent, fillInIntent); } }; @@ -334,13 +342,14 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) { + public void apply(RemoteViews owner, View root, ViewGroup rootParent) { final View target = root.findViewById(viewId); if (target == null) return; // If the view isn't an AdapterView, setting a PendingIntent template doesn't make sense if (target instanceof AdapterView<?>) { AdapterView<?> av = (AdapterView<?>) target; + final OnClickHandler clicker = owner.mOnClickHandler; // The PendingIntent template is stored in the view's tag. OnItemClickListener listener = new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, @@ -380,7 +389,7 @@ public class RemoteViews implements Parcelable, Filter { final Intent intent = new Intent(); intent.setSourceBounds(rect); - startIntentSafely(view, pendingIntentTemplate, fillInIntent); + clicker.onClickHandler(view, pendingIntentTemplate, fillInIntent); } } }; @@ -417,7 +426,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) { + public void apply(RemoteViews owner, View root, ViewGroup rootParent) { final View target = root.findViewById(viewId); if (target == null) return; @@ -485,7 +494,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) { + public void apply(RemoteViews owner, View root, ViewGroup rootParent) { final View target = root.findViewById(viewId); if (target == null) return; @@ -506,6 +515,7 @@ public class RemoteViews implements Parcelable, Filter { if (target != null) { // If the pendingIntent is null, we clear the onClickListener + final OnClickHandler clicker = owner.mOnClickHandler; OnClickListener listener = null; if (pendingIntent != null) { listener = new OnClickListener() { @@ -525,7 +535,7 @@ public class RemoteViews implements Parcelable, Filter { final Intent intent = new Intent(); intent.setSourceBounds(rect); - startIntentSafely(v, pendingIntent, intent); + clicker.onClickHandler(v, pendingIntent, intent); } }; } @@ -592,7 +602,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) { + public void apply(RemoteViews owner, View root, ViewGroup rootParent) { final View target = root.findViewById(viewId); if (target == null) return; @@ -652,7 +662,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) { + public void apply(RemoteViews owner, View root, ViewGroup rootParent) { final View view = root.findViewById(viewId); if (view == null) return; @@ -776,10 +786,11 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) throws ActionException { + public void apply(RemoteViews owner, View root, + ViewGroup rootParent) throws ActionException { ReflectionAction ra = new ReflectionAction(viewId, methodName, ReflectionAction.BITMAP, bitmap); - ra.apply(root, rootParent); + ra.apply(owner, root, rootParent); } @Override @@ -995,7 +1006,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) { + public void apply(RemoteViews owner, View root, ViewGroup rootParent) { final View view = root.findViewById(viewId); if (view == null) return; @@ -1097,13 +1108,13 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) { + public void apply(RemoteViews owner, View root, ViewGroup rootParent) { final Context context = root.getContext(); final ViewGroup target = (ViewGroup) root.findViewById(viewId); if (target == null) return; if (nestedViews != null) { // Inflate nested views and add as children - target.addView(nestedViews.apply(context, target)); + target.addView(nestedViews.apply(owner, context, target)); } else { // Clear all children when nested views omitted target.removeAllViews(); @@ -1164,7 +1175,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) { + public void apply(RemoteViews owner, View root, ViewGroup rootParent) { final Context context = root.getContext(); final TextView target = (TextView) root.findViewById(viewId); if (target == null) return; @@ -1206,7 +1217,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) { + public void apply(RemoteViews owner, View root, ViewGroup rootParent) { final Context context = root.getContext(); final TextView target = (TextView) root.findViewById(viewId); if (target == null) return; @@ -1250,7 +1261,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override - public void apply(View root, ViewGroup rootParent) { + public void apply(RemoteViews owner, View root, ViewGroup rootParent) { final Context context = root.getContext(); final View target = root.findViewById(viewId); if (target == null) return; @@ -2088,6 +2099,11 @@ public class RemoteViews implements Parcelable, Filter { return this; } + /** @hide */ + public void setOnClickHandler(OnClickHandler handler) { + mOnClickHandler = handler; + } + /** * Inflates the view hierarchy represented by this object and applies * all of the actions. @@ -2100,6 +2116,10 @@ public class RemoteViews implements Parcelable, Filter { * @return The inflated view hierarchy */ public View apply(Context context, ViewGroup parent) { + return apply(this, context, parent); + } + + View apply(RemoteViews owner, Context context, ViewGroup parent) { RemoteViews rvToApply = getRemoteViewsToApply(context); View result; @@ -2114,7 +2134,7 @@ public class RemoteViews implements Parcelable, Filter { result = inflater.inflate(rvToApply.getLayoutId(), parent, false); - rvToApply.performApply(result, parent); + rvToApply.performApply(owner, result, parent); return result; } @@ -2141,15 +2161,15 @@ public class RemoteViews implements Parcelable, Filter { } prepareContext(context); - rvToApply.performApply(v, (ViewGroup) v.getParent()); + rvToApply.performApply(this, v, (ViewGroup) v.getParent()); } - private void performApply(View v, ViewGroup parent) { + private void performApply(RemoteViews owner, View v, ViewGroup parent) { if (mActions != null) { final int count = mActions.size(); for (int i = 0; i < count; i++) { Action a = mActions.get(i); - a.apply(v, parent); + a.apply(owner, v, parent); } } } diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index c09e4c4..9448bbf 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -190,8 +190,7 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi sharingIntent.putExtra(Intent.EXTRA_STREAM, uri); Intent chooserIntent = Intent.createChooser(sharingIntent, null); - chooserIntent.addFlags(Intent.FLAG_ACTIVITY_CLOSE_SYSTEM_DIALOGS - | Intent.FLAG_ACTIVITY_CLEAR_TASK + chooserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); mNotificationBuilder.addAction(R.drawable.ic_menu_share, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index a3ec6c3..a2a03ea 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -154,6 +154,35 @@ public abstract class BaseStatusBar extends SystemUI implements } }; + private RemoteViews.OnClickHandler mOnClickHandler = new RemoteViews.OnClickHandler() { + @Override + public boolean onClickHandler(View view, PendingIntent pendingIntent, Intent fillInIntent) { + final boolean isActivity = pendingIntent.isActivity(); + if (isActivity) { + try { + // The intent we are sending is for the application, which + // won't have permission to immediately start an activity after + // the user switches to home. We know it is safe to do at this + // point, so make sure new activity switches are now allowed. + ActivityManagerNative.getDefault().resumeAppSwitches(); + // Also, notifications can be launched from the lock screen, + // so dismiss the lock screen when the activity starts. + ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity(); + } catch (RemoteException e) { + } + } + + boolean handled = super.onClickHandler(view, pendingIntent, fillInIntent); + + if (isActivity && handled) { + // close the shade if it was open + animateCollapse(CommandQueue.FLAG_EXCLUDE_NONE); + visibilityChanged(false); + } + return handled; + } + }; + public void start() { mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay(); @@ -547,8 +576,10 @@ public abstract class BaseStatusBar extends SystemUI implements View expandedLarge = null; Exception exception = null; try { + oneU.setOnClickHandler(mOnClickHandler); expandedOneU = oneU.apply(mContext, adaptive); if (large != null) { + large.setOnClickHandler(mOnClickHandler); expandedLarge = large.apply(mContext, adaptive); } } diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 63455ee..f482552 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -3577,8 +3577,7 @@ public final class ActivityManagerService extends ActivityManagerNative for (int i=mMainStack.mHistory.size()-1; i>=0; i--) { ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(i); - if ((r.info.flags&ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS) != 0 - && (r.intent.getFlags()&Intent.FLAG_ACTIVITY_CLOSE_SYSTEM_DIALOGS) == 0) { + if ((r.info.flags&ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS) != 0) { r.stack.finishActivityLocked(r, i, Activity.RESULT_CANCELED, null, "close-sys"); } @@ -4573,6 +4572,21 @@ public final class ActivityManagerService extends ActivityManagerNative return false; } + public boolean isIntentSenderAnActivity(IIntentSender pendingResult) { + if (!(pendingResult instanceof PendingIntentRecord)) { + return false; + } + try { + PendingIntentRecord res = (PendingIntentRecord)pendingResult; + if (res.key.type == ActivityManager.INTENT_SENDER_ACTIVITY) { + return true; + } + return false; + } catch (ClassCastException e) { + } + return false; + } + public void setProcessLimit(int max) { enforceCallingPermission(android.Manifest.permission.SET_PROCESS_LIMIT, "setProcessLimit()"); diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index e2d6d98..d954c6c 100755 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -2559,10 +2559,6 @@ final class ActivityStack { mDismissKeyguardOnNextActivity = false; mService.mWindowManager.dismissKeyguard(); } - if (err >= ActivityManager.START_SUCCESS && - (launchFlags&Intent.FLAG_ACTIVITY_CLOSE_SYSTEM_DIALOGS) != 0) { - mService.closeSystemDialogsLocked(Process.myUid(), "launch"); - } return err; } |