Skip to content
Snippets Groups Projects
Commit b1b7eef8 authored by akwizgran's avatar akwizgran
Browse files

Add a new key rather that reusing the EXTRA_PACKAGE_NAME key.

parent 2894edd9
Branches
Tags
No related merge requests found
......@@ -83,6 +83,13 @@ public class TorService extends Service {
*/
public final static String EXTRA_PACKAGE_NAME = "org.torproject.android.intent.extra.PACKAGE_NAME";
/**
* The {@link String} {@code packageName} of the app to which this {@code TorService} belongs.
* This allows broadcast receivers to distinguish between broadcasts from different apps that
* use {@code TorService}.
*/
public final static String EXTRA_SERVICE_PACKAGE_NAME = "org.torproject.android.intent.extra.SERVICE_PACKAGE_NAME";
/**
* All tor-related services and daemons are stopped
*/
......@@ -447,6 +454,7 @@ public class TorService extends Service {
*/
static void sendBroadcastStatusIntent(Context context) {
Intent intent = getBroadcastIntent(ACTION_STATUS, currentStatus);
intent.putExtra(EXTRA_SERVICE_PACKAGE_NAME, context.getPackageName());
context.sendBroadcast(intent);
}
......@@ -457,7 +465,7 @@ public class TorService extends Service {
static void broadcastStatus(Context context, String currentStatus) {
TorService.currentStatus = currentStatus;
Intent intent = getBroadcastIntent(ACTION_STATUS, currentStatus);
intent.putExtra(EXTRA_PACKAGE_NAME, context.getPackageName());
intent.putExtra(EXTRA_SERVICE_PACKAGE_NAME, context.getPackageName());
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
context.sendBroadcast(intent);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment