Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable default browsable intents from working profile #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions app/src/main/java/net/typeblog/shelter/util/Utility.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,22 @@ public static void enforceWorkProfilePolicies(Context context) {

// 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");
IntentFilter browsableIntentFilter = new IntentFilter(Intent.ACTION_VIEW);
browsableIntentFilter.addCategory(Intent.CATEGORY_BROWSABLE);
browsableIntentFilter.addDataScheme("http");
browsableIntentFilter.addDataScheme("https");
manager.addCrossProfileIntentFilter(
adminComponent,
i,
browsableIntentFilter,
DevicePolicyManager.FLAG_PARENT_CAN_ACCESS_MANAGED);
IntentFilter browsableDefaultIntentFilter = new IntentFilter(Intent.ACTION_VIEW);
browsableDefaultIntentFilter.addCategory(Intent.CATEGORY_BROWSABLE);
browsableDefaultIntentFilter.addCategory(Intent.CATEGORY_DEFAULT);
browsableDefaultIntentFilter.addDataScheme("http");
browsableDefaultIntentFilter.addDataScheme("https");
manager.addCrossProfileIntentFilter(
adminComponent,
browsableDefaultIntentFilter,
DevicePolicyManager.FLAG_PARENT_CAN_ACCESS_MANAGED);

manager.setProfileEnabled(adminComponent);
Expand Down