Improvements to SuggestClient

NEW
Unassigned

Status

()

Firefox for Android
General
4 years ago
4 years ago

People

(Reporter: Margaret, Unassigned, Mentored)

Tracking

Trunk
All
Android
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
Follow-ups to bug 1035341. We'll want to land these changes in the current version of SuggestClient in the tree, since eventually we'll move over to using that version of the file for the search activity.

From bug 1035341 comment 22:

:::
mobile/android/search/java/org/mozilla/search/autocomplete/SuggestClient.java
@@ +84,5 @@
> +                json = convertStreamToString(in);
> +            } finally {
> +                if (urlConnection != null)
> +                    urlConnection.disconnect();
> +                if (in != null) {

Blergh, you know how I hate this kind of thing :D

More precise try blocks, please!

@@ +93,5 @@
> +                    }
> +                }
> +            }
> +
> +            if (json != null) {

Early return.

@@ +131,5 @@
> +        ConnectivityManager connectivity = (ConnectivityManager) mContext
> +                .getSystemService(Context.CONNECTIVITY_SERVICE);
> +        if (connectivity == null)
> +            return null;
> +        return connectivity.getActiveNetworkInfo();

IIRC all of this is platform version dependent. Comment accordingly?
(Reporter)

Comment 1

4 years ago
FYI, the file I'm referring to is:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/home/SuggestClient.java

We will probably want to move that out of the home package when we start using it for both BrowserSearch and the search activity.
You need to log in before you can comment on or make changes to this bug.