The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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.settings; |
| 18 | |
Amith Yamasani | b810a0d | 2012-03-25 10:12:26 -0700 | [diff] [blame^] | 19 | import com.android.internal.util.ArrayUtils; |
Gilles Debunne | cd8e524 | 2011-07-25 11:36:15 -0700 | [diff] [blame] | 20 | import com.android.settings.accounts.AccountSyncSettings; |
| 21 | import com.android.settings.bluetooth.BluetoothEnabler; |
Jeff Sharkey | 11d3012 | 2012-03-19 16:54:07 -0700 | [diff] [blame] | 22 | import com.android.settings.deviceinfo.Memory; |
Gilles Debunne | cd8e524 | 2011-07-25 11:36:15 -0700 | [diff] [blame] | 23 | import com.android.settings.fuelgauge.PowerUsageSummary; |
| 24 | import com.android.settings.wifi.WifiEnabler; |
| 25 | |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 26 | import android.content.ComponentName; |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 27 | import android.content.Context; |
Amith Yamasani | 379d9b0 | 2010-09-27 12:03:59 -0700 | [diff] [blame] | 28 | import android.content.Intent; |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 29 | import android.content.pm.ActivityInfo; |
| 30 | import android.content.pm.PackageManager; |
| 31 | import android.content.pm.PackageManager.NameNotFoundException; |
Dianne Hackborn | f4eb85b | 2010-10-29 16:53:04 -0700 | [diff] [blame] | 32 | import android.os.Bundle; |
Amith Yamasani | b810a0d | 2012-03-25 10:12:26 -0700 | [diff] [blame^] | 33 | import android.os.UserId; |
Amith Yamasani | a4379d6 | 2011-07-22 10:34:58 -0700 | [diff] [blame] | 34 | import android.preference.Preference; |
Amith Yamasani | 02cf71a | 2010-09-21 15:48:52 -0700 | [diff] [blame] | 35 | import android.preference.PreferenceActivity; |
Amith Yamasani | a4379d6 | 2011-07-22 10:34:58 -0700 | [diff] [blame] | 36 | import android.preference.PreferenceFragment; |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 37 | import android.text.TextUtils; |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 38 | import android.util.Log; |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 39 | import android.view.LayoutInflater; |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 40 | import android.view.View; |
| 41 | import android.view.View.OnClickListener; |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 42 | import android.view.ViewGroup; |
| 43 | import android.widget.ArrayAdapter; |
Amith Yamasani | 9e3a470 | 2011-01-11 09:09:26 -0800 | [diff] [blame] | 44 | import android.widget.Button; |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 45 | import android.widget.ImageView; |
| 46 | import android.widget.ListAdapter; |
| 47 | import android.widget.Switch; |
| 48 | import android.widget.TextView; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 49 | |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 50 | import java.util.ArrayList; |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 51 | import java.util.HashMap; |
Amith Yamasani | 02cf71a | 2010-09-21 15:48:52 -0700 | [diff] [blame] | 52 | import java.util.List; |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Top-level settings activity to handle single pane and double pane UI layout. |
| 56 | */ |
Daisuke Miyakawa | 79c5fd9 | 2011-01-15 14:58:00 -0800 | [diff] [blame] | 57 | public class Settings extends PreferenceActivity implements ButtonBarHandler { |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 58 | |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 59 | private static final String LOG_TAG = "Settings"; |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 60 | private static final String META_DATA_KEY_HEADER_ID = |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 61 | "com.android.settings.TOP_LEVEL_HEADER_ID"; |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 62 | private static final String META_DATA_KEY_FRAGMENT_CLASS = |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 63 | "com.android.settings.FRAGMENT_CLASS"; |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 64 | private static final String META_DATA_KEY_PARENT_TITLE = |
| 65 | "com.android.settings.PARENT_FRAGMENT_TITLE"; |
| 66 | private static final String META_DATA_KEY_PARENT_FRAGMENT_CLASS = |
| 67 | "com.android.settings.PARENT_FRAGMENT_CLASS"; |
| 68 | |
Jeff Sharkey | 54d0af5 | 2011-08-11 18:26:57 -0700 | [diff] [blame] | 69 | private static final String EXTRA_CLEAR_UI_OPTIONS = "settings:remove_ui_options"; |
Jeff Sharkey | 9fab0da | 2011-07-09 17:52:31 -0700 | [diff] [blame] | 70 | |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 71 | private static final String SAVE_KEY_CURRENT_HEADER = "com.android.settings.CURRENT_HEADER"; |
| 72 | private static final String SAVE_KEY_PARENT_HEADER = "com.android.settings.PARENT_HEADER"; |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 73 | |
| 74 | private String mFragmentClass; |
| 75 | private int mTopLevelHeaderId; |
Amith Yamasani | 3965ae6 | 2010-11-15 14:45:19 -0800 | [diff] [blame] | 76 | private Header mFirstHeader; |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 77 | private Header mCurrentHeader; |
| 78 | private Header mParentHeader; |
| 79 | private boolean mInLocalHeaderSwitch; |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 80 | |
Amith Yamasani | b810a0d | 2012-03-25 10:12:26 -0700 | [diff] [blame^] | 81 | // Show only these settings for restricted users |
| 82 | private int[] SETTINGS_FOR_RESTRICTED = { |
| 83 | R.id.wifi_settings, |
| 84 | R.id.bluetooth_settings, |
| 85 | R.id.sound_settings, |
| 86 | R.id.display_settings, |
| 87 | //R.id.security_settings, |
| 88 | R.id.sync_settings, |
| 89 | R.id.about_settings |
| 90 | }; |
| 91 | |
Amith Yamasani | 02cf71a | 2010-09-21 15:48:52 -0700 | [diff] [blame] | 92 | // TODO: Update Call Settings based on airplane mode state. |
Amith Yamasani | b61cf51 | 2010-09-12 08:17:50 -0700 | [diff] [blame] | 93 | |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 94 | protected HashMap<Integer, Integer> mHeaderIndexMap = new HashMap<Integer, Integer>(); |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 95 | private List<Header> mHeaders; |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 96 | |
| 97 | @Override |
| 98 | protected void onCreate(Bundle savedInstanceState) { |
Jeff Sharkey | 54d0af5 | 2011-08-11 18:26:57 -0700 | [diff] [blame] | 99 | if (getIntent().getBooleanExtra(EXTRA_CLEAR_UI_OPTIONS, false)) { |
| 100 | getWindow().setUiOptions(0); |
| 101 | } |
Jeff Sharkey | 9fab0da | 2011-07-09 17:52:31 -0700 | [diff] [blame] | 102 | |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 103 | getMetaData(); |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 104 | mInLocalHeaderSwitch = true; |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 105 | super.onCreate(savedInstanceState); |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 106 | mInLocalHeaderSwitch = false; |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 107 | |
Gilles Debunne | 3661b62 | 2011-06-27 11:19:16 -0700 | [diff] [blame] | 108 | if (!onIsHidingHeaders() && onIsMultiPane()) { |
Amith Yamasani | 72aa19d | 2010-12-09 06:07:12 -0800 | [diff] [blame] | 109 | highlightHeader(); |
| 110 | // Force the title so that it doesn't get overridden by a direct launch of |
| 111 | // a specific settings screen. |
| 112 | setTitle(R.string.settings_label); |
| 113 | } |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 114 | |
| 115 | // Retrieve any saved state |
| 116 | if (savedInstanceState != null) { |
| 117 | mCurrentHeader = savedInstanceState.getParcelable(SAVE_KEY_CURRENT_HEADER); |
| 118 | mParentHeader = savedInstanceState.getParcelable(SAVE_KEY_PARENT_HEADER); |
| 119 | } |
| 120 | |
| 121 | // If the current header was saved, switch to it |
| 122 | if (savedInstanceState != null && mCurrentHeader != null) { |
| 123 | //switchToHeaderLocal(mCurrentHeader); |
| 124 | showBreadCrumbs(mCurrentHeader.title, null); |
| 125 | } |
| 126 | |
| 127 | if (mParentHeader != null) { |
| 128 | setParentTitle(mParentHeader.title, null, new OnClickListener() { |
| 129 | public void onClick(View v) { |
| 130 | switchToParent(mParentHeader.fragment); |
| 131 | } |
| 132 | }); |
| 133 | } |
Gilles Debunne | dc7101f | 2011-06-27 12:00:49 -0700 | [diff] [blame] | 134 | |
| 135 | // TODO Add support for android.R.id.home in all Setting's onOptionsItemSelected |
| 136 | // getActionBar().setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, |
| 137 | // ActionBar.DISPLAY_HOME_AS_UP); |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | @Override |
| 141 | protected void onSaveInstanceState(Bundle outState) { |
| 142 | super.onSaveInstanceState(outState); |
| 143 | |
| 144 | // Save the current fragment, if it is the same as originally launched |
| 145 | if (mCurrentHeader != null) { |
| 146 | outState.putParcelable(SAVE_KEY_CURRENT_HEADER, mCurrentHeader); |
| 147 | } |
| 148 | if (mParentHeader != null) { |
| 149 | outState.putParcelable(SAVE_KEY_PARENT_HEADER, mParentHeader); |
| 150 | } |
| 151 | } |
| 152 | |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 153 | @Override |
| 154 | public void onResume() { |
| 155 | super.onResume(); |
| 156 | |
| 157 | ListAdapter listAdapter = getListAdapter(); |
| 158 | if (listAdapter instanceof HeaderAdapter) { |
| 159 | ((HeaderAdapter) listAdapter).resume(); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | @Override |
| 164 | public void onPause() { |
| 165 | super.onPause(); |
| 166 | |
| 167 | ListAdapter listAdapter = getListAdapter(); |
| 168 | if (listAdapter instanceof HeaderAdapter) { |
| 169 | ((HeaderAdapter) listAdapter).pause(); |
| 170 | } |
| 171 | } |
| 172 | |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 173 | private void switchToHeaderLocal(Header header) { |
| 174 | mInLocalHeaderSwitch = true; |
| 175 | switchToHeader(header); |
| 176 | mInLocalHeaderSwitch = false; |
| 177 | } |
| 178 | |
| 179 | @Override |
| 180 | public void switchToHeader(Header header) { |
| 181 | if (!mInLocalHeaderSwitch) { |
| 182 | mCurrentHeader = null; |
| 183 | mParentHeader = null; |
| 184 | } |
| 185 | super.switchToHeader(header); |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * Switch to parent fragment and store the grand parent's info |
Jake Hamby | 2748fc2 | 2011-01-12 15:06:28 -0800 | [diff] [blame] | 190 | * @param className name of the activity wrapper for the parent fragment. |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 191 | */ |
| 192 | private void switchToParent(String className) { |
| 193 | final ComponentName cn = new ComponentName(this, className); |
| 194 | try { |
| 195 | final PackageManager pm = getPackageManager(); |
| 196 | final ActivityInfo parentInfo = pm.getActivityInfo(cn, PackageManager.GET_META_DATA); |
| 197 | |
| 198 | if (parentInfo != null && parentInfo.metaData != null) { |
| 199 | String fragmentClass = parentInfo.metaData.getString(META_DATA_KEY_FRAGMENT_CLASS); |
| 200 | CharSequence fragmentTitle = parentInfo.loadLabel(pm); |
| 201 | Header parentHeader = new Header(); |
| 202 | parentHeader.fragment = fragmentClass; |
| 203 | parentHeader.title = fragmentTitle; |
| 204 | mCurrentHeader = parentHeader; |
| 205 | |
| 206 | switchToHeaderLocal(parentHeader); |
Amith Yamasani | 990fb52 | 2011-09-02 09:47:18 -0700 | [diff] [blame] | 207 | highlightHeader(); |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 208 | |
| 209 | mParentHeader = new Header(); |
| 210 | mParentHeader.fragment |
| 211 | = parentInfo.metaData.getString(META_DATA_KEY_PARENT_FRAGMENT_CLASS); |
| 212 | mParentHeader.title = parentInfo.metaData.getString(META_DATA_KEY_PARENT_TITLE); |
| 213 | } |
| 214 | } catch (NameNotFoundException nnfe) { |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 215 | Log.w(LOG_TAG, "Could not find parent activity : " + className); |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 216 | } |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 217 | } |
| 218 | |
Amith Yamasani | 3965ae6 | 2010-11-15 14:45:19 -0800 | [diff] [blame] | 219 | @Override |
| 220 | public void onNewIntent(Intent intent) { |
| 221 | super.onNewIntent(intent); |
| 222 | |
| 223 | // If it is not launched from history, then reset to top-level |
| 224 | if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0 |
Gilles Debunne | 3661b62 | 2011-06-27 11:19:16 -0700 | [diff] [blame] | 225 | && mFirstHeader != null && !onIsHidingHeaders() && onIsMultiPane()) { |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 226 | switchToHeaderLocal(mFirstHeader); |
Amith Yamasani | 3965ae6 | 2010-11-15 14:45:19 -0800 | [diff] [blame] | 227 | } |
| 228 | } |
| 229 | |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 230 | private void highlightHeader() { |
| 231 | if (mTopLevelHeaderId != 0) { |
| 232 | Integer index = mHeaderIndexMap.get(mTopLevelHeaderId); |
| 233 | if (index != null) { |
| 234 | getListView().setItemChecked(index, true); |
Amith Yamasani | 990fb52 | 2011-09-02 09:47:18 -0700 | [diff] [blame] | 235 | getListView().smoothScrollToPosition(index); |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
Amith Yamasani | e0e4fc2 | 2010-10-05 11:49:51 -0700 | [diff] [blame] | 240 | @Override |
| 241 | public Intent getIntent() { |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 242 | Intent superIntent = super.getIntent(); |
| 243 | String startingFragment = getStartingFragmentClass(superIntent); |
Gilles Debunne | 3661b62 | 2011-06-27 11:19:16 -0700 | [diff] [blame] | 244 | // This is called from super.onCreate, isMultiPane() is not yet reliable |
| 245 | // Do not use onIsHidingHeaders either, which relies itself on this method |
| 246 | if (startingFragment != null && !onIsMultiPane()) { |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 247 | Intent modIntent = new Intent(superIntent); |
Amith Yamasani | e0e4fc2 | 2010-10-05 11:49:51 -0700 | [diff] [blame] | 248 | modIntent.putExtra(EXTRA_SHOW_FRAGMENT, startingFragment); |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 249 | Bundle args = superIntent.getExtras(); |
Dianne Hackborn | f4eb85b | 2010-10-29 16:53:04 -0700 | [diff] [blame] | 250 | if (args != null) { |
| 251 | args = new Bundle(args); |
| 252 | } else { |
| 253 | args = new Bundle(); |
| 254 | } |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 255 | args.putParcelable("intent", superIntent); |
| 256 | modIntent.putExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS, superIntent.getExtras()); |
Amith Yamasani | e0e4fc2 | 2010-10-05 11:49:51 -0700 | [diff] [blame] | 257 | return modIntent; |
| 258 | } |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 259 | return superIntent; |
Amith Yamasani | e0e4fc2 | 2010-10-05 11:49:51 -0700 | [diff] [blame] | 260 | } |
| 261 | |
Amith Yamasani | 02cf71a | 2010-09-21 15:48:52 -0700 | [diff] [blame] | 262 | /** |
Amith Yamasani | 379d9b0 | 2010-09-27 12:03:59 -0700 | [diff] [blame] | 263 | * Checks if the component name in the intent is different from the Settings class and |
| 264 | * returns the class name to load as a fragment. |
| 265 | */ |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 266 | protected String getStartingFragmentClass(Intent intent) { |
| 267 | if (mFragmentClass != null) return mFragmentClass; |
| 268 | |
Dianne Hackborn | f4eb85b | 2010-10-29 16:53:04 -0700 | [diff] [blame] | 269 | String intentClass = intent.getComponent().getClassName(); |
Amith Yamasani | 379d9b0 | 2010-09-27 12:03:59 -0700 | [diff] [blame] | 270 | if (intentClass.equals(getClass().getName())) return null; |
| 271 | |
Dianne Hackborn | ee29379 | 2010-11-01 12:32:33 -0700 | [diff] [blame] | 272 | if ("com.android.settings.ManageApplications".equals(intentClass) |
| 273 | || "com.android.settings.RunningServices".equals(intentClass) |
| 274 | || "com.android.settings.applications.StorageUse".equals(intentClass)) { |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 275 | // Old names of manage apps. |
Dianne Hackborn | f4eb85b | 2010-10-29 16:53:04 -0700 | [diff] [blame] | 276 | intentClass = com.android.settings.applications.ManageApplications.class.getName(); |
| 277 | } |
| 278 | |
Amith Yamasani | 379d9b0 | 2010-09-27 12:03:59 -0700 | [diff] [blame] | 279 | return intentClass; |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * Override initial header when an activity-alias is causing Settings to be launched |
| 284 | * for a specific fragment encoded in the android:name parameter. |
| 285 | */ |
| 286 | @Override |
| 287 | public Header onGetInitialHeader() { |
| 288 | String fragmentClass = getStartingFragmentClass(super.getIntent()); |
| 289 | if (fragmentClass != null) { |
| 290 | Header header = new Header(); |
| 291 | header.fragment = fragmentClass; |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 292 | header.title = getTitle(); |
Amith Yamasani | e0e4fc2 | 2010-10-05 11:49:51 -0700 | [diff] [blame] | 293 | header.fragmentArguments = getIntent().getExtras(); |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 294 | mCurrentHeader = header; |
Amith Yamasani | 379d9b0 | 2010-09-27 12:03:59 -0700 | [diff] [blame] | 295 | return header; |
| 296 | } |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 297 | |
Gilles Debunne | b396c9b | 2011-06-22 16:07:29 -0700 | [diff] [blame] | 298 | return mFirstHeader; |
Amith Yamasani | 379d9b0 | 2010-09-27 12:03:59 -0700 | [diff] [blame] | 299 | } |
| 300 | |
Dianne Hackborn | b725818 | 2011-03-15 16:23:55 -0700 | [diff] [blame] | 301 | @Override |
Dianne Hackborn | 48147dc | 2011-03-18 12:29:41 -0700 | [diff] [blame] | 302 | public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, |
| 303 | int titleRes, int shortTitleRes) { |
| 304 | Intent intent = super.onBuildStartFragmentIntent(fragmentName, args, |
| 305 | titleRes, shortTitleRes); |
Jeff Sharkey | 9fab0da | 2011-07-09 17:52:31 -0700 | [diff] [blame] | 306 | |
Jeff Sharkey | 54d0af5 | 2011-08-11 18:26:57 -0700 | [diff] [blame] | 307 | // some fragments want to avoid split actionbar |
Gilles Debunne | 162e541 | 2011-07-11 14:13:31 -0700 | [diff] [blame] | 308 | if (DataUsageSummary.class.getName().equals(fragmentName) || |
| 309 | PowerUsageSummary.class.getName().equals(fragmentName) || |
Gilles Debunne | cd8e524 | 2011-07-25 11:36:15 -0700 | [diff] [blame] | 310 | AccountSyncSettings.class.getName().equals(fragmentName) || |
Jeff Sharkey | 11d3012 | 2012-03-19 16:54:07 -0700 | [diff] [blame] | 311 | UserDictionarySettings.class.getName().equals(fragmentName) || |
| 312 | Memory.class.getName().equals(fragmentName)) { |
Jeff Sharkey | 54d0af5 | 2011-08-11 18:26:57 -0700 | [diff] [blame] | 313 | intent.putExtra(EXTRA_CLEAR_UI_OPTIONS, true); |
Jeff Sharkey | 9fab0da | 2011-07-09 17:52:31 -0700 | [diff] [blame] | 314 | } |
| 315 | |
Dianne Hackborn | b725818 | 2011-03-15 16:23:55 -0700 | [diff] [blame] | 316 | intent.setClass(this, SubSettings.class); |
| 317 | return intent; |
| 318 | } |
| 319 | |
Amith Yamasani | 379d9b0 | 2010-09-27 12:03:59 -0700 | [diff] [blame] | 320 | /** |
Amith Yamasani | 02cf71a | 2010-09-21 15:48:52 -0700 | [diff] [blame] | 321 | * Populate the activity with the top-level headers. |
| 322 | */ |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 323 | @Override |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 324 | public void onBuildHeaders(List<Header> headers) { |
| 325 | loadHeadersFromResource(R.xml.settings_headers, headers); |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 326 | |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 327 | updateHeaderList(headers); |
| 328 | |
| 329 | mHeaders = headers; |
Amith Yamasani | 02cf71a | 2010-09-21 15:48:52 -0700 | [diff] [blame] | 330 | } |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 331 | |
Amith Yamasani | 02cf71a | 2010-09-21 15:48:52 -0700 | [diff] [blame] | 332 | private void updateHeaderList(List<Header> target) { |
| 333 | int i = 0; |
| 334 | while (i < target.size()) { |
| 335 | Header header = target.get(i); |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 336 | // Ids are integers, so downcasting |
| 337 | int id = (int) header.id; |
Amith Yamasani | 02cf71a | 2010-09-21 15:48:52 -0700 | [diff] [blame] | 338 | if (id == R.id.dock_settings) { |
| 339 | if (!needsDockSettings()) |
| 340 | target.remove(header); |
| 341 | } else if (id == R.id.operator_settings || id == R.id.manufacturer_settings) { |
| 342 | Utils.updateHeaderToSpecificActivityFromMetaDataOrRemove(this, target, header); |
Gilles Debunne | 2454f49 | 2011-06-21 16:16:06 -0700 | [diff] [blame] | 343 | } else if (id == R.id.wifi_settings) { |
| 344 | // Remove WiFi Settings if WiFi service is not available. |
| 345 | if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)) { |
| 346 | target.remove(header); |
| 347 | } |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 348 | } else if (id == R.id.bluetooth_settings) { |
| 349 | // Remove Bluetooth Settings if Bluetooth service is not available. |
Gilles Debunne | 2454f49 | 2011-06-21 16:16:06 -0700 | [diff] [blame] | 350 | if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) { |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 351 | target.remove(header); |
| 352 | } |
Amith Yamasani | b810a0d | 2012-03-25 10:12:26 -0700 | [diff] [blame^] | 353 | } else if (id == R.id.user_settings) { |
| 354 | if (!UserId.MU_ENABLED || UserId.myUserId() != 0 |
| 355 | || !getResources().getBoolean(R.bool.enable_user_management) |
| 356 | || Utils.isMonkeyRunning()) { |
| 357 | target.remove(header); |
| 358 | } |
| 359 | } |
| 360 | if (UserId.MU_ENABLED && UserId.myUserId() != 0 |
| 361 | && !ArrayUtils.contains(SETTINGS_FOR_RESTRICTED, id)) { |
| 362 | target.remove(header); |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 363 | } |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 364 | |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 365 | // Increment if the current one wasn't removed by the Utils code. |
| 366 | if (target.get(i) == header) { |
Amith Yamasani | 3965ae6 | 2010-11-15 14:45:19 -0800 | [diff] [blame] | 367 | // Hold on to the first header, when we need to reset to the top-level |
Gilles Debunne | b396c9b | 2011-06-22 16:07:29 -0700 | [diff] [blame] | 368 | if (mFirstHeader == null && |
| 369 | HeaderAdapter.getHeaderType(header) != HeaderAdapter.HEADER_TYPE_CATEGORY) { |
| 370 | mFirstHeader = header; |
| 371 | } |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 372 | mHeaderIndexMap.put(id, i); |
Amith Yamasani | 02cf71a | 2010-09-21 15:48:52 -0700 | [diff] [blame] | 373 | i++; |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 374 | } |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 375 | } |
| 376 | } |
| 377 | |
Amith Yamasani | 02cf71a | 2010-09-21 15:48:52 -0700 | [diff] [blame] | 378 | private boolean needsDockSettings() { |
| 379 | return getResources().getBoolean(R.bool.has_dock_settings); |
Amith Yamasani | b61cf51 | 2010-09-12 08:17:50 -0700 | [diff] [blame] | 380 | } |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 381 | |
| 382 | private void getMetaData() { |
| 383 | try { |
| 384 | ActivityInfo ai = getPackageManager().getActivityInfo(getComponentName(), |
| 385 | PackageManager.GET_META_DATA); |
| 386 | if (ai == null || ai.metaData == null) return; |
| 387 | mTopLevelHeaderId = ai.metaData.getInt(META_DATA_KEY_HEADER_ID); |
| 388 | mFragmentClass = ai.metaData.getString(META_DATA_KEY_FRAGMENT_CLASS); |
Amith Yamasani | c9fdfa8 | 2010-12-14 14:38:16 -0800 | [diff] [blame] | 389 | |
| 390 | // Check if it has a parent specified and create a Header object |
| 391 | final int parentHeaderTitleRes = ai.metaData.getInt(META_DATA_KEY_PARENT_TITLE); |
| 392 | String parentFragmentClass = ai.metaData.getString(META_DATA_KEY_PARENT_FRAGMENT_CLASS); |
| 393 | if (parentFragmentClass != null) { |
| 394 | mParentHeader = new Header(); |
| 395 | mParentHeader.fragment = parentFragmentClass; |
| 396 | if (parentHeaderTitleRes != 0) { |
| 397 | mParentHeader.title = getResources().getString(parentHeaderTitleRes); |
| 398 | } |
| 399 | } |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 400 | } catch (NameNotFoundException nnfe) { |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 401 | // No recovery |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 402 | } |
| 403 | } |
| 404 | |
Amith Yamasani | 9e3a470 | 2011-01-11 09:09:26 -0800 | [diff] [blame] | 405 | @Override |
| 406 | public boolean hasNextButton() { |
| 407 | return super.hasNextButton(); |
| 408 | } |
| 409 | |
| 410 | @Override |
| 411 | public Button getNextButton() { |
| 412 | return super.getNextButton(); |
| 413 | } |
| 414 | |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 415 | private static class HeaderAdapter extends ArrayAdapter<Header> { |
| 416 | static final int HEADER_TYPE_CATEGORY = 0; |
| 417 | static final int HEADER_TYPE_NORMAL = 1; |
| 418 | static final int HEADER_TYPE_SWITCH = 2; |
| 419 | private static final int HEADER_TYPE_COUNT = HEADER_TYPE_SWITCH + 1; |
| 420 | |
| 421 | private final WifiEnabler mWifiEnabler; |
| 422 | private final BluetoothEnabler mBluetoothEnabler; |
| 423 | |
| 424 | private static class HeaderViewHolder { |
| 425 | ImageView icon; |
| 426 | TextView title; |
| 427 | TextView summary; |
| 428 | Switch switch_; |
| 429 | } |
| 430 | |
| 431 | private LayoutInflater mInflater; |
| 432 | |
| 433 | static int getHeaderType(Header header) { |
| 434 | if (header.fragment == null && header.intent == null) { |
| 435 | return HEADER_TYPE_CATEGORY; |
| 436 | } else if (header.id == R.id.wifi_settings || header.id == R.id.bluetooth_settings) { |
| 437 | return HEADER_TYPE_SWITCH; |
| 438 | } else { |
| 439 | return HEADER_TYPE_NORMAL; |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | @Override |
| 444 | public int getItemViewType(int position) { |
| 445 | Header header = getItem(position); |
| 446 | return getHeaderType(header); |
| 447 | } |
| 448 | |
| 449 | @Override |
| 450 | public boolean areAllItemsEnabled() { |
| 451 | return false; // because of categories |
| 452 | } |
| 453 | |
| 454 | @Override |
| 455 | public boolean isEnabled(int position) { |
| 456 | return getItemViewType(position) != HEADER_TYPE_CATEGORY; |
| 457 | } |
| 458 | |
| 459 | @Override |
| 460 | public int getViewTypeCount() { |
| 461 | return HEADER_TYPE_COUNT; |
| 462 | } |
| 463 | |
| 464 | @Override |
| 465 | public boolean hasStableIds() { |
| 466 | return true; |
| 467 | } |
| 468 | |
| 469 | public HeaderAdapter(Context context, List<Header> objects) { |
| 470 | super(context, 0, objects); |
| 471 | mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
| 472 | |
Gilles Debunne | b396c9b | 2011-06-22 16:07:29 -0700 | [diff] [blame] | 473 | // Temp Switches provided as placeholder until the adapter replaces these with actual |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 474 | // Switches inflated from their layouts. Must be done before adapter is set in super |
| 475 | mWifiEnabler = new WifiEnabler(context, new Switch(context)); |
| 476 | mBluetoothEnabler = new BluetoothEnabler(context, new Switch(context)); |
| 477 | } |
| 478 | |
| 479 | @Override |
| 480 | public View getView(int position, View convertView, ViewGroup parent) { |
| 481 | HeaderViewHolder holder; |
| 482 | Header header = getItem(position); |
| 483 | int headerType = getHeaderType(header); |
| 484 | View view = null; |
| 485 | |
| 486 | if (convertView == null) { |
| 487 | holder = new HeaderViewHolder(); |
| 488 | switch (headerType) { |
| 489 | case HEADER_TYPE_CATEGORY: |
Gilles Debunne | b396c9b | 2011-06-22 16:07:29 -0700 | [diff] [blame] | 490 | view = new TextView(getContext(), null, |
| 491 | android.R.attr.listSeparatorTextViewStyle); |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 492 | holder.title = (TextView) view; |
| 493 | break; |
| 494 | |
| 495 | case HEADER_TYPE_SWITCH: |
Gilles Debunne | b396c9b | 2011-06-22 16:07:29 -0700 | [diff] [blame] | 496 | view = mInflater.inflate(R.layout.preference_header_switch_item, parent, |
| 497 | false); |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 498 | holder.icon = (ImageView) view.findViewById(R.id.icon); |
Gilles Debunne | b396c9b | 2011-06-22 16:07:29 -0700 | [diff] [blame] | 499 | holder.title = (TextView) |
| 500 | view.findViewById(com.android.internal.R.id.title); |
| 501 | holder.summary = (TextView) |
| 502 | view.findViewById(com.android.internal.R.id.summary); |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 503 | holder.switch_ = (Switch) view.findViewById(R.id.switchWidget); |
| 504 | break; |
| 505 | |
| 506 | case HEADER_TYPE_NORMAL: |
Gilles Debunne | b396c9b | 2011-06-22 16:07:29 -0700 | [diff] [blame] | 507 | view = mInflater.inflate( |
| 508 | com.android.internal.R.layout.preference_header_item, parent, |
| 509 | false); |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 510 | holder.icon = (ImageView) view.findViewById(com.android.internal.R.id.icon); |
Gilles Debunne | b396c9b | 2011-06-22 16:07:29 -0700 | [diff] [blame] | 511 | holder.title = (TextView) |
| 512 | view.findViewById(com.android.internal.R.id.title); |
| 513 | holder.summary = (TextView) |
| 514 | view.findViewById(com.android.internal.R.id.summary); |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 515 | break; |
| 516 | } |
| 517 | view.setTag(holder); |
| 518 | } else { |
| 519 | view = convertView; |
| 520 | holder = (HeaderViewHolder) view.getTag(); |
| 521 | } |
| 522 | |
| 523 | // All view fields must be updated every time, because the view may be recycled |
| 524 | switch (headerType) { |
| 525 | case HEADER_TYPE_CATEGORY: |
| 526 | holder.title.setText(header.getTitle(getContext().getResources())); |
| 527 | break; |
| 528 | |
| 529 | case HEADER_TYPE_SWITCH: |
| 530 | // Would need a different treatment if the main menu had more switches |
| 531 | if (header.id == R.id.wifi_settings) { |
| 532 | mWifiEnabler.setSwitch(holder.switch_); |
| 533 | } else { |
| 534 | mBluetoothEnabler.setSwitch(holder.switch_); |
| 535 | } |
| 536 | // No break, fall through on purpose to update common fields |
| 537 | |
| 538 | //$FALL-THROUGH$ |
| 539 | case HEADER_TYPE_NORMAL: |
| 540 | holder.icon.setImageResource(header.iconRes); |
| 541 | holder.title.setText(header.getTitle(getContext().getResources())); |
| 542 | CharSequence summary = header.getSummary(getContext().getResources()); |
| 543 | if (!TextUtils.isEmpty(summary)) { |
| 544 | holder.summary.setVisibility(View.VISIBLE); |
| 545 | holder.summary.setText(summary); |
| 546 | } else { |
| 547 | holder.summary.setVisibility(View.GONE); |
| 548 | } |
| 549 | break; |
| 550 | } |
| 551 | |
| 552 | return view; |
| 553 | } |
| 554 | |
| 555 | public void resume() { |
| 556 | mWifiEnabler.resume(); |
| 557 | mBluetoothEnabler.resume(); |
| 558 | } |
| 559 | |
| 560 | public void pause() { |
| 561 | mWifiEnabler.pause(); |
| 562 | mBluetoothEnabler.pause(); |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | @Override |
Amith Yamasani | a4379d6 | 2011-07-22 10:34:58 -0700 | [diff] [blame] | 567 | public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) { |
| 568 | // Override the fragment title for Wallpaper settings |
Amith Yamasani | dfb6543 | 2011-11-29 16:38:14 -0800 | [diff] [blame] | 569 | int titleRes = pref.getTitleRes(); |
Amith Yamasani | a4379d6 | 2011-07-22 10:34:58 -0700 | [diff] [blame] | 570 | if (pref.getFragment().equals(WallpaperTypeSettings.class.getName())) { |
Amith Yamasani | dfb6543 | 2011-11-29 16:38:14 -0800 | [diff] [blame] | 571 | titleRes = R.string.wallpaper_settings_fragment_title; |
Amith Yamasani | a4379d6 | 2011-07-22 10:34:58 -0700 | [diff] [blame] | 572 | } |
Amith Yamasani | dfb6543 | 2011-11-29 16:38:14 -0800 | [diff] [blame] | 573 | startPreferencePanel(pref.getFragment(), pref.getExtras(), titleRes, null, null, 0); |
Amith Yamasani | a4379d6 | 2011-07-22 10:34:58 -0700 | [diff] [blame] | 574 | return true; |
| 575 | } |
| 576 | |
| 577 | @Override |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 578 | public void setListAdapter(ListAdapter adapter) { |
| 579 | if (mHeaders == null) { |
| 580 | mHeaders = new ArrayList<Header>(); |
| 581 | // When the saved state provides the list of headers, onBuildHeaders is not called |
| 582 | // Copy the list of Headers from the adapter, preserving their order |
| 583 | for (int i = 0; i < adapter.getCount(); i++) { |
| 584 | mHeaders.add((Header) adapter.getItem(i)); |
| 585 | } |
| 586 | } |
| 587 | |
| 588 | // Ignore the adapter provided by PreferenceActivity and substitute ours instead |
| 589 | super.setListAdapter(new HeaderAdapter(this, mHeaders)); |
| 590 | } |
| 591 | |
Amith Yamasani | 5203bdf | 2010-11-04 09:59:44 -0700 | [diff] [blame] | 592 | /* |
| 593 | * Settings subclasses for launching independently. |
| 594 | */ |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 595 | public static class BluetoothSettingsActivity extends Settings { /* empty */ } |
| 596 | public static class WirelessSettingsActivity extends Settings { /* empty */ } |
| 597 | public static class TetherSettingsActivity extends Settings { /* empty */ } |
| 598 | public static class VpnSettingsActivity extends Settings { /* empty */ } |
| 599 | public static class DateTimeSettingsActivity extends Settings { /* empty */ } |
| 600 | public static class StorageSettingsActivity extends Settings { /* empty */ } |
| 601 | public static class WifiSettingsActivity extends Settings { /* empty */ } |
repo sync | b98463f | 2011-06-30 10:58:43 -0700 | [diff] [blame] | 602 | public static class WifiP2pSettingsActivity extends Settings { /* empty */ } |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 603 | public static class InputMethodAndLanguageSettingsActivity extends Settings { /* empty */ } |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 604 | public static class InputMethodAndSubtypeEnablerActivity extends Settings { /* empty */ } |
satok | e077d2b | 2011-07-25 09:38:11 +0900 | [diff] [blame] | 605 | public static class SpellCheckersSettingsActivity extends Settings { /* empty */ } |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 606 | public static class LocalePickerActivity extends Settings { /* empty */ } |
| 607 | public static class UserDictionarySettingsActivity extends Settings { /* empty */ } |
| 608 | public static class SoundSettingsActivity extends Settings { /* empty */ } |
| 609 | public static class DisplaySettingsActivity extends Settings { /* empty */ } |
| 610 | public static class DeviceInfoSettingsActivity extends Settings { /* empty */ } |
| 611 | public static class ApplicationSettingsActivity extends Settings { /* empty */ } |
| 612 | public static class ManageApplicationsActivity extends Settings { /* empty */ } |
| 613 | public static class StorageUseActivity extends Settings { /* empty */ } |
| 614 | public static class DevelopmentSettingsActivity extends Settings { /* empty */ } |
| 615 | public static class AccessibilitySettingsActivity extends Settings { /* empty */ } |
| 616 | public static class SecuritySettingsActivity extends Settings { /* empty */ } |
Gilles Debunne | a6a8a14 | 2011-06-09 11:56:17 -0700 | [diff] [blame] | 617 | public static class LocationSettingsActivity extends Settings { /* empty */ } |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 618 | public static class PrivacySettingsActivity extends Settings { /* empty */ } |
| 619 | public static class DockSettingsActivity extends Settings { /* empty */ } |
| 620 | public static class RunningServicesActivity extends Settings { /* empty */ } |
| 621 | public static class ManageAccountsSettingsActivity extends Settings { /* empty */ } |
| 622 | public static class PowerUsageSummaryActivity extends Settings { /* empty */ } |
| 623 | public static class AccountSyncSettingsActivity extends Settings { /* empty */ } |
| 624 | public static class AccountSyncSettingsInAddAccountActivity extends Settings { /* empty */ } |
| 625 | public static class CryptKeeperSettingsActivity extends Settings { /* empty */ } |
| 626 | public static class DeviceAdminSettingsActivity extends Settings { /* empty */ } |
| 627 | public static class DataUsageSummaryActivity extends Settings { /* empty */ } |
Gilles Debunne | ab189bd | 2011-07-06 13:10:16 -0700 | [diff] [blame] | 628 | public static class AdvancedWifiSettingsActivity extends Settings { /* empty */ } |
Gilles Debunne | ab189bd | 2011-07-06 13:10:16 -0700 | [diff] [blame] | 629 | public static class TextToSpeechSettingsActivity extends Settings { /* empty */ } |
Jeff Hamilton | 3d670de | 2011-09-21 16:44:36 -0500 | [diff] [blame] | 630 | public static class AndroidBeamSettingsActivity extends Settings { /* empty */ } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 631 | } |