Skip to content
Open
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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.gradle/
.idea/
build/
.cxx/
braille/translate/src/phone/res/
gradle/
gradlew
gradlew.bat
local.properties
68 changes: 65 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Introduction

This repository contains source code for Google's TalkBack, which is a screen
![TalkBack For Developers Logo][100]

This repository contains forked source code for Google's TalkBack, which is a screen
reader for blind and visually-impaired users of Android. For usage instructions,
see
read
[TalkBack User Guide](https://support.google.com/accessibility/android/answer/6283677?hl=en).

### How to Build

To build TalkBack, run ./build.sh, which will produce an apk file.
To build TalkBack, run `./build.sh`, which will produce an apk file. You can also specify a serial number by running `./build.sh -s [SERIAL]` to automatically install to your device.

Ensure that:
- jenv local 1.8
- NDK 24.0.8215888 is installed

### How to Install

Expand All @@ -18,3 +24,59 @@ Install the apk onto your Android device in the usual manner using adb.
With the apk now installed on the device, the TalkBack service should now be
present under Settings -> Accessibility, and will be off by default. To turn it
on, toggle the switch preference to the on position.

### How to use with ADB

```shell
# Activate
adb shell settings put secure enabled_accessibility_services com.android.talkback4d/com.developer.talkback.TalkBackDevService

# Deactivate
adb shell settings put secure enabled_accessibility_services null

# General format
# All commands take the format of a broadcast
adb shell am broadcast -a com.a11y.adb.[ACTION] [OPTIONS]

BROADCAST () { adb shell am broadcast "$@"; }

# Perform actions
BROADCAST -a com.a11y.adb.previous # default granularity
BROADCAST -a com.a11y.adb.next # default granularity

BROADCAST -a com.a11y.adb.previous -e mode headings # move tp previous heading
BROADCAST -a com.a11y.adb.next -e mode headings # move to next heading

# Toggle settings
BROADCAST -a com.a11y.adb.toggle_speech_output # show special toasts for spoken text
BROADCAST -a com.a11y.adb.perform_click_action
BROADCAST -a com.a11y.adb.volume_toggle # special case that toggles between 5% and 50%
```

## All parameters
- [Action list][0]
- [Action parameter list in the SelectorController enum][1]
- [Developer settings][2]
- [Volume specific controls][3]

## TODO
- Add curtain
- Activate via ADB
- Dev tools:
- Colour contrast check
- Touch target size check
- Developer-friendly details on curtain (add to announcements)
- [NAF control checker][4]
- Hide all screen except highlighted node
- Show labels

## FIXED
- Menus lacking dark mode / styling
- Back button in menus

[0]: https://github.com/qbalsdon/talkback/blob/main/talkback/src/main/java/com/google/android/accessibility/talkback/adb/A11yAction.java
[1]: https://github.com/qbalsdon/talkback/blob/main/talkback/src/main/java/com/google/android/accessibility/talkback/selector/SelectorController.java#L116
[2]: https://github.com/qbalsdon/talkback/blob/main/talkback/src/main/java/com/google/android/accessibility/talkback/adb/ToggleDeveloperSetting.java
[3]: https://github.com/qbalsdon/talkback/blob/main/talkback/src/main/java/com/google/android/accessibility/talkback/adb/VolumeSetting.java
[4]: https://android.googlesource.com/platform/frameworks/uiautomator/+/android-support-test/src/main/java/android/support/test/uiautomator/AccessibilityNodeInfoDumper.java#125
[100]: ./talkback/src/main/res/drawable-xxxhdpi/icon_tb4d_round.png "TalkBack for developers" {: height="200px"}
9 changes: 3 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// For building the open-source release of TalkBack.

apply plugin: 'com.android.application'

apply from: 'shared.gradle'

apply from: 'version.gradle'

final BUILD_TIMESTAMP = new Date().format('yyyy_MM_dd_HHmm')
Expand All @@ -19,7 +16,7 @@ buildscript {
}
dependencies {
classpath 'org.aspectj:aspectjtools:1.8.1'
classpath 'com.android.tools.build:gradle:3.5.4'
classpath 'com.android.tools.build:gradle:4.2.2'
}
}

Expand All @@ -31,10 +28,10 @@ allprojects {
}

android {
buildToolsVersion '29.0.0'
buildToolsVersion '30.0.2'
defaultConfig {
applicationId talkbackApplicationId
versionName talkbackVersionName + "-" + BUILD_TIMESTAMP
versionName talkbackVersionName + "-" + BUILD_TIMESTAMP + "-" + talkback4DevVersionName
minSdkVersion 26
targetSdkVersion 30
testInstrumentationRunner 'android.test.InstrumentationTestRunner'
Expand Down
71 changes: 55 additions & 16 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,22 @@
### JAVA_HOME # path to local copy of Java SDK. Should be Java 8.
# On gLinux, use 'export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64'


GRADLE_DOWNLOAD_VERSION=5.4.1
#-----------------------------------------------------------------------------
DEVICE=""
PIPELINE=false
USAGE="./build.sh [[-s | --device] SERIAL_NUMBER]"
while [[ "$#" -gt 0 ]]; do
case $1 in
-s|--device) DEVICE="$2"; shift ;;
-p) PIPELINE=true; shift ;;
-h|--help) echo $USAGE; exit 0 ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
#-----------------------------------------------------------------------------

GRADLE_DOWNLOAD_VERSION=6.7.1
GRADLE_TRACE=false # change to true to enable verbose logging of gradlew


Expand Down Expand Up @@ -60,6 +74,14 @@ log "cat local.properties"; cat local.properties
log


#-----------------------------------------------------------------------------
if [[ "$PIPELINE" = false ]]; then
unset JAVA_HOME;
export JAVA_HOME=$(/usr/libexec/java_home -v"1.8");
fi
#-----------------------------------------------------------------------------


if [[ -z "${JAVA_HOME}" ]]; then
fail_with_message "JAVA_HOME environment variable is unset. It should be set to a Java 8 SDK (in order for the license acceptance to work)"
fi
Expand All @@ -79,9 +101,10 @@ if [[ $ACCEPT_SDK_LICENSES_EXIT_CODE -ne 0 ]]; then
fi


# Having compileSdkVersion=31 leads to javac error "unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)"; switching to Java 11 fixes this problem.
sudo update-java-alternatives --set java-1.11.0-openjdk-amd64
export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64
if [[ "$PIPELINE" = false ]]; then
unset JAVA_HOME;
export JAVA_HOME=$(/usr/libexec/java_home -v"11");
fi
log "\${JAVA_HOME}: ${JAVA_HOME}"
log "ls \${JAVA_HOME}:"; ls "${JAVA_HOME}"
log "java -version:"; java -version
Expand All @@ -91,14 +114,29 @@ log

GRADLE_ZIP_REMOTE_FILE=gradle-${GRADLE_DOWNLOAD_VERSION}-bin.zip
GRADLE_ZIP_DEST_PATH=~/Desktop/${GRADLE_DOWNLOAD_VERSION}.zip
log "Download gradle binary from the web ${GRADLE_ZIP_REMOTE_FILE} to ${GRADLE_ZIP_DEST_PATH} using wget"
wget -O ${GRADLE_ZIP_DEST_PATH} https://services.gradle.org/distributions/${GRADLE_ZIP_REMOTE_FILE}
log
GRADLE_UNZIP_HOSTING_FOLDER=/opt/gradle-${GRADLE_DOWNLOAD_VERSION}


if [[ ! -f "$GRADLE_ZIP_DEST_PATH" ]]; then
log "--> Downloading GRADLE"
if [[ "$PIPELINE" = true ]]; then
mkdir ~/tmp
mkdir ~/tmp/opt
GRADLE_ZIP_DEST_PATH=~/tmp/${GRADLE_DOWNLOAD_VERSION}.zip
GRADLE_UNZIP_HOSTING_FOLDER=~/tmp/opt/gradle-${GRADLE_DOWNLOAD_VERSION}
log "Download gradle binary from the web ${GRADLE_ZIP_REMOTE_FILE} to ${GRADLE_ZIP_DEST_PATH} using wget"
wget -O ${GRADLE_ZIP_DEST_PATH} https://services.gradle.org/distributions/${GRADLE_ZIP_REMOTE_FILE}
log
else
log "Download gradle binary from the web ${GRADLE_ZIP_REMOTE_FILE} to ${GRADLE_ZIP_DEST_PATH} using curl"
COMMAND="curl -L -o ${GRADLE_ZIP_DEST_PATH} https://services.gradle.org/distributions/${GRADLE_ZIP_REMOTE_FILE}"
sudo curl -L -o ${GRADLE_ZIP_DEST_PATH} https://services.gradle.org/distributions/${GRADLE_ZIP_REMOTE_FILE}
fi
fi


GRADLE_UNZIP_HOSTING_FOLDER=/opt/gradle-${GRADLE_DOWNLOAD_VERSION}
log "Unzip gradle zipfile ${GRADLE_ZIP_DEST_PATH} to ${GRADLE_UNZIP_HOSTING_FOLDER}"
sudo unzip -n -d ${GRADLE_UNZIP_HOSTING_FOLDER} ${GRADLE_ZIP_DEST_PATH}
unzip -n -d ${GRADLE_UNZIP_HOSTING_FOLDER} ${GRADLE_ZIP_DEST_PATH}
log


Expand Down Expand Up @@ -137,16 +175,17 @@ log "./gradlew assembleDebug"
BUILD_EXIT_CODE=$?
log


print_sdk_info
log


if [[ $BUILD_EXIT_CODE -eq 0 ]]; then
if [[ ! -z $DEVICE ]]; then
log "installing on $DEVICE"
adb -s $DEVICE install ./build/outputs/apk/phone/debug/talkback-phone-debug.apk
fi
print_sdk_info
log

log "find . -name *.apk"
find . -name "*.apk"
log
fi


exit $BUILD_EXIT_CODE ### This should be the last line in this file
45 changes: 45 additions & 0 deletions download_resources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
echo "talkback/src/main/res/drawable-anydpi-v26/icon_tb4d.xml" > tempfile.txt
echo "talkback/src/main/res/drawable-anydpi-v26/icon_tb4d_round.xml" >> tempfile.txt
echo "talkback/src/main/res/drawable-hdpi/icon_tb4d.png" >> tempfile.txt
echo "talkback/src/main/res/drawable-hdpi/icon_tb4d_round.png" >> tempfile.txt
echo "talkback/src/main/res/drawable-ldpi/icon_tb4d.png" >> tempfile.txt
echo "talkback/src/main/res/drawable-ldpi/icon_tb4d_round.png" >> tempfile.txt
echo "talkback/src/main/res/drawable-mdpi/icon_tb4d.png" >> tempfile.txt
echo "talkback/src/main/res/drawable-mdpi/icon_tb4d_round.png" >> tempfile.txt
echo "talkback/src/main/res/drawable-xhdpi/icon_tb4d.png" >> tempfile.txt
echo "talkback/src/main/res/drawable-xhdpi/icon_tb4d_round.png" >> tempfile.txt
echo "talkback/src/main/res/drawable-xxhdpi/icon_tb4d.png" >> tempfile.txt
echo "talkback/src/main/res/drawable-xxhdpi/icon_tb4d_round.png" >> tempfile.txt
echo "talkback/src/main/res/drawable-xxxhdpi/icon_tb4d.png" >> tempfile.txt
echo "talkback/src/main/res/drawable-xxxhdpi/icon_tb4d_round.png" >> tempfile.txt
echo "talkback/src/main/res/drawable/ic_tb4d_launcher_background.xml" >> tempfile.txt
echo "talkback/src/main/res/drawable/ic_tb4d_launcher_foreground.xml" >> tempfile.txt
echo "talkback/src/main/res/drawable/talkback_intro.png" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_1.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_2.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_3.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_4.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_5.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_6.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_7.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_8.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_9.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_10.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_11.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_12.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_13.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_14.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_15.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/rounded_corner_16.xml" >> tempfile.txt
echo "utils/src/main/res/values/integers.xml" >> tempfile.txt
echo "utils/src/main/res/drawable/toast_transition.xml" >> tempfile.txt

URL=https://raw.githubusercontent.com/qbalsdon/talkback/feature/tb4d_modifications/
mkdir ./utils/src/main/res/drawable/
cat tempfile.txt | while read ITEM
do
curl -L $URL$ITEM -o ./$ITEM
done

rm tempfile.txt
10 changes: 8 additions & 2 deletions shared.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// For building the open-source release of TalkBack.

ext {
talkbackApplicationId = "com.android.talkback"
talkbackApplicationId = "com.android.talkback4d"
}

android {
compileSdkVersion 'android-Tiramisu'
compileSdkVersion 'android-33'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -59,3 +59,9 @@ dependencies {
// UI understanding
implementation 'joda-time:joda-time:2.9.9'
}

android {
defaultConfig {
buildConfigField("String", "APPLICATION_ID", "\"" + talkbackApplicationId + "\"")
}
}
2 changes: 1 addition & 1 deletion src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.talkback"
package="com.android.talkback4d"
>

<!-- Strings with the format ${foo}, such as ${applicationId}, are called
Expand Down
8 changes: 5 additions & 3 deletions talkback/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@

<!-- TalkBack -->
<service
android:icon="@drawable/icon"
android:name="com.google.android.marvin.talkback.TalkBackService"
android:icon="@drawable/icon_tb4d"
android:roundIcon="@drawable/icon_tb4d_round"
android:name="com.developer.talkback.TalkBackDevService"
android:exported="true"
android:label="@string/talkback_title"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
Expand All @@ -104,7 +105,8 @@
</service>

<service
android:icon="@drawable/icon"
android:icon="@drawable/icon_tb4d"
android:roundIcon="@drawable/icon_tb4d_round"
android:name="com.google.android.accessibility.talkback.ipc.IpcService"
android:enabled="true"
android:exported="false"
Expand Down
Loading