Broadcast intent

pull/153/head
M66B 7 years ago
parent 6f1e773249
commit 78d61a8053

@ -21,8 +21,6 @@ package eu.faircode.email;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri; import android.net.Uri;
import org.json.JSONException; import org.json.JSONException;
@ -43,7 +41,6 @@ import javax.mail.MessagingException;
import javax.mail.internet.InternetAddress; import javax.mail.internet.InternetAddress;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.room.Entity; import androidx.room.Entity;
import androidx.room.ForeignKey; import androidx.room.ForeignKey;
import androidx.room.Index; import androidx.room.Index;
@ -282,20 +279,13 @@ public class EntityRule {
automation.putExtra(EXTRA_SENDER, sender); automation.putExtra(EXTRA_SENDER, sender);
automation.putExtra(EXTRA_SUBJECT, message.subject); automation.putExtra(EXTRA_SUBJECT, message.subject);
PackageManager pm = context.getPackageManager();
ResolveInfo ri = pm.resolveService(automation, 0);
if (ri == null)
Log.w("Unable to resolve " + automation);
else {
automation.setPackage(ri.serviceInfo.packageName);
Log.i("Sending " + automation); Log.i("Sending " + automation);
try { try {
ContextCompat.startForegroundService(context, automation); context.sendBroadcast(automation);
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
} }
} }
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {

Loading…
Cancel
Save