Add search loader for installed apps.

- The loader filters out system apps.
- Loader performs case-insensitive match with app names.
- SearchResultAdapter combines results from multiple loaders into a
  single list.

Fixes: 33347966
Test: make RunSettingsRoboTests
Change-Id: I228ca6fb82f0ac5151b2346c079c2de41104a4df
This commit is contained in:
Fan Zhang
2016-12-06 16:22:16 -08:00
parent 413eaa4070
commit 36d0d143be
16 changed files with 445 additions and 179 deletions

View File

@@ -18,6 +18,7 @@ package com.android.settings.applications;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import java.util.List;
@@ -29,24 +30,30 @@ import java.util.List;
* the API version supported by Robolectric.
*/
public interface PackageManagerWrapper {
/**
* Returns the real {@code PackageManager} object.
*/
PackageManager getPackageManager();
/**
* Calls {@code PackageManager.getInstalledApplicationsAsUser()}.
*
* @see android.content.pm.PackageManager.PackageManager#getInstalledApplicationsAsUser
* @see android.content.pm.PackageManager#getInstalledApplicationsAsUser
*/
List<ApplicationInfo> getInstalledApplicationsAsUser(int flags, int userId);
/**
* Calls {@code PackageManager.hasSystemFeature()}.
*
* @see android.content.pm.PackageManager.PackageManager#hasSystemFeature
* @see android.content.pm.PackageManager#hasSystemFeature
*/
boolean hasSystemFeature(String name);
/**
* Calls {@code PackageManager.queryIntentActivitiesAsUser()}.
*
* @see android.content.pm.PackageManager.PackageManager#queryIntentActivitiesAsUser
* @see android.content.pm.PackageManager#queryIntentActivitiesAsUser
*/
List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, int flags, int userId);
}