1

For one of my customer, I have an Android COSU app in LockTask mode.

On an incoming/outgoing call, the InCallUI is well displayed because the phone app of the device is whitelisted.

However, in LockTask mode, the back button is still enabled in the navigation bar and their employees (as good ones :)) often hit it so they cannot hang up the conversation.

My question is:

Does it exist an Intent to bring back the InCallUI so users can interact with the keypad or hang up?

In this case, I could display an overlay (bar on top of the screen or button like Facebook Messenger) to bring back the InCallUI.

Thanks in advance :)

[EDIT] Exiting the LockTask mode is not an option ;)

Cœur
  • 37,241
  • 25
  • 195
  • 267
Doc_1faux
  • 141
  • 5
  • 15
  • Do you mean display of your cosu app during an ongoing call is not the desired behaviour? – cuihtlauac May 31 '18 at 05:05
  • In facts, for my customer, the COSU app main goal is to manage LockTask mode, app execution restriction & some tricks for displaying stock apps like Phone or PIN entry. Then, I have an other app which behaves as a Home Android app for their employees and others which launch from this one. But like "classic" Android development, I am in favor of using existing stock apps as far as possible for common tasks like phoning. – Doc_1faux May 31 '18 at 14:46
  • So yes, the Phone app (com.android.phone) and the InCallUI (com.android.incallui) are both authorized packages for the user to be able to interact with on incoming/outgoing call. So I expect, mostly for the InCallUI app, to be displayed on incoming/outgoing call and be able to provide an overlay widget to go back to it if the user hit the back button during a call while InCallUI was displayed in LockTask mode. – Doc_1faux May 31 '18 at 14:47

1 Answers1

1

Have you tried calling TelecomManager.showInCallScreen()? Its documentation says:

Requires that the method-caller be set as the system dialer app or have the READ_PHONE_STATE permission.

Since READ_PHONE_STATE is a dangerous permission, it might be granted to your COSU app. Then, per the second clause of the above quote, you should be able to expose a button bringing back the InCallService to the foreground.

I haven't tested this myself, let me know if it works.

cuihtlauac
  • 1,808
  • 2
  • 20
  • 39
  • Hi @cuihtlauac, thanks for you reply. I'm currently testing your solution... It definitely works outside LockTask mode for sure! However, I am not sure if it is the current COSU implementation which fails or the InCallUI package which is not in the authorized ones but the InCallUI is not displaying on an incoming call or on my overlay click. Is it possible that Phone app or InCallUI do not share the same package name? – Doc_1faux May 31 '18 at 13:10
  • @Doc_1faux yes the Phone (a.k.a. Dialer) and InCallUI may be different apps. What is the brand of the devices? – cuihtlauac May 31 '18 at 14:49
  • Unfortunately, there are many :D But currently, I am testing on Nokia 3 device which seems using stock apps. – Doc_1faux May 31 '18 at 15:02
  • @Doc_1faux you'll probably reach a problem here. Different manufacturers, different package names – cuihtlauac May 31 '18 at 15:07
  • 1
    You are right! Asking me this question made me take a closer look at all installed packages on this device via `adb shell` and I found that the InCallUI package is not "com.android.dialer" but "com.google.android.dialer" on this device... I have just added it to the whitelisted packages and it works very well now in LockTask mode too! Thanks a lot for your help :) – Doc_1faux May 31 '18 at 15:15