summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Mantler <nicoya@google.com>2018-03-26 15:16:43 -0700
committerTony Mantler <nicoya@google.com>2018-04-03 10:25:02 -0700
commit18b0348378082c6d64a73b65f06c766f08eb8fdf (patch)
treef9878712e0478e605107b90e3009329e320be3dd
parent436f2235f00566e08b1c4fdd32be2495c7d22d40 (diff)
Autogenerate SearchIndexableResources subclass
Bug: 77148954 Test: RunSettingsLibRoboTests RunSettingsRoboTests RunSettingsGoogleRoboTests RunArcSettingsRoboTests Change-Id: I963d0fa47031c3ebc539987c3a2808a8583c4c16
-rw-r--r--packages/SettingsLib/search/Android.mk33
-rw-r--r--packages/SettingsLib/search/common.mk10
-rw-r--r--packages/SettingsLib/search/processor-src/com/android/settingslib/search/IndexableProcessor.java213
-rw-r--r--packages/SettingsLib/search/resources/META-INF/services/javax.annotation.processing.Processor17
-rw-r--r--packages/SettingsLib/search/src/com/android/settingslib/search/SearchIndexable.java65
-rw-r--r--packages/SettingsLib/search/src/com/android/settingslib/search/SearchIndexableResources.java35
-rw-r--r--packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesArc.java23
-rw-r--r--packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesAuto.java23
-rw-r--r--packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesBase.java34
-rw-r--r--packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesMobile.java23
-rw-r--r--packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesTv.java23
-rw-r--r--packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesWear.java23
12 files changed, 522 insertions, 0 deletions
diff --git a/packages/SettingsLib/search/Android.mk b/packages/SettingsLib/search/Android.mk
new file mode 100644
index 000000000000..cb1989157db8
--- /dev/null
+++ b/packages/SettingsLib/search/Android.mk
@@ -0,0 +1,33 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE = SettingsLib-search
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE = SettingsLib-search-host
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE = SettingsLib-annotation-processor
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ javapoet-prebuilt-jar \
+ SettingsLib-search-host
+
+LOCAL_SRC_FILES := $(call all-java-files-under, processor-src)
+
+LOCAL_JAVA_RESOURCE_DIRS := \
+ resources
+
+include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/packages/SettingsLib/search/common.mk b/packages/SettingsLib/search/common.mk
new file mode 100644
index 000000000000..05226db5cb91
--- /dev/null
+++ b/packages/SettingsLib/search/common.mk
@@ -0,0 +1,10 @@
+# Include this file to generate SearchIndexableResourcesImpl
+
+LOCAL_ANNOTATION_PROCESSORS += \
+ SettingsLib-annotation-processor
+
+LOCAL_ANNOTATION_PROCESSOR_CLASSES += \
+ com.android.settingslib.search.IndexableProcessor
+
+LOCAL_STATIC_JAVA_LIBRARIES += \
+ SettingsLib-search
diff --git a/packages/SettingsLib/search/processor-src/com/android/settingslib/search/IndexableProcessor.java b/packages/SettingsLib/search/processor-src/com/android/settingslib/search/IndexableProcessor.java
new file mode 100644
index 000000000000..10fc685015b7
--- /dev/null
+++ b/packages/SettingsLib/search/processor-src/com/android/settingslib/search/IndexableProcessor.java
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.search;
+
+import com.squareup.javapoet.ClassName;
+import com.squareup.javapoet.FieldSpec;
+import com.squareup.javapoet.JavaFile;
+import com.squareup.javapoet.MethodSpec;
+import com.squareup.javapoet.ParameterizedTypeName;
+import com.squareup.javapoet.TypeName;
+import com.squareup.javapoet.TypeSpec;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Filer;
+import javax.annotation.processing.Messager;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.Name;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.SimpleElementVisitor8;
+import javax.tools.Diagnostic.Kind;
+
+/**
+ * Annotation processor for {@link SearchIndexable} that generates {@link SearchIndexableResources}
+ * subclasses.
+ */
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
+@SupportedAnnotationTypes({"com.android.settingslib.search.SearchIndexable"})
+public class IndexableProcessor extends AbstractProcessor {
+
+ private static final String PACKAGE = "com.android.settingslib.search";
+ private static final String CLASS_BASE = "SearchIndexableResourcesBase";
+ private static final String CLASS_MOBILE = "SearchIndexableResourcesMobile";
+ private static final String CLASS_TV = "SearchIndexableResourcesTv";
+ private static final String CLASS_WEAR = "SearchIndexableResourcesWear";
+ private static final String CLASS_AUTO = "SearchIndexableResourcesAuto";
+ private static final String CLASS_ARC = "SearchIndexableResourcesArc";
+
+ private Filer mFiler;
+ private Messager mMessager;
+ private boolean mRanOnce;
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations,
+ RoundEnvironment roundEnvironment) {
+ if (mRanOnce) {
+ // Will get called once per round, but we only want to run on the first one.
+ return true;
+ }
+ mRanOnce = true;
+
+ final FieldSpec providers = FieldSpec.builder(
+ ParameterizedTypeName.get(
+ ClassName.get(Set.class),
+ TypeName.get(Class.class)),
+ "mProviders",
+ Modifier.PRIVATE, Modifier.FINAL)
+ .initializer("new $T()", HashSet.class)
+ .build();
+
+ final MethodSpec addIndex = MethodSpec.methodBuilder("addIndex")
+ .addModifiers(Modifier.PUBLIC)
+ .addParameter(ClassName.get(Class.class), "indexClass")
+ .addCode("$N.add(indexClass);\n", providers)
+ .build();
+
+ final MethodSpec.Builder baseConstructorBuilder = MethodSpec.constructorBuilder()
+ .addModifiers(Modifier.PUBLIC);
+ final MethodSpec.Builder mobileConstructorBuilder = MethodSpec.constructorBuilder()
+ .addModifiers(Modifier.PUBLIC);
+ final MethodSpec.Builder tvConstructorBuilder = MethodSpec.constructorBuilder()
+ .addModifiers(Modifier.PUBLIC);
+ final MethodSpec.Builder wearConstructorBuilder = MethodSpec.constructorBuilder()
+ .addModifiers(Modifier.PUBLIC);
+ final MethodSpec.Builder autoConstructorBuilder = MethodSpec.constructorBuilder()
+ .addModifiers(Modifier.PUBLIC);
+ final MethodSpec.Builder arcConstructorBuilder = MethodSpec.constructorBuilder()
+ .addModifiers(Modifier.PUBLIC);
+
+ for (Element element : roundEnvironment.getElementsAnnotatedWith(SearchIndexable.class)) {
+ if (element.getKind().isClass()) {
+ Name className = element.accept(new SimpleElementVisitor8<Name, Void>() {
+ @Override
+ public Name visitType(TypeElement typeElement, Void aVoid) {
+ return typeElement.getQualifiedName();
+ }
+ }, null);
+ if (className != null) {
+ SearchIndexable searchIndexable = element.getAnnotation(SearchIndexable.class);
+
+ int forTarget = searchIndexable.forTarget();
+ if (forTarget == SearchIndexable.ALL) {
+ baseConstructorBuilder.addCode("$N($L.class);\n", addIndex, className);
+ } else if ((forTarget & SearchIndexable.MOBILE) != 0) {
+ mobileConstructorBuilder.addCode("$N($L.class);\n", addIndex, className);
+ } else if ((forTarget & SearchIndexable.TV) != 0) {
+ tvConstructorBuilder.addCode("$N($L.class);\n", addIndex, className);
+ } else if ((forTarget & SearchIndexable.WEAR) != 0) {
+ wearConstructorBuilder.addCode("$N($L.class);\n", addIndex, className);
+ } else if ((forTarget & SearchIndexable.AUTO) != 0) {
+ autoConstructorBuilder.addCode("$N($L.class);\n", addIndex, className);
+ } else if ((forTarget & SearchIndexable.ARC) != 0) {
+ arcConstructorBuilder.addCode("$N($L.class);\n", addIndex, className);
+ }
+ } else {
+ throw new IllegalStateException("Null classname from " + element);
+ }
+ }
+ }
+
+ final MethodSpec getProviderValues = MethodSpec.methodBuilder("getProviderValues")
+ .addAnnotation(Override.class)
+ .addModifiers(Modifier.PUBLIC)
+ .returns(ParameterizedTypeName.get(
+ ClassName.get(Collection.class),
+ TypeName.get(Class.class)))
+ .addCode("return $N;\n", providers)
+ .build();
+
+ final TypeSpec baseClass = TypeSpec.classBuilder(CLASS_BASE)
+ .addModifiers(Modifier.PUBLIC)
+ .addSuperinterface(ClassName.get(SearchIndexableResources.class))
+ .addField(providers)
+ .addMethod(baseConstructorBuilder.build())
+ .addMethod(addIndex)
+ .addMethod(getProviderValues)
+ .build();
+ final JavaFile searchIndexableResourcesBase = JavaFile.builder(PACKAGE, baseClass).build();
+
+ final JavaFile searchIndexableResourcesMobile = JavaFile.builder(PACKAGE,
+ TypeSpec.classBuilder(CLASS_MOBILE)
+ .addModifiers(Modifier.PUBLIC)
+ .superclass(ClassName.get(PACKAGE, baseClass.name))
+ .addMethod(mobileConstructorBuilder.build())
+ .build())
+ .build();
+
+ final JavaFile searchIndexableResourcesTv = JavaFile.builder(PACKAGE,
+ TypeSpec.classBuilder(CLASS_TV)
+ .addModifiers(Modifier.PUBLIC)
+ .superclass(ClassName.get(PACKAGE, baseClass.name))
+ .addMethod(tvConstructorBuilder.build())
+ .build())
+ .build();
+
+ final JavaFile searchIndexableResourcesWear = JavaFile.builder(PACKAGE,
+ TypeSpec.classBuilder(CLASS_WEAR)
+ .addModifiers(Modifier.PUBLIC)
+ .superclass(ClassName.get(PACKAGE, baseClass.name))
+ .addMethod(wearConstructorBuilder.build())
+ .build())
+ .build();
+
+ final JavaFile searchIndexableResourcesAuto = JavaFile.builder(PACKAGE,
+ TypeSpec.classBuilder(CLASS_AUTO)
+ .addModifiers(Modifier.PUBLIC)
+ .superclass(ClassName.get(PACKAGE, baseClass.name))
+ .addMethod(autoConstructorBuilder.build())
+ .build())
+ .build();
+
+ final JavaFile searchIndexableResourcesArc = JavaFile.builder(PACKAGE,
+ TypeSpec.classBuilder(CLASS_ARC)
+ .addModifiers(Modifier.PUBLIC)
+ .superclass(ClassName.get(PACKAGE, baseClass.name))
+ .addMethod(arcConstructorBuilder.build())
+ .build())
+ .build();
+
+ try {
+ searchIndexableResourcesBase.writeTo(mFiler);
+ searchIndexableResourcesMobile.writeTo(mFiler);
+ searchIndexableResourcesTv.writeTo(mFiler);
+ searchIndexableResourcesWear.writeTo(mFiler);
+ searchIndexableResourcesAuto.writeTo(mFiler);
+ searchIndexableResourcesArc.writeTo(mFiler);
+ } catch (IOException e) {
+ mMessager.printMessage(Kind.ERROR, "Error while writing file: " + e);
+ }
+ return true;
+ }
+
+ @Override
+ public synchronized void init(ProcessingEnvironment processingEnvironment) {
+ super.init(processingEnvironment);
+ mFiler = processingEnvironment.getFiler();
+ mMessager = processingEnvironment.getMessager();
+ }
+}
diff --git a/packages/SettingsLib/search/resources/META-INF/services/javax.annotation.processing.Processor b/packages/SettingsLib/search/resources/META-INF/services/javax.annotation.processing.Processor
new file mode 100644
index 000000000000..13b8fa8d07dc
--- /dev/null
+++ b/packages/SettingsLib/search/resources/META-INF/services/javax.annotation.processing.Processor
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+com.android.settingslib.search.IndexableProcessor
diff --git a/packages/SettingsLib/search/src/com/android/settingslib/search/SearchIndexable.java b/packages/SettingsLib/search/src/com/android/settingslib/search/SearchIndexable.java
new file mode 100644
index 000000000000..638fa3e98138
--- /dev/null
+++ b/packages/SettingsLib/search/src/com/android/settingslib/search/SearchIndexable.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.search;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Denotes that the class should participate in search indexing.
+ */
+@Retention(RetentionPolicy.SOURCE)
+public @interface SearchIndexable {
+ /**
+ * Bitfield for the form factors this class should be considered indexable for.
+ * Default is {@link #ALL}.
+ *
+ * TODO: actually use this value somehow
+ */
+ int forTarget() default ALL;
+
+ /**
+ * Indicates that the class should be considered indexable for Mobile.
+ */
+ int MOBILE = 1<<0;
+
+ /**
+ * Indicates that the class should be considered indexable for TV.
+ */
+ int TV = 1<<1;
+
+ /**
+ * Indicates that the class should be considered indexable for Wear.
+ */
+ int WEAR = 1<<2;
+
+ /**
+ * Indicates that the class should be considered indexable for Auto.
+ */
+ int AUTO = 1<<3;
+
+ /**
+ * Indicates that the class should be considered indexable for ARC++.
+ */
+ int ARC = 1<<4;
+
+ /**
+ * Indicates that the class should be considered indexable for all targets.
+ */
+ int ALL = MOBILE | TV | WEAR | AUTO | ARC;
+
+}
diff --git a/packages/SettingsLib/search/src/com/android/settingslib/search/SearchIndexableResources.java b/packages/SettingsLib/search/src/com/android/settingslib/search/SearchIndexableResources.java
new file mode 100644
index 000000000000..300d360e0057
--- /dev/null
+++ b/packages/SettingsLib/search/src/com/android/settingslib/search/SearchIndexableResources.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.search;
+
+import java.util.Collection;
+
+public interface SearchIndexableResources {
+
+ /**
+ * Returns a collection of classes that should be indexed for search.
+ *
+ * Each class should have the SEARCH_INDEX_DATA_PROVIDER public static member.
+ */
+ Collection<Class> getProviderValues();
+
+ /**
+ * For testing. Can't use @VisibleForTesting here because this builds as a host binary as well
+ * as a device binary.
+ */
+ void addIndex(Class indexClass);
+}
diff --git a/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesArc.java b/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesArc.java
new file mode 100644
index 000000000000..df64f4c23b6b
--- /dev/null
+++ b/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesArc.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.search;
+
+/**
+ * Stub for Intellij, not compiled! See {@link IndexableProcessor}
+ */
+public class SearchIndexableResourcesArc extends SearchIndexableResourcesBase {
+}
diff --git a/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesAuto.java b/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesAuto.java
new file mode 100644
index 000000000000..768fe4412c39
--- /dev/null
+++ b/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesAuto.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.search;
+
+/**
+ * Stub for Intellij, not compiled! See {@link IndexableProcessor}
+ */
+public class SearchIndexableResourcesAuto extends SearchIndexableResourcesBase {
+}
diff --git a/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesBase.java b/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesBase.java
new file mode 100644
index 000000000000..4870d45cff04
--- /dev/null
+++ b/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesBase.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.search;
+
+import java.util.Collection;
+
+/**
+ * Stub for Intellij, not compiled! See {@link IndexableProcessor}
+ */
+public class SearchIndexableResourcesBase implements SearchIndexableResources {
+
+ @Override
+ public Collection<Class> getProviderValues() {
+ throw new RuntimeException("STUB!");
+ }
+
+ public void addIndex(Class indexClass) {
+ throw new RuntimeException("STUB!");
+ }
+}
diff --git a/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesMobile.java b/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesMobile.java
new file mode 100644
index 000000000000..d04443b3431f
--- /dev/null
+++ b/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesMobile.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.search;
+
+/**
+ * Stub for Intellij, not compiled! See {@link IndexableProcessor}
+ */
+public class SearchIndexableResourcesMobile extends SearchIndexableResourcesBase {
+}
diff --git a/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesTv.java b/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesTv.java
new file mode 100644
index 000000000000..1a47add9a5a3
--- /dev/null
+++ b/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesTv.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.search;
+
+/**
+ * Stub for Intellij, not compiled! See {@link IndexableProcessor}
+ */
+public class SearchIndexableResourcesTv extends SearchIndexableResourcesBase {
+}
diff --git a/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesWear.java b/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesWear.java
new file mode 100644
index 000000000000..a604fefb858f
--- /dev/null
+++ b/packages/SettingsLib/search/stub-src/com/android/settingslib/search/SearchIndexableResourcesWear.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.search;
+
+/**
+ * Stub for Intellij, not compiled! See {@link IndexableProcessor}
+ */
+public class SearchIndexableResourcesWear extends SearchIndexableResourcesBase {
+}