summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Stetson <alexstetson@google.com>2020-06-15 14:10:46 -0700
committerAlex Stetson <alexstetson@google.com>2020-06-16 15:40:34 -0700
commit5c63453d6d27b68636d67069547d1eab6e1a1cc2 (patch)
tree20361415427b5c55045652e6f265734b5f2c91f2 /src
parentf48d88a3f5ec8340dce41a20030aac76afb60d9c (diff)
downloadCellBroadcastReceiver-5c63453d6d27b68636d67069547d1eab6e1a1cc2.tar.gz
Disable search indexing on auto
Android Automotive doesn't currently use this feature so it should not appear in our settings search results Bug: 156388829 Test: manual - gcar_hl_emu_x86 & sdk_gphone_x86 Change-Id: Icd93a961e3661f4865590a9752368ed6eaa8f245
Diffstat (limited to 'src')
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastSearchIndexableProvider.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastSearchIndexableProvider.java b/src/com/android/cellbroadcastreceiver/CellBroadcastSearchIndexableProvider.java
index 3d56f7b05..16dbc2649 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastSearchIndexableProvider.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastSearchIndexableProvider.java
@@ -38,6 +38,7 @@ import static android.provider.SearchIndexablesContract.NON_INDEXABLES_KEYS_COLU
import android.annotation.Nullable;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.MatrixCursor;
@@ -108,6 +109,10 @@ public class CellBroadcastSearchIndexableProvider extends SearchIndexablesProvid
@Override
public Cursor queryXmlResources(String[] projection) {
+ if (isAutomotive()) {
+ return null;
+ }
+
MatrixCursor cursor = new MatrixCursor(INDEXABLES_XML_RES_COLUMNS);
final int count = INDEXABLE_RES.length;
for (int n = 0; n < count; n++) {
@@ -126,6 +131,10 @@ public class CellBroadcastSearchIndexableProvider extends SearchIndexablesProvid
@Override
public Cursor queryRawData(String[] projection) {
+ if (isAutomotive()) {
+ return null;
+ }
+
MatrixCursor cursor = new MatrixCursor(INDEXABLES_RAW_COLUMNS);
final Resources res = getResourcesMethod();
@@ -255,4 +264,14 @@ public class CellBroadcastSearchIndexableProvider extends SearchIndexablesProvid
return cursor;
}
+
+ /**
+ * Whether or not this is an Android Automotive platform.
+ * @return true if the current platform is automotive
+ */
+ @VisibleForTesting
+ public boolean isAutomotive() {
+ return getContextMethod().getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_AUTOMOTIVE);
+ }
}