1 /* 2 * Copyright (C) 2017 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.voicemail; 18 19 import android.content.Intent; 20 import android.os.Bundle; 21 import android.telecom.TelecomManager; 22 import android.view.View; 23 import android.view.View.OnClickListener; 24 25 import com.android.cts.verifier.PassFailButtons; 26 import com.android.cts.verifier.R; 27 28 /** 29 * Tests {@link android.telephony.TelephonyManager#METADATA_HIDE_VOICEMAIL_SETTINGS_MENU} 30 */ 31 public class CallSettingsCheckActivity extends PassFailButtons.Activity { 32 33 private DefaultDialerChanger mDefaultDialerChanger; 34 35 @Override onCreate(Bundle savedInstanceState)36 protected void onCreate(Bundle savedInstanceState) { 37 super.onCreate(savedInstanceState); 38 View view = getLayoutInflater().inflate(R.layout.voicemail_hide_in_call_settings, null); 39 setContentView(view); 40 setInfoResources(R.string.call_settings_check_test, 41 R.string.call_settings_check_instructions, -1); 42 setPassFailButtonClickListeners(); 43 getPassButton().setEnabled(false); 44 45 mDefaultDialerChanger = new DefaultDialerChanger(this); 46 47 findViewById(R.id.open_call_settings).setOnClickListener( 48 new OnClickListener() { 49 @Override 50 public void onClick(View v) { 51 startActivity(new Intent(TelecomManager.ACTION_SHOW_CALL_SETTINGS)); 52 } 53 } 54 ); 55 56 findViewById(R.id.settings_hidden).setOnClickListener( 57 new OnClickListener() { 58 @Override 59 public void onClick(View v) { 60 getPassButton().setEnabled(true); 61 setTestResultAndFinish(true); 62 } 63 } 64 ); 65 66 findViewById(R.id.settings_not_hidden).setOnClickListener( 67 new OnClickListener() { 68 @Override 69 public void onClick(View v) { 70 setTestResultAndFinish(false); 71 } 72 } 73 ); 74 75 } 76 77 @Override onDestroy()78 protected void onDestroy() { 79 mDefaultDialerChanger.destroy(); 80 super.onDestroy(); 81 } 82 } 83