Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): pulling release/1.23.0 into master #427

Merged
merged 5 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.23.0](https://github.com/rudderlabs/rudder-sdk-android/compare/v1.22.0...v1.23.0) (2024-05-20)


### Features

* migrate from sqlcipher legacy to latest version ([#419](https://github.com/rudderlabs/rudder-sdk-android/issues/419)) ([a739a78](https://github.com/rudderlabs/rudder-sdk-android/commit/a739a789fddcd5afec0a8fc9fceaa1fd1d1bd8ab))


### Bug Fixes

* check if the referrer is not null before casting it to a string ([#425](https://github.com/rudderlabs/rudder-sdk-android/issues/425)) ([3b58967](https://github.com/rudderlabs/rudder-sdk-android/commit/3b58967202adfb37efb4cb2c9374885986c927de))
* key "batch" was being obfuscated due to proguard ([#423](https://github.com/rudderlabs/rudder-sdk-android/issues/423)) ([eaa282c](https://github.com/rudderlabs/rudder-sdk-android/commit/eaa282c4c0f95dc02e02ce2ca0b16bfed5ee5e41))

## [1.22.0](https://github.com/rudderlabs/rudder-sdk-android/compare/v1.21.3...v1.22.0) (2024-03-19)


Expand Down
4 changes: 2 additions & 2 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ dependencies {
compileOnly 'androidx.lifecycle:lifecycle-common:2.6.1'

//sql-cipher
compileOnly "net.zetetic:android-database-sqlcipher:4.5.4"
compileOnly "androidx.sqlite:sqlite:2.3.1"
compileOnly "net.zetetic:sqlcipher-android:4.5.6@aar"
compileOnly "androidx.sqlite:sqlite:2.4.0"

//test
testImplementation('com.android.support.test:rules:1.0.2')
Expand Down
1 change: 1 addition & 0 deletions core/proguard-consumer-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
-keep class com.rudderstack.android.sdk.core.persistence.DefaultPersistenceProviderFactory { *; }

# Required for Device Mode Transformations
-keep class com.rudderstack.android.sdk.core.TransformationRequest { *; }
-keep class com.rudderstack.android.sdk.core.TransformationResponse { *; }
-keep class com.rudderstack.android.sdk.core.TransformationResponseDeserializer { *; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import java.util.List;

public class TransformationRequest {
@SerializedName(value="batch")
final List<TransformationRequestEvent> batch;

public TransformationRequest(List<TransformationRequestEvent> batch) {
TransformationRequest(List<TransformationRequestEvent> batch) {
this.batch = batch;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.rudderstack.android.sdk.core.persistence;

import android.app.Application;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;

import androidx.annotation.NonNull;
Expand All @@ -9,8 +10,8 @@
import com.rudderstack.android.sdk.core.ReportManager;
import com.rudderstack.android.sdk.core.RudderLogger;

import net.sqlcipher.Cursor;
import net.sqlcipher.database.SQLiteDatabase;

import net.zetetic.database.sqlcipher.SQLiteDatabase;

import java.io.File;
import java.util.Collections;
Expand All @@ -21,7 +22,6 @@ public class DefaultPersistenceProvider implements PersistenceProvider {
private final Application application;
private final ProviderParams params;


DefaultPersistenceProvider(Application application, ProviderParams params) {
this.application = application;
this.params = params;
Expand Down Expand Up @@ -88,7 +88,7 @@ private EncryptedPersistence createEncryptedObject(@Nullable Persistence.DbCreat

private boolean checkIfEncryptionIsValid(File encryptedDbPath) {
try (SQLiteDatabase database = SQLiteDatabase.openDatabase(encryptedDbPath.getAbsolutePath(),
params.encryptionKey, null, SQLiteDatabase.OPEN_READWRITE)) {
params.encryptionKey, null, SQLiteDatabase.OPEN_READWRITE, null)) {
Cursor cursor = database.rawQuery("PRAGMA cipher_version", null);
cursor.close();
return true;
Expand Down Expand Up @@ -118,12 +118,12 @@ private DefaultPersistence getDefaultPersistence(@Nullable Persistence.DbCreateL

private void createDefaultDatabase() {
File databasePath = application.getDatabasePath(params.dbName);
SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(databasePath.getAbsolutePath(), "", null);
SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(databasePath.getAbsolutePath(), "",null, null);
database.close();
}

private void initCipheredDatabase() {
SQLiteDatabase.loadLibs(application);
System.loadLibrary("sqlcipher");
}

private void deleteEncryptedDb() {
Expand All @@ -140,7 +140,7 @@ private void migrateToDefaultDatabase(File databasePath) {

File encryptedDb = application.getDatabasePath(params.encryptedDbName);
String encryptedPath = encryptedDb.getAbsolutePath();
SQLiteDatabase database = SQLiteDatabase.openDatabase(encryptedPath, params.encryptionKey, null, SQLiteDatabase.OPEN_READWRITE);
SQLiteDatabase database = SQLiteDatabase.openDatabase(encryptedPath, params.encryptionKey, null, SQLiteDatabase.OPEN_READWRITE, null);
//will throw exception if encryption key is invalid
database.isDatabaseIntegrityOk();
database.rawExecSQL(String.format("ATTACH DATABASE '%s' AS rl_persistence KEY ''",
Expand All @@ -163,11 +163,11 @@ private void migrateToEncryptedDatabase(File encryptedDbPath) {
ReportManager.LABEL_TYPE, ReportManager.LABEL_TYPE_MIGRATE_TO_ENCRYPT
));

SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(encryptedDbPath.getAbsolutePath(), params.encryptionKey, null);
SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(encryptedDbPath.getAbsolutePath(), params.encryptionKey,null, null);
database.close();
File decryptedDb = application.getDatabasePath(params.dbName);
String decryptedPath = decryptedDb.getAbsolutePath();
database = SQLiteDatabase.openDatabase(decryptedPath, "", null, SQLiteDatabase.OPEN_READWRITE);
database = SQLiteDatabase.openDatabase(decryptedPath, "", null, SQLiteDatabase.OPEN_READWRITE, null);
database.rawExecSQL(String.format("ATTACH DATABASE '%s' AS rl_persistence_encrypted KEY '%s'",
encryptedDbPath.getAbsolutePath(), params.encryptionKey));
database.rawExecSQL("select sqlcipher_export('rl_persistence_encrypted')");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import com.rudderstack.android.sdk.core.RudderLogger;

import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteOpenHelper;
import net.zetetic.database.sqlcipher.SQLiteDatabase;
import net.zetetic.database.sqlcipher.SQLiteOpenHelper;

import java.io.File;
import java.util.List;
Expand All @@ -29,21 +29,21 @@
public class EncryptedPersistence extends SQLiteOpenHelper implements Persistence {
private final List<DbCloseListener> dbCloseListeners = new java.util.concurrent.CopyOnWriteArrayList<>();
private final DbCreateListener dbCreateListener;
private final String encryptPassword;
private SQLiteDatabase initialDatabase = null;


EncryptedPersistence(Application application, DbParams params, @Nullable DbCreateListener dbCreateListener) {
super(application, params.dbName, null, params.dbVersion);
this.encryptPassword = params.encryptPassword;
super(application, params.dbName, params.encryptPassword,null, params.dbVersion,
0, null, null, false);
this.dbCreateListener = dbCreateListener;
}

private SQLiteDatabase getWritableDatabase() {
@NonNull
public SQLiteDatabase getWritableDatabase() {
if (initialDatabase != null) {
return initialDatabase;
}
return getWritableDatabase(encryptPassword);
return super.getWritableDatabase();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
import android.os.Build;
import android.text.TextUtils;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.rudderstack.android.sdk.core.ReportManager;
import com.rudderstack.android.sdk.core.RudderLogger;
import com.rudderstack.android.sdk.core.RudderMessage;
import com.rudderstack.android.sdk.core.gson.RudderGson;

import java.io.File;
Expand All @@ -26,7 +24,6 @@
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -200,7 +197,8 @@ public static boolean fileExists(Context context, String filename) {
public static String getReferrer(Activity activity) {
// If devices running on SDK versions greater than equal to 22
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
return activity.getReferrer().toString();
Uri referrer = activity.getReferrer();
return referrer != null ? referrer.toString() : null;
}
// If devices running on SDK versions greater than equal to 19
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ android.enableJetifier=true
android.enableR8.fullMode=true
kotlin.code.style=official
GROUP=com.rudderstack.android.sdk
VERSION_CODE=26
VERSION_NAME=1.22.0
VERSION_CODE=27
VERSION_NAME=1.23.0
POM_NAME=Rudderstack SDK for android
POM_DESCRIPTION=Rudderstack SDK for android
POM_ARTIFACT_ID=core
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.22.0",
"version": "1.23.0",
"dependencies": {
"properties-reader": "^2.2.0"
}
Expand Down
2 changes: 1 addition & 1 deletion sample-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ dependencies {
implementation "androidx.work:work-runtime:2.7.1"

//sql-cipher
implementation "net.zetetic:android-database-sqlcipher:4.5.4"
implementation "net.zetetic:sqlcipher-android:4.5.6@aar"
implementation "androidx.sqlite:sqlite:2.3.1"

// required for new life cycle methods
Expand Down
1 change: 1 addition & 0 deletions sample-kotlin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
android.enableR8.fullMode=true
21 changes: 0 additions & 21 deletions sample-kotlin/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@

# These rules should be kept as part of the reporter module, as the fields of Entities are getting removed
# this deals with `There should be at least one field in @Entity`
-keep class com.rudderstack.android.ruddermetricsreporterandroid.models.LabelEntity { *; }
-keep class com.rudderstack.android.ruddermetricsreporterandroid.models.MetricEntity { *; }
-keep class com.rudderstack.android.ruddermetricsreporterandroid.models.ErrorEntity { *; }

# Required for the usage off TypeToken class in Utils.converToMap, Utils.convertToList
-keep class com.google.gson.reflect.TypeToken { *; }
Expand All @@ -34,31 +31,13 @@
-keep class com.google.gson.internal.LinkedTreeMap { *; }
-keep class * implements java.io.Serializable { *; }

-keep class com.rudderstack.rudderjsonadapter.RudderTypeAdapter { *; }
-keep class * extends com.rudderstack.rudderjsonadapter.RudderTypeAdapter

# Required to ensure the DefaultPersistenceProviderFactory is not removed by Proguard and works as expected
# even when the customer is not using encryption feature.
-dontwarn net.sqlcipher.Cursor
-dontwarn net.sqlcipher.database.SQLiteDatabase$CursorFactory
-dontwarn net.sqlcipher.database.SQLiteDatabase
-dontwarn net.sqlcipher.database.SQLiteOpenHelper
-keep class com.rudderstack.android.sdk.core.persistence.DefaultPersistenceProviderFactory { *; }

# Required for the usage of annotations across reporter and web modules
-dontwarn com.fasterxml.jackson.annotation.JsonIgnore
-dontwarn com.squareup.moshi.Json
-dontwarn com.fasterxml.jackson.annotation.JsonProperty

# because of an issue with the dependencies used by the instruementation tests as mentioned here
# androidTestImplementation 'androidx.test.ext:junit:1.1.5'
# androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
# the errors didn't go even after adding the below rule, hence needed to remove the instrumentation tests for the time being.
-dontwarn com.google.errorprone.annotations

# Required for Amplitude Device Mode
-keep class com.rudderstack.android.integrations.amplitude.AmplitudeDestinationConfig { *; }

# Required for DMT
-keep class com.rudderstack.android.sdk.core.TransformationResponse { *; }
-keep class com.rudderstack.android.sdk.core.TransformationResponseDeserializer { *; }
Loading