Skip to content

Commit 08b68ca

Browse files
committed
[Mono.Android] Provide enum overload of PackageManager.PackageInfoFlags.Of.
1 parent a850d81 commit 08b68ca

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
namespace Android.Content.PM;
2+
3+
#if ANDROID_34
4+
public abstract partial class PackageManager
5+
{
6+
public sealed partial class PackageInfoFlags
7+
{
8+
// Create overloads that accept PackageInfoLongFlags
9+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android33.0")]
10+
public static unsafe Android.Content.PM.PackageManager.PackageInfoFlags Of (PackageInfoLongFlags value)
11+
=> Of ((long) value);
12+
13+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android33.0")]
14+
public unsafe PackageInfoLongFlags ValueAsFlags
15+
=> (PackageInfoLongFlags) Value;
16+
}
17+
}
18+
19+
// Manually created "long" version of "PackageInfoFlags" enum, created from documentation:
20+
// https://developer.android.com/reference/android/content/pm/PackageManager.PackageInfoFlags#of(long)
21+
[System.Flags]
22+
public enum PackageInfoLongFlags : long
23+
{
24+
None = 0,
25+
26+
GetActivities = 1,
27+
28+
GetReceivers = 2,
29+
30+
GetServices = 4,
31+
32+
GetProviders = 8,
33+
34+
GetInstrumentation = 16,
35+
36+
GetIntentFilters = 32,
37+
38+
GetSignatures = 64,
39+
40+
GetMetaData = 128,
41+
42+
GetGids = 256,
43+
44+
GetDisabledComponents = 512,
45+
46+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android24.0")]
47+
MatchDisabledComponents = 512,
48+
49+
GetSharedLibraryFiles = 1024,
50+
51+
GetUriPermissionPatterns = 2048,
52+
53+
GetPermissions = 4096,
54+
55+
GetUninstalledPackages = 8192,
56+
57+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android24.0")]
58+
MatchUninstalledPackages = 8192,
59+
60+
GetConfigurations = 16384,
61+
62+
GetDisabledUntilUsedComponents = 32768,
63+
64+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android24.0")]
65+
MatchDisabledUntilUsedComponents = 32768,
66+
67+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android24.0")]
68+
MatchSystemOnly = 1048576,
69+
70+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android28.0")]
71+
GetSigningCertificates = 134217728,
72+
73+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android29.0")]
74+
MatchApex = 1073741824,
75+
76+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android34.0")]
77+
GetAttributionsLong = 2147483648,
78+
}
79+
#endif // ANDROID_34

src/Mono.Android/Mono.Android.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
<Compile Include="..\..\external\Java.Interop\src\Java.Interop.Tools.JavaCallableWrappers\Java.Interop.Tools.JavaCallableWrappers\Crc64.Table.cs">
7171
<Link>Crc64.Table.cs</Link>
7272
</Compile>
73+
<Compile Include="Android.Content.PM\PackageManager.cs" />
7374
<Compile Include="Android.Graphics\PathIterator.cs" />
7475
<Compile Include="Android.Icu\ListFormatter.cs" />
7576
<Compile Include="Android.Icu\RelativeDateTimeFormatter.cs" />

0 commit comments

Comments
 (0)