Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Tor Android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leap
Android Libs
Tor Android
Commits
f44b1d15
Unverified
Commit
f44b1d15
authored
3 years ago
by
Hans-Christoph Steiner
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #71 from akwizgran/attach-package-name-to-status-broadcast
Attach package name to status broadcasts.
parents
b4e0d59f
b1b7eef8
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tor-android-binary/src/main/java/org/torproject/jni/TorService.java
+9
-0
9 additions, 0 deletions
...d-binary/src/main/java/org/torproject/jni/TorService.java
with
9 additions
and
0 deletions
tor-android-binary/src/main/java/org/torproject/jni/TorService.java
+
9
−
0
View file @
f44b1d15
...
@@ -83,6 +83,13 @@ public class TorService extends Service {
...
@@ -83,6 +83,13 @@ public class TorService extends Service {
*/
*/
public
final
static
String
EXTRA_PACKAGE_NAME
=
"org.torproject.android.intent.extra.PACKAGE_NAME"
;
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
* All tor-related services and daemons are stopped
*/
*/
...
@@ -447,6 +454,7 @@ public class TorService extends Service {
...
@@ -447,6 +454,7 @@ public class TorService extends Service {
*/
*/
static
void
sendBroadcastStatusIntent
(
Context
context
)
{
static
void
sendBroadcastStatusIntent
(
Context
context
)
{
Intent
intent
=
getBroadcastIntent
(
ACTION_STATUS
,
currentStatus
);
Intent
intent
=
getBroadcastIntent
(
ACTION_STATUS
,
currentStatus
);
intent
.
putExtra
(
EXTRA_SERVICE_PACKAGE_NAME
,
context
.
getPackageName
());
context
.
sendBroadcast
(
intent
);
context
.
sendBroadcast
(
intent
);
}
}
...
@@ -457,6 +465,7 @@ public class TorService extends Service {
...
@@ -457,6 +465,7 @@ public class TorService extends Service {
static
void
broadcastStatus
(
Context
context
,
String
currentStatus
)
{
static
void
broadcastStatus
(
Context
context
,
String
currentStatus
)
{
TorService
.
currentStatus
=
currentStatus
;
TorService
.
currentStatus
=
currentStatus
;
Intent
intent
=
getBroadcastIntent
(
ACTION_STATUS
,
currentStatus
);
Intent
intent
=
getBroadcastIntent
(
ACTION_STATUS
,
currentStatus
);
intent
.
putExtra
(
EXTRA_SERVICE_PACKAGE_NAME
,
context
.
getPackageName
());
LocalBroadcastManager
.
getInstance
(
context
).
sendBroadcast
(
intent
);
LocalBroadcastManager
.
getInstance
(
context
).
sendBroadcast
(
intent
);
context
.
sendBroadcast
(
intent
);
context
.
sendBroadcast
(
intent
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment