0

In Android, it's possible to search for a specific setting by clicking the magnifying glass in the top right corner of the Settings app and typing. However, I haven't found a way to remove earlier search queries.

I have recently misspelled a word, and it always pops up when I search for something else.

Is there a way to clear the search history, or, better, to remove a specific search?

2

Clearing the Settings App data will not reset any of your settings to their original state, but should clear the search history.


In the settings, navigate to your apps and find Settings and tap on Clear Data. The app should close and when opened back up, the search history should be cleared.

2

Note: I've tested this solution on CM12.


Three answers saying the same thing but are rather extreme in their approach. I want to remove one query out of dozens I made. Why should I remove everything just to remove one? Not fair!

First things first:

In Android, it's possible to search for a specific setting by clicking the magnifying glass in the top right corner of the settings app and typing.

I don't think that's true for any stock ROM. This seems to be a CM specific feature, and based on the tags, the ROM is CM12.1.

It is an assumption that if you're using Cyanogenmod then the device would be rooted. Considering it to be the case, install SQLite Editor.

The queries that you make using the lens icon are saved in a table saved_queries with time-stamp, under the database search_index.db, located in the data directory of Settings (/data/data/com.android.settings/databases/search_index.db).

Instructions

  1. Launch SQLite Editor
  2. Under Apps tap Settings (com.android.settings)
  3. Tap search_index.db, or do a Full Scan if you don't see the entry
  4. Go to saved_queries
  5. Choose the search query you don't want to see in Settings, and select the trash icon at the top

Changes would take place immediately. If not, force-close the Settings app from Settings → Apps → All → Settings, and then proceed with aforesaid instructions. You may optionally reboot as well.


I heard that you like fancy stuff

You can use to achieve the goal. The commands would be:

  1. This command would give you the schema of saved_queries table:

    adb shell su -c 'sqlite3 /data/data/com.android.settings/databases/search_index.db ".schema saved_queries"'
    

    Output would be:

    CREATE TABLE saved_queries(query VARCHAR(64) NOT NULL, timestamp INTEGER);
    

    The columns are query and timestamp. Use this resource to know the details about sqlite commands.

  2. List all the entries in the table saved_queries:

    adb shell su -c 'sqlite3 /data/data/com.android.settings/databases/search_index.db "SELECT * from saved_queries"'
    

    Output would be like:

    pin|1437892238443
    berserk|1438802356524
    manga|1438802367295
    

    The output is in the order of schema you saw in the last command.

  3. Select and delete your search query from the table:

    adb shell su -c 'sqlite3 /data/data/com.android.settings/databases/search_index.db "DELETE from saved_queries where query=\"pin\""'
    

    You can confirm from the last command that your query is gone for good from the table, and so as from the search entries listed under lens icon of Settings app.

  4. As said in first part, you can force-close the Settings app if needed. Do:

    adb shell su -c 'am force-stop com.android.settings'
    

You can use a terminal app like Terminal Emulator to achieve the goal as well. Simply do su, and then follow the sqlite3 commands (i.e. remove adb shell su -c '' from the commands).


Screenshots before and after tweaks:

(Click image to enlarge; hover to see detail)

IMG: Notice 'rofl' IMG: Notice that 'rofl' is now gone


For Non-rooted devices

No salvation other than doing Settings → Apps → All → Settings → Force Stop → Clear data, as suggested in other answers. (Don't bother about this step because your custom settings are saved in Settings Storage app (com.android.providers.settings)). You can't access the data directory of Settings app since you don't meet the privileges to access it.

Furthermore, you can't do tinkering with backup taken using adb backup either as android:allowBackup="false" is declared in Manifest file of Settings, which means no backup is allowed at all.

We're good to go now!

0

You can try to clear cache or data of Settings application. Do this by opening the Settings application and opening Apps. Scroll sideways to the All tab and find the Settings application. There press the Clear cache button. If this does not help try pressing the Clear data button and confirming the action.

-1

On Android Lollipop,

Settings > Apps > ALL > Settings > Clear Data

A confirmation dialog asking "Delete app data?" will open and on pressing OK the Settings app menu closes by itself and your previous searches won't be displayed.

Note: This will not change/affect your Phone Settings anyway but only clears the Setting's App Data.

  • 2
    Not only Lollipop. Same place/procedure at least since ICS :) // BTW: Have you noticed there are already two answers proposing the same? ;) – Izzy Aug 5 '15 at 21:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.