Remove BatteryStatsValidationTest#testGpsUpdates

Bug: 153844216
Test: m cts
Change-Id: Ibd321fdcbc5fb49de0abda2e10dbb6a18f7a1b60
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsBgVsFgActions.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsBgVsFgActions.java
index a5a220c..4fe1785 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsBgVsFgActions.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsBgVsFgActions.java
@@ -63,7 +63,6 @@
     public static final String KEY_ACTION = "action";
     public static final String ACTION_BLE_SCAN_OPTIMIZED = "action.ble_scan_optimized";
     public static final String ACTION_BLE_SCAN_UNOPTIMIZED = "action.ble_scan_unoptimized";
-    public static final String ACTION_GPS = "action.gps";
     public static final String ACTION_JOB_SCHEDULE = "action.jobs";
     public static final String ACTION_SYNC = "action.sync";
     public static final String ACTION_SLEEP_WHILE_BACKGROUND = "action.sleep_background";
@@ -92,9 +91,6 @@
             case ACTION_BLE_SCAN_UNOPTIMIZED:
                 doUnoptimizedBleScan(ctx, requestCode);
                 break;
-            case ACTION_GPS:
-                doGpsUpdate(ctx, requestCode);
-                break;
             case ACTION_JOB_SCHEDULE:
                 doScheduleJob(ctx, requestCode);
                 break;
@@ -217,51 +213,6 @@
         }
     }
 
-    private static void doGpsUpdate(Context ctx, String requestCode) {
-        final LocationManager locManager = ctx.getSystemService(LocationManager.class);
-        if (!locManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
-            Log.e(TAG, "GPS provider is not enabled");
-            tellHostActionFinished(ACTION_GPS, requestCode);
-            return;
-        }
-        CountDownLatch latch = new CountDownLatch(1);
-
-        final LocationListener locListener = new LocationListener() {
-            public void onLocationChanged(Location location) {
-                Log.v(TAG, "onLocationChanged: location has been obtained");
-            }
-
-            public void onProviderDisabled(String provider) {
-                Log.w(TAG, "onProviderDisabled " + provider);
-            }
-
-            public void onProviderEnabled(String provider) {
-                Log.w(TAG, "onProviderEnabled " + provider);
-            }
-
-            public void onStatusChanged(String provider, int status, Bundle extras) {
-                Log.w(TAG, "onStatusChanged " + provider + " " + status);
-            }
-        };
-
-        HandlerThread handlerThread = new HandlerThread("doGpsUpdate_bg");
-        handlerThread.start();
-
-        Handler handler = new Handler(handlerThread.getLooper());
-        handler.post(() -> {
-                    locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 990, 0,
-                            locListener);
-                    sleep(1_000);
-                    locManager.removeUpdates(locListener);
-                    latch.countDown();
-                });
-
-        waitForReceiver(ctx, 59_000, latch, null);
-        handlerThread.quitSafely();
-
-        tellHostActionFinished(ACTION_GPS, requestCode);
-    }
-
     private static void doScheduleJob(Context ctx, String requestCode) {
         final ComponentName JOB_COMPONENT_NAME =
                 new ComponentName("com.android.server.cts.device.batterystats",
diff --git a/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java b/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java
index 22535cc..27d4d22 100644
--- a/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java
+++ b/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java
@@ -43,7 +43,6 @@
     // These constants are those in PackageManager.
     public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
     public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
-    public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
 
     private static final int STATE_TIME_TOP_INDEX = 4;
     private static final int STATE_TIME_FOREGROUND_SERVICE_INDEX = 5;
@@ -62,7 +61,6 @@
     public static final String KEY_ACTION = "action";
     public static final String ACTION_BLE_SCAN_OPTIMIZED = "action.ble_scan_optimized";
     public static final String ACTION_BLE_SCAN_UNOPTIMIZED = "action.ble_scan_unoptimized";
-    public static final String ACTION_GPS = "action.gps";
     public static final String ACTION_JOB_SCHEDULE = "action.jobs";
     public static final String ACTION_SYNC = "action.sync";
     public static final String ACTION_SLEEP_WHILE_BACKGROUND = "action.sleep_background";
@@ -345,45 +343,6 @@
         batteryOffScreenOn();
     }
 
-    public void testGpsUpdates() throws Exception {
-        if (noBattery() || !hasFeature(FEATURE_LOCATION_GPS, true)) {
-            return;
-        }
-
-        final String gpsSensorNumber = "-10000";
-
-        batteryOnScreenOff();
-        installPackage(DEVICE_SIDE_TEST_APK, true);
-        // Whitelist this app against background location request throttling
-        String origWhitelist = getDevice().executeShellCommand(
-                "settings get global location_background_throttle_package_whitelist").trim();
-        getDevice().executeShellCommand(String.format(
-                "settings put global location_background_throttle_package_whitelist %s",
-                DEVICE_SIDE_TEST_PACKAGE));
-
-        try {
-            // Background test.
-            executeBackground(ACTION_GPS, 60_000);
-            assertValueRange("sr", gpsSensorNumber, 6, 1, 1); // count
-            assertValueRange("sr", gpsSensorNumber, 7, 1, 1); // background_count
-
-            // Foreground test.
-            executeForeground(ACTION_GPS, 60_000);
-            assertValueRange("sr", gpsSensorNumber, 6, 2, 2); // count
-            assertValueRange("sr", gpsSensorNumber, 7, 1, 1); // background_count
-        } finally {
-            if ("null".equals(origWhitelist) || "".equals(origWhitelist)) {
-                getDevice().executeShellCommand(
-                        "settings delete global location_background_throttle_package_whitelist");
-            } else {
-                getDevice().executeShellCommand(String.format(
-                        "settings put global location_background_throttle_package_whitelist %s",
-                        origWhitelist));
-            }
-            batteryOffScreenOn();
-        }
-    }
-
     public void testJobBgVsFg() throws Exception {
         if (noBattery()) {
             return;