Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import android.view.textclassifier.TextClassification
import android.view.textclassifier.TextClassificationContext
import android.view.textclassifier.TextClassificationManager
import android.view.textclassifier.TextClassifier
import androidx.compose.foundation.ComposeFoundationFlags
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.test.core.app.ActivityScenario
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
Expand Down Expand Up @@ -91,6 +93,17 @@ class SansClassificationDeTexteTest {
assertThat(application.textClassifier).isNotSameInstanceAs(TextClassifier.NO_OP)
}

/**
* Compose must list no other app's text action, on any version: package visibility is granted
* per app. See [sansActionsDeTexteDesAutresApps].
*/
@OptIn(ExperimentalFoundationApi::class)
@Test
fun compose_lists_no_other_app_text_action() {
gestionnaireDeLActivite() // the activity has run its onCreate
assertThat(ComposeFoundationFlags.isSmartSelectionEnabled).isFalse()
}

private fun gestionnaireDeLActivite(): TextClassificationManager {
var gestionnaire: TextClassificationManager? = null
scene!!.onActivity { gestionnaire = it.getSystemService(TextClassificationManager::class.java) }
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/filestech/notes_tech/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import com.filestech.notes_tech.ui.panic.RecouvrementDePanique
import com.filestech.notes_tech.ui.panic.activityPanicViewModel
import com.filestech.notes_tech.ui.secure.LocalSecureWindow
import com.filestech.notes_tech.ui.secure.SecureWindowController
import com.filestech.notes_tech.ui.secure.sansActionsDeTexteDesAutresApps
import com.filestech.notes_tech.ui.secure.sansClassificationDeTexte
import com.filestech.notes_tech.ui.share.PartagesRecus
import com.filestech.notes_tech.ui.splash.SplashScreen
Expand Down Expand Up @@ -108,6 +109,8 @@ class MainActivity : FragmentActivity() {
// 🔴 Before the first field exists: the selection toolbar's "Translate" sent the selected text
// of a note to another app (3.1.1) — see `sansClassificationDeTexte`.
sansClassificationDeTexte()
// Same toolbar, other door: other apps' text actions — editing entries only.
sansActionsDeTexteDesAutresApps()
enableEdgeToEdge()
setContent {
CompositionLocalProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.app.Activity
import android.os.Build
import android.view.textclassifier.TextClassificationManager
import android.view.textclassifier.TextClassifier
import androidx.compose.foundation.ComposeFoundationFlags
import androidx.compose.foundation.ExperimentalFoundationApi

/**
* 🔴 **No text classifier in this app** — 3.1.1, measured on 2026-10-29.
Expand Down Expand Up @@ -33,3 +35,25 @@ internal fun Activity.sansClassificationDeTexte() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
getSystemService(TextClassificationManager::class.java)?.setTextClassifier(TextClassifier.NO_OP)
}

/**
* 🔴 **No other app's text action in Compose's selection toolbar** — measured on 2026-10-31.
*
* Compose foundation 1.12 adds to that toolbar one entry per app that declares `ACTION_PROCESS_TEXT`
* and that this app can see (`ProcessText_android`, read in the bytecode) — any app may declare one,
* under any name, and one tap hands it the selected text, in the title, search and vault fields
* alike. Removing the `<queries>` for it (audit of 2026-09-26) is not enough: before Android 11 there
* is no package visibility, every app is listed, a translator among them; from 11 on, visibility is
* granted per WHOLE app, and any app another `<queries>` of the manifest reaches is listed with all
* its text actions.
*
* [ComposeFoundationFlags.isSmartSelectionEnabled] set to `false` takes those entries — and smart
* selection, already off with the classifier — out of every Compose toolbar of the process, on every
* version: Compose's fields keep editing only, as the body's native field already does
* ([com.filestech.notes_tech.ui.editor.MenuDuChampDuCorps]). What is lost:
* reading aloud from the toolbar, still reachable through its own accessibility shortcut.
*/
@OptIn(ExperimentalFoundationApi::class)
internal fun sansActionsDeTexteDesAutresApps() {
ComposeFoundationFlags.isSmartSelectionEnabled = false
}
Loading