I had lunch with a friend a few weeks ago. During the course of chatting he complained that his cell service provider has a add-on service that is a bit extreme where they block incoming calls from anyone not in his contacts list for $5/month. He pays it because he gets a lot of spam calls but he's not happy about it. There are several apps available that will do the same thing but I guess he doesn't trust them. The best ones I looked at appeared to be Russian. *shrug* Anyway, for the enterprising developer here are the three components that you need to create your own app to create a incoming call fence.
- Recognize when a call is coming in.
https://developer.android.com/reference/android/telephony/PhoneStateListener#onCallStateChanged(int,%20java.lang.String) - Access the contacts list.
https://developer.android.com/training/contacts-provider/retrieve-names - End the call.
https://stackoverflow.com/questions/18065144/end-call-in-android-programmatically
There you go. Yes, there is a bunch of other stuff to do to make an app but that is mostly handled in template code that is provided by many instructional sites. Please, go forth and create.