diff options
| -rw-r--r-- | services/core/java/com/android/server/am/ComponentAliasResolver.java | 15 | ||||
| -rw-r--r-- | tests/componentalias/AndroidManifest_service_aliases.xml | 20 |
2 files changed, 23 insertions, 12 deletions
diff --git a/services/core/java/com/android/server/am/ComponentAliasResolver.java b/services/core/java/com/android/server/am/ComponentAliasResolver.java index cf910d45b632..2db3b15e719d 100644 --- a/services/core/java/com/android/server/am/ComponentAliasResolver.java +++ b/services/core/java/com/android/server/am/ComponentAliasResolver.java @@ -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); diff --git a/tests/componentalias/AndroidManifest_service_aliases.xml b/tests/componentalias/AndroidManifest_service_aliases.xml index e73bb6102fbf..c96f1736c684 100644 --- a/tests/componentalias/AndroidManifest_service_aliases.xml +++ b/tests/componentalias/AndroidManifest_service_aliases.xml @@ -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> |