6 Commits
Author SHA1 Message Date
OneWay 7571cd0213 Release 1.10.0
- Stale search results no longer flash during a new search
- Import errors no longer linger after the import finishes
- Search history actions stay visible while scrolling
- Text from other apps now fills the search field in one step
- Refreshed performance profiles
- Updated libraries and build tooling
2026-11-08 03:22:00 +08:00
OneWay c8e3312bff perf(profile): regenerate baseline and startup profiles 2026-11-07 22:04:00 +08:00
OneWay 53adde3a95 feat(profile): pass query and reference target through runner arguments 2026-11-07 22:03:00 +08:00
OneWay 8f16160794 refactor(profile): simplify the generator code 2026-11-07 22:02:00 +08:00
OneWay 64b9f06ff0 chore(deps): update the toolchain and dependencies
- Material 3 1.5.0-rc01
- Android Gradle Plugin 9.5.1
- UI Automator 2.4.1
- Gradle wrapper 9.9.0
- Pin the Compose runtime and runtime-tracing debug pair, move
  startup-runtime and tracing-wire into the catalog
2026-11-07 22:01:00 +08:00
OneWay 60e86cac2c fix(profile): decode UTF-16 dictionaries with the correct byte order 2026-11-07 22:00:00 +08:00
10 changed files with 16876 additions and 16933 deletions

No files matched your search

+1 -1
View File
@@ -94,7 +94,7 @@ The main search screen remains usable as long as at least one indexed dictionary
- OkHttp 5.5.1
- kotlinx.serialization 1.12.0
- AboutLibraries 15.3.0 metadata generation
- Android Gradle Plugin 9.4.1
- Android Gradle Plugin 9.5.1
## Build
+12 -2
View File
@@ -93,8 +93,8 @@ android {
applicationId = "com.example.research"
minSdk = project.property("minSdk").toString().toInt()
targetSdk = project.property("targetSdk").toString().toInt()
versionCode = 13
versionName = "1.9.0"
versionCode = 14
versionName = "1.10.0"
vectorDrawables {
useSupportLibrary = true
@@ -112,6 +112,13 @@ android {
release {
if (project.hasProperty("research.debugSign")) {
signingConfig = signingConfigs.getByName("debug")
} else if (project.hasProperty("research.releaseSign")) {
signingConfig = signingConfigs.create("researchRelease") {
storeFile = file(project.property("research.keystore") as String)
storePassword = project.property("research.storePass") as String
keyAlias = project.property("research.keyAlias") as String
keyPassword = project.property("research.keyPass") as String
}
}
ndk {
@@ -175,7 +182,10 @@ dependencies {
implementation(composeBom)
implementation(libs.bundles.compose)
implementation(libs.androidx.compose.material3.adaptive.layout)
debugImplementation(libs.androidx.compose.runtime)
debugImplementation(libs.androidx.compose.runtime.tracing)
debugImplementation(libs.androidx.startup.runtime)
debugImplementation(libs.androidx.tracing.wire)
implementation(libs.androidx.paging.runtime)
implementation(libs.androidx.paging.compose)
implementation(libs.androidx.profileinstaller)
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+6
View File
@@ -12,6 +12,12 @@ android {
minSdk = project.property("minSdk").toString().toInt()
targetSdk = project.property("targetSdk").toString().toInt()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
project.findProperty("profileQuery")?.let {
testInstrumentationRunnerArguments["query"] = it.toString()
}
project.findProperty("profileRefTarget")?.let {
testInstrumentationRunnerArguments["refTarget"] = it.toString()
}
}
compileOptions {
@@ -3,6 +3,7 @@ package com.example.research.baselineprofile
import android.util.Base64
import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.By
import androidx.test.uiautomator.Direction
import androidx.test.uiautomator.UiDevice
@@ -180,24 +181,28 @@ class BaselineProfileGenerator {
/**
* Reads the first .dsl.gz archive from the shared Download folder and
* extracts a search query from its first article, so the scenario does
* not depend on a specific dictionary.
* not depend on a specific dictionary. The `query` and `refTarget`
* runner arguments override the head parsing, which cannot read heavy
* archives because the UiAutomation shell output is size-capped.
*/
private fun loadProfileDictionary(device: UiDevice): ProfileDictionary {
val fileName = device.executeShellCommand("ls $DOWNLOAD_DIR")
.lineSequence()
.map(String::trim)
.filter { it.endsWith(GZ_SUFFIX) }
.firstOrNull()
.firstOrNull { it.endsWith(GZ_SUFFIX) }
?: error("No $GZ_SUFFIX archives available in $DOWNLOAD_DIR")
val archiveBytes = Base64.decode(
device.executeShellCommand("base64 $DOWNLOAD_DIR/$fileName")
.filter { it != '\n' && it != '\r' },
Base64.DEFAULT,
)
val dictionaryBytes = ungzip(archiveBytes)
val head = decodeWithBom(
dictionaryBytes.copyOfRange(0, minOf(HEAD_BYTES, dictionaryBytes.size)),
)
val args = InstrumentationRegistry.getArguments()
val argQuery = args.getString("query")?.takeIf { it.isNotEmpty() }
val argRefTarget = args.getString("refTarget")?.takeIf { it.isNotEmpty() }
if (argQuery != null) return ProfileDictionary(fileName, argQuery, argRefTarget)
val head = try {
decodeWithBom(readGzipHead(device, "$DOWNLOAD_DIR/$fileName", HEAD_BYTES))
} catch (e: OutOfMemoryError) {
error(
"Staged archive does not fit the instrumentation heap; " +
"pass the query and refTarget runner arguments",
)
}
var entry: String? = null
var query: String? = null
@@ -208,7 +213,7 @@ class BaselineProfileGenerator {
val headword = entry?.let(::firstHeadword).orEmpty()
if (headword.isNotEmpty()) query = headword
} else {
refTarget = refTarget ?: firstReference(line)
refTarget = firstReference(line)
if (refTarget != null) break
}
}
@@ -222,7 +227,7 @@ class BaselineProfileGenerator {
}
/**
* Extracts the plain target of the first [ref]...[/ref] pair on the line,
* Extracts the plain target of the first `[ref]...[/ref]` pair on the line,
* dropping any nested DSL tags, so the scenario can follow a real
* cross-reference instead of relying on a hardcoded word.
*/
@@ -239,6 +244,16 @@ class BaselineProfileGenerator {
return target.ifEmpty { null }
}
private fun readGzipHead(device: UiDevice, remotePath: String, textBytes: Int): ByteArray {
val archiveBytes = Base64.decode(
device.executeShellCommand("base64 $remotePath")
.filter { it != '\n' && it != '\r' },
Base64.DEFAULT,
)
val dictionaryBytes = ungzip(archiveBytes)
return dictionaryBytes.copyOfRange(0, minOf(textBytes, dictionaryBytes.size))
}
private fun ungzip(bytes: ByteArray): ByteArray {
val output = ByteArrayOutputStream()
GZIPInputStream(ByteArrayInputStream(bytes)).use { input ->
@@ -259,11 +274,11 @@ class BaselineProfileGenerator {
bytes.size >= UTF16_BOM.size &&
bytes[0] == UTF16_BOM[0] && bytes[1] == UTF16_BOM[1] ->
String(bytes, UTF16_BOM.size, bytes.size - UTF16_BOM.size, Charsets.UTF_16LE)
String(bytes, UTF16_BOM.size, bytes.size - UTF16_BOM.size, Charsets.UTF_16BE)
bytes.size >= UTF16_BOM.size &&
bytes[0] == UTF16_BOM[1] && bytes[1] == UTF16_BOM[0] ->
String(bytes, UTF16_BOM.size, bytes.size - UTF16_BOM.size, Charsets.UTF_16BE)
String(bytes, UTF16_BOM.size, bytes.size - UTF16_BOM.size, Charsets.UTF_16LE)
bytes.size >= 2 && bytes[0] == 0.toByte() ->
String(bytes, Charsets.UTF_16BE)
@@ -307,7 +322,7 @@ class BaselineProfileGenerator {
private companion object {
val UTF8_BOM = byteArrayOf(0xEF.toByte(), 0xBB.toByte(), 0xBF.toByte())
val UTF16_BOM = byteArrayOf(0xFE.toByte(), 0xFF.toByte())
val NESTED_TAG_REGEX = Regex("\\[[^\\]]*\\]")
val NESTED_TAG_REGEX = Regex("\\[[^]]*]")
const val DOWNLOAD_DIR = "/sdcard/Download"
const val GZ_SUFFIX = ".dsl.gz"
@@ -0,0 +1,6 @@
- Stale search results no longer flash during a new search
- Import errors no longer linger after the import finishes
- Search history actions stay visible while scrolling
- Text from other apps now fills the search field in one step
- Refreshed performance profiles
- Updated libraries and build tooling
@@ -0,0 +1,6 @@
- Устаревшие результаты поиска больше не мелькают при новом поиске
- Ошибка импорта больше не остаётся после завершения импорта
- Действия в истории поиска остаются видимыми при прокрутке
- Текст из других приложений попадает в поле поиска одним шагом
- Обновлены профили производительности
- Обновлены библиотеки и инструменты сборки
+10 -4
View File
@@ -1,21 +1,24 @@
[versions]
aboutlibraries = "15.3.0"
activity_compose = "1.13.0"
agp = "9.4.1"
agp = "9.5.1"
baselineprofile = "1.5.0"
benchmark_macro = "1.5.0"
compose_bom = "2026.09.00"
compose_runtime = "1.13.0-rc01"
core = "1.19.1"
datastore_preferences = "1.3.0"
documentfile = "1.1.0"
junit = "1.3.0"
kotlin = "2.4.21"
lifecycle_runtime_ktx = "2.11.0"
material3 = "1.5.0-beta02"
material3 = "1.5.0-rc01"
okhttp = "5.5.1"
paging = "3.5.3"
profileinstaller = "1.4.1"
uiautomator = "2.4.0"
startup_runtime = "1.2.0"
tracing_wire = "2.0.5"
uiautomator = "2.4.1"
kotlinx_coroutines = "1.11.0"
kotlinx_serialization = "1.12.0"
@@ -25,7 +28,8 @@ androidx-benchmark-macro-junit4 = { module = "androidx.benchmark:benchmark-macro
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose_bom" }
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
androidx-compose-material3-adaptive-layout = { group = "androidx.compose.material3.adaptive", name = "adaptive-layout" }
androidx-compose-runtime-tracing = { module = "androidx.compose.runtime:runtime-tracing" }
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "compose_runtime" }
androidx-compose-runtime-tracing = { module = "androidx.compose.runtime:runtime-tracing", version.ref = "compose_runtime" }
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
@@ -37,7 +41,9 @@ androidx-lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-ru
androidx-paging-runtime = { module = "androidx.paging:paging-runtime", version.ref = "paging" }
androidx-paging-compose = { module = "androidx.paging:paging-compose", version.ref = "paging" }
androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "profileinstaller" }
androidx-startup-runtime = { module = "androidx.startup:startup-runtime", version.ref = "startup_runtime" }
androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "junit" }
androidx-tracing-wire = { module = "androidx.tracing:tracing-wire", version.ref = "tracing_wire" }
androidx-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiautomator" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx_coroutines" }
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.9.0-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500