summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorSongchun Fan <schfan@google.com>2021-11-30 15:47:16 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-11-30 15:47:16 +0000
commit502ab7764e25ca8b40a274e2aef31aea84c82e86 (patch)
tree9d8c88b5c1dd1087949547ce6f8407486e29229c /core/java/android
parente9273c486904571d5bc026bf6914748f611387f6 (diff)
parent5fab45ef672814ad7dd8e4097c48215c8ebe05e9 (diff)
Merge "[pm] change internal flags to long"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/content/pm/IPackageManager.aidl59
-rw-r--r--core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java74
-rw-r--r--core/java/android/content/pm/parsing/component/ComponentParseUtils.java4
-rw-r--r--core/java/android/content/pm/pkg/PackageUserStateUtils.java21
-rw-r--r--core/java/android/util/DebugUtils.java40
5 files changed, 103 insertions, 95 deletions
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 516156d136d9..1c82b38c5007 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -69,41 +69,34 @@ interface IPackageManager {
void checkPackageStartable(String packageName, int userId);
@UnsupportedAppUsage(trackingBug = 171933273)
boolean isPackageAvailable(String packageName, int userId);
- @UnsupportedAppUsage
- PackageInfo getPackageInfo(String packageName, int flags, int userId);
+ PackageInfo getPackageInfo(String packageName, long flags, int userId);
PackageInfo getPackageInfoVersioned(in VersionedPackage versionedPackage,
- int flags, int userId);
- @UnsupportedAppUsage
- int getPackageUid(String packageName, int flags, int userId);
- int[] getPackageGids(String packageName, int flags, int userId);
+ long flags, int userId);
+ int getPackageUid(String packageName, long flags, int userId);
+ int[] getPackageGids(String packageName, long flags, int userId);
@UnsupportedAppUsage
String[] currentToCanonicalPackageNames(in String[] names);
@UnsupportedAppUsage
String[] canonicalToCurrentPackageNames(in String[] names);
- @UnsupportedAppUsage
- ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId);
+ ApplicationInfo getApplicationInfo(String packageName, long flags, int userId);
/**
* @return the target SDK for the given package name, or -1 if it cannot be retrieved
*/
int getTargetSdkVersion(String packageName);
- @UnsupportedAppUsage
- ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId);
+ ActivityInfo getActivityInfo(in ComponentName className, long flags, int userId);
boolean activitySupportsIntent(in ComponentName className, in Intent intent,
String resolvedType);
- @UnsupportedAppUsage
- ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId);
+ ActivityInfo getReceiverInfo(in ComponentName className, long flags, int userId);
- @UnsupportedAppUsage
- ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId);
+ ServiceInfo getServiceInfo(in ComponentName className, long flags, int userId);
- @UnsupportedAppUsage
- ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId);
+ ProviderInfo getProviderInfo(in ComponentName className, long flags, int userId);
boolean isProtectedBroadcast(String actionName);
@@ -133,33 +126,31 @@ interface IPackageManager {
@UnsupportedAppUsage
boolean isUidPrivileged(int uid);
- @UnsupportedAppUsage
- ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId);
+ ResolveInfo resolveIntent(in Intent intent, String resolvedType, long flags, int userId);
ResolveInfo findPersistentPreferredActivity(in Intent intent, int userId);
boolean canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId);
- @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
ParceledListSlice queryIntentActivities(in Intent intent,
- String resolvedType, int flags, int userId);
+ String resolvedType, long flags, int userId);
ParceledListSlice queryIntentActivityOptions(
in ComponentName caller, in Intent[] specifics,
in String[] specificTypes, in Intent intent,
- String resolvedType, int flags, int userId);
+ String resolvedType, long flags, int userId);
ParceledListSlice queryIntentReceivers(in Intent intent,
- String resolvedType, int flags, int userId);
+ String resolvedType, long flags, int userId);
ResolveInfo resolveService(in Intent intent,
- String resolvedType, int flags, int userId);
+ String resolvedType, long flags, int userId);
ParceledListSlice queryIntentServices(in Intent intent,
- String resolvedType, int flags, int userId);
+ String resolvedType, long flags, int userId);
ParceledListSlice queryIntentContentProviders(in Intent intent,
- String resolvedType, int flags, int userId);
+ String resolvedType, long flags, int userId);
/**
* This implements getInstalledPackages via a "last returned row"
@@ -167,8 +158,7 @@ interface IPackageManager {
* limit that kicks in when flags are included that bloat up the data
* returned.
*/
- @UnsupportedAppUsage
- ParceledListSlice getInstalledPackages(int flags, in int userId);
+ ParceledListSlice getInstalledPackages(long flags, in int userId);
/**
* This implements getPackagesHoldingPermissions via a "last returned row"
@@ -177,7 +167,7 @@ interface IPackageManager {
* returned.
*/
ParceledListSlice getPackagesHoldingPermissions(in String[] permissions,
- int flags, int userId);
+ long flags, int userId);
/**
* This implements getInstalledApplications via a "last returned row"
@@ -185,18 +175,17 @@ interface IPackageManager {
* limit that kicks in when flags are included that bloat up the data
* returned.
*/
- @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
- ParceledListSlice getInstalledApplications(int flags, int userId);
+ ParceledListSlice getInstalledApplications(long flags, int userId);
/**
* Retrieve all applications that are marked as persistent.
*
- * @return A List&lt;applicationInfo> containing one entry for each persistent
+ * @return A List<ApplicationInfo> containing one entry for each persistent
* application.
*/
ParceledListSlice getPersistentApplications(int flags);
- ProviderInfo resolveContentProvider(String name, int flags, int userId);
+ ProviderInfo resolveContentProvider(String name, long flags, int userId);
/**
* Retrieve sync information for all content providers.
@@ -211,7 +200,7 @@ interface IPackageManager {
inout List<ProviderInfo> outInfo);
ParceledListSlice queryContentProviders(
- String processName, int uid, int flags, String metaDataKey);
+ String processName, int uid, long flags, String metaDataKey);
@UnsupportedAppUsage
InstrumentationInfo getInstrumentationInfo(
@@ -690,9 +679,9 @@ interface IPackageManager {
int getInstallReason(String packageName, int userId);
- ParceledListSlice getSharedLibraries(in String packageName, int flags, int userId);
+ ParceledListSlice getSharedLibraries(in String packageName, long flags, int userId);
- ParceledListSlice getDeclaredSharedLibraries(in String packageName, int flags, int userId);
+ ParceledListSlice getDeclaredSharedLibraries(in String packageName, long flags, int userId);
boolean canRequestPackageInstalls(String packageName, int userId);
diff --git a/core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java b/core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java
index ef124c7e3b27..b11b38a6d788 100644
--- a/core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java
+++ b/core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java
@@ -76,7 +76,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static PackageInfo generate(ParsingPackageRead pkg, int[] gids,
- @PackageManager.PackageInfoFlags int flags, long firstInstallTime, long lastUpdateTime,
+ @PackageManager.PackageInfoFlags long flags, long firstInstallTime, long lastUpdateTime,
Set<String> grantedPermissions, FrameworkPackageUserState state, int userId) {
return generateWithComponents(pkg, gids, flags, firstInstallTime, lastUpdateTime, grantedPermissions,
state, userId, null);
@@ -90,7 +90,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
private static PackageInfo generateWithComponents(ParsingPackageRead pkg, int[] gids,
- @PackageManager.PackageInfoFlags int flags, long firstInstallTime, long lastUpdateTime,
+ @PackageManager.PackageInfoFlags long flags, long firstInstallTime, long lastUpdateTime,
Set<String> grantedPermissions, FrameworkPackageUserState state, int userId,
@Nullable ApexInfo apexInfo) {
ApplicationInfo applicationInfo = generateApplicationInfo(pkg, flags, state, userId);
@@ -190,7 +190,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static PackageInfo generateWithoutComponents(ParsingPackageRead pkg, int[] gids,
- @PackageManager.PackageInfoFlags int flags, long firstInstallTime, long lastUpdateTime,
+ @PackageManager.PackageInfoFlags long flags, long firstInstallTime, long lastUpdateTime,
Set<String> grantedPermissions, FrameworkPackageUserState state, int userId,
@Nullable ApexInfo apexInfo, @NonNull ApplicationInfo applicationInfo) {
if (!checkUseInstalled(pkg, state, flags)) {
@@ -210,9 +210,9 @@ public class PackageInfoWithoutStateUtils {
*/
@NonNull
public static PackageInfo generateWithoutComponentsUnchecked(ParsingPackageRead pkg, int[] gids,
- @PackageManager.PackageInfoFlags int flags, long firstInstallTime, long lastUpdateTime,
- Set<String> grantedPermissions, FrameworkPackageUserState state, int userId,
- @Nullable ApexInfo apexInfo, @NonNull ApplicationInfo applicationInfo) {
+ @PackageManager.PackageInfoFlags long flags, long firstInstallTime,
+ long lastUpdateTime, Set<String> grantedPermissions, FrameworkPackageUserState state,
+ int userId, @Nullable ApexInfo apexInfo, @NonNull ApplicationInfo applicationInfo) {
PackageInfo pi = new PackageInfo();
pi.packageName = pkg.getPackageName();
pi.splitNames = pkg.getSplitNames();
@@ -365,7 +365,8 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ApplicationInfo generateApplicationInfo(ParsingPackageRead pkg,
- @PackageManager.ApplicationInfoFlags int flags, FrameworkPackageUserState state, int userId) {
+ @PackageManager.ApplicationInfoFlags long flags, FrameworkPackageUserState state,
+ int userId) {
if (pkg == null) {
return null;
}
@@ -392,8 +393,8 @@ public class PackageInfoWithoutStateUtils {
*/
@NonNull
public static ApplicationInfo generateApplicationInfoUnchecked(@NonNull ParsingPackageRead pkg,
- @PackageManager.ApplicationInfoFlags int flags, @NonNull FrameworkPackageUserState state,
- int userId, boolean assignUserFields) {
+ @PackageManager.ApplicationInfoFlags long flags,
+ @NonNull FrameworkPackageUserState state, int userId, boolean assignUserFields) {
// Make shallow copy so we can store the metadata/libraries safely
ApplicationInfo ai = ((ParsingPackageHidden) pkg).toAppInfoWithoutState();
@@ -406,7 +407,7 @@ public class PackageInfoWithoutStateUtils {
return ai;
}
- private static void updateApplicationInfo(ApplicationInfo ai, int flags,
+ private static void updateApplicationInfo(ApplicationInfo ai, long flags,
FrameworkPackageUserState state) {
if ((flags & PackageManager.GET_META_DATA) == 0) {
ai.metaData = null;
@@ -452,8 +453,8 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ApplicationInfo generateDelegateApplicationInfo(@Nullable ApplicationInfo ai,
- @PackageManager.ApplicationInfoFlags int flags, @NonNull FrameworkPackageUserState state,
- int userId) {
+ @PackageManager.ApplicationInfoFlags long flags,
+ @NonNull FrameworkPackageUserState state, int userId) {
if (ai == null || !checkUseInstalledOrHidden(flags, state, ai)) {
return null;
}
@@ -469,7 +470,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ActivityInfo generateDelegateActivityInfo(@Nullable ActivityInfo a,
- @PackageManager.ComponentInfoFlags int flags, @NonNull FrameworkPackageUserState state,
+ @PackageManager.ComponentInfoFlags long flags, @NonNull FrameworkPackageUserState state,
int userId) {
if (a == null || !checkUseInstalledOrHidden(flags, state, a.applicationInfo)) {
return null;
@@ -484,7 +485,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ActivityInfo generateActivityInfo(ParsingPackageRead pkg, ParsedActivity a,
- @PackageManager.ComponentInfoFlags int flags, FrameworkPackageUserState state,
+ @PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state,
@Nullable ApplicationInfo applicationInfo, int userId) {
if (a == null) return null;
if (!checkUseInstalled(pkg, state, flags)) {
@@ -504,12 +505,12 @@ public class PackageInfoWithoutStateUtils {
* This bypasses critical checks that are necessary for usage with data passed outside of system
* server.
* <p>
- * Prefer {@link #generateActivityInfo(ParsingPackageRead, ParsedActivity, int,
+ * Prefer {@link #generateActivityInfo(ParsingPackageRead, ParsedActivity, long,
* FrameworkPackageUserState, ApplicationInfo, int)}.
*/
@NonNull
public static ActivityInfo generateActivityInfoUnchecked(@NonNull ParsedActivity a,
- @PackageManager.ComponentInfoFlags int flags,
+ @PackageManager.ComponentInfoFlags long flags,
@NonNull ApplicationInfo applicationInfo) {
// Make shallow copies so we can store the metadata safely
ActivityInfo ai = new ActivityInfo();
@@ -550,13 +551,14 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ActivityInfo generateActivityInfo(ParsingPackageRead pkg, ParsedActivity a,
- @PackageManager.ComponentInfoFlags int flags, FrameworkPackageUserState state, int userId) {
+ @PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state,
+ int userId) {
return generateActivityInfo(pkg, a, flags, state, null, userId);
}
@Nullable
public static ServiceInfo generateServiceInfo(ParsingPackageRead pkg, ParsedService s,
- @PackageManager.ComponentInfoFlags int flags, FrameworkPackageUserState state,
+ @PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state,
@Nullable ApplicationInfo applicationInfo, int userId) {
if (s == null) return null;
if (!checkUseInstalled(pkg, state, flags)) {
@@ -576,12 +578,12 @@ public class PackageInfoWithoutStateUtils {
* This bypasses critical checks that are necessary for usage with data passed outside of system
* server.
* <p>
- * Prefer {@link #generateServiceInfo(ParsingPackageRead, ParsedService, int, FrameworkPackageUserState,
- * ApplicationInfo, int)}.
+ * Prefer {@link #generateServiceInfo(ParsingPackageRead, ParsedService, long,
+ * FrameworkPackageUserState, ApplicationInfo, int)}.
*/
@NonNull
public static ServiceInfo generateServiceInfoUnchecked(@NonNull ParsedService s,
- @PackageManager.ComponentInfoFlags int flags,
+ @PackageManager.ComponentInfoFlags long flags,
@NonNull ApplicationInfo applicationInfo) {
// Make shallow copies so we can store the metadata safely
ServiceInfo si = new ServiceInfo();
@@ -600,13 +602,14 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ServiceInfo generateServiceInfo(ParsingPackageRead pkg, ParsedService s,
- @PackageManager.ComponentInfoFlags int flags, FrameworkPackageUserState state, int userId) {
+ @PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state,
+ int userId) {
return generateServiceInfo(pkg, s, flags, state, null, userId);
}
@Nullable
public static ProviderInfo generateProviderInfo(ParsingPackageRead pkg, ParsedProvider p,
- @PackageManager.ComponentInfoFlags int flags, FrameworkPackageUserState state,
+ @PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state,
@Nullable ApplicationInfo applicationInfo, int userId) {
if (p == null) return null;
if (!checkUseInstalled(pkg, state, flags)) {
@@ -626,12 +629,12 @@ public class PackageInfoWithoutStateUtils {
* This bypasses critical checks that are necessary for usage with data passed outside of system
* server.
* <p>
- * Prefer {@link #generateProviderInfo(ParsingPackageRead, ParsedProvider, int,
+ * Prefer {@link #generateProviderInfo(ParsingPackageRead, ParsedProvider, long,
* FrameworkPackageUserState, ApplicationInfo, int)}.
*/
@NonNull
public static ProviderInfo generateProviderInfoUnchecked(@NonNull ParsedProvider p,
- @PackageManager.ComponentInfoFlags int flags,
+ @PackageManager.ComponentInfoFlags long flags,
@NonNull ApplicationInfo applicationInfo) {
// Make shallow copies so we can store the metadata safely
ProviderInfo pi = new ProviderInfo();
@@ -661,17 +664,18 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ProviderInfo generateProviderInfo(ParsingPackageRead pkg, ParsedProvider p,
- @PackageManager.ComponentInfoFlags int flags, FrameworkPackageUserState state, int userId) {
+ @PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state,
+ int userId) {
return generateProviderInfo(pkg, p, flags, state, null, userId);
}
/**
- * @param assignUserFields see {@link #generateApplicationInfoUnchecked(ParsingPackageRead, int,
- * FrameworkPackageUserState, int, boolean)}
+ * @param assignUserFields see {@link #generateApplicationInfoUnchecked(ParsingPackageRead,
+ * long, FrameworkPackageUserState, int, boolean)}
*/
@Nullable
public static InstrumentationInfo generateInstrumentationInfo(ParsedInstrumentation i,
- ParsingPackageRead pkg, @PackageManager.ComponentInfoFlags int flags, int userId,
+ ParsingPackageRead pkg, @PackageManager.ComponentInfoFlags long flags, int userId,
boolean assignUserFields) {
if (i == null) return null;
@@ -702,7 +706,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static PermissionInfo generatePermissionInfo(ParsedPermission p,
- @PackageManager.ComponentInfoFlags int flags) {
+ @PackageManager.ComponentInfoFlags long flags) {
if (p == null) return null;
PermissionInfo pi = new PermissionInfo(p.getBackgroundPermission());
@@ -725,7 +729,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static PermissionGroupInfo generatePermissionGroupInfo(ParsedPermissionGroup pg,
- @PackageManager.ComponentInfoFlags int flags) {
+ @PackageManager.ComponentInfoFlags long flags) {
if (pg == null) return null;
PermissionGroupInfo pgi = new PermissionGroupInfo(
@@ -753,8 +757,8 @@ public class PackageInfoWithoutStateUtils {
return new Attribution(pa.getTag(), pa.getLabel());
}
- private static boolean checkUseInstalledOrHidden(int flags, @NonNull FrameworkPackageUserState state,
- @Nullable ApplicationInfo appInfo) {
+ private static boolean checkUseInstalledOrHidden(long flags,
+ @NonNull FrameworkPackageUserState state, @Nullable ApplicationInfo appInfo) {
// Returns false if the package is hidden system app until installed.
if ((flags & PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS) == 0
&& !state.isInstalled()
@@ -882,8 +886,8 @@ public class PackageInfoWithoutStateUtils {
return privateFlagsExt;
}
- private static boolean checkUseInstalled(ParsingPackageRead pkg, FrameworkPackageUserState state,
- @PackageManager.PackageInfoFlags int flags) {
+ private static boolean checkUseInstalled(ParsingPackageRead pkg,
+ FrameworkPackageUserState state, @PackageManager.PackageInfoFlags long flags) {
// If available for the target user
return PackageUserStateUtils.isAvailable(state, flags);
}
diff --git a/core/java/android/content/pm/parsing/component/ComponentParseUtils.java b/core/java/android/content/pm/parsing/component/ComponentParseUtils.java
index 1ac9739cc460..0334601a0a06 100644
--- a/core/java/android/content/pm/parsing/component/ComponentParseUtils.java
+++ b/core/java/android/content/pm/parsing/component/ComponentParseUtils.java
@@ -170,13 +170,13 @@ public class ComponentParseUtils {
}
public static boolean isMatch(FrameworkPackageUserState state, boolean isSystem,
- boolean isPackageEnabled, ParsedMainComponent component, int flags) {
+ boolean isPackageEnabled, ParsedMainComponent component, long flags) {
return PackageUserStateUtils.isMatch(state, isSystem, isPackageEnabled,
component.isEnabled(), component.isDirectBootAware(), component.getName(), flags);
}
public static boolean isEnabled(FrameworkPackageUserState state, boolean isPackageEnabled,
- ParsedMainComponent parsedComponent, int flags) {
+ ParsedMainComponent parsedComponent, long flags) {
return PackageUserStateUtils.isEnabled(state, isPackageEnabled, parsedComponent.isEnabled(),
parsedComponent.getName(), flags);
}
diff --git a/core/java/android/content/pm/pkg/PackageUserStateUtils.java b/core/java/android/content/pm/pkg/PackageUserStateUtils.java
index 9a800b0990fd..468bff1b53ec 100644
--- a/core/java/android/content/pm/pkg/PackageUserStateUtils.java
+++ b/core/java/android/content/pm/pkg/PackageUserStateUtils.java
@@ -34,15 +34,15 @@ public class PackageUserStateUtils {
private static final boolean DEBUG = false;
private static final String TAG = "PackageUserStateUtils";
- public static boolean isMatch(@NonNull FrameworkPackageUserState state, ComponentInfo componentInfo,
- int flags) {
+ public static boolean isMatch(@NonNull FrameworkPackageUserState state,
+ ComponentInfo componentInfo, long flags) {
return isMatch(state, componentInfo.applicationInfo.isSystemApp(),
componentInfo.applicationInfo.enabled, componentInfo.enabled,
componentInfo.directBootAware, componentInfo.name, flags);
}
public static boolean isMatch(@NonNull FrameworkPackageUserState state, boolean isSystem,
- boolean isPackageEnabled, ParsedMainComponent component, int flags) {
+ boolean isPackageEnabled, ParsedMainComponent component, long flags) {
return isMatch(state, isSystem, isPackageEnabled, component.isEnabled(),
component.isDirectBootAware(), component.getName(), flags);
}
@@ -58,7 +58,7 @@ public class PackageUserStateUtils {
*/
public static boolean isMatch(@NonNull FrameworkPackageUserState state, boolean isSystem,
boolean isPackageEnabled, boolean isComponentEnabled,
- boolean isComponentDirectBootAware, String componentName, int flags) {
+ boolean isComponentDirectBootAware, String componentName, long flags) {
final boolean matchUninstalled = (flags & PackageManager.MATCH_KNOWN_PACKAGES) != 0;
if (!isAvailable(state, flags) && !(isSystem && matchUninstalled)) {
return reportIfDebug(false, flags);
@@ -81,7 +81,7 @@ public class PackageUserStateUtils {
return reportIfDebug(matchesUnaware || matchesAware, flags);
}
- public static boolean isAvailable(@NonNull FrameworkPackageUserState state, int flags) {
+ public static boolean isAvailable(@NonNull FrameworkPackageUserState state, long flags) {
// True if it is installed for this user and it is not hidden. If it is hidden,
// still return true if the caller requested MATCH_UNINSTALLED_PACKAGES
final boolean matchAnyUser = (flags & PackageManager.MATCH_ANY_USER) != 0;
@@ -91,7 +91,7 @@ public class PackageUserStateUtils {
&& (!state.isHidden() || matchUninstalled));
}
- public static boolean reportIfDebug(boolean result, int flags) {
+ public static boolean reportIfDebug(boolean result, long flags) {
if (DEBUG && !result) {
Slog.i(TAG, "No match!; flags: "
+ DebugUtils.flagsToString(PackageManager.class, "MATCH_", flags) + " "
@@ -101,13 +101,13 @@ public class PackageUserStateUtils {
}
public static boolean isEnabled(@NonNull FrameworkPackageUserState state, ComponentInfo componentInfo,
- int flags) {
+ long flags) {
return isEnabled(state, componentInfo.applicationInfo.enabled, componentInfo.enabled,
componentInfo.name, flags);
}
public static boolean isEnabled(@NonNull FrameworkPackageUserState state, boolean isPackageEnabled,
- ParsedMainComponent parsedComponent, int flags) {
+ ParsedMainComponent parsedComponent, long flags) {
return isEnabled(state, isPackageEnabled, parsedComponent.isEnabled(),
parsedComponent.getName(), flags);
}
@@ -115,8 +115,9 @@ public class PackageUserStateUtils {
/**
* Test if the given component is considered enabled.
*/
- public static boolean isEnabled(@NonNull FrameworkPackageUserState state, boolean isPackageEnabled,
- boolean isComponentEnabled, String componentName, int flags) {
+ public static boolean isEnabled(@NonNull FrameworkPackageUserState state,
+ boolean isPackageEnabled, boolean isComponentEnabled, String componentName,
+ long flags) {
if ((flags & MATCH_DISABLED_COMPONENTS) != 0) {
return true;
}
diff --git a/core/java/android/util/DebugUtils.java b/core/java/android/util/DebugUtils.java
index ece6b3516f7a..bab20893a118 100644
--- a/core/java/android/util/DebugUtils.java
+++ b/core/java/android/util/DebugUtils.java
@@ -242,35 +242,49 @@ public class DebugUtils {
*
* @hide
*/
- public static String flagsToString(Class<?> clazz, String prefix, int flags) {
+ public static String flagsToString(Class<?> clazz, String prefix, long flags) {
final StringBuilder res = new StringBuilder();
boolean flagsWasZero = flags == 0;
for (Field field : clazz.getDeclaredFields()) {
final int modifiers = field.getModifiers();
if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)
- && field.getType().equals(int.class) && field.getName().startsWith(prefix)) {
- try {
- final int value = field.getInt(null);
- if (value == 0 && flagsWasZero) {
- return constNameWithoutPrefix(prefix, field);
- }
- if (value != 0 && (flags & value) == value) {
- flags &= ~value;
- res.append(constNameWithoutPrefix(prefix, field)).append('|');
- }
- } catch (IllegalAccessException ignored) {
+ && (field.getType().equals(int.class) || field.getType().equals(long.class))
+ && field.getName().startsWith(prefix)) {
+ final long value = getFieldValue(field);
+ if (value == 0 && flagsWasZero) {
+ return constNameWithoutPrefix(prefix, field);
+ }
+ if (value != 0 && (flags & value) == value) {
+ flags &= ~value;
+ res.append(constNameWithoutPrefix(prefix, field)).append('|');
}
}
}
if (flags != 0 || res.length() == 0) {
- res.append(Integer.toHexString(flags));
+ res.append(Long.toHexString(flags));
} else {
res.deleteCharAt(res.length() - 1);
}
return res.toString();
}
+ private static long getFieldValue(Field field) {
+ // Field could be int or long
+ try {
+ final long longValue = field.getLong(null);
+ if (longValue != 0) {
+ return longValue;
+ }
+ final int intValue = field.getInt(null);
+ if (intValue != 0) {
+ return intValue;
+ }
+ } catch (IllegalAccessException ignored) {
+ }
+ return 0;
+ }
+
/**
* Gets human-readable representation of constants (static final values).
*