diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index 5e323cd7..c71f87f4 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -46,16 +46,10 @@ android:label="@string/perm_extended_access_label" android:protectionLevel="dangerous" /> - - - - - - diff --git a/play-services-core/src/main/java/org/microg/gms/auth/AccountContentProvider.java b/play-services-core/src/main/java/org/microg/gms/auth/AccountContentProvider.java index b1fb4822..2d26d8c9 100644 --- a/play-services-core/src/main/java/org/microg/gms/auth/AccountContentProvider.java +++ b/play-services-core/src/main/java/org/microg/gms/auth/AccountContentProvider.java @@ -16,7 +16,6 @@ package org.microg.gms.auth; -import android.Manifest; import android.accounts.Account; import android.accounts.AccountManager; import android.content.ContentProvider; @@ -63,8 +62,6 @@ public class AccountContentProvider extends ContentProvider { if (packagesForUid != null && packagesForUid.length != 0) Log.w(TAG, "Not granting extended access to " + Arrays.toString(packagesForUid) + ", signature: " + PackageUtils.firstSignatureDigest(getContext(), packagesForUid[0])); - if (getContext().checkCallingPermission(Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) - throw new SecurityException("Access denied, missing GET_ACCOUNTS or EXTENDED_ACCESS permission"); } if (PROVIDER_METHOD_GET_ACCOUNTS.equals(method)) { Bundle result = new Bundle(); diff --git a/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java b/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java index 5742cb49..28ac4486 100644 --- a/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java +++ b/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java @@ -16,7 +16,6 @@ package org.microg.gms.location; -import android.Manifest; import android.app.PendingIntent; import android.content.Context; import android.location.Location; @@ -35,10 +34,7 @@ import org.microg.gms.common.Utils; import java.util.ArrayList; import java.util.List; -import static android.Manifest.permission.ACCESS_COARSE_LOCATION; -import static android.Manifest.permission.ACCESS_FINE_LOCATION; import static android.content.pm.PackageManager.PERMISSION_GRANTED; -import static android.location.LocationManager.GPS_PROVIDER; import static com.google.android.gms.location.LocationRequest.PRIORITY_HIGH_ACCURACY; public class GoogleLocationManager implements LocationChangeListener { @@ -52,12 +48,7 @@ public class GoogleLocationManager implements LocationChangeListener { public GoogleLocationManager(Context context) { this.context = context; - LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); - if (Utils.hasSelfPermissionOrNotify(context, Manifest.permission.ACCESS_FINE_LOCATION)) { - this.gpsProvider = new RealLocationProvider(locationManager, GPS_PROVIDER, this); - } else { - this.gpsProvider = null; - } + this.gpsProvider = null; mockProvider = new MockLocationProvider(this); } @@ -89,11 +80,11 @@ public class GoogleLocationManager implements LocationChangeListener { } private boolean hasCoarseLocationPermission() { - return context.checkCallingPermission(ACCESS_COARSE_LOCATION) == PERMISSION_GRANTED || hasFineLocationPermission(); + return false; } private boolean hasFineLocationPermission() { - return context.checkCallingPermission(ACCESS_FINE_LOCATION) == PERMISSION_GRANTED; + return false; } private boolean hasMockLocationPermission() { @@ -190,7 +181,7 @@ public class GoogleLocationManager implements LocationChangeListener { public void onLocationChanged() { for (int i = 0; i < currentRequests.size(); i++) { LocationRequestHelper request = currentRequests.get(i); - if (!request.report(getLocation(request.initialHasFinePermission, request.initialHasCoarsePermission))) { + if (!request.report(getLocation(false, false))) { removeLocationUpdates(request); i--; } diff --git a/play-services-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java b/play-services-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java index 24daa598..af8c2348 100644 --- a/play-services-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java +++ b/play-services-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java @@ -36,15 +36,10 @@ import com.google.android.gms.location.internal.LocationRequestUpdateData; import java.util.Arrays; -import static android.Manifest.permission.ACCESS_COARSE_LOCATION; -import static android.Manifest.permission.ACCESS_FINE_LOCATION; - public class LocationRequestHelper { public static final String TAG = "GmsLocRequestHelper"; private final Context context; public final LocationRequest locationRequest; - public final boolean initialHasFinePermission; - public final boolean initialHasCoarsePermission; public final String packageName; public final int uid; private final boolean selfHasAppOpsRights; @@ -61,9 +56,6 @@ public class LocationRequestHelper { this.packageName = packageName; this.uid = uid; - this.initialHasFinePermission = context.getPackageManager().checkPermission(ACCESS_FINE_LOCATION, packageName) == PackageManager.PERMISSION_GRANTED; - this.initialHasCoarsePermission = context.getPackageManager().checkPermission(ACCESS_COARSE_LOCATION, packageName) == PackageManager.PERMISSION_GRANTED; - this.selfHasAppOpsRights = context.getPackageManager().checkPermission("android.permission.UPDATE_APP_OPS_STATS", context.getPackageName()) == PackageManager.PERMISSION_GRANTED; } @@ -168,17 +160,17 @@ public class LocationRequestHelper { public boolean hasFinePermission() { if (Build.VERSION.SDK_INT >= 19) { - return isAppOpsAllowed(AppOpsManager.OPSTR_FINE_LOCATION, initialHasFinePermission); + return isAppOpsAllowed(AppOpsManager.OPSTR_FINE_LOCATION, false); } else { - return initialHasFinePermission; + return false; } } public boolean hasCoarsePermission() { if (Build.VERSION.SDK_INT >= 19) { - return isAppOpsAllowed(AppOpsManager.OPSTR_COARSE_LOCATION, initialHasCoarsePermission); + return isAppOpsAllowed(AppOpsManager.OPSTR_COARSE_LOCATION, false); } else { - return initialHasCoarsePermission; + return false; } } diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationRequest.java index 15d159e8..c48e5791 100644 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationRequest.java +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationRequest.java @@ -62,8 +62,8 @@ import java.util.Arrays; * may fuse the results from several sources into a single Location object. *

* Location requests from applications with - * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} and not - * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} will be automatically throttled to a + * ACCESS_COARSE_LOCATION and not + * ACCESS_FINE_LOCATION will be automatically throttled to a * slower interval, and the location object will be obfuscated to only show a coarse level of * accuracy. *