code: private void checkOnClickListener(View view, AttributeSet attrs) {
          final Context context = view.getContext();
  
          if (!(context instanceof ContextWrapper) ||
                  (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 && !ViewCompat.hasOnClickListeners(view))) {
              // Skip our compat functionality if: the Context isn't a ContextWrapper, or
              // the view doesn't have an OnClickListener (we can only rely on this on API 15+ so
              // always use our compat code on older devices)
              return;
          }
  
          final TypedArray a = context.obtainStyledAttributes(attrs, sOnClickAttrs);
          final String handlerName = a.getString(0);
          if (handlerName != null) {
              view.setOnClickListener(new DeclaredOnClickListener(view, handlerName));
          }
          a.recycle();
      }
docs: android:onClick doesn't handle views with a ContextWrapper context. This method
  backports new framework functionality to traverse the Context wrappers to find a
  suitable target.