use the same action string for local and broadcast status
No need to have separate action strings, using the LocalBroadcastManager enforces the local-only messaging, and Orbot does not claim the global broadcasts in any kind of receiver.
This commit is contained in:
parent
2f7ddc4423
commit
bf3572eb82
|
@ -109,7 +109,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
* info to this app */
|
* info to this app */
|
||||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
||||||
lbm.registerReceiver(mLocalBroadcastReceiver,
|
lbm.registerReceiver(mLocalBroadcastReceiver,
|
||||||
new IntentFilter(TorServiceConstants.LOCAL_ACTION_STATUS));
|
new IntentFilter(TorServiceConstants.ACTION_STATUS));
|
||||||
lbm.registerReceiver(mLocalBroadcastReceiver,
|
lbm.registerReceiver(mLocalBroadcastReceiver,
|
||||||
new IntentFilter(TorServiceConstants.LOCAL_ACTION_BANDWIDTH));
|
new IntentFilter(TorServiceConstants.LOCAL_ACTION_BANDWIDTH));
|
||||||
lbm.registerReceiver(mLocalBroadcastReceiver,
|
lbm.registerReceiver(mLocalBroadcastReceiver,
|
||||||
|
@ -161,7 +161,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
msg.getData().putLong("writeTotal", written);
|
msg.getData().putLong("writeTotal", written);
|
||||||
mStatusUpdateHandler.sendMessage(msg);
|
mStatusUpdateHandler.sendMessage(msg);
|
||||||
|
|
||||||
} else if (action.equals(TorServiceConstants.LOCAL_ACTION_STATUS)) {
|
} else if (action.equals(TorServiceConstants.ACTION_STATUS)) {
|
||||||
torStatus = intent.getStringExtra(TorServiceConstants.EXTRA_STATUS);
|
torStatus = intent.getStringExtra(TorServiceConstants.EXTRA_STATUS);
|
||||||
updateStatus("");
|
updateStatus("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public interface TorServiceConstants {
|
||||||
|
|
||||||
public final static String ACTION_STATUS = "org.torproject.android.intent.action.STATUS";
|
public final static String ACTION_STATUS = "org.torproject.android.intent.action.STATUS";
|
||||||
public final static String EXTRA_STATUS = "org.torproject.android.intent.extra.STATUS";
|
public final static String EXTRA_STATUS = "org.torproject.android.intent.extra.STATUS";
|
||||||
public final static String LOCAL_ACTION_STATUS = "status";
|
|
||||||
public final static String LOCAL_ACTION_LOG = "log";
|
public final static String LOCAL_ACTION_LOG = "log";
|
||||||
public final static String LOCAL_ACTION_BANDWIDTH = "bandwidth";
|
public final static String LOCAL_ACTION_BANDWIDTH = "bandwidth";
|
||||||
public final static String LOCAL_EXTRA_LOG = "log";
|
public final static String LOCAL_EXTRA_LOG = "log";
|
||||||
|
|
Loading…
Reference in New Issue