From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Tue, 19 Oct 2021 15:17:55 +0300
Subject: [PATCH] stop auto-granting location to system browsers

---
 .../role/model/BrowserRoleBehavior.java       | 27 -------------------
 1 file changed, 27 deletions(-)

diff --git a/PermissionController/src/com/android/permissioncontroller/role/model/BrowserRoleBehavior.java b/PermissionController/src/com/android/permissioncontroller/role/model/BrowserRoleBehavior.java
index 9d4d9e08b..9765432ea 100644
--- a/PermissionController/src/com/android/permissioncontroller/role/model/BrowserRoleBehavior.java
+++ b/PermissionController/src/com/android/permissioncontroller/role/model/BrowserRoleBehavior.java
@@ -52,11 +52,6 @@ public class BrowserRoleBehavior implements RoleBehavior {
             .addCategory(Intent.CATEGORY_BROWSABLE)
             .setData(Uri.fromParts("http", "", null));
 
-    private static final List<String> SYSTEM_BROWSER_PERMISSIONS = Arrays.asList(
-            android.Manifest.permission.ACCESS_COARSE_LOCATION,
-            android.Manifest.permission.ACCESS_FINE_LOCATION
-    );
-
     @Nullable
     @Override
     public String getFallbackHolder(@NonNull Role role, @NonNull Context context) {
@@ -130,28 +125,6 @@ public class BrowserRoleBehavior implements RoleBehavior {
         return new ArrayList<>(packageNames);
     }
 
-    @Override
-    public void grant(@NonNull Role role, @NonNull String packageName, @NonNull Context context) {
-        // @see com.android.server.pm.permission.DefaultPermissionGrantPolicy
-        //      #grantDefaultPermissionsToDefaultBrowser(java.lang.String, int)
-        if (SdkLevel.isAtLeastS()) {
-            if (PackageUtils.isSystemPackage(packageName, context)) {
-                Permissions.grant(packageName, SYSTEM_BROWSER_PERMISSIONS, false, false, false,
-                        true, false, context);
-            }
-        }
-    }
-
-    @Override
-    public void revoke(@NonNull Role role, @NonNull String packageName, @NonNull Context context) {
-        if (SdkLevel.isAtLeastT()) {
-            if (PackageUtils.isSystemPackage(packageName, context)) {
-                Permissions.revoke(packageName, SYSTEM_BROWSER_PERMISSIONS, false, true, false,
-                        context);
-            }
-        }
-    }
-
     @Override
     public boolean isVisibleAsUser(@NonNull Role role, @NonNull UserHandle user,
             @NonNull Context context) {
