1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.cts.verifier.location; 18 19 import android.location.LocationManager; 20 import android.provider.Settings.Secure; 21 import com.android.cts.verifier.R; 22 23 public class LocationModeOffTestActivity extends LocationModeTestActivity { 24 25 @Override 26 protected void createTestItems() { 27 createUserItem(R.string.location_mode_turn_off); 28 createAutoItem(R.string.location_mode_secure_gps_off); 29 createAutoItem(R.string.location_mode_secure_nlp_off); 30 createAutoItem(R.string.location_mode_manager_gps_off); 31 createAutoItem(R.string.location_mode_manager_nlp_off); 32 } 33 34 @Override 35 protected void setInfoResources() { 36 setInfoResources(R.string.location_mode_off_test, 37 R.string.location_mode_off_info, -1); 38 } 39 40 @Override 41 protected void testAdvance(int state) { 42 switch (state) { 43 case 0: 44 testIsExpectedMode(0, Secure.LOCATION_MODE_OFF); 45 break; 46 case 1: 47 testSecureProviderIsDisabled(1, LocationManager.GPS_PROVIDER); 48 break; 49 case 2: 50 testSecureProviderIsDisabled(2, LocationManager.NETWORK_PROVIDER); 51 break; 52 case 3: 53 testManagerProviderIsDisabled(3, LocationManager.GPS_PROVIDER); 54 break; 55 case 4: 56 testManagerProviderIsDisabled(4, LocationManager.NETWORK_PROVIDER); 57 break; 58 } 59 } 60 } 61