diff options
| author | 2020-12-16 18:58:25 +0000 | |
|---|---|---|
| committer | 2020-12-16 18:58:25 +0000 | |
| commit | 8068b16f2f82fa1d4af251fed34e7b455bdddc68 (patch) | |
| tree | b335dc3a2fa029d8b834cc0c8b68e0df21ae8fbd /location/java | |
| parent | 6d7e51948d6b616b7e630829247772cdcc45673e (diff) | |
| parent | ff097cef1746fff6a58dd16d2539b8b5dd914e47 (diff) | |
Merge "Move NUM_GPS_SIGNAL_QUALITY_LEVELS to GnssSignalQuality"
Diffstat (limited to 'location/java')
| -rw-r--r-- | location/java/android/location/GnssSignalQuality.java | 38 | ||||
| -rw-r--r-- | location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java | 25 |
2 files changed, 47 insertions, 16 deletions
diff --git a/location/java/android/location/GnssSignalQuality.java b/location/java/android/location/GnssSignalQuality.java new file mode 100644 index 000000000000..7945f3ecf841 --- /dev/null +++ b/location/java/android/location/GnssSignalQuality.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.location; + +import android.server.location.ServerLocationProtoEnums; + +/** + * Gnss signal quality information. + * + * @hide + */ +public interface GnssSignalQuality { + + int GNSS_SIGNAL_QUALITY_UNKNOWN = + ServerLocationProtoEnums.GPS_SIGNAL_QUALITY_UNKNOWN; // -1 + + int GNSS_SIGNAL_QUALITY_POOR = + ServerLocationProtoEnums.GPS_SIGNAL_QUALITY_POOR; // 0 + + int GNSS_SIGNAL_QUALITY_GOOD = + ServerLocationProtoEnums.GPS_SIGNAL_QUALITY_GOOD; // 1 + + int NUM_GNSS_SIGNAL_QUALITY_LEVELS = GNSS_SIGNAL_QUALITY_GOOD + 1; +} diff --git a/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java b/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java index 0822cda04417..dd8a8c3bd1d5 100644 --- a/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java +++ b/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java @@ -16,6 +16,11 @@ package com.android.internal.location.gnssmetrics; +import static android.location.GnssSignalQuality.GNSS_SIGNAL_QUALITY_GOOD; +import static android.location.GnssSignalQuality.GNSS_SIGNAL_QUALITY_POOR; +import static android.location.GnssSignalQuality.GNSS_SIGNAL_QUALITY_UNKNOWN; +import static android.location.GnssSignalQuality.NUM_GNSS_SIGNAL_QUALITY_LEVELS; + import android.app.StatsManager; import android.content.Context; import android.location.GnssStatus; @@ -23,7 +28,6 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.SystemProperties; import android.os.connectivity.GpsBatteryStats; -import android.server.location.ServerLocationProtoEnums; import android.text.format.DateUtils; import android.util.Base64; import android.util.Log; @@ -50,17 +54,6 @@ public class GnssMetrics { private static final String TAG = "GnssMetrics"; - private static final int GPS_SIGNAL_QUALITY_UNKNOWN = - ServerLocationProtoEnums.GPS_SIGNAL_QUALITY_UNKNOWN; // -1 - - private static final int GPS_SIGNAL_QUALITY_POOR = - ServerLocationProtoEnums.GPS_SIGNAL_QUALITY_POOR; // 0 - - private static final int GPS_SIGNAL_QUALITY_GOOD = - ServerLocationProtoEnums.GPS_SIGNAL_QUALITY_GOOD; // 1 - - public static final int NUM_GPS_SIGNAL_QUALITY_LEVELS = GPS_SIGNAL_QUALITY_GOOD + 1; - /** Default time between location fixes (in millisecs) */ private static final int DEFAULT_TIME_BETWEEN_FIXES_MILLISECS = 1000; @@ -397,7 +390,7 @@ public class GnssMetrics { stats.getLoggingDurationMs() / ((double) DateUtils.MINUTE_IN_MILLIS)).append( "\n"); long[] t = stats.getTimeInGpsSignalQualityLevel(); - if (t != null && t.length == NUM_GPS_SIGNAL_QUALITY_LEVELS) { + if (t != null && t.length == NUM_GNSS_SIGNAL_QUALITY_LEVELS) { s.append(" Amount of time (while on battery) Top 4 Avg CN0 > " + GnssPowerMetrics.POOR_TOP_FOUR_AVG_CN0_THRESHOLD_DB_HZ + " dB-Hz (min): ").append( @@ -512,7 +505,7 @@ public class GnssMetrics { // so that // the first CNO report will trigger an update to BatteryStats mLastAverageCn0 = -100.0; - mLastSignalLevel = GPS_SIGNAL_QUALITY_UNKNOWN; + mLastSignalLevel = GNSS_SIGNAL_QUALITY_UNKNOWN; } /** @@ -584,9 +577,9 @@ public class GnssMetrics { */ private int getSignalLevel(double cn0) { if (cn0 > POOR_TOP_FOUR_AVG_CN0_THRESHOLD_DB_HZ) { - return GnssMetrics.GPS_SIGNAL_QUALITY_GOOD; + return GNSS_SIGNAL_QUALITY_GOOD; } - return GnssMetrics.GPS_SIGNAL_QUALITY_POOR; + return GNSS_SIGNAL_QUALITY_POOR; } } |