summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Bernard Chau <bernardchau@google.com> 2016-04-13 15:58:38 +0100
committer Bernard Chau <bernardchau@google.com> 2016-04-13 18:00:06 +0100
commit186f29b6d8f00dfc16288b4972d43e874a805229 (patch)
tree8723df8287e8b05a7cb2778f1731dcfdecc27d44
parent68b19f2778989c3f4ae9eb2407f40c97e11fb57d (diff)
Includes both direct boot aware and unaware apps in Apps default view
The view should be showing a combined list of "downloaded" + "visible in launcher" apps. However, if FBE and work callenge are enabled, after a reboot the direct boot unaware apps are filtered. Reason is that PackageUserState#isMatch assumes at least one of the flags are specified and expects system to derive the aware/unaware flags according to the user's lock state if neither of them is specified. Bug: 28004355 Change-Id: Ia05edb0530023597fd219eb5e59cd71752efd279
-rw-r--r--core/java/android/content/pm/PackageUserState.java5
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java21
2 files changed, 24 insertions, 2 deletions
diff --git a/core/java/android/content/pm/PackageUserState.java b/core/java/android/content/pm/PackageUserState.java
index 8236f552901f..995d2ccce953 100644
--- a/core/java/android/content/pm/PackageUserState.java
+++ b/core/java/android/content/pm/PackageUserState.java
@@ -87,6 +87,11 @@ public class PackageUserState {
/**
* Test if the given component is considered installed, enabled and a match
* for the given flags.
+ *
+ * <p>
+ * Expects at least one of {@link PackageManager#MATCH_DIRECT_BOOT_AWARE} and
+ * {@link PackageManager#MATCH_DIRECT_BOOT_UNAWARE} are specified in {@code flags}.
+ * </p>
*/
public boolean isMatch(ComponentInfo componentInfo, int flags) {
if (!isInstalled(flags)) return false;
diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
index d353f31e59b1..4f06235647bc 100644
--- a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
+++ b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
@@ -825,8 +825,18 @@ public class ApplicationsState {
for (int i = 0; i < mEntriesMap.size(); i++) {
int userId = mEntriesMap.keyAt(i);
- List<ResolveInfo> intents = mPm.queryIntentActivitiesAsUser(launchIntent,
- PackageManager.GET_DISABLED_COMPONENTS, userId);
+ // If we do not specify MATCH_DIRECT_BOOT_AWARE or
+ // MATCH_DIRECT_BOOT_UNAWARE, system will derive and update the flags
+ // according to the user's lock state. When the user is locked, components
+ // with ComponentInfo#directBootAware == false will be filtered. We should
+ // explicitly include both direct boot aware and unaware components here.
+ List<ResolveInfo> intents = mPm.queryIntentActivitiesAsUser(
+ launchIntent,
+ PackageManager.GET_DISABLED_COMPONENTS
+ | PackageManager.MATCH_DIRECT_BOOT_AWARE
+ | PackageManager.MATCH_DIRECT_BOOT_UNAWARE,
+ userId
+ );
synchronized (mEntriesMap) {
if (DEBUG_LOCKING) Log.v(TAG, "MSG_LOAD_LAUNCHER acquired lock");
HashMap<String, AppEntry> userEntries = mEntriesMap.valueAt(i);
@@ -1102,6 +1112,10 @@ public class ApplicationsState {
public boolean mounted;
+ /**
+ * Setting this to {@code true} prevents the entry to be filtered by
+ * {@link #FILTER_DOWNLOADED_AND_LAUNCHER}.
+ */
public boolean hasLauncherEntry;
public String getNormalizedLabel() {
@@ -1272,6 +1286,9 @@ public class ApplicationsState {
}
};
+ /**
+ * Displays a combined list with "downloaded" and "visible in launcher" apps only.
+ */
public static final AppFilter FILTER_DOWNLOADED_AND_LAUNCHER = new AppFilter() {
public void init() {
}