Use a com.android prefix for hidden intent actions

CtsIntentSignatureTestCases asserts system apps' intent filters
shouldn't have any "android.*" intent actions that are not public/system
APIs.

So let's just use a com.android prefix.

Bug: 230099874
Test: atest ComponentAliasTests ComponentAliasTests1 ComponentAliasTests2
Change-Id: Ife697a58abb220cebce1ffda393f20cbe821a13a
This commit is contained in:
Makoto Onuki
2022-04-22 13:41:07 -07:00
parent d248c68122
commit f3d0bfaa4c
2 changed files with 23 additions and 12 deletions

View File

@@ -104,7 +104,10 @@ public class ComponentAliasResolver {
private static final String OPT_IN_PROPERTY = "com.android.EXPERIMENTAL_COMPONENT_ALIAS_OPT_IN";
private static final String ALIAS_FILTER_ACTION = "android.intent.action.EXPERIMENTAL_IS_ALIAS";
private static final String ALIAS_FILTER_ACTION =
"com.android.intent.action.EXPERIMENTAL_IS_ALIAS";
private static final String ALIAS_FILTER_ACTION_ALT =
"android.intent.action.EXPERIMENTAL_IS_ALIAS";
private static final String META_DATA_ALIAS_TARGET = "alias_target";
private static final int PACKAGE_QUERY_FLAGS =
@@ -223,8 +226,16 @@ public class ComponentAliasResolver {
@GuardedBy("mLock")
private void loadFromMetadataLocked() {
if (DEBUG) Slog.d(TAG, "Scanning service aliases...");
Intent i = new Intent(ALIAS_FILTER_ACTION);
// PM.queryInetntXxx() doesn't support "OR" queries, so we search for
// both the com.android... action and android... action on by one.
// It's okay if a single component handles both actions because the resulting aliases
// will be stored in a map and duplicates will naturally be removed.
loadFromMetadataLockedInner(new Intent(ALIAS_FILTER_ACTION_ALT));
loadFromMetadataLockedInner(new Intent(ALIAS_FILTER_ACTION));
}
private void loadFromMetadataLockedInner(Intent i) {
final List<ResolveInfo> services = mContext.getPackageManager().queryIntentServicesAsUser(
i, PACKAGE_QUERY_FLAGS, UserHandle.USER_SYSTEM);

View File

@@ -23,57 +23,57 @@
-->
<service android:name=".s.Alias00" android:exported="true" android:enabled="true" >
<meta-data android:name="alias_target" android:value="android.content.componentalias.tests/android.content.componentalias.tests.s.Target00" />
<intent-filter><action android:name="android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="com.android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="android.content.componentalias.tests.IS_ALIAS_00" /></intent-filter>
</service>
<service android:name=".s.Alias01" android:exported="true" android:enabled="true" >
<meta-data android:name="alias_target" android:value="android.content.componentalias.tests.sub1/android.content.componentalias.tests.s.Target01" />
<intent-filter><action android:name="android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="com.android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="android.content.componentalias.tests.IS_ALIAS_01" /></intent-filter>
</service>
<service android:name=".s.Alias02" android:exported="true" android:enabled="true" >
<meta-data android:name="alias_target" android:value="android.content.componentalias.tests.sub2/android.content.componentalias.tests.s.Target02" />
<intent-filter><action android:name="android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="com.android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="android.content.componentalias.tests.IS_ALIAS_02" /></intent-filter>
</service>
<service android:name=".s.Alias03" android:exported="true" android:enabled="true" >
<meta-data android:name="alias_target" android:value="android.content.componentalias.tests.sub1/android.content.componentalias.tests.s.Target03" />
<intent-filter><action android:name="android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="com.android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="android.content.componentalias.tests.IS_ALIAS_03" /></intent-filter>
</service>
<service android:name=".s.Alias04" android:exported="true" android:enabled="true" >
<meta-data android:name="alias_target" android:value="android.content.componentalias.tests.sub2/android.content.componentalias.tests.s.Target04" />
<intent-filter><action android:name="android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="com.android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="android.content.componentalias.tests.IS_ALIAS_04" /></intent-filter>
</service>
<receiver android:name=".b.Alias00" android:exported="true" android:enabled="true" >
<meta-data android:name="alias_target" android:value="android.content.componentalias.tests/android.content.componentalias.tests.b.Target00" />
<intent-filter><action android:name="android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="com.android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="android.content.componentalias.tests.IS_RECEIVER_00" /></intent-filter>
<intent-filter><action android:name="ACTION_BROADCAST" /></intent-filter>
</receiver>
<receiver android:name=".b.Alias01" android:exported="true" android:enabled="true" >
<meta-data android:name="alias_target" android:value="android.content.componentalias.tests.sub1/android.content.componentalias.tests.b.Target01" />
<intent-filter><action android:name="android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="com.android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="android.content.componentalias.tests.IS_RECEIVER_01" /></intent-filter>
<intent-filter><action android:name="ACTION_BROADCAST" /></intent-filter>
</receiver>
<receiver android:name=".b.Alias02" android:exported="true" android:enabled="true" >
<meta-data android:name="alias_target" android:value="android.content.componentalias.tests.sub2/android.content.componentalias.tests.b.Target02" />
<intent-filter><action android:name="android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="com.android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="android.content.componentalias.tests.IS_RECEIVER_02" /></intent-filter>
<intent-filter><action android:name="ACTION_BROADCAST" /></intent-filter>
</receiver>
<receiver android:name=".b.Alias03" android:exported="true" android:enabled="true" >
<meta-data android:name="alias_target" android:value="android.content.componentalias.tests.sub1/android.content.componentalias.tests.b.Target03" />
<intent-filter><action android:name="android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="com.android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="android.content.componentalias.tests.IS_RECEIVER_03" /></intent-filter>
<intent-filter><action android:name="ACTION_BROADCAST" /></intent-filter>
</receiver>
<receiver android:name=".b.Alias04" android:exported="true" android:enabled="true" >
<meta-data android:name="alias_target" android:value="android.content.componentalias.tests.sub2/android.content.componentalias.tests.b.Target04" />
<intent-filter><action android:name="android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="com.android.intent.action.EXPERIMENTAL_IS_ALIAS" /></intent-filter>
<intent-filter><action android:name="android.content.componentalias.tests.IS_RECEIVER_04" /></intent-filter>
<intent-filter><action android:name="ACTION_BROADCAST" /></intent-filter>
</receiver>