Bug 33617 - MD5 Sum for action name
Summary: MD5 Sum for action name
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 5.1
Hardware: PC Windows
: High enhancement
Target Milestone: master
Assignee: Jonathan Pryor
Depends on:
Reported: 2015-09-03 14:32 UTC by Philipp
Modified: 2017-03-21 20:21 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 33617 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Philipp 2015-09-03 14:32:21 UTC
I have defined my preferences in xml/preferences.xml,  containing

		<intent android:action="keepass2android.AboutActivity"/>

The AboutActivity declares as

namespace keepass2android
	[Activity(Label = "@string/app_name",
		ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden,
		Theme = "@style/NoTitleBar")]
	[IntentFilter(new[] { "keepass2android.AboutActivity" }, Categories = new[] { Intent.CategoryDefault })]
	public class AboutActivity: Activity, IDialogInterfaceOnDismissListener
Note that the android:action="keepass2android.AboutActivity" corresponds to the Action name in 
[IntentFilter(new[] { "keepass2android.AboutActivity" }

The action name is the same as the fully qualified class name. One might argue it's no good style, but that's how it is (or was...).

Starting with Android 5.1, the namespace gets md5'ed (https://developer.xamarin.com/guides/android/advanced_topics/working_with_androidmanifest.xml/) which is fine for classes, but apparently this also translates my IntentFilter's action name as well: In obj/Debug/android/AndroidManifest.xml I found

<activity android:configChanges="keyboardHidden|orientation" android:label="@string/app_name" android:theme="@style/NoTitleBar" android:name="md5f0702f468598c68ce18586502249fb40.AboutActivity">
        <action android:name="md5f0702f468598c68ce18586502249fb40.AboutActivity" />
        <category android:name="android.intent.category.DEFAULT" />

I am not totally sure if this is a bug or intended behavior, but if it's intended to transform the action name, also the preferences.xml should be modified to have the corresponding action name.

In the current implementation, I got ActivityNotFoundException. A workaround is to change the Action name, e.g. kp2a.action.AboutActivity in both places, but it's bad that previously working code gets subtly broken without even a warning.
Comment 1 Jonathan Pryor 2015-09-04 11:27:22 UTC
> I am not totally sure if this is a bug or intended behavior

It's accidentally intended...

As part of the "let's just MD5 everything!" gambit, we hit a few customer projects and samples for which that broke things (shock?), so the current solution was to go through //*/@android:name (i.e. *all* android:name attributes) and if the attribute value matches that of a "legacy" type name, we'd replace it with the "new" name.

Which is why it's fixing up your <intent-filter/> description.

I think that this is being too loose; we should only fixup e.g. <application/>, <activity/>, etc., and not *every* instance of //*/@android:name, as that alters //action/@android:name as well.

We'll need to see if being stricter breaks anything...
Comment 2 gcnew 2015-10-26 23:50:11 UTC
Philipp, could you please add more details regarding workaround? To my mind if I change namespace it will generate new md5 hash and it won't work as well. What am I missing?
Comment 3 Philipp 2015-10-27 15:13:45 UTC
@gcnew: my "solution" was to rename the action to something that didn't start with my classes' namespace. So the C# namespace keepass2android was kept, but the action was renamed from keepass2android.AboutActivity to kp2a.action.AboutActivity both in the preferences as well as the [IntentFilter]