+ * Unpatched YouTube uses a layout fixed thread pool between 1 and 3 threads: + *
+ * 1 thread - > Device has less than 6 cores + * 2 threads -> Device has over 6 cores and less than 6GB of memory + * 3 threads -> Device has over 6 cores and more than 6GB of memory + *+ * + * Using more than 1 thread causes layout issues such as the You tab watch/playlist shelf + * that is sometimes incorrectly hidden (ReVanced is not hiding it), and seems to + * fix a race issue if using the active navigation tab status with litho filtering. + */ + private static final int LITHO_LAYOUT_THREAD_POOL_SIZE = 1; + + /** + * Placeholder for actual filters. + */ + private static final class DummyFilter extends Filter { } + + private static final Filter[] filters = new Filter[] { + new DummyFilter() // Replaced patching, do not touch. + }; + + private static final StringTrieSearch pathSearchTree = new StringTrieSearch(); + private static final StringTrieSearch identifierSearchTree = new StringTrieSearch(); + + private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; + + /** + * Because litho filtering is multi-threaded and the buffer is passed in from a different injection point, + * the buffer is saved to a ThreadLocal so each calling thread does not interfere with other threads. + */ + private static final ThreadLocal