I am able to detect which URL is being loaded in Chrome Custom Tab with help of accessibility service, and now i want to find id of back button so that i can close the tab if the url is in the block list, following is the code for click action:
List<AccessibilityNodeInfo> list = nodeInfo.
findAccessibilityNodeInfosByViewId("com.android.chrome:"id for back button"");
for (AccessibilityNodeInfo node : list) {
Log.i(TAG, "ACC::onAccessibilityEvent: back_button " + node);
node.performAction(AccessibilityNodeInfo.ACTION_CLICK);
}