blob: 4a5f229daa937e0f54c29e69b662cf33f4b84452 [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
19import com.android.internal.telephony.Phone;
20import com.android.internal.telephony.PhoneConstants;
21
22import android.content.DialogInterface;
23import android.os.AsyncResult;
24import android.os.Bundle;
25import android.os.Handler;
26import android.os.Message;
Jonathan Basseric31f1f32015-05-12 10:13:03 -070027import android.os.PersistableBundle;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070028import android.preference.CheckBoxPreference;
29import android.preference.Preference;
30import android.preference.PreferenceActivity;
31import android.preference.PreferenceScreen;
Jonathan Basseri3649bdb2015-04-30 22:39:11 -070032import android.telephony.CarrierConfigManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070033import android.util.Log;
Sanket Padawee09a6f62015-03-05 11:59:39 -080034import android.view.MenuItem;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070035
36public class CdmaCallOptions extends PreferenceActivity {
37 private static final String LOG_TAG = "CdmaCallOptions";
38 private final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 2);
39
40 private static final String BUTTON_VP_KEY = "button_voice_privacy_key";
41 private CheckBoxPreference mButtonVoicePrivacy;
42
43 @Override
44 protected void onCreate(Bundle icicle) {
45 super.onCreate(icicle);
46
47 addPreferencesFromResource(R.xml.cdma_call_privacy);
48
Sanket Padawee09a6f62015-03-05 11:59:39 -080049 SubscriptionInfoHelper subInfoHelper = new SubscriptionInfoHelper(this, getIntent());
50 subInfoHelper.setActionBarTitle(
51 getActionBar(), getResources(), R.string.labelCdmaMore_with_label);
52
Santos Cordon7d4ddf62013-07-10 11:58:08 -070053 mButtonVoicePrivacy = (CheckBoxPreference) findPreference(BUTTON_VP_KEY);
Jonathan Basseric31f1f32015-05-12 10:13:03 -070054 PersistableBundle carrierConfig;
Jonathan Basseri3649bdb2015-04-30 22:39:11 -070055 if (subInfoHelper.hasSubId()) {
56 carrierConfig = PhoneGlobals.getInstance().getCarrierConfigForSubId(
57 subInfoHelper.getSubId());
58 } else {
59 carrierConfig = PhoneGlobals.getInstance().getCarrierConfig();
60 }
Sanket Padawee09a6f62015-03-05 11:59:39 -080061 if (subInfoHelper.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_CDMA
Jonathan Basserif0b39112015-06-09 15:14:06 -070062 || carrierConfig.getBoolean(CarrierConfigManager.KEY_VOICE_PRIVACY_DISABLE_UI_BOOL)) {
Jonathan Basseri3649bdb2015-04-30 22:39:11 -070063 // disable the entire screen
Santos Cordon7d4ddf62013-07-10 11:58:08 -070064 getPreferenceScreen().setEnabled(false);
65 }
66 }
67
68 @Override
Sanket Padawee09a6f62015-03-05 11:59:39 -080069 public boolean onOptionsItemSelected(MenuItem item) {
70 final int itemId = item.getItemId();
71 if (itemId == android.R.id.home) {
72 onBackPressed();
73 return true;
74 }
75 return super.onOptionsItemSelected(item);
76 }
77
78 @Override
Santos Cordon7d4ddf62013-07-10 11:58:08 -070079 public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
80 if (preference.getKey().equals(BUTTON_VP_KEY)) {
81 return true;
82 }
83 return false;
84 }
85
86}