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 name="id" type="int">
|
||||||
</parameter>
|
</parameter>
|
||||||
</method>
|
</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"
|
<method name="startActivityForResult"
|
||||||
return="void"
|
return="void"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@ -17201,29 +17180,6 @@
|
|||||||
<parameter name="requestCode" type="int">
|
<parameter name="requestCode" type="int">
|
||||||
</parameter>
|
</parameter>
|
||||||
</method>
|
</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"
|
<method name="startActivityFromChild"
|
||||||
return="void"
|
return="void"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@ -17241,31 +17197,6 @@
|
|||||||
<parameter name="requestCode" type="int">
|
<parameter name="requestCode" type="int">
|
||||||
</parameter>
|
</parameter>
|
||||||
</method>
|
</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"
|
<method name="startActivityIfNeeded"
|
||||||
return="boolean"
|
return="boolean"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@ -17281,6 +17212,58 @@
|
|||||||
<parameter name="requestCode" type="int">
|
<parameter name="requestCode" type="int">
|
||||||
</parameter>
|
</parameter>
|
||||||
</method>
|
</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"
|
<method name="startManagingCursor"
|
||||||
return="void"
|
return="void"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@ -31782,6 +31765,29 @@
|
|||||||
<parameter name="arguments" type="android.os.Bundle">
|
<parameter name="arguments" type="android.os.Bundle">
|
||||||
</parameter>
|
</parameter>
|
||||||
</method>
|
</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"
|
<method name="startService"
|
||||||
return="android.content.ComponentName"
|
return="android.content.ComponentName"
|
||||||
abstract="true"
|
abstract="true"
|
||||||
@ -33095,6 +33101,29 @@
|
|||||||
<parameter name="arguments" type="android.os.Bundle">
|
<parameter name="arguments" type="android.os.Bundle">
|
||||||
</parameter>
|
</parameter>
|
||||||
</method>
|
</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"
|
<method name="startService"
|
||||||
return="android.content.ComponentName"
|
return="android.content.ComponentName"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@ -126744,6 +126773,29 @@
|
|||||||
<parameter name="arguments" type="android.os.Bundle">
|
<parameter name="arguments" type="android.os.Bundle">
|
||||||
</parameter>
|
</parameter>
|
||||||
</method>
|
</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"
|
<method name="startService"
|
||||||
return="android.content.ComponentName"
|
return="android.content.ComponentName"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
|
@ -24,6 +24,7 @@ import android.content.ContentResolver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IIntentSender;
|
import android.content.IIntentSender;
|
||||||
|
import android.content.IntentSender;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
@ -2774,48 +2775,50 @@ public class Activity extends ContextThemeWrapper
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Like {@link #startActivityForResult(Intent, int)}, but allowing you
|
* Like {@link #startActivityForResult(Intent, int)}, but allowing you
|
||||||
* to use a PendingIntent to describe the activity to be started. Note
|
* to use a IntentSender to describe the activity to be started. If
|
||||||
* that the given PendingIntent <em>must</em> have been created with
|
* the IntentSender is for an activity, that activity will be started
|
||||||
* {@link PendingIntent#getActivity PendingIntent.getActivity}; all other
|
* as if you had called the regular {@link #startActivityForResult(Intent, int)}
|
||||||
* types will result in an IllegalArgumentException being thrown.
|
* 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
|
* @param requestCode If >= 0, this code will be returned in
|
||||||
* onActivityResult() when the activity exits.
|
* onActivityResult() when the activity exits.
|
||||||
* @param fillInIntent If non-null, this will be provided as the
|
* @param fillInIntent If non-null, this will be provided as the
|
||||||
* intent parameter to {@link PendingIntent#send(Context, int, Intent)
|
* intent parameter to {@link IntentSender#sendIntent}.
|
||||||
* PendingIntent.send(Context, int, Intent)}.
|
* @param flagsMask Intent flags in the original IntentSender that you
|
||||||
* @param flagsMask Intent flags in the original PendingIntent that you
|
|
||||||
* would like to change.
|
* would like to change.
|
||||||
* @param flagsValues Desired values for any bits set in
|
* @param flagsValues Desired values for any bits set in
|
||||||
* <var>flagsMask</var>
|
* <var>flagsMask</var>
|
||||||
|
* @param extraFlags Always set to 0.
|
||||||
*/
|
*/
|
||||||
public void startActivityForResult(PendingIntent intent, int requestCode,
|
public void startIntentSenderForResult(IntentSender intent, int requestCode,
|
||||||
Intent fillInIntent, int flagsMask, int flagsValues)
|
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
|
||||||
throws PendingIntent.CanceledException {
|
throws IntentSender.SendIntentException {
|
||||||
if (mParent == null) {
|
if (mParent == null) {
|
||||||
startActivityForResultInner(intent, requestCode, fillInIntent,
|
startIntentSenderForResultInner(intent, requestCode, fillInIntent,
|
||||||
flagsMask, flagsValues, this);
|
flagsMask, flagsValues, this);
|
||||||
} else {
|
} else {
|
||||||
mParent.startActivityFromChild(this, intent, requestCode,
|
mParent.startIntentSenderFromChild(this, intent, requestCode,
|
||||||
fillInIntent, flagsMask, flagsValues);
|
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)
|
Intent fillInIntent, int flagsMask, int flagsValues, Activity activity)
|
||||||
throws PendingIntent.CanceledException {
|
throws IntentSender.SendIntentException {
|
||||||
try {
|
try {
|
||||||
String resolvedType = null;
|
String resolvedType = null;
|
||||||
if (fillInIntent != null) {
|
if (fillInIntent != null) {
|
||||||
resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver());
|
resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver());
|
||||||
}
|
}
|
||||||
int result = ActivityManagerNative.getDefault()
|
int result = ActivityManagerNative.getDefault()
|
||||||
.startActivityPendingIntent(mMainThread.getApplicationThread(), intent,
|
.startActivityIntentSender(mMainThread.getApplicationThread(), intent,
|
||||||
fillInIntent, resolvedType, mToken, activity.mEmbeddedID,
|
fillInIntent, resolvedType, mToken, activity.mEmbeddedID,
|
||||||
requestCode, flagsMask, flagsValues);
|
requestCode, flagsMask, flagsValues);
|
||||||
if (result == IActivityManager.START_CANCELED) {
|
if (result == IActivityManager.START_CANCELED) {
|
||||||
throw new PendingIntent.CanceledException();
|
throw new IntentSender.SendIntentException();
|
||||||
}
|
}
|
||||||
Instrumentation.checkStartActivityResult(result, null);
|
Instrumentation.checkStartActivityResult(result, null);
|
||||||
} catch (RemoteException e) {
|
} 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
|
* to start; see
|
||||||
* {@link #startActivityForResult(PendingIntent, int, Intent, int, int)}
|
* {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int)}
|
||||||
* for more information.
|
* 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
|
* @param fillInIntent If non-null, this will be provided as the
|
||||||
* intent parameter to {@link PendingIntent#send(Context, int, Intent)
|
* intent parameter to {@link IntentSender#sendIntent}.
|
||||||
* PendingIntent.send(Context, int, Intent)}.
|
* @param flagsMask Intent flags in the original IntentSender that you
|
||||||
* @param flagsMask Intent flags in the original PendingIntent that you
|
|
||||||
* would like to change.
|
* would like to change.
|
||||||
* @param flagsValues Desired values for any bits set in
|
* @param flagsValues Desired values for any bits set in
|
||||||
* <var>flagsMask</var>
|
* <var>flagsMask</var>
|
||||||
|
* @param extraFlags Always set to 0.
|
||||||
*/
|
*/
|
||||||
public void startActivity(PendingIntent intent,
|
public void startIntentSender(IntentSender intent,
|
||||||
Intent fillInIntent, int flagsMask, int flagsValues)
|
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
|
||||||
throws PendingIntent.CanceledException {
|
throws IntentSender.SendIntentException {
|
||||||
startActivityForResult(intent, -1, fillInIntent, flagsMask, flagsValues);
|
startIntentSenderForResult(intent, -1, fillInIntent, flagsMask,
|
||||||
|
flagsValues, extraFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2998,14 +3002,15 @@ public class Activity extends ContextThemeWrapper
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Like {@link #startActivityFromChild(Activity, Intent, int)}, but
|
* Like {@link #startActivityFromChild(Activity, Intent, int)}, but
|
||||||
* taking a PendingIntent; see
|
* taking a IntentSender; see
|
||||||
* {@link #startActivityForResult(PendingIntent, int, Intent, int, int)}
|
* {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int)}
|
||||||
* for more information.
|
* for more information.
|
||||||
*/
|
*/
|
||||||
public void startActivityFromChild(Activity child, PendingIntent intent,
|
public void startIntentSenderFromChild(Activity child, IntentSender intent,
|
||||||
int requestCode, Intent fillInIntent, int flagsMask, int flagsValues)
|
int requestCode, Intent fillInIntent, int flagsMask, int flagsValues,
|
||||||
throws PendingIntent.CanceledException {
|
int extraFlags)
|
||||||
startActivityForResultInner(intent, requestCode, fillInIntent,
|
throws IntentSender.SendIntentException {
|
||||||
|
startIntentSenderForResultInner(intent, requestCode, fillInIntent,
|
||||||
flagsMask, flagsValues, child);
|
flagsMask, flagsValues, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.IIntentSender;
|
import android.content.IIntentSender;
|
||||||
import android.content.IIntentReceiver;
|
import android.content.IIntentReceiver;
|
||||||
|
import android.content.IntentSender;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.ConfigurationInfo;
|
import android.content.pm.ConfigurationInfo;
|
||||||
import android.content.pm.IPackageDataObserver;
|
import android.content.pm.IPackageDataObserver;
|
||||||
@ -145,12 +146,12 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case START_ACTIVITY_PENDING_INTENT_TRANSACTION:
|
case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
|
||||||
{
|
{
|
||||||
data.enforceInterface(IActivityManager.descriptor);
|
data.enforceInterface(IActivityManager.descriptor);
|
||||||
IBinder b = data.readStrongBinder();
|
IBinder b = data.readStrongBinder();
|
||||||
IApplicationThread app = ApplicationThreadNative.asInterface(b);
|
IApplicationThread app = ApplicationThreadNative.asInterface(b);
|
||||||
PendingIntent intent = PendingIntent.CREATOR.createFromParcel(data);
|
IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
|
||||||
Intent fillInIntent = null;
|
Intent fillInIntent = null;
|
||||||
if (data.readInt() != 0) {
|
if (data.readInt() != 0) {
|
||||||
fillInIntent = Intent.CREATOR.createFromParcel(data);
|
fillInIntent = Intent.CREATOR.createFromParcel(data);
|
||||||
@ -161,7 +162,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
|
|||||||
int requestCode = data.readInt();
|
int requestCode = data.readInt();
|
||||||
int flagsMask = data.readInt();
|
int flagsMask = data.readInt();
|
||||||
int flagsValues = data.readInt();
|
int flagsValues = data.readInt();
|
||||||
int result = startActivityPendingIntent(app, intent,
|
int result = startActivityIntentSender(app, intent,
|
||||||
fillInIntent, resolvedType, resultTo, resultWho,
|
fillInIntent, resolvedType, resultTo, resultWho,
|
||||||
requestCode, flagsMask, flagsValues);
|
requestCode, flagsMask, flagsValues);
|
||||||
reply.writeNoException();
|
reply.writeNoException();
|
||||||
@ -1202,8 +1203,8 @@ class ActivityManagerProxy implements IActivityManager
|
|||||||
data.recycle();
|
data.recycle();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public int startActivityPendingIntent(IApplicationThread caller,
|
public int startActivityIntentSender(IApplicationThread caller,
|
||||||
PendingIntent intent, Intent fillInIntent, String resolvedType,
|
IntentSender intent, Intent fillInIntent, String resolvedType,
|
||||||
IBinder resultTo, String resultWho, int requestCode,
|
IBinder resultTo, String resultWho, int requestCode,
|
||||||
int flagsMask, int flagsValues) throws RemoteException {
|
int flagsMask, int flagsValues) throws RemoteException {
|
||||||
Parcel data = Parcel.obtain();
|
Parcel data = Parcel.obtain();
|
||||||
@ -1223,7 +1224,7 @@ class ActivityManagerProxy implements IActivityManager
|
|||||||
data.writeInt(requestCode);
|
data.writeInt(requestCode);
|
||||||
data.writeInt(flagsMask);
|
data.writeInt(flagsMask);
|
||||||
data.writeInt(flagsValues);
|
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();
|
reply.readException();
|
||||||
int result = reply.readInt();
|
int result = reply.readInt();
|
||||||
reply.recycle();
|
reply.recycle();
|
||||||
|
@ -560,6 +560,27 @@ class ApplicationContext extends Context {
|
|||||||
getOuterContext(), mMainThread.getApplicationThread(), null, null, intent, -1);
|
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
|
@Override
|
||||||
public void sendBroadcast(Intent intent) {
|
public void sendBroadcast(Intent intent) {
|
||||||
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
|
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
|
||||||
|
@ -23,6 +23,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.IIntentSender;
|
import android.content.IIntentSender;
|
||||||
import android.content.IIntentReceiver;
|
import android.content.IIntentReceiver;
|
||||||
|
import android.content.IntentSender;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.ConfigurationInfo;
|
import android.content.pm.ConfigurationInfo;
|
||||||
import android.content.pm.IPackageDataObserver;
|
import android.content.pm.IPackageDataObserver;
|
||||||
@ -83,8 +84,8 @@ public interface IActivityManager extends IInterface {
|
|||||||
Intent intent, String resolvedType, Uri[] grantedUriPermissions,
|
Intent intent, String resolvedType, Uri[] grantedUriPermissions,
|
||||||
int grantedMode, IBinder resultTo, String resultWho, int requestCode,
|
int grantedMode, IBinder resultTo, String resultWho, int requestCode,
|
||||||
boolean onlyIfNeeded, boolean debug) throws RemoteException;
|
boolean onlyIfNeeded, boolean debug) throws RemoteException;
|
||||||
public int startActivityPendingIntent(IApplicationThread caller,
|
public int startActivityIntentSender(IApplicationThread caller,
|
||||||
PendingIntent intent, Intent fillInIntent, String resolvedType,
|
IntentSender intent, Intent fillInIntent, String resolvedType,
|
||||||
IBinder resultTo, String resultWho, int requestCode,
|
IBinder resultTo, String resultWho, int requestCode,
|
||||||
int flagsMask, int flagsValues) throws RemoteException;
|
int flagsMask, int flagsValues) throws RemoteException;
|
||||||
public boolean startNextMatchingActivity(IBinder callingActivity,
|
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 CLOSE_SYSTEM_DIALOGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+96;
|
||||||
int GET_PROCESS_MEMORY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+97;
|
int GET_PROCESS_MEMORY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+97;
|
||||||
int KILL_APPLICATION_PROCESS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+98;
|
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);
|
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
|
* Broadcast the given intent to all interested BroadcastReceivers. This
|
||||||
* call is asynchronous; it returns immediately, and you will continue
|
* call is asynchronous; it returns immediately, and you will continue
|
||||||
|
@ -248,6 +248,14 @@ public class ContextWrapper extends Context {
|
|||||||
mBase.startActivity(intent);
|
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
|
@Override
|
||||||
public void sendBroadcast(Intent intent) {
|
public void sendBroadcast(Intent intent) {
|
||||||
mBase.sendBroadcast(intent);
|
mBase.sendBroadcast(intent);
|
||||||
|
@ -2334,6 +2334,13 @@ public class Intent implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x10000000;
|
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.
|
// toUri() and parseUri() options.
|
||||||
|
@ -248,6 +248,11 @@ public class IntentSender implements Parcelable {
|
|||||||
return b != null ? new IntentSender(b) : null;
|
return b != null ? new IntentSender(b) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public IIntentSender getTarget() {
|
||||||
|
return mTarget;
|
||||||
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public IntentSender(IIntentSender target) {
|
public IntentSender(IIntentSender target) {
|
||||||
mTarget = target;
|
mTarget = target;
|
||||||
|
@ -17,8 +17,9 @@
|
|||||||
package android.widget;
|
package android.widget;
|
||||||
|
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.app.PendingIntent.CanceledException;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentSender;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
@ -137,8 +138,11 @@ public class RemoteViews implements Parcelable, Filter {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
try {
|
try {
|
||||||
// TODO: Unregister this handler if PendingIntent.FLAG_ONE_SHOT?
|
// TODO: Unregister this handler if PendingIntent.FLAG_ONE_SHOT?
|
||||||
pendingIntent.send();
|
v.getContext().startIntentSender(
|
||||||
} catch (CanceledException e) {
|
pendingIntent.getIntentSender(), null,
|
||||||
|
Intent.FLAG_ACTIVITY_NEW_TASK,
|
||||||
|
Intent.FLAG_ACTIVITY_NEW_TASK, 0);
|
||||||
|
} catch (IntentSender.SendIntentException e) {
|
||||||
throw new ActionException(e.toString());
|
throw new ActionException(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ import android.app.AlertDialog;
|
|||||||
import android.app.ApplicationErrorReport;
|
import android.app.ApplicationErrorReport;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.IActivityController;
|
import android.app.IActivityController;
|
||||||
import android.app.IActivityManager;
|
|
||||||
import android.app.IActivityWatcher;
|
import android.app.IActivityWatcher;
|
||||||
import android.app.IApplicationThread;
|
import android.app.IApplicationThread;
|
||||||
import android.app.IInstrumentationWatcher;
|
import android.app.IInstrumentationWatcher;
|
||||||
@ -53,6 +52,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.IIntentReceiver;
|
import android.content.IIntentReceiver;
|
||||||
import android.content.IIntentSender;
|
import android.content.IIntentSender;
|
||||||
|
import android.content.IntentSender;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.ConfigurationInfo;
|
import android.content.pm.ConfigurationInfo;
|
||||||
@ -3613,8 +3613,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int startActivityPendingIntent(IApplicationThread caller,
|
public int startActivityIntentSender(IApplicationThread caller,
|
||||||
PendingIntent intent, Intent fillInIntent, String resolvedType,
|
IntentSender intent, Intent fillInIntent, String resolvedType,
|
||||||
IBinder resultTo, String resultWho, int requestCode,
|
IBinder resultTo, String resultWho, int requestCode,
|
||||||
int flagsMask, int flagsValues) {
|
int flagsMask, int flagsValues) {
|
||||||
// Refuse possible leaked file descriptors
|
// Refuse possible leaked file descriptors
|
||||||
@ -3628,8 +3628,15 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
PendingIntentRecord pir = (PendingIntentRecord)sender;
|
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,
|
return pir.sendInner(0, fillInIntent, resolvedType,
|
||||||
|
@ -198,6 +198,7 @@ class PendingIntentRecord extends IIntentSender.Stub {
|
|||||||
} else {
|
} else {
|
||||||
resolvedType = key.requestResolvedType;
|
resolvedType = key.requestResolvedType;
|
||||||
}
|
}
|
||||||
|
flagsMask &= ~Intent.IMMUTABLE_FLAGS;
|
||||||
flagsValues &= flagsMask;
|
flagsValues &= flagsMask;
|
||||||
finalIntent.setFlags((finalIntent.getFlags()&~flagsMask) | flagsValues);
|
finalIntent.setFlags((finalIntent.getFlags()&~flagsMask) | flagsValues);
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.IntentSender;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
@ -227,6 +228,13 @@ public class MockContext extends Context {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startIntentSender(IntentSender intent,
|
||||||
|
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
|
||||||
|
throws IntentSender.SendIntentException {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendBroadcast(Intent intent) {
|
public void sendBroadcast(Intent intent) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -27,6 +27,7 @@ import android.content.ContentResolver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.content.IntentSender;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ApplicationInfo;
|
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
|
@Override
|
||||||
public boolean startInstrumentation(ComponentName arg0, String arg1,
|
public boolean startInstrumentation(ComponentName arg0, String arg1,
|
||||||
Bundle arg2) {
|
Bundle arg2) {
|
||||||
|
Reference in New Issue
Block a user