Skip to content

Commit

Permalink
FIX: Build for F-droid.
Browse files Browse the repository at this point in the history
  • Loading branch information
tiann committed Feb 25, 2019
1 parent 60acd2b commit 9685d67
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 93 deletions.
2 changes: 1 addition & 1 deletion VirtualApp/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ dependencies {
implementation 'org.jdeferred:jdeferred-android-aar:1.2.4'
// ThirdParty
implementation 'com.jonathanfinerty.once:once:1.0.3'
fdroidImplementation('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') {
aospImplementation('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') {
transitive = true
}
implementation 'com.kyleduo.switchbutton:library:1.4.6'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
package io.virtualapp.delegate;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.os.Looper;
import android.util.Log;

import com.crashlytics.android.Crashlytics;
import com.lody.virtual.client.VClientImpl;
import com.lody.virtual.client.core.CrashHandler;
import com.lody.virtual.client.core.VirtualCore;
import com.lody.virtual.os.VUserHandle;
import com.lody.virtual.remote.InstalledAppInfo;

import java.util.concurrent.TimeUnit;

/**
* author: weishu on 18/3/10.
* @author weishu
* @date 2019/2/25.
*/
public class MyCrashHandler implements CrashHandler {

private static final String TAG = "XApp";
public class MyCrashHandler extends BaseCrashHandler {
private static final String CRASH_SP = "vxp_crash";
private static final String KEY_LAST_CRASH_TIME = "last_crash_time";
private static final String KEY_LAST_CRASH_TYPE = "last_crash_type";

@SuppressLint("ApplySharedPref")
@Override
public void handleUncaughtException(Thread t, Throwable e) {
SharedPreferences sp = VirtualCore.get().getContext().getSharedPreferences(CRASH_SP, Context.MODE_MULTI_PROCESS);
Expand Down Expand Up @@ -77,10 +72,6 @@ public void handleUncaughtException(Thread t, Throwable e) {
// must commit.
sp.edit().putLong(KEY_LAST_CRASH_TIME, now).putString(KEY_LAST_CRASH_TYPE, exceptionType).commit();

if (t == Looper.getMainLooper().getThread()) {
System.exit(0);
} else {
Log.e(TAG, "ignore uncaught exception of sub thread: " + t);
}
super.handleUncaughtException(t, e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ public void onVirtualProcess() {

// For Crash statics
Fabric.with(application, new Crashlytics());
virtualCore.setCrashHandler(new MyCrashHandler());

super.onVirtualProcess();

// Override
virtualCore.setCrashHandler(new MyCrashHandler());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.virtualapp.delegate;

import android.annotation.SuppressLint;
import android.os.Looper;
import android.util.Log;

import com.lody.virtual.client.core.CrashHandler;

/**
* author: weishu on 18/3/10.
*/
public class BaseCrashHandler implements CrashHandler {

protected static final String TAG = "XApp";

@SuppressLint("ApplySharedPref")
@Override
public void handleUncaughtException(Thread t, Throwable e) {


if (t == Looper.getMainLooper().getThread()) {
System.exit(0);
} else {
Log.e(TAG, "ignore uncaught exception of sub thread: " + t);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public void onMainProcess() {
@Override
public void onVirtualProcess() {

virtualCore.setCrashHandler(new BaseCrashHandler());

//listener components
virtualCore.setComponentDelegate(new MyComponentDelegate());
//fake phone imei,macAddress,BluetoothAddress
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import io.virtualapp.VCommends;
import io.virtualapp.abs.ui.VActivity;
import io.virtualapp.abs.ui.VUiKit;
import io.virtualapp.home.FlurryROMCollector;
import io.virtualapp.home.NewHomeActivity;
import jonathanfinerty.once.Once;

Expand All @@ -25,10 +24,6 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
VUiKit.defer().when(() -> {
if (!Once.beenDone("collect_fabric")) {
FlurryROMCollector.startCollect();
Once.markDone("collect_fabric");
}
long time = System.currentTimeMillis();
doActionInThread();
time = System.currentTimeMillis() - time;
Expand Down

0 comments on commit 9685d67

Please sign in to comment.