Skip to content

Instantly share code, notes, and snippets.

@phstudy
Last active February 11, 2019 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phstudy/2c23609731578a941e2847aed1ccfc04 to your computer and use it in GitHub Desktop.
Save phstudy/2c23609731578a941e2847aed1ccfc04 to your computer and use it in GitHub Desktop.
revert CVE-2017-0489 for mock location detection (Android 2017-03-01 security patch)
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index 7b02a4fb3fd..04006c36e5a 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -73,7 +73,6 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
-import android.util.EventLog;
import android.util.Log;
import android.util.Slog;
import com.android.internal.content.PackageMonitor;
@@ -3250,21 +3249,9 @@ public class LocationManagerService extends ILocationManager.Stub {
throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
}
- // Ensure that the location is marked as being mock. There's some logic to do this in
- // handleLocationChanged(), but it fails if loc has the wrong provider (bug 33091107).
- Location mock = new Location(loc);
- mock.setIsFromMockProvider(true);
-
- if (!TextUtils.isEmpty(loc.getProvider()) && !provider.equals(loc.getProvider())) {
- // The location has an explicit provider that is different from the mock provider
- // name. The caller may be trying to fool us via bug 33091107.
- EventLog.writeEvent(0x534e4554, "33091107", Binder.getCallingUid(),
- provider + "!=" + loc.getProvider());
- }
-
// clear calling identity so INSTALL_LOCATION_PROVIDER permission is not required
long identity = Binder.clearCallingIdentity();
- mockProvider.setLocation(mock);
+ mockProvider.setLocation(loc);
Binder.restoreCallingIdentity(identity);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment