futhrevo/SpeechTrials

Auto Answer Call from Favorite Contacts in Drive Mode

Opened this issue · 11 comments

When in Drive Mode the App should auto answer any incoming phone call from favorite contacts after announcing the caller name. If not in Drive mode this feature should be de-activated.

fixed in 0e8b8fe

Auto Answer Calls Not Working

@gkbiswas share logs

This is working now. As tested on One Plus 3. @futhrevo

Incoming Call behavior not working as expected when set to "Accept All" or "Accept only Favorite".

Test was done on Samsung Galaxy S4 running Android
Incoming Call Tests on Samsung Galaxy S4 Running Android Lollipop.txt
Lollipop.
@futhrevo

Incoming Call behavior not working as expected when set to "Accept All" or "Accept only Favorite".

Test was done on Moto G5running Android N
Incoming Call Tests on Moto G5 Running Android N.txt
@futhrevo

Incoming Call behavior not working as expected when set to "Accept All" or "Accept only Favorite".

Test was done on One Plus 3 running Android N
Incoming Call Tests on One Plus 3 Running Android N.txt

@futhrevo

Re-Test for Answer Incoming Calls after upgrading Software on Samsung Galaxy S4...
@futhrevo Phone Call from Favorite Number was answered once, but wasn't answer sometimes.. Please check the logs below for two attempts. First time call was answered, second time it wasn't answered...

04-18 14:31:01.256 15943-15943/in.hedera.reku.speechtrial D/MyPhoneListener: 1 incoming no:+918939577096
04-18 14:31:01.296 15943-15943/in.hedera.reku.speechtrial E/MyPhoneListener: true
04-18 14:31:01.331 15943-15943/in.hedera.reku.speechtrial D/NotifyService: OnStartCommand
04-18 14:31:01.366 15943-13410/in.hedera.reku.speechtrial D/NotifyService: run thread
04-18 14:31:01.366 15943-13410/in.hedera.reku.speechtrial D/NotifyService: android.intent.action.PHONE_STATE
04-18 14:31:01.366 15943-13410/in.hedera.reku.speechtrial D/NotifyService: settings status is 0
04-18 14:31:02.031 15943-13410/in.hedera.reku.speechtrial D/NotifyService: Phone call from Goutam Biswas
04-18 14:31:02.361 15943-13410/in.hedera.reku.speechtrial E/NotifyService: incomingCallAction true
04-18 14:31:02.371 15943-13410/in.hedera.reku.speechtrial D/NotifyService: Trying to Answer call
04-18 14:31:02.391 15943-13410/in.hedera.reku.speechtrial D/NotifyService: Sending HEADSETHOOK to telecom server
04-18 14:31:02.396 15943-17709/in.hedera.reku.speechtrial D/NotifyService: Onstart Speaking
04-18 14:31:02.401 15943-13410/in.hedera.reku.speechtrial D/NotifyService: AnswerType.MEDIA_CONTROLLER
04-18 14:31:02.571 15943-29431/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:02.996 15943-15943/in.hedera.reku.speechtrial D/MyPhoneListener: 2 incoming no:
04-18 14:31:03.336 15943-15954/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:03.806 15943-11553/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:04.341 15943-28024/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:04.501 15943-29475/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:04.661 15943-29431/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:04.911 15943-13421/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:05.041 15943-13422/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:05.221 15943-28844/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:05.441 15943-15958/in.hedera.reku.speechtrial D/NotifyService: Ondone Speaking
04-18 14:31:05.441 15943-15958/in.hedera.reku.speechtrial D/NotifyService: resetting call volume
04-18 14:31:17.176 15943-15943/in.hedera.reku.speechtrial D/MyPhoneListener: 0 incoming no:
04-18 14:31:17.181 15943-31150/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationRemoved
04-18 14:31:17.236 15943-15954/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:17.381 15943-29431/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationRemoved
04-18 14:31:28.341 15943-15943/in.hedera.reku.speechtrial D/MyPhoneListener: 1 incoming no:+918939577096
04-18 14:31:28.356 15943-15943/in.hedera.reku.speechtrial E/MyPhoneListener: true
04-18 14:31:28.361 15943-15943/in.hedera.reku.speechtrial D/NotifyService: OnStartCommand
04-18 14:31:28.361 15943-13972/in.hedera.reku.speechtrial D/NotifyService: run thread
04-18 14:31:28.361 15943-13972/in.hedera.reku.speechtrial D/NotifyService: android.intent.action.PHONE_STATE
04-18 14:31:28.361 15943-13972/in.hedera.reku.speechtrial D/NotifyService: settings status is 0
04-18 14:31:28.401 15943-13972/in.hedera.reku.speechtrial D/NotifyService: Phone call from Goutam Biswas
04-18 14:31:28.411 15943-13972/in.hedera.reku.speechtrial E/NotifyService: incomingCallAction true
04-18 14:31:28.411 15943-13972/in.hedera.reku.speechtrial D/NotifyService: Trying to Answer call
04-18 14:31:28.416 15943-28844/in.hedera.reku.speechtrial D/NotifyService: Onstart Speaking
04-18 14:31:28.421 15943-13972/in.hedera.reku.speechtrial D/NotifyService: Answering incoming call via input keyevent
04-18 14:31:29.036 15943-15958/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:29.466 15943-29430/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:29.581 15943-11553/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:29.631 15943-31150/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:29.761 15943-13421/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:31.701 15943-28844/in.hedera.reku.speechtrial D/NotifyService: Ondone Speaking
04-18 14:31:31.701 15943-28844/in.hedera.reku.speechtrial D/NotifyService: resetting call volume
04-18 14:31:32.141 15943-29431/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:32.406 15943-17709/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationPosted
04-18 14:31:51.761 15943-29475/in.hedera.reku.speechtrial W/Bundle: Key android.text expected String but value was a android.text.SpannableString. The default value was returned.
04-18 14:31:51.776 15943-29475/in.hedera.reku.speechtrial W/Bundle: Attempt to cast generated internal exception:
java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String
at android.os.BaseBundle.getString(BaseBundle.java:921)
at in.hedera.reku.speechtrial.NotificationListenerService.onNotificationRemoved(NotificationListenerService.java:19)
at android.service.notification.NotificationListenerService.onNotificationRemoved(NotificationListenerService.java:199)
at android.service.notification.NotificationListenerService$INotificationListenerWrapper.onNotificationRemoved(NotificationListenerService.java:641)
at android.service.notification.INotificationListener$Stub.onTransact(INotificationListener.java:86)
at android.os.Binder.execTransact(Binder.java:446)
04-18 14:31:51.776 15943-29475/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 0. null onNotificationRemoved
04-18 14:32:13.926 15943-15958/in.hedera.reku.speechtrial D/ResourcesManager: creating new AssetManager and set to /system/priv-app/Telecom/Telecom.apk
04-18 14:32:13.936 15943-15958/in.hedera.reku.speechtrial W/ResourcesManager: Asset path '/system/framework/twframework.jar' does not exist or contains no resources.
04-18 14:32:13.956 15943-15958/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. Goutam Biswas onNotificationPosted
04-18 14:32:13.956 15943-15958/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. null onNotificationRemoved
04-18 14:32:14.141 15943-15943/in.hedera.reku.speechtrial D/MyPhoneListener: 0 incoming no:+918939577096
04-18 14:32:15.161 15943-29430/in.hedera.reku.speechtrial I/class in.hedera.reku.speechtrial.NotificationListenerService: 1. Goutam Biswas onNotificationRemoved

@futhrevo [Something to consider for an enhanced user experience]

Maybe one thing we can do is acknowledge that we are unable to answer call by catching the relevant exceptions?
So we can say before answering call "Trying to answer call from Caller Name"
and if some error occurs say "Sorry, unable to auto answer call from Caller Name
At least that will lead to a better user experience
I feel
This principle applies to all actions
so we want to think how to organize the code around this principle