adjust build and add a variant that doesn't allow user-added libraries

This commit is contained in:
Helium314 2024-02-01 22:10:54 +01:00
parent 53022afdab
commit 978d76ed7c
6 changed files with 39 additions and 52 deletions

View file

@ -18,8 +18,6 @@ import java.util.List;
/**
* KeyboardLayout maintains the keyboard layout information.
*/
// todo: this seems completely unused, see whether it can be removed, or re-purposed to contain
// some useful information about the layout (currently that's in KeyboardParser.LayoutInfos)
public class KeyboardLayout {
private final int[] mKeyCodes;

View file

@ -117,6 +117,9 @@ class AdvancedSettingsFragment : SubScreenFragment() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
removePreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON)
}
if (BuildConfig.BUILD_TYPE == "nouserlib") {
removePreference("load_gesture_library")
}
setupKeyLongpressTimeoutSettings()
findPreference<Preference>("load_gesture_library")?.setOnPreferenceClickListener { onClickLoadLibrary() }
findPreference<Preference>("backup_restore")?.setOnPreferenceClickListener { showBackupRestoreDialog() }

View file

@ -57,7 +57,7 @@ public final class JniUtils {
if (app != null) // use the actual path if possible
filesDir = app.getFilesDir().getAbsolutePath();
final File userSuppliedLibrary = new File(filesDir + File.separator + JNI_LIB_IMPORT_FILE_NAME);
if (userSuppliedLibrary.exists()) {
if (!BuildConfig.BUILD_TYPE.equals("nouserlib") && userSuppliedLibrary.exists()) {
String wantedChecksum = expectedDefaultChecksum();
try {
if (app != null) {

View file

@ -1,30 +0,0 @@
# Keep classes and methods that have the @UsedForTesting annotation
-keep @helium314.keyboard.annotations.UsedForTesting class *
-keepclassmembers class * {
@helium314.keyboard.annotations.UsedForTesting *;
}
# Keep classes and methods that have the @ExternallyReferenced annotation
-keep @helium314.keyboard.annotations.ExternallyReferenced class *
-keepclassmembers class * {
@helium314.keyboard.annotations.ExternallyReferenced *;
}
# Keep native methods
-keepclassmembers class * {
native <methods>;
}
# Keep classes that are used as a parameter type of methods that are also marked as keep
# to preserve changing those methods' signature.
-keep class helium314.keyboard.latin.Dictionary
-keep class helium314.keyboard.latin.NgramContext
-keep class helium314.keyboard.latin.makedict.ProbabilityInfo
-keep class helium314.keyboard.latin.utils.LanguageModelParam
# TODO: remove once used in code.
-keep class helium314.keyboard.keyboard.KeyboardLayout { *; }
# after upgrading to gradle 8, stack traces contain "unknown source", which is horribly bad making them rather useless
-keepattributes SourceFile,LineNumberTable
-dontobfuscate