Merge change 4479 into donut
* changes: Adds checks in Home's broadcast receivers to handle only known actions.
This commit is contained in:
commit
529100b752
|
@ -24,9 +24,16 @@ import android.database.Cursor;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class InstallShortcutReceiver extends BroadcastReceiver {
|
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];
|
private final int[] mCoordinates = new int[2];
|
||||||
|
|
||||||
public void onReceive(Context context, Intent data) {
|
public void onReceive(Context context, Intent data) {
|
||||||
|
if (!ACTION_INSTALL_SHORTCUT.equals(data.getAction())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int screen = Launcher.getScreen();
|
int screen = Launcher.getScreen();
|
||||||
|
|
||||||
if (!installShortcut(context, data, screen)) {
|
if (!installShortcut(context, data, screen)) {
|
||||||
|
|
|
@ -27,7 +27,14 @@ import android.widget.Toast;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
public class UninstallShortcutReceiver extends BroadcastReceiver {
|
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) {
|
public void onReceive(Context context, Intent data) {
|
||||||
|
if (!ACTION_UNINSTALL_SHORTCUT.equals(data.getAction())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
|
Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
|
||||||
String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
|
String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
|
||||||
boolean duplicate = data.getBooleanExtra(Launcher.EXTRA_SHORTCUT_DUPLICATE, true);
|
boolean duplicate = data.getBooleanExtra(Launcher.EXTRA_SHORTCUT_DUPLICATE, true);
|
||||||
|
|
Loading…
Reference in New Issue