谷歌源代码下载:
https://github.com/google/talkback/commits/master
2018年12月20日版本
build.gradle文件:
minSdkVersion 26 改为23,否则安卓6装不上
compile project(':switchaccess') 这行删除,这是安卓辅助功能“开关控制”,就是用手机硬件按键(比如音量键)来操作屏幕控件,方便手指不灵活的人
switchaccess在xml里的服务配置也全删除
shared.gradle文件
compile 'com.google.guava:guava:22.0'改为10.0,否则生成报错Caused by: com.android.dx.cf.code.SimException: default or static interface method used without --min-sdk-version >= 24
TalkBackService.java文件
这些代码要改
while (true) {
synchronized (mDisableTalkBackCompleteAction) {
if (mDisableTalkBackCompleteAction.isDone) {
break;
}
try {
mDisableTalkBackCompleteAction.wait();
} catch (InterruptedException e) {
// Do nothing
}
}
}
改为:
for (int i=0;;++i) {
if(15<=i){
break;
}
synchronized (mDisableTalkBackCompleteAction) {
if (mDisableTalkBackCompleteAction.isDone) {
break;
}
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
这样是为了避免点明或解说语音库在服务退出时一直卡住无法退出