Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Xamarin.Android.Tools.AndroidSdk/AndroidAppManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@ void RemoveAndroidPermissions (IEnumerable<string> permissions)
IEnumerable<XElement> GetLaunchableActivities ()
{
foreach (var activity in application.Elements ("activity")) {
var filter = activity.Element ("intent-filter");
if (filter != null) {
foreach (var filter in activity.Elements ("intent-filter")) {
foreach (var category in filter.Elements ("category"))
if (category != null && (string?)category.Attribute (aName) == "android.intent.category.LAUNCHER")
yield return activity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ static XDocument GetTestAppManifest ()
}
}

[Test]
public void GetLaunchableActivityNames ()
{
var versions = new AndroidVersions (Array.Empty<AndroidVersion>());
var manifest = AndroidAppManifest.Load (GetTestAppManifest (), versions);
var launchers = manifest.GetLaunchableActivityNames ().ToList ();
Assert.AreEqual (1, launchers.Count);
Assert.AreEqual (".HasMultipleIntentFilters", launchers [0]);
}

[Test]
public void SetNewPermissions ()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".HasMultipleIntentFilters" android:label="launcher?">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
Expand Down