Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 394b8683 authored by Soonil Nagarkar's avatar Soonil Nagarkar
Browse files

Reduce GpsStatus API crashes to SDK S+

Bug: 144125622
Test: n/a
Change-Id: Ic1f6e1ed8daf867fbfdc1ce94d42420577e29bac
parent 643bbeb1
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -1810,6 +1810,14 @@ public class LocationManager {
    @Deprecated
    @RequiresPermission(ACCESS_FINE_LOCATION)
    public @Nullable GpsStatus getGpsStatus(@Nullable GpsStatus status) {
        UnsupportedOperationException ex = new UnsupportedOperationException(
                "GpsStatus APIs not supported in S and above, use GnssStatus APIs instead");
        if (mContext.getApplicationInfo().targetSdkVersion > Build.VERSION_CODES.R) {
            throw ex;
        } else {
            Log.w(TAG, ex);
        }

        if (status == null) {
            status = new GpsStatus();
        }
@@ -1837,8 +1845,8 @@ public class LocationManager {
    @RequiresPermission(ACCESS_FINE_LOCATION)
    public boolean addGpsStatusListener(GpsStatus.Listener listener) {
        UnsupportedOperationException ex = new UnsupportedOperationException(
                "GpsStatus APIs not supported in R and above, use GnssStatus APIs instead");
        if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.R) {
                "GpsStatus APIs not supported in S and above, use GnssStatus APIs instead");
        if (mContext.getApplicationInfo().targetSdkVersion > Build.VERSION_CODES.R) {
            throw ex;
        } else {
            Log.w(TAG, ex);
@@ -1862,8 +1870,8 @@ public class LocationManager {
    @Deprecated
    public void removeGpsStatusListener(GpsStatus.Listener listener) {
        UnsupportedOperationException ex = new UnsupportedOperationException(
                "GpsStatus APIs not supported in R and above, use GnssStatus APIs instead");
        if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.R) {
                "GpsStatus APIs not supported in S and above, use GnssStatus APIs instead");
        if (mContext.getApplicationInfo().targetSdkVersion > Build.VERSION_CODES.R) {
            throw ex;
        } else {
            Log.w(TAG, ex);