Skip to content

Commit 2f73009

Browse files
committed
Hook to be informed of tor_raw_abort_ in TorService, before process crashes.
1 parent bdb71a1 commit 2f73009

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

tor-android-binary/src/main/java/org/torproject/jni/TorService.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,15 @@ private static File getAppTorServiceDataDir(Context context) {
230230
private native int runMain();
231231

232232

233+
public native static boolean fatal();
234+
public static final String STATUS_ABORT = "ABORTING";
235+
private static Context ctx;
236+
public static void onTorRawAbort() {
237+
Log.wtf("OrbotAbortReport", "made it to java abort");
238+
broadcastStatus(ctx, STATUS_ABORT);
239+
}
240+
241+
233242
public class LocalBinder extends Binder {
234243
public TorService getService() {
235244
return TorService.this;
@@ -248,6 +257,7 @@ public IBinder onBind(Intent intent) {
248257
public void onCreate() {
249258
super.onCreate();
250259
broadcastStatus(this, STATUS_STARTING);
260+
ctx = this;
251261
startTorServiceThread();
252262
}
253263

@@ -443,6 +453,7 @@ private void startTorServiceThread() {
443453
@Override
444454
public void onDestroy() {
445455
super.onDestroy();
456+
ctx = null;
446457
if (torControlConnection != null) {
447458
torControlConnection.removeRawEventListener(startedEventListener);
448459
}

0 commit comments

Comments
 (0)