From 20d0a396a0a9b7ffc458169c4fae4c5eea0836b1 Mon Sep 17 00:00:00 2001 From: costin Date: Tue, 25 May 2010 21:52:22 +0000 Subject: [PATCH] Set the package name of the registration service, to be extra sure it is not routed to a bad application ( which wouldn't be able to to anything bad, since receiving is protected by permissions, but may disrupt registration ) --- android/c2dm/com/google/android/c2dm/C2DMessaging.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/c2dm/com/google/android/c2dm/C2DMessaging.java b/android/c2dm/com/google/android/c2dm/C2DMessaging.java index 8ba299e..6702078 100644 --- a/android/c2dm/com/google/android/c2dm/C2DMessaging.java +++ b/android/c2dm/com/google/android/c2dm/C2DMessaging.java @@ -34,6 +34,7 @@ public class C2DMessaging { public static final String REQUEST_REGISTRATION_INTENT = "com.google.android.c2dm.intent.REGISTER"; public static final String LAST_REGISTRATION_CHANGE = "last_registration_change"; public static final String BACKOFF = "backoff"; + public static final String GSF_PACKAGE = "com.google.android.gsf"; // package @@ -47,6 +48,7 @@ public class C2DMessaging { public static void register(Context context, String senderId) { Intent registrationIntent = new Intent(REQUEST_REGISTRATION_INTENT); + registrationIntent.setPackage(GSF_PACKAGE); registrationIntent.putExtra(EXTRA_APPLICATION_PENDING_INTENT, PendingIntent.getBroadcast(context, 0, new Intent(), 0)); registrationIntent.putExtra(EXTRA_SENDER, senderId); @@ -59,6 +61,7 @@ public class C2DMessaging { */ public static void unregister(Context context) { Intent regIntent = new Intent(REQUEST_UNREGISTRATION_INTENT); + regIntent.setPackage(GSF_PACKAGE); regIntent.putExtra(EXTRA_APPLICATION_PENDING_INTENT, PendingIntent.getBroadcast(context, 0, new Intent(), 0)); context.startService(regIntent);