From d57ae50f17a6b2ed12e188cd3764c506dcc86b74 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Sat, 15 Apr 2023 00:09:30 -0400 Subject: android: Enable code minification --- src/android/app/build.gradle.kts | 7 ++++++- src/android/app/proguard-rules.pro | 23 ++-------------------- .../main/java/org/yuzu/yuzu_emu/NativeLibrary.kt | 4 ++++ .../yuzu_emu/applets/keyboard/SoftwareKeyboard.kt | 4 ++++ .../disk_shader_cache/DiskShaderCacheProgress.kt | 2 ++ 5 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts index d8ef02ac1..bf6d42042 100644 --- a/src/android/app/build.gradle.kts +++ b/src/android/app/build.gradle.kts @@ -78,6 +78,12 @@ android { // Signed by release key, allowing for upload to Play Store. release { signingConfig = signingConfigs.getByName("debug") + isMinifyEnabled = true + isDebuggable = false + proguardFiles( + getDefaultProguardFile("proguard-android.txt"), + "proguard-rules.pro" + ) } // builds a release build that doesn't need signing @@ -86,7 +92,6 @@ android { initWith(getByName("release")) versionNameSuffix = "-debug" signingConfig = signingConfigs.getByName("debug") - isMinifyEnabled = false enableAndroidTestCoverage = false isDebuggable = true isJniDebuggable = true diff --git a/src/android/app/proguard-rules.pro b/src/android/app/proguard-rules.pro index f1b424510..2f695757c 100644 --- a/src/android/app/proguard-rules.pro +++ b/src/android/app/proguard-rules.pro @@ -1,21 +1,2 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile +# To get usable stack traces +-dontobfuscate diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt index 1e654777a..cd9bc9ef0 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt @@ -11,6 +11,7 @@ import android.text.method.LinkMovementMethod import android.view.Surface import android.view.View import android.widget.TextView +import androidx.annotation.Keep import androidx.fragment.app.DialogFragment import com.google.android.material.dialog.MaterialAlertDialogBuilder import org.yuzu.yuzu_emu.YuzuApplication.Companion.appContext @@ -53,6 +54,7 @@ object NativeLibrary { } } + @Keep @JvmStatic fun openContentUri(path: String?, openmode: String?): Int { return if (isNativePath(path!!)) { @@ -60,6 +62,7 @@ object NativeLibrary { } else openContentUri(appContext, path, openmode) } + @Keep @JvmStatic fun getSize(path: String?): Long { return if (isNativePath(path!!)) { @@ -340,6 +343,7 @@ object NativeLibrary { return coreErrorAlertResult } + @Keep @JvmStatic fun exitEmulationActivity(resultCode: Int) { val Success = 0 diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/keyboard/SoftwareKeyboard.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/keyboard/SoftwareKeyboard.kt index e6485d039..82a6712b6 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/keyboard/SoftwareKeyboard.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/keyboard/SoftwareKeyboard.kt @@ -10,12 +10,14 @@ import android.view.KeyEvent import android.view.View import android.view.WindowInsets import android.view.inputmethod.InputMethodManager +import androidx.annotation.Keep import androidx.core.view.ViewCompat import org.yuzu.yuzu_emu.NativeLibrary import org.yuzu.yuzu_emu.R import org.yuzu.yuzu_emu.applets.keyboard.ui.KeyboardDialogFragment import java.io.Serializable +@Keep object SoftwareKeyboard { lateinit var data: KeyboardData val dataLock = Object() @@ -91,6 +93,7 @@ object SoftwareKeyboard { Cancel } + @Keep data class KeyboardConfig( var ok_text: String? = null, var header_text: String? = null, @@ -113,5 +116,6 @@ object SoftwareKeyboard { ) : Serializable // Corresponds to Frontend::KeyboardData + @Keep data class KeyboardData(var result: Int, var text: String) } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/disk_shader_cache/DiskShaderCacheProgress.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/disk_shader_cache/DiskShaderCacheProgress.kt index 9b665c7a0..3b1559c80 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/disk_shader_cache/DiskShaderCacheProgress.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/disk_shader_cache/DiskShaderCacheProgress.kt @@ -3,10 +3,12 @@ package org.yuzu.yuzu_emu.disk_shader_cache +import androidx.annotation.Keep import org.yuzu.yuzu_emu.NativeLibrary import org.yuzu.yuzu_emu.R import org.yuzu.yuzu_emu.disk_shader_cache.ui.ShaderProgressDialogFragment +@Keep object DiskShaderCacheProgress { val finishLock = Object() private lateinit var fragment: ShaderProgressDialogFragment -- cgit v1.2.3