Utility: allow ACTION_VIEW browser intents to cross from managed to parent

This commit is contained in:
Peter Cai 2018-08-24 09:24:19 +08:00
parent e9e6ce2a9c
commit 6d17405dbe
No known key found for this signature in database
GPG key ID: 71F5FB4E4F3FD54F

View file

@ -59,6 +59,9 @@ public class Utility {
new ComponentName(context.getApplicationContext(), MainActivity.class),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
// Clear everything first to ensure our policies are set properly
manager.clearCrossProfileIntentFilters(adminComponent);
// Allow cross-profile intents for START_SERVICE
manager.addCrossProfileIntentFilter(
adminComponent,
@ -85,6 +88,17 @@ public class Utility {
new IntentFilter(DummyActivity.FINALIZE_PROVISION),
DevicePolicyManager.FLAG_PARENT_CAN_ACCESS_MANAGED);
// Browser intents are allowed from work profile to parent
// TODO: Make this configurable, just as ALLOW_PARENT_PROFILE_APP_LINKING in the next function
IntentFilter i = new IntentFilter(Intent.ACTION_VIEW);
i.addCategory(Intent.CATEGORY_BROWSABLE);
i.addDataScheme("http");
i.addDataScheme("https");
manager.addCrossProfileIntentFilter(
adminComponent,
i,
DevicePolicyManager.FLAG_PARENT_CAN_ACCESS_MANAGED);
manager.setProfileEnabled(adminComponent);
}