1 /* 2 * Copyright (C) 2018 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.server.telecom.ui; 18 19 import android.app.Activity; 20 import android.os.Bundle; 21 import android.widget.Switch; 22 23 import com.android.server.telecom.R; 24 import com.android.server.telecom.SystemSettingsUtil; 25 26 /** 27 * Telecom Developer Settings Menu. 28 */ 29 public class TelecomDeveloperMenu extends Activity { 30 31 private Switch mEnhancedCallingSwitch; 32 private SystemSettingsUtil mSystemSettingsUtil; 33 34 @Override onCreate(Bundle savedInstanceState)35 public void onCreate(Bundle savedInstanceState) { 36 super.onCreate(savedInstanceState); 37 mSystemSettingsUtil = new SystemSettingsUtil(); 38 setContentView(R.layout.telecom_developer_menu); 39 40 mEnhancedCallingSwitch = findViewById(R.id.switchEnhancedCallBlocking); 41 mEnhancedCallingSwitch.setOnClickListener(l -> { 42 handleEnhancedCallingToggle(); 43 }); 44 loadPreferences(); 45 } 46 handleEnhancedCallingToggle()47 private void handleEnhancedCallingToggle() { 48 mSystemSettingsUtil.setEnhancedCallBlockingEnabled(this, 49 mEnhancedCallingSwitch.isChecked()); 50 } 51 loadPreferences()52 private void loadPreferences() { 53 mEnhancedCallingSwitch.setChecked(mSystemSettingsUtil.isEnhancedCallBlockingEnabled(this)); 54 } 55 }