From 435890b2df48bf39a2d321558af78835e930eb5d Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Thu, 16 Feb 2023 15:25:26 +0000 Subject: [PATCH] Adding CrossProfile Intent Filters Clone Profile. Based upon undergoing QA tests, we had identified some more filters to be added for cross-profile resolution between clone_profile and main_user. These include: - ACTION_VIEW intents apart from web intents from clone to parent. - ACTION_OPEN_DOCUMENT intents (Picker Intent) both ways. - ACTION_DIAL intents for dialing to phone numbers, both ways. - ACTION_VIEW intents with dialer type data schemes, both ways. - SMS/MMS Intents from clone to parent. This Cl is a continuation over ag/20410068 including its changes. Bug: 243109287 Test: Manual and QA. Change-Id: I4f99bb182930eeb8aea1b125cb61df9d81533b92 --- ...DefaultCrossProfileIntentFiltersUtils.java | 80 +++++++++++++++++-- 1 file changed, 75 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/pm/DefaultCrossProfileIntentFiltersUtils.java b/services/core/java/com/android/server/pm/DefaultCrossProfileIntentFiltersUtils.java index 84ea077a06878..9eb73aa6befce 100644 --- a/services/core/java/com/android/server/pm/DefaultCrossProfileIntentFiltersUtils.java +++ b/services/core/java/com/android/server/pm/DefaultCrossProfileIntentFiltersUtils.java @@ -401,7 +401,7 @@ public class DefaultCrossProfileIntentFiltersUtils { /* Allowing view action from clone to parent profile to open any app-links or web links */ - private static final DefaultCrossProfileIntentFilter CLONE_TO_PARENT_VIEW_ACTION = + private static final DefaultCrossProfileIntentFilter CLONE_TO_PARENT_WEB_VIEW_ACTION = new DefaultCrossProfileIntentFilter.Builder( DefaultCrossProfileIntentFilter.Direction.TO_PARENT, /* flags= */ 0x00000018, // 0x00000018 means FLAG_IS_PACKAGE_FOR_FILTER @@ -415,7 +415,7 @@ public class DefaultCrossProfileIntentFiltersUtils { /* Allowing view action from parent to clone profile to open any app-links or web links */ - private static final DefaultCrossProfileIntentFilter PARENT_TO_CLONE_VIEW_ACTION = + private static final DefaultCrossProfileIntentFilter PARENT_TO_CLONE_WEB_VIEW_ACTION = new DefaultCrossProfileIntentFilter.Builder( DefaultCrossProfileIntentFilter.Direction.TO_PROFILE, /* flags= */ 0x00000018, // 0x00000018 means FLAG_IS_PACKAGE_FOR_FILTER @@ -426,6 +426,21 @@ public class DefaultCrossProfileIntentFiltersUtils { .addDataScheme("http") .build(); + /* + Allowing view action from clone to parent profile to any data type e.g. pdf, including custom + content providers. + */ + private static final DefaultCrossProfileIntentFilter CLONE_TO_PARENT_VIEW_ACTION = + new DefaultCrossProfileIntentFilter.Builder( + DefaultCrossProfileIntentFilter.Direction.TO_PARENT, + /* flags= */ 0x00000018, // 0x00000018 means FLAG_IS_PACKAGE_FOR_FILTER + // and FLAG_ALLOW_CHAINED_RESOLUTION set + /* letsPersonalDataIntoProfile= */ false) + .addAction(Intent.ACTION_VIEW) + .addDataType("*/*") + .build(); + + /* Allowing pick,insert and edit action from clone to parent profile to open picker or contacts insert/edit. @@ -441,7 +456,10 @@ public class DefaultCrossProfileIntentFiltersUtils { .addAction(Intent.ACTION_EDIT) .addAction(Intent.ACTION_INSERT) .addAction(Intent.ACTION_INSERT_OR_EDIT) + .addAction(Intent.ACTION_OPEN_DOCUMENT) .addDataType("*/*") + .addCategory(Intent.CATEGORY_DEFAULT) + .addCategory(Intent.CATEGORY_OPENABLE) .build(); /* @@ -458,19 +476,71 @@ public class DefaultCrossProfileIntentFiltersUtils { .addAction(Intent.ACTION_EDIT) .addAction(Intent.ACTION_INSERT) .addAction(Intent.ACTION_INSERT_OR_EDIT) + .addAction(Intent.ACTION_OPEN_DOCUMENT) .addDataType("*/*") + .addCategory(Intent.CATEGORY_DEFAULT) + .addCategory(Intent.CATEGORY_OPENABLE) + .build(); + + private static final DefaultCrossProfileIntentFilter PARENT_TO_CLONE_DIAL_DATA = + new DefaultCrossProfileIntentFilter.Builder( + DefaultCrossProfileIntentFilter.Direction.TO_PROFILE, + /* flags= */ 0x00000018, // 0x00000018 means FLAG_IS_PACKAGE_FOR_FILTER + // and FLAG_ALLOW_CHAINED_RESOLUTION set + /* letsPersonalDataIntoProfile= */ false) + .addAction(Intent.ACTION_DIAL) + .addAction(Intent.ACTION_VIEW) + .addCategory(Intent.CATEGORY_DEFAULT) + .addCategory(Intent.CATEGORY_BROWSABLE) + .addDataScheme("tel") + .addDataScheme("sip") + .addDataScheme("voicemail") + .build(); + + private static final DefaultCrossProfileIntentFilter CLONE_TO_PARENT_DIAL_DATA = + new DefaultCrossProfileIntentFilter.Builder( + DefaultCrossProfileIntentFilter.Direction.TO_PARENT, + /* flags= */ 0x00000018, // 0x00000018 means FLAG_IS_PACKAGE_FOR_FILTER + // and FLAG_ALLOW_CHAINED_RESOLUTION set + /* letsPersonalDataIntoProfile= */ false) + .addAction(Intent.ACTION_DIAL) + .addAction(Intent.ACTION_VIEW) + .addCategory(Intent.CATEGORY_DEFAULT) + .addCategory(Intent.CATEGORY_BROWSABLE) + .addDataScheme("tel") + .addDataScheme("sip") + .addDataScheme("voicemail") + .build(); + + private static final DefaultCrossProfileIntentFilter CLONE_TO_PARENT_SMS_MMS = + new DefaultCrossProfileIntentFilter.Builder( + DefaultCrossProfileIntentFilter.Direction.TO_PARENT, + /* flags= */ 0x00000018, // 0x00000018 means FLAG_IS_PACKAGE_FOR_FILTER + // and FLAG_ALLOW_CHAINED_RESOLUTION set + /* letsPersonalDataIntoProfile= */ false) + .addAction(Intent.ACTION_VIEW) + .addAction(Intent.ACTION_SENDTO) + .addCategory(Intent.CATEGORY_DEFAULT) + .addCategory(Intent.CATEGORY_BROWSABLE) + .addDataScheme("sms") + .addDataScheme("smsto") + .addDataScheme("mms") + .addDataScheme("mmsto") .build(); public static List getDefaultCloneProfileFilters() { return Arrays.asList( PARENT_TO_CLONE_SEND_ACTION, - PARENT_TO_CLONE_VIEW_ACTION, + PARENT_TO_CLONE_WEB_VIEW_ACTION, PARENT_TO_CLONE_PICK_INSERT_ACTION, + PARENT_TO_CLONE_DIAL_DATA, CLONE_TO_PARENT_MEDIA_CAPTURE, CLONE_TO_PARENT_SEND_ACTION, + CLONE_TO_PARENT_WEB_VIEW_ACTION, CLONE_TO_PARENT_VIEW_ACTION, - CLONE_TO_PARENT_PICK_INSERT_ACTION - + CLONE_TO_PARENT_PICK_INSERT_ACTION, + CLONE_TO_PARENT_DIAL_DATA, + CLONE_TO_PARENT_SMS_MMS ); } }