define Intent.ACTION_REMOTE_INTENT, which replaces the old GTalk data messaging intent "android.intent.action.GTALK_DATA_MESSAGE_RECEIVED".
The remote intent concept shouldn't be limited to Google or GTalkService. It should be owned by the Android platform.
This commit is contained in:
@@ -31502,6 +31502,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="ACTION_REMOTE_INTENT"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value=""android.intent.action.REMOTE_INTENT""
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="ACTION_RUN"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
@@ -32040,6 +32051,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="EXTRA_REMOTE_INTENT_TOKEN"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value=""android.intent.extra.remote_intent_token""
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="EXTRA_REPLACING"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
|
||||
@@ -1542,6 +1542,21 @@ public class Intent implements Parcelable {
|
||||
public static final String ACTION_REBOOT =
|
||||
"android.intent.action.REBOOT";
|
||||
|
||||
/**
|
||||
* Broadcast Action: a remote intent is to be broadcasted.
|
||||
*
|
||||
* A remote intent is used for remote RPC between devices. The remote intent
|
||||
* is serialized and sent from one device to another device. The receiving
|
||||
* device parses the remote intent and broadcasts it. Note that anyone can
|
||||
* broadcast a remote intent. However, if the intent receiver of the remote intent
|
||||
* does not trust intent broadcasts from arbitrary intent senders, it should require
|
||||
* the sender to hold certain permissions so only trusted sender's broadcast will be
|
||||
* let through.
|
||||
*/
|
||||
public static final String ACTION_REMOTE_INTENT =
|
||||
"android.intent.action.REMOTE_INTENT";
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------
|
||||
// Standard intent categories (see addCategory()).
|
||||
@@ -1782,6 +1797,13 @@ public class Intent implements Parcelable {
|
||||
*/
|
||||
public static final String EXTRA_ALARM_COUNT = "android.intent.extra.ALARM_COUNT";
|
||||
|
||||
/**
|
||||
* Used in the extra field in the remote intent. It's astring token passed with the
|
||||
* remote intent.
|
||||
*/
|
||||
public static final String EXTRA_REMOTE_INTENT_TOKEN =
|
||||
"android.intent.extra.remote_intent_token";
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------
|
||||
// Intent flags (see mFlags variable).
|
||||
|
||||
@@ -1037,7 +1037,7 @@
|
||||
<receiver android:name="com.android.server.MasterClearReceiver"
|
||||
android:permission="android.permission.MASTER_CLEAR" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GTALK_DATA_MESSAGE_RECEIVED" />
|
||||
<action android:name="android.intent.action.REMOTE_INTENT" />
|
||||
<category android:name="android.intent.category.MASTER_CLEAR" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
android:writePermission="android.permission.SUBSCRIBED_FEEDS_WRITE" />
|
||||
<receiver android:name="SubscribedFeedsBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GTALK_DATA_MESSAGE_RECEIVED" />
|
||||
<action android:name="android.intent.action.REMOTE_INTENT" />
|
||||
<category android:name="GSYNC_TICKLE"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
|
||||
@@ -43,8 +43,7 @@ public class SubscribedFeedsIntentService extends IntentService {
|
||||
|
||||
private static final String sSubscribedFeedsPrefs = "subscribedFeeds";
|
||||
|
||||
private static final String GTALK_DATA_MESSAGE_RECEIVED =
|
||||
"android.intent.action.GTALK_DATA_MESSAGE_RECEIVED";
|
||||
private static final String REMOTE_INTENT_ACTION = Intent.ACTION_REMOTE_INTENT;
|
||||
|
||||
private static final String SUBSCRIBED_FEEDS_REFRESH_ACTION =
|
||||
"com.android.subscribedfeeds.action.REFRESH";
|
||||
@@ -56,8 +55,9 @@ public class SubscribedFeedsIntentService extends IntentService {
|
||||
}
|
||||
|
||||
protected void onHandleIntent(Intent intent) {
|
||||
if (GTALK_DATA_MESSAGE_RECEIVED.equals(intent.getAction())) {
|
||||
boolean fromTrustedServer = intent.getBooleanExtra("from_trusted_server", false);
|
||||
if (REMOTE_INTENT_ACTION.equals(intent.getAction())) {
|
||||
boolean fromTrustedServer = intent.getBooleanExtra(
|
||||
"android.intent.extra.from_trusted_server", false);
|
||||
if (fromTrustedServer) {
|
||||
String accountName = intent.getStringExtra("account");
|
||||
String token = intent.getStringExtra("message_token");
|
||||
|
||||
@@ -30,8 +30,8 @@ public class MasterClearReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction().equals("android.intent.action.GTALK_DATA_MESSAGE_RECEIVED")) {
|
||||
if (!intent.getBooleanExtra("from_trusted_server", false)) {
|
||||
if (intent.getAction().equals(Intent.ACTION_REMOTE_INTENT)) {
|
||||
if (!intent.getBooleanExtra("android.intent.extra.from_trusted_server", false)) {
|
||||
Log.w(TAG, "Ignoring master clear request -- not from trusted server.");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user