Allow system home app to show when filtering app list.

am: 8089d48968

Change-Id: I94d1cb27c61cab5e5a7e16c6fc82c66e08ce8246
This commit is contained in:
Fan Zhang
2016-07-27 21:24:26 +00:00
committed by android-build-merger

View File

@@ -749,6 +749,7 @@ public class ApplicationsState {
static final int MSG_LOAD_ICONS = 3;
static final int MSG_LOAD_SIZES = 4;
static final int MSG_LOAD_LAUNCHER = 5;
static final int MSG_LOAD_HOME_APP = 6;
boolean mRunning;
@@ -817,13 +818,33 @@ public class ApplicationsState {
if (!mMainHandler.hasMessages(MainHandler.MSG_LOAD_ENTRIES_COMPLETE)) {
mMainHandler.sendEmptyMessage(MainHandler.MSG_LOAD_ENTRIES_COMPLETE);
}
sendEmptyMessage(MSG_LOAD_LAUNCHER);
sendEmptyMessage(MSG_LOAD_HOME_APP);
}
} break;
case MSG_LOAD_HOME_APP: {
final List<ResolveInfo> homeActivities = new ArrayList<>();
mPm.getHomeActivities(homeActivities);
synchronized (mEntriesMap) {
final int entryCount = mEntriesMap.size();
for (int i = 0; i < entryCount; i++) {
if (DEBUG_LOCKING) Log.v(TAG, "MSG_LOAD_HOME_APP acquired lock");
final HashMap<String, AppEntry> userEntries = mEntriesMap.valueAt(i);
for (ResolveInfo activity : homeActivities) {
String packageName = activity.activityInfo.packageName;
AppEntry entry = userEntries.get(packageName);
if (entry != null) {
entry.isHomeApp = true;
}
}
if (DEBUG_LOCKING) Log.v(TAG, "MSG_LOAD_HOME_APP releasing lock");
}
}
sendEmptyMessage(MSG_LOAD_LAUNCHER);
}
break;
case MSG_LOAD_LAUNCHER: {
Intent launchIntent = new Intent(Intent.ACTION_MAIN, null)
.addCategory(Intent.CATEGORY_LAUNCHER);
for (int i = 0; i < mEntriesMap.size(); i++) {
int userId = mEntriesMap.keyAt(i);
// If we do not specify MATCH_DIRECT_BOOT_AWARE or
@@ -1119,6 +1140,11 @@ public class ApplicationsState {
*/
public boolean hasLauncherEntry;
/**
* Whether or not it's a Home app.
*/
public boolean isHomeApp;
public String getNormalizedLabel() {
if (normalizedLabel != null) {
return normalizedLabel;
@@ -1310,6 +1336,8 @@ public class ApplicationsState {
return true;
} else if (entry.hasLauncherEntry) {
return true;
} else if ((entry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0 && entry.isHomeApp) {
return true;
}
return false;
}