Skip to content
Merged
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
31 changes: 30 additions & 1 deletion app/src/main/java/com/screensaathi/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import android.text.TextUtils
import android.view.accessibility.AccessibilityManager
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
Expand Down Expand Up @@ -53,7 +54,7 @@ class MainActivity : AppCompatActivity() {
}

findViewById<Button>(R.id.btn_accessibility).setOnClickListener {
startActivity(Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS))
explainAccessibilityThenOpenSettings()
}

findViewById<Button>(R.id.btn_start).setOnClickListener {
Expand Down Expand Up @@ -117,6 +118,34 @@ class MainActivity : AppCompatActivity() {
finish()
}

/**
* `BIND_ACCESSIBILITY_SERVICE` is the single scariest permission dialog on
* Android, and the OS prompt explains none of it — the audit that flagged
* this called it out as the single biggest reason a first-time user quits
* before ever seeing the product work. This dialog is the one screen
* between "unexplained scary permission" and an informed decision; the
* full accounting lives in docs/DATA_HANDLING.md if that's not enough.
*/
private fun explainAccessibilityThenOpenSettings() {
AlertDialog.Builder(this)
.setTitle("Why ScreenSaathi needs this")
.setMessage(
"This lets the app read the text and layout of the screen " +
"you're currently looking at, so it can point at the right " +
"field and button.\n\n" +
"It reads the foreground app only, as text — never a " +
"screenshot, never other apps in the background. That text " +
"is sent to Sarvam's cloud service to decide what to say next.\n\n" +
"On the next screen, find ScreenSaathi under Downloaded " +
Comment on lines +131 to +139

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider moving user-facing strings into resources for localization and reuse.

The dialog’s title, message, and button labels are all hardcoded here. Please move them into string resources so they can be localized, managed centrally, and updated independently of the implementation.

Suggested implementation:

    private fun explainAccessibilityThenOpenSettings() {
        AlertDialog.Builder(this)
            .setTitle(R.string.accessibility_explanation_title)
            .setMessage(getString(R.string.accessibility_explanation_message))
            .setPositiveButton(R.string.accessibility_explanation_positive) { _, _ ->
                startActivity(Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS))
            }
            .setNegativeButton(R.string.accessibility_explanation_negative, null)
            .show()
    }

Add the corresponding string resources in app/src/main/res/values/strings.xml (and any localized values-xx/strings.xml files), for example:

  • accessibility_explanation_title"Why ScreenSaathi needs this"
  • accessibility_explanation_message — the full explanatory message currently hardcoded in the dialog
  • accessibility_explanation_positive"Continue"
  • accessibility_explanation_negative"Not now"

Ensure the message string preserves the intended formatting (e.g., using \n\n or <br/> as appropriate).

"apps or Installed apps and turn it on."
)
.setPositiveButton("Continue") { _, _ ->
startActivity(Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS))
}
.setNegativeButton("Not now", null)
.show()
}

private fun refreshStatus() {
val overlay = if (Settings.canDrawOverlays(this)) "✓" else "✗"
val mic = if (hasMic()) "✓" else "✗"
Expand Down
Loading