big picture:
user on device home screen overlay application in arbitrary corner. overlay small icon no functionality (can register if has been touched) other presence.
is possible know when user has clicked outside overlay. can tell when user touches overlay itself, know if user has touched screen not overlay?
does not matter being touched, if screen being touched on device.
also, same scenario, possible know user has clicked button? instance, user clicks contacts application (or camera, or application), way read action? not care application/button clicked, 1 clicked.
just trying learn possible, please no need write out code. maybe pointers in right direction. input.
for first scenario can try chat heads(like facebook messanger) using intentservice.