diff options
| author | 2022-04-25 16:15:17 +0000 | |
|---|---|---|
| committer | 2022-04-25 16:15:17 +0000 | |
| commit | cac95d57ad43c37ec10a2996c3359f6c04649790 (patch) | |
| tree | 53587b4a40840d6d2090aad896e8eadacbca5423 | |
| parent | 58d6997e8140ed2802381f5f16a74bc5339beefe (diff) | |
| parent | 161d56278a45da98016cb4a809fd0417f0db856d (diff) | |
Merge "Use a com.android prefix for hidden intent actions" into tm-dev am: 7246463df0 am: 161d56278a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17916381
Change-Id: I00fbd47bd5c384fa2ec164715aca88eab41c59fe
Ignore-AOSP-First: this is an automerge
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -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> |