• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
19 import com.android.internal.telephony.Phone;
20 import com.android.internal.telephony.PhoneConstants;
21 
22 import android.content.DialogInterface;
23 import android.os.AsyncResult;
24 import android.os.Bundle;
25 import android.os.Handler;
26 import android.os.Message;
27 import android.os.PersistableBundle;
28 import android.preference.CheckBoxPreference;
29 import android.preference.Preference;
30 import android.preference.PreferenceActivity;
31 import android.preference.PreferenceScreen;
32 import android.telephony.CarrierConfigManager;
33 import android.util.Log;
34 import android.view.MenuItem;
35 
36 public 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
onCreate(Bundle icicle)44     protected void onCreate(Bundle icicle) {
45         super.onCreate(icicle);
46 
47         addPreferencesFromResource(R.xml.cdma_call_privacy);
48 
49         SubscriptionInfoHelper subInfoHelper = new SubscriptionInfoHelper(this, getIntent());
50         subInfoHelper.setActionBarTitle(
51                 getActionBar(), getResources(), R.string.labelCdmaMore_with_label);
52 
53         mButtonVoicePrivacy = (CheckBoxPreference) findPreference(BUTTON_VP_KEY);
54         PersistableBundle carrierConfig;
55         if (subInfoHelper.hasSubId()) {
56             carrierConfig = PhoneGlobals.getInstance().getCarrierConfigForSubId(
57                     subInfoHelper.getSubId());
58         } else {
59             carrierConfig = PhoneGlobals.getInstance().getCarrierConfig();
60         }
61         if (subInfoHelper.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_CDMA
62                 || carrierConfig.getBoolean(CarrierConfigManager.KEY_VOICE_PRIVACY_DISABLE_UI_BOOL)) {
63             // disable the entire screen
64             getPreferenceScreen().setEnabled(false);
65         }
66     }
67 
68     @Override
onOptionsItemSelected(MenuItem item)69     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
onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference)79     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 }
87