Adds checks in Home's broadcast receivers to handle only known actions.

Previously, Home would handle any action sent directly to its broadcast
receivers as if it was an UNINSTALL/INSTALL_SHORTCUT action.
This commit is contained in:
Romain Guy 2009-06-17 10:20:34 -07:00
parent ded9ec91f6
commit 51ed5b9bc0
2 changed files with 14 additions and 0 deletions

View File

@ -24,9 +24,16 @@ import android.database.Cursor;
import android.widget.Toast;
public class InstallShortcutReceiver extends BroadcastReceiver {
private static final String ACTION_INSTALL_SHORTCUT =
"com.android.launcher.action.INSTALL_SHORTCUT";
private final int[] mCoordinates = new int[2];
public void onReceive(Context context, Intent data) {
if (!ACTION_INSTALL_SHORTCUT.equals(data.getAction())) {
return;
}
int screen = Launcher.getScreen();
if (!installShortcut(context, data, screen)) {

View File

@ -27,7 +27,14 @@ import android.widget.Toast;
import java.net.URISyntaxException;
public class UninstallShortcutReceiver extends BroadcastReceiver {
private static final String ACTION_UNINSTALL_SHORTCUT =
"com.android.launcher.action.UNINSTALL_SHORTCUT";
public void onReceive(Context context, Intent data) {
if (!ACTION_UNINSTALL_SHORTCUT.equals(data.getAction())) {
return;
}
Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
boolean duplicate = data.getBooleanExtra(Launcher.EXTRA_SHORTCUT_DUPLICATE, true);