blob: acfa496f202487e5298040e30f339b42149a3435 [file] [log] [blame]
Santos Cordon7d4ddf62013-07-10 11:58:08 -07001/*
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
17package com.android.phone;
18
Santos Cordon7d4ddf62013-07-10 11:58:08 -070019import android.os.Bundle;
Jonathan Basseric31f1f32015-05-12 10:13:03 -070020import android.os.PersistableBundle;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070021import android.preference.Preference;
22import android.preference.PreferenceActivity;
23import android.preference.PreferenceScreen;
fionaxue46e69f2017-04-27 14:32:46 -070024import android.preference.SwitchPreference;
Jonathan Basseri3649bdb2015-04-30 22:39:11 -070025import android.telephony.CarrierConfigManager;
Sanket Padawee09a6f62015-03-05 11:59:39 -080026import android.view.MenuItem;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070027
Aravind Sreekumarafc08c52018-04-10 15:34:32 -070028import com.android.internal.telephony.PhoneConstants;
29
Santos Cordon7d4ddf62013-07-10 11:58:08 -070030public 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";
fionaxue46e69f2017-04-27 14:32:46 -070035 private SwitchPreference mButtonVoicePrivacy;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070036
37 @Override
38 protected void onCreate(Bundle icicle) {
39 super.onCreate(icicle);
40
41 addPreferencesFromResource(R.xml.cdma_call_privacy);
42
Sanket Padawee09a6f62015-03-05 11:59:39 -080043 SubscriptionInfoHelper subInfoHelper = new SubscriptionInfoHelper(this, getIntent());
44 subInfoHelper.setActionBarTitle(
45 getActionBar(), getResources(), R.string.labelCdmaMore_with_label);
46
fionaxue46e69f2017-04-27 14:32:46 -070047 mButtonVoicePrivacy = (SwitchPreference) findPreference(BUTTON_VP_KEY);
Jonathan Basseric31f1f32015-05-12 10:13:03 -070048 PersistableBundle carrierConfig;
Jonathan Basseri3649bdb2015-04-30 22:39:11 -070049 if (subInfoHelper.hasSubId()) {
50 carrierConfig = PhoneGlobals.getInstance().getCarrierConfigForSubId(
51 subInfoHelper.getSubId());
52 } else {
53 carrierConfig = PhoneGlobals.getInstance().getCarrierConfig();
54 }
Sanket Padawee09a6f62015-03-05 11:59:39 -080055 if (subInfoHelper.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_CDMA
Jonathan Basserif0b39112015-06-09 15:14:06 -070056 || carrierConfig.getBoolean(CarrierConfigManager.KEY_VOICE_PRIVACY_DISABLE_UI_BOOL)) {
Jonathan Basseri3649bdb2015-04-30 22:39:11 -070057 // disable the entire screen
Santos Cordon7d4ddf62013-07-10 11:58:08 -070058 getPreferenceScreen().setEnabled(false);
59 }
60 }
61
62 @Override
Sanket Padawee09a6f62015-03-05 11:59:39 -080063 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 Cordon7d4ddf62013-07-10 11:58:08 -070073 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}