code: public void filterActiveWindow() {
      WindowFilter.Builder filterBuilder = WindowFilter.newBuilder();
      filterBuilder.setClearFilter(true);
      filterBuilder.addIncludeIDList(getActiveWindowId());
  
      executeMessage(WindowManagerMessage.MODIFY_FILTER, filterBuilder);
    }
docs: Filter only the active window so we don't get messages from other windows (like thread
  messages).