Skip to content

Commit

Permalink
[Exposed-core] crash handler for virtual process.
Browse files Browse the repository at this point in the history
  • Loading branch information
维术 committed Jan 25, 2018
1 parent 82f43ed commit b4ff9bc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions VirtualApp/app/src/main/java/io/virtualapp/VApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Looper;
import android.support.multidex.MultiDexApplication;
import android.util.Log;

import com.flurry.android.FlurryAgent;
import com.lody.virtual.client.core.CrashHandler;
import com.lody.virtual.client.core.InstallStrategy;
import com.lody.virtual.client.core.VirtualCore;
import com.lody.virtual.client.stub.VASettings;
Expand Down Expand Up @@ -125,6 +127,17 @@ public void onVirtualProcess() {
virtualCore.setPhoneInfoDelegate(new MyPhoneInfoDelegate());
//fake task description's icon and title
virtualCore.setTaskDescriptionDelegate(new MyTaskDescriptionDelegate());
virtualCore.setCrashHandler(new CrashHandler() {
@Override
public void handleUncaughtException(Thread t, Throwable e) {
Log.i(TAG, "uncaught :" + t, e);
if (t == Looper.getMainLooper().getThread()) {
System.exit(0);
} else {
Log.e(TAG, "ignore uncaught exception of thread: " + t);
}
}
});
// ensure the logcat service alive when every virtual process start.
LogcatService.start(VApp.this, VEnvironment.getDataUserPackageDirectory(0, XPOSED_INSTALLER_PACKAGE));
}
Expand Down

0 comments on commit b4ff9bc

Please sign in to comment.