History log of /frameworks/base/core/java/android/app/SuggestionsAdapter.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ba223760895e62ad2fcb85476984cb29018860c9 26-Aug-2009 Bjorn Bringert <bringert@android.com> Close suggestion cursors that arrive after adapter is closed

Before, after using the Browser, memory-hungry apps could
become very sluggish. This was because the search dialog in the
system process had the BrowserProvider open, which in turn had
EnhancedGoogleSearch open. Since EhancedGoogleSearch runs in acore,
the system would keep both the Browser process and acore to stay
around forever.

The cause (or at least one common cause) for this was that
if the user types quickly, and clicks on a suggestion before
the displayed suggestions have caught up, some suggestion cursors
are not be closed.

This change solves this problem by adding a close() method to
SuggestionsAdapter. SuggestionsAdapter now closes any cursors
that are passed to it after close() is called.

Fixes http://b/issue?id=2078226
"global search holding reference to browser: system -> browser -> acore = :("
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
e303d2cf94da6bb7f0569fbddd6dfd5b85ed8295 06-Aug-2009 Mike LeBeau <mlebeau@android.com> Send a special respond to the cursor in SuggestionsAdapter to tell it to
close itself directly because it may not happen correctly for some cursors
currently. This fixes http://b/2036290, which is being caused by
http://b/2015069 which we are not fixing for Donut, so this is a hack around
that for the time being.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
a02d0d60204b94f88da4896f7dcfa8d58dca5c43 05-Aug-2009 Karl Rosaen <krosaen@google.com> Guard against remote process dying when retrieving column from cursor.

Fixes bug 2035791.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
9377738cdbb7eb0a1267cb536443cbed700ff5e9 27-Jul-2009 Bjorn Bringert <bringert@android.com> Remove search dialog PRE_CLOSE event

This is part of the fix for http://b/issue?id=2000655
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
6ddaa3497ce7af2c303771365449501e2be52511 27-Jul-2009 Bjorn Bringert <bringert@android.com> Send max displayed position in search dialog click event

This is part of the fix for http://b/issue?id=2000655
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
92f461ea66d0c326ea6705cce9932b753954c690 24-Jul-2009 Karl Rosaen <krosaen@google.com> add some more defensiveness to SuggestionsAdapter to avoid system process crashes.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
6aaeba20d21adf1973af153fb15753801097e62a 22-Jul-2009 Bjorn Bringert <bringert@android.com> Remove background padding workaround from SuggestionsAdapter

Romain has checked in a framework fix,
https://android-git.corp.google.com/g/8218
so the workaround added in
https://android-git.corp.google.com/g/8209
is no longer needed.

Fixes http://b/issue?id=1996635
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
8051172a285a4b5926186e40d1c7942a93c4eb15 22-Jul-2009 Bjorn Bringert <bringert@android.com> Work around StateListDrawable padding in search suggestions

Sometimes when searching, some of the suggestions had no left padding.
The left-hand side icons were flush with the left edge of the screen.
The problems was that setting a StateListDrawable as a background
will always set the padding of a View, because of a problem in
DrawableContainer.

DrawableContainer.DrawableContainerState.getConstantPadding()
will always return a Rect if mVariablePadding is false, which
makes DrawableContainer.getPadding() return true, which
causes View to change the padding.

As a workaround, we use setVariablePadding(true) on the background
that we create.

Fixes http://b/editIssue?id=1984813
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
dfefa3e915938aa1eeeaa7c0910a882bded7bcf7 17-Jul-2009 Bjorn Bringert <bringert@android.com> Copy cached drawables in search dialog.

Before, Drawables for cached icons were reused. This is not good,
since they can then share mutable state information. This change
copies all Drawables when getting them from the cache, storing
only the constant state in the cache.

Hopefully fixes http://b/issue?id=1984813
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
8bf92e003d89be00c7cb9209b3ffba2658523734 16-Jul-2009 Karl Rosaen <krosaen@google.com> Add ability to delay messages in Filter based on constraint. Use this to delay 500ms for delete keys in the search dialog.

Holding down delete is nice and zippy in the browser now :)
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
84ee74335ffae80c304224b9d40792b9b95a987c 16-Jul-2009 Bjorn Bringert <bringert@android.com> Only parse search suggestions that look like HTML

HTML parsing of search suggestions is still a major
CPU hog in the search dialog. This change first
checks if the text contains any HTML markup
(by looking for < and &) before bothering to
treat it as HTML.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
391eaa3ba8c9883c9c0d6bf3b5ab742c9cb38594 16-Jul-2009 Bjorn Bringert <bringert@android.com> Get rid of drawing hacks for search dialog suggestions

Before, SuggestionsAdapter parsed every HTML formatted
string three times, to support state-dependent colors
in <font> tags. Now that there is support in Html
for color resources (added in
https://android-git.corp.google.com/g/7441),
we can get rid of this code.

Also, SuggestionsAdapter had a special purpose view
for drawing background colors when suggestion items
were not selected or pressed. This change replaces that
code with a StateListDrawable of ColorDrawables.

Before this change, HTML parsing used ~17% (uncontrolled benchmark,
just did some random searching) of the system_process CPU.
This change should reduce that by 2/3, i.e. about ~11% total
system_process reduction.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
c1d82e68eb4aae1b575e82b08e71a87670cc1532 14-Jul-2009 Bjorn Bringert <bringert@android.com> Use activity icon when search suggestion icon is missing

New left-hand side icon fallback logic in search dialog:

1. If the search dialog gets no icon column, it shows no
icon (like before). This would handle the case of in-app
search where the provider does not include icons.
2. If the icon column is empty, or there is an error converting
the icon id or URI to a drawable, the search dialog identifies
the suggestion source by looking at the
SUGGEST_COLUMN_INTENT_COMPONENT_NAME.
3. If SUGGEST_COLUMN_INTENT_COMPONENT_NAME is empty or not set,
the current searchable activity is considered the suggestion source.
4. Try to get the activity icon of the suggestion source.
5. Fall back to the application icon of the suggestion source
if there is no activity icon.
6. Fall back to some generic icon if there is no application icon.

Fixes http://b/issue?id=1905757
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
313ea433d18e7fd5438b94c0606c496fcc7a2f88 09-Jul-2009 Satish Sampath <satish@android.com> Make suggestion text color change based on the item state.

We support a ColorStateList reference now as a valid font color value
in the given html and manage html strings for all supported states
which we dynamically set while drawing the items.

This will get checked in along with changes to GlobalSearch,
EnhancedGoogleSearchProvider and Browser to make them use the new
model.

Bug: http://b/issue?id=1865037
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
544450b4eee175c78a1ca8647a3bfaca4aecf47a 24-Jun-2009 Bjorn Bringert <bringert@android.com> Fix NPE in SuggestionsAdapter when cursor is null.

Fixes http://b/issue?id=1940013
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
8d1538237847baf381787b881141f8c0478bef5b 22-Jun-2009 Bjorn Bringert <bringert@android.com> Make all static methods in SearchManager non-static.

They were only static because of a now removed restriction that
only activity contexts could instantiate SearchManager.
This only changes hidden APIs, but all users of the changed methods
must be updated to use them non-statically before this is submitted.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
7f50c08fb998786a2963e979cd5b4347e64808e3 12-Jun-2009 Satish Sampath <satish@android.com> Show proper suggestion item hilite on selection.

With the new implementation of using a SuggestionItemView, we no longer need to draw a solid background for all items in the suggestion listview. Hence removing the code to draw a default white background, and make the item transparent so the listview-drawn selection hilite shows through.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
aba34d96fda75cbaaae19ce6296266feb24ce365 11-Jun-2009 Satish Sampath <satish@android.com> Fix display of the selection background for search results.

I've used a simple approach of not drawing the solid background color for the selected item, thereby letting the default selection background to show through properly. This works by using the item's 'pressed' state and redraw code which are used by the listview during the tapping operation.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
048d1a4821114330c5ab7728f69ff853f1684f0a 10-Jun-2009 Karl Rosaen <krosaen@android.com> Show progress spinner while waiting for results in in app search.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
1c5fa0f31009502c539c65de99010b63cb617aac 09-Jun-2009 Satish Sampath <satish@android.com> Adds UI support for custom search widget item backgrounds.

- A new column was added to SearchManager cursors to specify background color (optional)
- Two new colour references added to the theme for normal and search widget corpus items (we need both to be opaque for the items to render properly)
- SuggestionAdapter was updated to choose the right theme colour for each item
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
320b2eeeea426dc06f7bb7f37c3d795babeb6adb 04-Jun-2009 Karl Rosaen <krosaen@android.com> SearchDialog should only do DialogCursorProtocol stuff when in global search mode.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
1c54cf0903cd81467ca41ec6733c459e10b22763 04-Jun-2009 Karl Rosaen <krosaen@android.com> Detect impressions, and cleanup the SearchDialog / SuggestionCursor communication.

(framework portion)

There are now 4 times the search dialog will check with the cursor:
- after data set changed
- when an item is clicked
- when the cursor is about to be closed
- when an item at a particular position is detected as showing

these are now the points where we can add data in either direction, which we use to accomplish:
- finding out whether there are any pending results
- find out if there is a position at which to notify when it is displayed (the "more results" triggering)
- toggling the "more results" button
- sending the max position that was displayed when the cursor is done

the new behavior (in addition to the refactoring) is improved detection of "more results" to trigger the additional sources
(it is now precise), and detection of which items were displayed to the user.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
3250fa73711537d42a9711eba6315f24d89dee0f 03-Jun-2009 Bjorn Bringert <bringert@android.com> Remove support for bitmap icons in search suggestions.

This is no longer needed, since content providers can now return
AssetFileDescriptors for in-memory data.
Bitmaps in the suggestion cursor was resopnsible for lots of
unnecessary copying, since all rows are copied out of the database
regardless of how many are displayed in the UI.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
33a22dc9c84ef12006b0c12f6d169d2a74c15284 02-Jun-2009 Bjorn Bringert <bringert@android.com> Close icon input stream in SuggestionsAdapter.

Before, SuggestionsAdapter would not close input streams after
reading icons from them. This leaks file descriptors and,
in the case of MemoryFiles, virtual address space.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
a058f02b591d971a829cb1e28d48a992e46ad85e 02-Jun-2009 Karl Rosaen <krosaen@android.com> progress towards impression and click stats on all sources, plus some internal cleanup

(framework portion)

suggestionCursor has new callbacks for impressions and clicks
- impressions now used to trigger "more" UI, cleanup apis around that

search dialog reports which position was clicked on via cursor#respond
- can now detect when sources under "more results" are clicked
- also used to simplify existing stuff:
- can detect when "more results" entry is clicked and toggle base on that (no longer need INTENT_ACTION_CURSOR_RESPOND one off)
- use response from click reporting to instruct which position should be selected
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
b791f344744d39475925e480488c828e6b02999a 01-Jun-2009 Bjorn Bringert <bringert@android.com> Added some icon debug logging to SuggestionsAdapter.

Good for checking that lazy contact photos works.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
ae9760b62c400e3e7009d4a7b85e9524a5cd44fc 01-Jun-2009 Mike LeBeau <mlebeau@android.com> Add framework support for scrolling to the "More results..." list item
when it is clicked.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
91bc6f2c57efb0faf8871f885667a451e091cdc5 27-May-2009 Mike LeBeau <mlebeau@android.com> Cause the icon drawables to animate automatically by calling setVisible
false and then true on the drawables. For an AnimationDrawable, this will
trigger the desired behavior of 'automatically' starting the animation,
which should have been working to begin with according to the intended
design of AnimationDrawable (see http://b/1878430 for my description of
my correspondence with Romain). For Donut we'll just do this to work
around it, but for a later release we need to decide a better story.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
1480eb27f5321ef5fc2faeee87c7464e279a4912 21-May-2009 Mike LeBeau <mlebeau@android.com> Add support to SuggestionsAdapter to query the 'working' status
of its underlying cursor and update a spinner in the search dialog
accordingly.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
a92041306e4d73baa10fb711fb905b9590f06b26 05-May-2009 Bjorn Bringert <bringert@android.com> Refactor SearchableInfo.

- Removes the mSearchable field which was only
for communication between the constructor and
getActivityMetaData().
- Removes the badge and query rewriting fields,
since their values can be efficiently computed
on the fly.
- Makes all the other public fields private and adds getters
for them.
- Makes all fields final, except mActionKeys.
- Removes the DBG_INHIBIT_SUGGESTIONS_CONSTANT.
I don't see why we would every want that, and it
complicated making the fields final.
- Makes all fields in ActionKeyInfo final.
- Makes all fields in ActionKeyInfo private and adds getters.
- Removes the use of ActioKeyInfo.mKeyCode for failure
signalling. Uses IllegalArgumentException instead.
- Replaces the ad hoc linked list for looking up
action keys by a HashMap. This is needed to
make the fields in ActionkeyInfo final, and also avoids O(N)
lookup in the (unlikely) case that an activity
has lots of action keys.
- Don't throw exceptions when reading searchable
meta-data, since that could crash SearchManagerService.
- Adds debug logging.
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
4369397d0697810241f7a7ab22891930067166dd 24-Apr-2009 Bjorn Bringert <> AI 147681: Fix SearchDialog crash on missing FORMAT suggestion column.
CL 147456 introduced support for HTML formatted search suggestions.
This is triggered by the value "html" in the SUGGEST_COLUMN_FORMAT
column. However, the code failed to check that the
SUGGEST_COLUMN_FORMAT column was present before trying to read it.
This resulted in an IllegalStateException being thrown when searching
with a suggestion provider that does not include the SUGGEST_COLUMN_FORMAT
column. This broke search at least in the Contacts and Music apps.

Automated import of CL 147681
/frameworks/base/core/java/android/app/SuggestionsAdapter.java
875d50a4b9294b2be33cff6493cae7acd1d07ea7 24-Apr-2009 Karl Rosaen <> AI 147564: Merge back from search branch to donut. Notes:
- all public apis and framework changes have been reviewed by relevant folks in our branch (e.g romainguy)
- all new public apis are @hidden; they will still get reviewed by api council once we're in git
- other than that, it's mostly GlobalSearch and search dialog stuff, a new apps provider, and some tweaks
to the contacts provider that was reviewed by jham

Automated import of CL 147564
/frameworks/base/core/java/android/app/SuggestionsAdapter.java