am d3b82c9e: (-s ours) am b27db3b5: am 58fd9eb6: Import revised translations.  DO NOT MERGE

* commit 'd3b82c9e89bed0deeb47554d73f114f077a6730b':
  Import revised translations.  DO NOT MERGE
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index 74c2080..d6422a0 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -18,6 +18,6 @@
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="8842303127802367578">"Suchanwendungsanbieter"</string>
     <string name="search_label" msgid="6182832093760999173">"Apps"</string>
-    <string name="application_desc" msgid="888412554142684749">"App"</string>
+    <string name="application_desc" msgid="888412554142684749">"Anwendung"</string>
     <string name="settings_description" msgid="966629744054022387">"Namen der installierten Anwendungen"</string>
 </resources>
diff --git a/src/com/android/providers/applications/ApplicationsProvider.java b/src/com/android/providers/applications/ApplicationsProvider.java
index e46aa52..d6a4f00 100644
--- a/src/com/android/providers/applications/ApplicationsProvider.java
+++ b/src/com/android/providers/applications/ApplicationsProvider.java
@@ -39,9 +39,7 @@
 import android.database.Cursor;
 import android.database.DatabaseUtils;
 import android.database.sqlite.SQLiteDatabase;
-import android.database.sqlite.SQLiteException;
 import android.database.sqlite.SQLiteQueryBuilder;
-import android.database.sqlite.SQLiteStatement;
 import android.net.Uri;
 import android.os.Handler;
 import android.os.HandlerThread;
@@ -52,7 +50,6 @@
 import android.util.Log;
 
 import java.lang.Runnable;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -375,8 +372,9 @@
     }
 
     private Cursor getSuggestions(String query, String[] projectionIn) {
-        // No zero-query suggestions
-        if (TextUtils.isEmpty(query)) {
+        // No zero-query suggestions except for global search, to avoid leaking info about apps
+        // that have been used.
+        if (TextUtils.isEmpty(query) && !canRankByLaunchCount()) {
             return null;
         }
         return searchApplications(query, projectionIn, sSearchSuggestionsProjectionMap);
@@ -409,34 +407,41 @@
 
     private Cursor searchApplications(String query, String[] projectionIn,
             Map<String, String> columnMap) {
+        final boolean zeroQuery = TextUtils.isEmpty(query);
         SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
         qb.setTables(APPLICATIONS_LOOKUP_JOIN);
         qb.setProjectionMap(columnMap);
-        if (!TextUtils.isEmpty(query)) {
+        if (!zeroQuery) {
             qb.appendWhere(buildTokenFilter(query));
+        } else {
+            if (canRankByLaunchCount()) {
+                qb.appendWhere(LAUNCH_COUNT + " > 0");
+            }
         }
         // don't return duplicates when there are two matching tokens for an app
         String groupBy = APPLICATIONS_TABLE + "." + _ID;
-        String orderBy = getOrderBy();
+        String orderBy = getOrderBy(zeroQuery);
         Cursor cursor = qb.query(mDb, projectionIn, null, null, groupBy, null, orderBy);
         if (DBG) Log.d(TAG, "Returning " + cursor.getCount() + " results for " + query);
         return cursor;
     }
 
-    private String getOrderBy() {
+    private String getOrderBy(boolean zeroQuery) {
         // order first by whether it a full prefix match, then by launch
         // count (if allowed, frequently used apps rank higher), then name
         // MIN(token_index) != 0 is true for non-full prefix matches,
         // and since false (0) < true(1), this expression makes sure
         // that full prefix matches come first.
         StringBuilder orderBy = new StringBuilder();
-        orderBy.append("MIN(token_index) != 0");
-
-        if (canRankByLaunchCount()) {
-            orderBy.append(", " + LAUNCH_COUNT + " DESC");
+        if (!zeroQuery) {
+            orderBy.append("MIN(token_index) != 0, ");
         }
 
-        orderBy.append(", " + NAME);
+        if (canRankByLaunchCount()) {
+            orderBy.append(LAUNCH_COUNT + " DESC, ");
+        }
+
+        orderBy.append(NAME);
 
         return orderBy.toString();
     }