Panagiotis Triantafyllou

crash fixes

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc30'
PUBLISH_VERSION = '4.5.4.6rc31'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......@@ -32,6 +32,12 @@ android {
abortOnError false
}
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
buildTypes {
release {
minifyEnabled false
......@@ -85,8 +91,9 @@ dependencies {
implementation 'com.huawei.hms:ads-identifier:3.4.56.300'
//------------------------------ SQLCipher -----------------------------//
api "net.zetetic:android-database-sqlcipher:4.5.0"
api "net.zetetic:android-database-sqlcipher:4.5.2"
api "androidx.sqlite:sqlite:2.2.0"
api 'com.getkeepsafe.relinker:relinker:1.4.4'
//------------------------------ Calligraphy -----------------------------//
api 'io.github.inflationx:calligraphy3:3.1.1'
......
......@@ -13,7 +13,7 @@
android:name="android.permission.REQUEST_INSTALL_PACKAGES"
tools:node="remove" />
<application>
<application android:largeHeap="true">
<!-- <meta-data-->
<!-- android:name="com.google.android.geo.API_KEY"-->
<!-- android:value="@string/google_maps_key" />-->
......@@ -207,14 +207,14 @@
android:name="ly.warp.sdk.receivers.LocationChangedReceiver"
android:exported="false" />
<receiver
android:name="ly.warp.sdk.receivers.ConnectivityChangedReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<!-- <receiver-->
<!-- android:name="ly.warp.sdk.receivers.ConnectivityChangedReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />-->
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<receiver
android:name="ly.warp.sdk.receivers.BluetoothStateChangeReceiver"
......
......@@ -129,7 +129,9 @@ public enum Warply {
@Override
public void onInit(Context context) {
if (context != null) {
INSTANCE.mContext = new WeakReference<>(context.getApplicationContext());
}
initInternal(context);
}
});
......@@ -140,6 +142,7 @@ public enum Warply {
INSTANCE.check();
return;
}
if (INSTANCE.mRequestQueue == null)
INSTANCE.mRequestQueue = Volley.newRequestQueue(context);
INSTANCE.mContext = new WeakReference<>(context.getApplicationContext());
WarpConstants.DEBUG = WarplyProperty.isDebugMode(INSTANCE.mContext.get());
......
......@@ -11,6 +11,8 @@ import android.util.Log;
import androidx.annotation.Nullable;
import com.getkeepsafe.relinker.ReLinker;
import net.sqlcipher.DatabaseUtils;
import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteOpenHelper;
......@@ -35,7 +37,7 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
}
private static final String DB_NAME = "warply.db";
private static final int DB_VERSION = 7;
private static final int DB_VERSION = 8;
private static final String KEY_CIPHER = "tn#mpOl3v3Dy1pr@W";
//------------------------------ Fields -----------------------------//
......@@ -110,7 +112,12 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
public static synchronized WarplyDBHelper getInstance(Context context) {
if (mDBHelperInstance == null) {
SQLiteDatabase.loadLibs(context);
// SQLiteDatabase.loadLibs(context); //old implementation
SQLiteDatabase.loadLibs(context, libraries -> {
for (String library : libraries) {
ReLinker.loadLibrary(context, library);
}
});
mDBHelperInstance = new WarplyDBHelper(context);
}
return mDBHelperInstance;
......
......@@ -113,7 +113,7 @@ public class DiskBasedCache implements Cache {
try {
cis = new CountingInputStream(new FileInputStream(file));
CacheHeader.readHeader(cis); // eat header
byte[] data = streamToBytes(cis, (int) (file.length() - cis.bytesRead));
byte[] data = streamToBytes(cis, (int) Math.abs((int)(file.length() - cis.bytesRead)));
return entry.toCacheEntry(data);
} catch (IOException e) {
VolleyLog.d("%s: %s", file.getAbsolutePath(), e.toString());
......
......@@ -256,7 +256,7 @@ public class UpdateUserLocationService extends Worker {
&& backgroundProvider == WarpConstants.LocationModes.OFF.ordinal()) {
WarplyLocationManager.stopReportingLocation(context);
WarplyLocationManager.disableConnectivityChangedReceiver(context);
// WarplyLocationManager.disableConnectivityChangedReceiver(context);
} else if (foregroundProvider == WarpConstants.LocationModes.OFF.ordinal()) {
/*
......
......@@ -172,6 +172,7 @@ public class WarplyInitializer extends Thread /*implements ActivityCompat.OnRequ
}
public synchronized void initWithPermissions(Activity activity) {
mContext = activity;
// this.mPermissionsActivity = activity;
//
// int result;
......
......@@ -74,7 +74,7 @@ public class WarplySessionManager {
*/
public static void onStartActivity(Activity activity) {
synchronized (_activities) {
Warply.getInitializer(activity).init();
// Warply.getInitializer(activity).init();
_activities.add(activity);
if (_activities.size() == 1)
onApplicationEnterForeground();
......