Fix proguard rules

This commit is contained in:
Matéo Duparc 2021-09-05 14:36:03 +02:00
parent dc62f73188
commit d36910ac19
Signed by untrusted user: hardcoresushi
GPG Key ID: 007F84120107191E
3 changed files with 12 additions and 9 deletions

View File

@ -20,8 +20,8 @@
# hide the original source file name. # hide the original source file name.
#-renamesourcefileattribute SourceFile #-renamesourcefileattribute SourceFile
-keepattributes InnerClasses -keep class sushi.hardcore.droidfs.SettingsActivity$**
-keep class sushi.hardcore.droidfs.SettingsActivity$** { -keep class sushi.hardcore.droidfs.explorers.ExplorerElement
*; -keepclassmembers class sushi.hardcore.droidfs.explorers.ExplorerElement {
static sushi.hardcore.droidfs.explorers.ExplorerElement new(...);
} }
-keep class sushi.hardcore.droidfs.explorers.ExplorerElement

View File

@ -17,6 +17,12 @@ class ExplorerElement(val name: String, val elementType: Short, var size: Long =
get() = elementType.toInt() == 1 get() = elementType.toInt() == 1
companion object { companion object {
@JvmStatic
//this function is needed because I had some problems calling the constructor from JNI, probably due to arguments with default values
fun new(name: String, elementType: Short, size: Long, mTime: Long, parentPath: String): ExplorerElement {
return ExplorerElement(name, elementType, size, mTime, parentPath)
}
private fun foldersFirst(a: ExplorerElement, b: ExplorerElement, default: () -> Int): Int { private fun foldersFirst(a: ExplorerElement, b: ExplorerElement, default: () -> Int): Int {
return if (a.isDirectory && b.isRegularFile) { return if (a.isDirectory && b.isRegularFile) {
-1 -1

View File

@ -3,7 +3,6 @@
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <android/log.h>
#include "libgocryptfs.h" #include "libgocryptfs.h"
void wipe(char* data, const unsigned int len){ void wipe(char* data, const unsigned int len){
@ -234,8 +233,7 @@ Java_sushi_hardcore_droidfs_GocryptfsVolume_native_1list_1dir(JNIEnv *env, jobje
jmethodID java_ArrayList_add = (*env)->GetMethodID(env, java_ArrayList, "add", "(Ljava/lang/Object;)Z"); jmethodID java_ArrayList_add = (*env)->GetMethodID(env, java_ArrayList, "add", "(Ljava/lang/Object;)Z");
jclass classExplorerElement = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "sushi/hardcore/droidfs/explorers/ExplorerElement")); jclass classExplorerElement = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "sushi/hardcore/droidfs/explorers/ExplorerElement"));
jmethodID classExplorerElement_init = (*env)->GetMethodID(env, classExplorerElement, "<init>", "(Ljava/lang/String;SJJLjava/lang/String;)V"); jmethodID explorerElement_new = (*env)->GetStaticMethodID(env, classExplorerElement, "new", "(Ljava/lang/String;SJJLjava/lang/String;)Lsushi/hardcore/droidfs/explorers/ExplorerElement;");
jobject element_list = (*env)->NewObject(env, java_ArrayList, java_ArrayList_init, elements.r2); jobject element_list = (*env)->NewObject(env, java_ArrayList, java_ArrayList_init, elements.r2);
unsigned int c = 0; unsigned int c = 0;
for (unsigned int i=0; i<elements.r2; ++i){ for (unsigned int i=0; i<elements.r2; ++i){
@ -261,8 +259,7 @@ Java_sushi_hardcore_droidfs_GocryptfsVolume_native_1list_1dir(JNIEnv *env, jobje
type = 1; //regular file type = 1; //regular file
} }
jstring jname = (*env)->NewStringUTF(env, name); jstring jname = (*env)->NewStringUTF(env, name);
jobject explorerElement = (*env)->NewObject(env, classExplorerElement, classExplorerElement_init, jname, type, (long long)attrs.r0, attrs.r1, jplain_dir); jobject explorerElement = (*env)->CallStaticObjectMethod(env, classExplorerElement, explorerElement_new, jname, type, (long long)attrs.r0, attrs.r1, jplain_dir);(*env)->CallBooleanMethod(env, element_list, java_ArrayList_add, explorerElement);
(*env)->CallBooleanMethod(env, element_list, java_ArrayList_add, explorerElement);
c += name_len+1; c += name_len+1;
} }