Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 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.phone; |
| 18 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 19 | import android.os.Bundle; |
Jonathan Basseri | c31f1f3 | 2015-05-12 10:13:03 -0700 | [diff] [blame] | 20 | import android.os.PersistableBundle; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 21 | import android.preference.Preference; |
| 22 | import android.preference.PreferenceActivity; |
| 23 | import android.preference.PreferenceScreen; |
fionaxu | e46e69f | 2017-04-27 14:32:46 -0700 | [diff] [blame] | 24 | import android.preference.SwitchPreference; |
Jonathan Basseri | 3649bdb | 2015-04-30 22:39:11 -0700 | [diff] [blame] | 25 | import android.telephony.CarrierConfigManager; |
Sanket Padawe | e09a6f6 | 2015-03-05 11:59:39 -0800 | [diff] [blame] | 26 | import android.view.MenuItem; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 27 | |
Aravind Sreekumar | afc08c5 | 2018-04-10 15:34:32 -0700 | [diff] [blame^] | 28 | import com.android.internal.telephony.PhoneConstants; |
| 29 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 30 | public class CdmaCallOptions extends PreferenceActivity { |
| 31 | private static final String LOG_TAG = "CdmaCallOptions"; |
| 32 | private final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 2); |
| 33 | |
| 34 | private static final String BUTTON_VP_KEY = "button_voice_privacy_key"; |
fionaxu | e46e69f | 2017-04-27 14:32:46 -0700 | [diff] [blame] | 35 | private SwitchPreference mButtonVoicePrivacy; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 36 | |
| 37 | @Override |
| 38 | protected void onCreate(Bundle icicle) { |
| 39 | super.onCreate(icicle); |
| 40 | |
| 41 | addPreferencesFromResource(R.xml.cdma_call_privacy); |
| 42 | |
Sanket Padawe | e09a6f6 | 2015-03-05 11:59:39 -0800 | [diff] [blame] | 43 | SubscriptionInfoHelper subInfoHelper = new SubscriptionInfoHelper(this, getIntent()); |
| 44 | subInfoHelper.setActionBarTitle( |
| 45 | getActionBar(), getResources(), R.string.labelCdmaMore_with_label); |
| 46 | |
fionaxu | e46e69f | 2017-04-27 14:32:46 -0700 | [diff] [blame] | 47 | mButtonVoicePrivacy = (SwitchPreference) findPreference(BUTTON_VP_KEY); |
Jonathan Basseri | c31f1f3 | 2015-05-12 10:13:03 -0700 | [diff] [blame] | 48 | PersistableBundle carrierConfig; |
Jonathan Basseri | 3649bdb | 2015-04-30 22:39:11 -0700 | [diff] [blame] | 49 | if (subInfoHelper.hasSubId()) { |
| 50 | carrierConfig = PhoneGlobals.getInstance().getCarrierConfigForSubId( |
| 51 | subInfoHelper.getSubId()); |
| 52 | } else { |
| 53 | carrierConfig = PhoneGlobals.getInstance().getCarrierConfig(); |
| 54 | } |
Sanket Padawe | e09a6f6 | 2015-03-05 11:59:39 -0800 | [diff] [blame] | 55 | if (subInfoHelper.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_CDMA |
Jonathan Basseri | f0b3911 | 2015-06-09 15:14:06 -0700 | [diff] [blame] | 56 | || carrierConfig.getBoolean(CarrierConfigManager.KEY_VOICE_PRIVACY_DISABLE_UI_BOOL)) { |
Jonathan Basseri | 3649bdb | 2015-04-30 22:39:11 -0700 | [diff] [blame] | 57 | // disable the entire screen |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 58 | getPreferenceScreen().setEnabled(false); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | @Override |
Sanket Padawe | e09a6f6 | 2015-03-05 11:59:39 -0800 | [diff] [blame] | 63 | public boolean onOptionsItemSelected(MenuItem item) { |
| 64 | final int itemId = item.getItemId(); |
| 65 | if (itemId == android.R.id.home) { |
| 66 | onBackPressed(); |
| 67 | return true; |
| 68 | } |
| 69 | return super.onOptionsItemSelected(item); |
| 70 | } |
| 71 | |
| 72 | @Override |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 73 | public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { |
| 74 | if (preference.getKey().equals(BUTTON_VP_KEY)) { |
| 75 | return true; |
| 76 | } |
| 77 | return false; |
| 78 | } |
| 79 | |
| 80 | } |