Fix issue #2093608: Calendar widget takes a few seconds to launch
Avert your eyes! The key change here is that RemoteViews can now call a Context API to start its pending intent, which inside of the activity manager we can use to determine to cancel the timeout delay for external entities to disrupt the home screen. Change-Id: If097cf7478cbed7a3c04a304050bd7fd5703d197
This commit is contained in:
190
api/current.xml
190
api/current.xml
@ -17165,27 +17165,6 @@
|
||||
<parameter name="id" type="int">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="startActivity"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="intent" type="android.app.PendingIntent">
|
||||
</parameter>
|
||||
<parameter name="fillInIntent" type="android.content.Intent">
|
||||
</parameter>
|
||||
<parameter name="flagsMask" type="int">
|
||||
</parameter>
|
||||
<parameter name="flagsValues" type="int">
|
||||
</parameter>
|
||||
<exception name="PendingIntent.CanceledException" type="android.app.PendingIntent.CanceledException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="startActivityForResult"
|
||||
return="void"
|
||||
abstract="false"
|
||||
@ -17201,29 +17180,6 @@
|
||||
<parameter name="requestCode" type="int">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="startActivityForResult"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="intent" type="android.app.PendingIntent">
|
||||
</parameter>
|
||||
<parameter name="requestCode" type="int">
|
||||
</parameter>
|
||||
<parameter name="fillInIntent" type="android.content.Intent">
|
||||
</parameter>
|
||||
<parameter name="flagsMask" type="int">
|
||||
</parameter>
|
||||
<parameter name="flagsValues" type="int">
|
||||
</parameter>
|
||||
<exception name="PendingIntent.CanceledException" type="android.app.PendingIntent.CanceledException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="startActivityFromChild"
|
||||
return="void"
|
||||
abstract="false"
|
||||
@ -17241,31 +17197,6 @@
|
||||
<parameter name="requestCode" type="int">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="startActivityFromChild"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="child" type="android.app.Activity">
|
||||
</parameter>
|
||||
<parameter name="intent" type="android.app.PendingIntent">
|
||||
</parameter>
|
||||
<parameter name="requestCode" type="int">
|
||||
</parameter>
|
||||
<parameter name="fillInIntent" type="android.content.Intent">
|
||||
</parameter>
|
||||
<parameter name="flagsMask" type="int">
|
||||
</parameter>
|
||||
<parameter name="flagsValues" type="int">
|
||||
</parameter>
|
||||
<exception name="PendingIntent.CanceledException" type="android.app.PendingIntent.CanceledException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="startActivityIfNeeded"
|
||||
return="boolean"
|
||||
abstract="false"
|
||||
@ -17281,6 +17212,58 @@
|
||||
<parameter name="requestCode" type="int">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="startIntentSenderForResult"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="intent" type="android.content.IntentSender">
|
||||
</parameter>
|
||||
<parameter name="requestCode" type="int">
|
||||
</parameter>
|
||||
<parameter name="fillInIntent" type="android.content.Intent">
|
||||
</parameter>
|
||||
<parameter name="flagsMask" type="int">
|
||||
</parameter>
|
||||
<parameter name="flagsValues" type="int">
|
||||
</parameter>
|
||||
<parameter name="extraFlags" type="int">
|
||||
</parameter>
|
||||
<exception name="IntentSender.SendIntentException" type="android.content.IntentSender.SendIntentException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="startIntentSenderFromChild"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="child" type="android.app.Activity">
|
||||
</parameter>
|
||||
<parameter name="intent" type="android.content.IntentSender">
|
||||
</parameter>
|
||||
<parameter name="requestCode" type="int">
|
||||
</parameter>
|
||||
<parameter name="fillInIntent" type="android.content.Intent">
|
||||
</parameter>
|
||||
<parameter name="flagsMask" type="int">
|
||||
</parameter>
|
||||
<parameter name="flagsValues" type="int">
|
||||
</parameter>
|
||||
<parameter name="extraFlags" type="int">
|
||||
</parameter>
|
||||
<exception name="IntentSender.SendIntentException" type="android.content.IntentSender.SendIntentException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="startManagingCursor"
|
||||
return="void"
|
||||
abstract="false"
|
||||
@ -31782,6 +31765,29 @@
|
||||
<parameter name="arguments" type="android.os.Bundle">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="startIntentSender"
|
||||
return="void"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="intent" type="android.content.IntentSender">
|
||||
</parameter>
|
||||
<parameter name="fillInIntent" type="android.content.Intent">
|
||||
</parameter>
|
||||
<parameter name="flagsMask" type="int">
|
||||
</parameter>
|
||||
<parameter name="flagsValues" type="int">
|
||||
</parameter>
|
||||
<parameter name="extraFlags" type="int">
|
||||
</parameter>
|
||||
<exception name="IntentSender.SendIntentException" type="android.content.IntentSender.SendIntentException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="startService"
|
||||
return="android.content.ComponentName"
|
||||
abstract="true"
|
||||
@ -33095,6 +33101,29 @@
|
||||
<parameter name="arguments" type="android.os.Bundle">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="startIntentSender"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="intent" type="android.content.IntentSender">
|
||||
</parameter>
|
||||
<parameter name="fillInIntent" type="android.content.Intent">
|
||||
</parameter>
|
||||
<parameter name="flagsMask" type="int">
|
||||
</parameter>
|
||||
<parameter name="flagsValues" type="int">
|
||||
</parameter>
|
||||
<parameter name="extraFlags" type="int">
|
||||
</parameter>
|
||||
<exception name="IntentSender.SendIntentException" type="android.content.IntentSender.SendIntentException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="startService"
|
||||
return="android.content.ComponentName"
|
||||
abstract="false"
|
||||
@ -126744,6 +126773,29 @@
|
||||
<parameter name="arguments" type="android.os.Bundle">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="startIntentSender"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="intent" type="android.content.IntentSender">
|
||||
</parameter>
|
||||
<parameter name="fillInIntent" type="android.content.Intent">
|
||||
</parameter>
|
||||
<parameter name="flagsMask" type="int">
|
||||
</parameter>
|
||||
<parameter name="flagsValues" type="int">
|
||||
</parameter>
|
||||
<parameter name="extraFlags" type="int">
|
||||
</parameter>
|
||||
<exception name="IntentSender.SendIntentException" type="android.content.IntentSender.SendIntentException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="startService"
|
||||
return="android.content.ComponentName"
|
||||
abstract="false"
|
||||
|
@ -24,6 +24,7 @@ import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IIntentSender;
|
||||
import android.content.IntentSender;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Configuration;
|
||||
@ -2774,48 +2775,50 @@ public class Activity extends ContextThemeWrapper
|
||||
|
||||
/**
|
||||
* Like {@link #startActivityForResult(Intent, int)}, but allowing you
|
||||
* to use a PendingIntent to describe the activity to be started. Note
|
||||
* that the given PendingIntent <em>must</em> have been created with
|
||||
* {@link PendingIntent#getActivity PendingIntent.getActivity}; all other
|
||||
* types will result in an IllegalArgumentException being thrown.
|
||||
* to use a IntentSender to describe the activity to be started. If
|
||||
* the IntentSender is for an activity, that activity will be started
|
||||
* as if you had called the regular {@link #startActivityForResult(Intent, int)}
|
||||
* here; otherwise, its associated action will be executed (such as
|
||||
* sending a broadcast) as if you had called
|
||||
* {@link IntentSender#sendIntent IntentSender.sendIntent} on it.
|
||||
*
|
||||
* @param intent The PendingIntent to launch.
|
||||
* @param intent The IntentSender to launch.
|
||||
* @param requestCode If >= 0, this code will be returned in
|
||||
* onActivityResult() when the activity exits.
|
||||
* @param fillInIntent If non-null, this will be provided as the
|
||||
* intent parameter to {@link PendingIntent#send(Context, int, Intent)
|
||||
* PendingIntent.send(Context, int, Intent)}.
|
||||
* @param flagsMask Intent flags in the original PendingIntent that you
|
||||
* intent parameter to {@link IntentSender#sendIntent}.
|
||||
* @param flagsMask Intent flags in the original IntentSender that you
|
||||
* would like to change.
|
||||
* @param flagsValues Desired values for any bits set in
|
||||
* <var>flagsMask</var>
|
||||
* @param extraFlags Always set to 0.
|
||||
*/
|
||||
public void startActivityForResult(PendingIntent intent, int requestCode,
|
||||
Intent fillInIntent, int flagsMask, int flagsValues)
|
||||
throws PendingIntent.CanceledException {
|
||||
public void startIntentSenderForResult(IntentSender intent, int requestCode,
|
||||
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
|
||||
throws IntentSender.SendIntentException {
|
||||
if (mParent == null) {
|
||||
startActivityForResultInner(intent, requestCode, fillInIntent,
|
||||
startIntentSenderForResultInner(intent, requestCode, fillInIntent,
|
||||
flagsMask, flagsValues, this);
|
||||
} else {
|
||||
mParent.startActivityFromChild(this, intent, requestCode,
|
||||
fillInIntent, flagsMask, flagsValues);
|
||||
mParent.startIntentSenderFromChild(this, intent, requestCode,
|
||||
fillInIntent, flagsMask, flagsValues, extraFlags);
|
||||
}
|
||||
}
|
||||
|
||||
private void startActivityForResultInner(PendingIntent intent, int requestCode,
|
||||
private void startIntentSenderForResultInner(IntentSender intent, int requestCode,
|
||||
Intent fillInIntent, int flagsMask, int flagsValues, Activity activity)
|
||||
throws PendingIntent.CanceledException {
|
||||
throws IntentSender.SendIntentException {
|
||||
try {
|
||||
String resolvedType = null;
|
||||
if (fillInIntent != null) {
|
||||
resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver());
|
||||
}
|
||||
int result = ActivityManagerNative.getDefault()
|
||||
.startActivityPendingIntent(mMainThread.getApplicationThread(), intent,
|
||||
.startActivityIntentSender(mMainThread.getApplicationThread(), intent,
|
||||
fillInIntent, resolvedType, mToken, activity.mEmbeddedID,
|
||||
requestCode, flagsMask, flagsValues);
|
||||
if (result == IActivityManager.START_CANCELED) {
|
||||
throw new PendingIntent.CanceledException();
|
||||
throw new IntentSender.SendIntentException();
|
||||
}
|
||||
Instrumentation.checkStartActivityResult(result, null);
|
||||
} catch (RemoteException e) {
|
||||
@ -2856,24 +2859,25 @@ public class Activity extends ContextThemeWrapper
|
||||
}
|
||||
|
||||
/**
|
||||
* Like {@link #startActivity(Intent)}, but taking a PendingIntent
|
||||
* Like {@link #startActivity(Intent)}, but taking a IntentSender
|
||||
* to start; see
|
||||
* {@link #startActivityForResult(PendingIntent, int, Intent, int, int)}
|
||||
* {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int)}
|
||||
* for more information.
|
||||
*
|
||||
* @param intent The PendingIntent to launch.
|
||||
* @param intent The IntentSender to launch.
|
||||
* @param fillInIntent If non-null, this will be provided as the
|
||||
* intent parameter to {@link PendingIntent#send(Context, int, Intent)
|
||||
* PendingIntent.send(Context, int, Intent)}.
|
||||
* @param flagsMask Intent flags in the original PendingIntent that you
|
||||
* intent parameter to {@link IntentSender#sendIntent}.
|
||||
* @param flagsMask Intent flags in the original IntentSender that you
|
||||
* would like to change.
|
||||
* @param flagsValues Desired values for any bits set in
|
||||
* <var>flagsMask</var>
|
||||
* @param extraFlags Always set to 0.
|
||||
*/
|
||||
public void startActivity(PendingIntent intent,
|
||||
Intent fillInIntent, int flagsMask, int flagsValues)
|
||||
throws PendingIntent.CanceledException {
|
||||
startActivityForResult(intent, -1, fillInIntent, flagsMask, flagsValues);
|
||||
public void startIntentSender(IntentSender intent,
|
||||
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
|
||||
throws IntentSender.SendIntentException {
|
||||
startIntentSenderForResult(intent, -1, fillInIntent, flagsMask,
|
||||
flagsValues, extraFlags);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2998,14 +3002,15 @@ public class Activity extends ContextThemeWrapper
|
||||
|
||||
/**
|
||||
* Like {@link #startActivityFromChild(Activity, Intent, int)}, but
|
||||
* taking a PendingIntent; see
|
||||
* {@link #startActivityForResult(PendingIntent, int, Intent, int, int)}
|
||||
* taking a IntentSender; see
|
||||
* {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int)}
|
||||
* for more information.
|
||||
*/
|
||||
public void startActivityFromChild(Activity child, PendingIntent intent,
|
||||
int requestCode, Intent fillInIntent, int flagsMask, int flagsValues)
|
||||
throws PendingIntent.CanceledException {
|
||||
startActivityForResultInner(intent, requestCode, fillInIntent,
|
||||
public void startIntentSenderFromChild(Activity child, IntentSender intent,
|
||||
int requestCode, Intent fillInIntent, int flagsMask, int flagsValues,
|
||||
int extraFlags)
|
||||
throws IntentSender.SendIntentException {
|
||||
startIntentSenderForResultInner(intent, requestCode, fillInIntent,
|
||||
flagsMask, flagsValues, child);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.IIntentSender;
|
||||
import android.content.IIntentReceiver;
|
||||
import android.content.IntentSender;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.ConfigurationInfo;
|
||||
import android.content.pm.IPackageDataObserver;
|
||||
@ -145,12 +146,12 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
|
||||
return true;
|
||||
}
|
||||
|
||||
case START_ACTIVITY_PENDING_INTENT_TRANSACTION:
|
||||
case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
|
||||
{
|
||||
data.enforceInterface(IActivityManager.descriptor);
|
||||
IBinder b = data.readStrongBinder();
|
||||
IApplicationThread app = ApplicationThreadNative.asInterface(b);
|
||||
PendingIntent intent = PendingIntent.CREATOR.createFromParcel(data);
|
||||
IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
|
||||
Intent fillInIntent = null;
|
||||
if (data.readInt() != 0) {
|
||||
fillInIntent = Intent.CREATOR.createFromParcel(data);
|
||||
@ -161,7 +162,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
|
||||
int requestCode = data.readInt();
|
||||
int flagsMask = data.readInt();
|
||||
int flagsValues = data.readInt();
|
||||
int result = startActivityPendingIntent(app, intent,
|
||||
int result = startActivityIntentSender(app, intent,
|
||||
fillInIntent, resolvedType, resultTo, resultWho,
|
||||
requestCode, flagsMask, flagsValues);
|
||||
reply.writeNoException();
|
||||
@ -1202,8 +1203,8 @@ class ActivityManagerProxy implements IActivityManager
|
||||
data.recycle();
|
||||
return result;
|
||||
}
|
||||
public int startActivityPendingIntent(IApplicationThread caller,
|
||||
PendingIntent intent, Intent fillInIntent, String resolvedType,
|
||||
public int startActivityIntentSender(IApplicationThread caller,
|
||||
IntentSender intent, Intent fillInIntent, String resolvedType,
|
||||
IBinder resultTo, String resultWho, int requestCode,
|
||||
int flagsMask, int flagsValues) throws RemoteException {
|
||||
Parcel data = Parcel.obtain();
|
||||
@ -1223,7 +1224,7 @@ class ActivityManagerProxy implements IActivityManager
|
||||
data.writeInt(requestCode);
|
||||
data.writeInt(flagsMask);
|
||||
data.writeInt(flagsValues);
|
||||
mRemote.transact(START_ACTIVITY_PENDING_INTENT_TRANSACTION, data, reply, 0);
|
||||
mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
|
||||
reply.readException();
|
||||
int result = reply.readInt();
|
||||
reply.recycle();
|
||||
|
@ -560,6 +560,27 @@ class ApplicationContext extends Context {
|
||||
getOuterContext(), mMainThread.getApplicationThread(), null, null, intent, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startIntentSender(IntentSender intent,
|
||||
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
|
||||
throws IntentSender.SendIntentException {
|
||||
try {
|
||||
String resolvedType = null;
|
||||
if (fillInIntent != null) {
|
||||
resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver());
|
||||
}
|
||||
int result = ActivityManagerNative.getDefault()
|
||||
.startActivityIntentSender(mMainThread.getApplicationThread(), intent,
|
||||
fillInIntent, resolvedType, null, null,
|
||||
0, flagsMask, flagsValues);
|
||||
if (result == IActivityManager.START_CANCELED) {
|
||||
throw new IntentSender.SendIntentException();
|
||||
}
|
||||
Instrumentation.checkStartActivityResult(result, null);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBroadcast(Intent intent) {
|
||||
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
|
||||
|
@ -23,6 +23,7 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.IIntentSender;
|
||||
import android.content.IIntentReceiver;
|
||||
import android.content.IntentSender;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.ConfigurationInfo;
|
||||
import android.content.pm.IPackageDataObserver;
|
||||
@ -83,8 +84,8 @@ public interface IActivityManager extends IInterface {
|
||||
Intent intent, String resolvedType, Uri[] grantedUriPermissions,
|
||||
int grantedMode, IBinder resultTo, String resultWho, int requestCode,
|
||||
boolean onlyIfNeeded, boolean debug) throws RemoteException;
|
||||
public int startActivityPendingIntent(IApplicationThread caller,
|
||||
PendingIntent intent, Intent fillInIntent, String resolvedType,
|
||||
public int startActivityIntentSender(IApplicationThread caller,
|
||||
IntentSender intent, Intent fillInIntent, String resolvedType,
|
||||
IBinder resultTo, String resultWho, int requestCode,
|
||||
int flagsMask, int flagsValues) throws RemoteException;
|
||||
public boolean startNextMatchingActivity(IBinder callingActivity,
|
||||
@ -442,5 +443,5 @@ public interface IActivityManager extends IInterface {
|
||||
int CLOSE_SYSTEM_DIALOGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+96;
|
||||
int GET_PROCESS_MEMORY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+97;
|
||||
int KILL_APPLICATION_PROCESS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+98;
|
||||
int START_ACTIVITY_PENDING_INTENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+99;
|
||||
int START_ACTIVITY_INTENT_SENDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+99;
|
||||
}
|
||||
|
@ -558,6 +558,27 @@ public abstract class Context {
|
||||
*/
|
||||
public abstract void startActivity(Intent intent);
|
||||
|
||||
/**
|
||||
* Like {@link #startActivity(Intent)}, but taking a IntentSender
|
||||
* to start. If the IntentSender is for an activity, that activity will be started
|
||||
* as if you had called the regular {@link #startActivityForResult(Intent, int)}
|
||||
* here; otherwise, its associated action will be executed (such as
|
||||
* sending a broadcast) as if you had called
|
||||
* {@link IntentSender#sendIntent IntentSender.sendIntent} on it.
|
||||
*
|
||||
* @param intent The IntentSender to launch.
|
||||
* @param fillInIntent If non-null, this will be provided as the
|
||||
* intent parameter to {@link IntentSender#sendIntent}.
|
||||
* @param flagsMask Intent flags in the original IntentSender that you
|
||||
* would like to change.
|
||||
* @param flagsValues Desired values for any bits set in
|
||||
* <var>flagsMask</var>
|
||||
* @param extraFlags Always set to 0.
|
||||
*/
|
||||
public abstract void startIntentSender(IntentSender intent,
|
||||
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
|
||||
throws IntentSender.SendIntentException;
|
||||
|
||||
/**
|
||||
* Broadcast the given intent to all interested BroadcastReceivers. This
|
||||
* call is asynchronous; it returns immediately, and you will continue
|
||||
|
@ -248,6 +248,14 @@ public class ContextWrapper extends Context {
|
||||
mBase.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startIntentSender(IntentSender intent,
|
||||
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
|
||||
throws IntentSender.SendIntentException {
|
||||
mBase.startIntentSender(intent, fillInIntent, flagsMask,
|
||||
flagsValues, extraFlags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBroadcast(Intent intent) {
|
||||
mBase.sendBroadcast(intent);
|
||||
|
@ -2334,6 +2334,13 @@ public class Intent implements Parcelable {
|
||||
*/
|
||||
public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x10000000;
|
||||
|
||||
/**
|
||||
* @hide Flags that can't be changed with PendingIntent.
|
||||
*/
|
||||
public static final int IMMUTABLE_FLAGS =
|
||||
FLAG_GRANT_READ_URI_PERMISSION
|
||||
| FLAG_GRANT_WRITE_URI_PERMISSION;
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------
|
||||
// toUri() and parseUri() options.
|
||||
|
@ -248,6 +248,11 @@ public class IntentSender implements Parcelable {
|
||||
return b != null ? new IntentSender(b) : null;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public IIntentSender getTarget() {
|
||||
return mTarget;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public IntentSender(IIntentSender target) {
|
||||
mTarget = target;
|
||||
|
@ -17,8 +17,9 @@
|
||||
package android.widget;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.app.PendingIntent.CanceledException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.PorterDuff;
|
||||
@ -137,8 +138,11 @@ public class RemoteViews implements Parcelable, Filter {
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
// TODO: Unregister this handler if PendingIntent.FLAG_ONE_SHOT?
|
||||
pendingIntent.send();
|
||||
} catch (CanceledException e) {
|
||||
v.getContext().startIntentSender(
|
||||
pendingIntent.getIntentSender(), null,
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK,
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK, 0);
|
||||
} catch (IntentSender.SendIntentException e) {
|
||||
throw new ActionException(e.toString());
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ import android.app.AlertDialog;
|
||||
import android.app.ApplicationErrorReport;
|
||||
import android.app.Dialog;
|
||||
import android.app.IActivityController;
|
||||
import android.app.IActivityManager;
|
||||
import android.app.IActivityWatcher;
|
||||
import android.app.IApplicationThread;
|
||||
import android.app.IInstrumentationWatcher;
|
||||
@ -53,6 +52,7 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.IIntentReceiver;
|
||||
import android.content.IIntentSender;
|
||||
import android.content.IntentSender;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.ConfigurationInfo;
|
||||
@ -3613,8 +3613,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
}
|
||||
}
|
||||
|
||||
public int startActivityPendingIntent(IApplicationThread caller,
|
||||
PendingIntent intent, Intent fillInIntent, String resolvedType,
|
||||
public int startActivityIntentSender(IApplicationThread caller,
|
||||
IntentSender intent, Intent fillInIntent, String resolvedType,
|
||||
IBinder resultTo, String resultWho, int requestCode,
|
||||
int flagsMask, int flagsValues) {
|
||||
// Refuse possible leaked file descriptors
|
||||
@ -3628,8 +3628,15 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
}
|
||||
|
||||
PendingIntentRecord pir = (PendingIntentRecord)sender;
|
||||
if (pir.key.type != IActivityManager.INTENT_SENDER_ACTIVITY) {
|
||||
return START_NOT_ACTIVITY;
|
||||
|
||||
synchronized (this) {
|
||||
// If this is coming from the currently resumed activity, it is
|
||||
// effectively saying that app switches are allowed at this point.
|
||||
if (mResumedActivity != null
|
||||
&& mResumedActivity.info.applicationInfo.uid ==
|
||||
Binder.getCallingUid()) {
|
||||
mAppSwitchesAllowedTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return pir.sendInner(0, fillInIntent, resolvedType,
|
||||
|
@ -198,6 +198,7 @@ class PendingIntentRecord extends IIntentSender.Stub {
|
||||
} else {
|
||||
resolvedType = key.requestResolvedType;
|
||||
}
|
||||
flagsMask &= ~Intent.IMMUTABLE_FLAGS;
|
||||
flagsValues &= flagsMask;
|
||||
finalIntent.setFlags((finalIntent.getFlags()&~flagsMask) | flagsValues);
|
||||
|
||||
|
@ -22,6 +22,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.IntentSender;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
@ -227,6 +228,13 @@ public class MockContext extends Context {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startIntentSender(IntentSender intent,
|
||||
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
|
||||
throws IntentSender.SendIntentException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBroadcast(Intent intent) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
@ -27,6 +27,7 @@ import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.IntentSender;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
@ -1123,6 +1124,13 @@ public final class BridgeContext extends Context {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startIntentSender(IntentSender intent,
|
||||
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
|
||||
throws IntentSender.SendIntentException {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInstrumentation(ComponentName arg0, String arg1,
|
||||
Bundle arg2) {
|
||||
|
Reference in New Issue
Block a user