From e41992c16e717f5ed04e506bcfc6cea09e76a8ea Mon Sep 17 00:00:00 2001 From: Anil Admal Date: Mon, 8 Apr 2019 12:36:02 -0700 Subject: [PATCH] Extend support for requestRouteToHostAddress for backward compatibility The gnss@2.0 HAL and the framework GNSS Location Provider code is updated in Q to not call the deprecated requestRouteToHost() method. However, devices upgrading to Q which are still using gnss@1.1 or earlier HAL must continued to be supported. Fixes: 121222025 Test: Tested with gnss@1.1 HAL and first API level P. The ConnectivityService log message "This method exists only for app backwards compatibility and must not be called by system services" is not present for devices with first API level P. Change-Id: I10199776ea413dc256dbf0771e6cb3eedb334495 Merged-In: Ifa60d8f2d60aba4c4e2894dc612c224d45e3992d Merged-In: Ifa4ec98d5c942522dfd569664f169fa841d495ed (cherry picked from commit 2eea7ac272431b6e02a0a281207b981b01daf393) --- .../core/java/com/android/server/ConnectivityService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 640525411239c..7a5e1b5b04f11 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -133,6 +133,7 @@ import android.os.ServiceSpecificException; import android.os.ShellCallback; import android.os.ShellCommand; import android.os.SystemClock; +import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; @@ -1628,8 +1629,11 @@ public class ConnectivityService extends IConnectivityManager.Stub */ private boolean disallowedBecauseSystemCaller() { // TODO: start throwing a SecurityException when GnssLocationProvider stops calling - // requestRouteToHost. - if (isSystem(Binder.getCallingUid())) { + // requestRouteToHost. In Q, GnssLocationProvider is changed to not call requestRouteToHost + // for devices launched with Q and above. However, existing devices upgrading to Q and + // above must continued to be supported for few more releases. + if (isSystem(Binder.getCallingUid()) && SystemProperties.getInt( + "ro.product.first_api_level", 0) > Build.VERSION_CODES.P) { log("This method exists only for app backwards compatibility" + " and must not be called by system services."); return true;