~petercxy/shelter

feat: Enable default browsable intents from working profile v1 PROPOSED

Camilo Alejo
Camilo Alejo: 1
 feat: Enable default browsable intents from working profile

 1 files changed, 14 insertions(+), 5 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~petercxy/shelter/patches/13821/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] feat: Enable default browsable intents from working profile Export this patch

Camilo Alejo
Some browsable intents are also defined as "CATEGORY_DEFAULT", meaning
the current filter won't allow them to interact with the main profile.
Notably within this group are some authenticators and other safe-to-use
apps that the user might not be able/allowed to clone.
---
 .../net/typeblog/shelter/util/Utility.java    | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/app/src/main/java/net/typeblog/shelter/util/Utility.java b/app/src/main/java/net/typeblog/shelter/util/Utility.java
index 1a3aa89..19a7f99 100644
--- a/app/src/main/java/net/typeblog/shelter/util/Utility.java
+++ b/app/src/main/java/net/typeblog/shelter/util/Utility.java
@@ -180,13 +180,22 @@ public class Utility {
        
        // 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);
-- 
2.28.0