History:
A client of ours has integrated our SDK library for Android. They try to pass Google's compatibility test (CTS).
The issue:
They failed CTS test suit with the following message: android.signature.cts.intent.intentTest#shouldNotFindUnexpectedIntents | Result fail | java.lang.AssertionError: [package <their package> Invalid Intent: [android.intent.action.ACTION_BOOT_COMPLETE]].
The main question:
My goal is to help them pass this test but I'm not sure what the real problem is and how to solve it. Can anyone help?
Details:
1) I cannot currently extract information from our client at all about their host apk. All I know is that they're testing a priv-app apk for Android 8.0 devices. (It's legitimately a priv-app and should be). I cannot be sure for the next few days but I believe their targetSdk is 26 (i.e., Android 8.0.0)
2) Our SDK library contains a Broadcast Receiver that's defined as following:
<receiver android:enabled="true" android:exported="false" android:name="<our Broadcast Receiver class path>">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
<action android:name="com.dt.ignite.startService"/>
<action android:name="<our package>.<our custom intent name 1>"/>
<action android:name="<our package>.<our custom intent name 2>"/>
<action android:name="<our package>.<our custom intent name 3>"/>
</intent-filter>
</receiver>
3) Looking at the source code of this specific CTS test (IntentTest.java) I understand it's failing because the ApplicationInfo of this apk contains an Intent which is not a "platform Intent", specifically "BROADCAST_COMPLETE". (https://github.com/leolin310148/ShortcutBadger/issues/274)
4) The above made me think of Google's newly introduced "Background Limitations" and how they ban implicit Intent receivers from Android 8.0 and on. However, it is stated that BROADCAST_COMPLETE would be exempt from this ban. (https://developer.android.com/about/versions/oreo/background#broadcasts)
The test in question checks if any Intent
s are referenced in the manifest that are NOT Platform Intent
s. It does this by checking for all Intent
s that start with android.intent.action
that are not in the list of Platform Intent
s.
To pass the test you will need to either remove BOOT_COMPLETED
from the <intent-filter>
or replace it with a suitable Platform Intent
See also this problem report: https://github.com/leolin310148/ShortcutBadger/issues/274