The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -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.contacts; |
| 18 | |
Jeff Hamilton | b25c13e | 2009-09-21 09:22:16 -0500 | [diff] [blame^] | 19 | import com.android.internal.telephony.ITelephony; |
| 20 | |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 21 | import android.app.Activity; |
| 22 | import android.app.TabActivity; |
| 23 | import android.content.Intent; |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 24 | import android.content.SharedPreferences; |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 25 | import android.net.Uri; |
| 26 | import android.os.Bundle; |
| 27 | import android.os.RemoteException; |
| 28 | import android.os.ServiceManager; |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 29 | import android.provider.CallLog.Calls; |
Jeff Hamilton | b25c13e | 2009-09-21 09:22:16 -0500 | [diff] [blame^] | 30 | import android.provider.ContactsContract.Intents.UI; |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 31 | import android.util.Log; |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 32 | import android.view.Window; |
| 33 | import android.widget.TabHost; |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 34 | |
| 35 | /** |
| 36 | * The dialer activity that has one tab with the virtual 12key dialer, |
| 37 | * and another tab with recent calls in it. This is the container and the tabs |
| 38 | * are embedded using intents. |
| 39 | */ |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 40 | public class DialtactsActivity extends TabActivity implements TabHost.OnTabChangeListener { |
| 41 | private static final String TAG = "Dailtacts"; |
| 42 | private static final String FAVORITES_ENTRY_COMPONENT = |
| 43 | "com.android.contacts.DialtactsFavoritesEntryActivity"; |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 44 | |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 45 | private static final int TAB_INDEX_DIALER = 0; |
| 46 | private static final int TAB_INDEX_CALL_LOG = 1; |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 47 | private static final int TAB_INDEX_CONTACTS = 2; |
| 48 | private static final int TAB_INDEX_FAVORITES = 3; |
| 49 | |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 50 | static final String EXTRA_IGNORE_STATE = "ignore-state"; |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 51 | |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 52 | /** Name of the dialtacts shared preferences */ |
| 53 | static final String PREFS_DIALTACTS = "dialtacts"; |
| 54 | /** If true, when handling the contacts intent the favorites tab will be shown instead */ |
| 55 | static final String PREF_FAVORITES_AS_CONTACTS = "favorites_as_contacts"; |
| 56 | static final boolean PREF_FAVORITES_AS_CONTACTS_DEFAULT = false; |
| 57 | |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 58 | private TabHost mTabHost; |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 59 | private String mFilterText; |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 60 | private Uri mDialUri; |
| 61 | |
| 62 | @Override |
| 63 | protected void onCreate(Bundle icicle) { |
| 64 | super.onCreate(icicle); |
| 65 | |
| 66 | final Intent intent = getIntent(); |
| 67 | fixIntent(intent); |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 68 | |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 69 | requestWindowFeature(Window.FEATURE_NO_TITLE); |
| 70 | setContentView(R.layout.dialer_activity); |
| 71 | |
| 72 | mTabHost = getTabHost(); |
| 73 | mTabHost.setOnTabChangedListener(this); |
| 74 | |
| 75 | // Setup the tabs |
| 76 | setupDialerTab(); |
| 77 | setupCallLogTab(); |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 78 | setupContactsTab(); |
| 79 | setupFavoritesTab(); |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 80 | |
| 81 | setCurrentTab(intent); |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 82 | |
Jeff Hamilton | b25c13e | 2009-09-21 09:22:16 -0500 | [diff] [blame^] | 83 | if (intent.getAction().equals(UI.FILTER_CONTACTS_ACTION) |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 84 | && icicle == null) { |
| 85 | setupFilterText(intent); |
| 86 | } |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 87 | } |
| 88 | |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 89 | @Override |
| 90 | protected void onPause() { |
| 91 | super.onPause(); |
| 92 | |
| 93 | int currentTabIndex = mTabHost.getCurrentTab(); |
| 94 | if (currentTabIndex == TAB_INDEX_CONTACTS || currentTabIndex == TAB_INDEX_FAVORITES) { |
| 95 | SharedPreferences.Editor editor = getSharedPreferences(PREFS_DIALTACTS, MODE_PRIVATE) |
| 96 | .edit(); |
| 97 | editor.putBoolean(PREF_FAVORITES_AS_CONTACTS, currentTabIndex == TAB_INDEX_FAVORITES); |
| 98 | editor.commit(); |
| 99 | } |
| 100 | } |
| 101 | |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 102 | private void fixIntent(Intent intent) { |
| 103 | // This should be cleaned up: the call key used to send an Intent |
| 104 | // that just said to go to the recent calls list. It now sends this |
| 105 | // abstract action, but this class hasn't been rewritten to deal with it. |
| 106 | if (Intent.ACTION_CALL_BUTTON.equals(intent.getAction())) { |
| 107 | intent.setDataAndType(Calls.CONTENT_URI, Calls.CONTENT_TYPE); |
| 108 | intent.putExtra("call_key", true); |
| 109 | setIntent(intent); |
| 110 | } |
| 111 | } |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 112 | |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 113 | private void setupCallLogTab() { |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 114 | // Force the class since overriding tab entries doesn't work |
| 115 | Intent intent = new Intent("com.android.phone.action.RECENT_CALLS"); |
| 116 | intent.setClass(this, RecentCallsListActivity.class); |
| 117 | |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 118 | mTabHost.addTab(mTabHost.newTabSpec("call_log") |
| 119 | .setIndicator(getString(R.string.recentCallsIconLabel), |
| 120 | getResources().getDrawable(R.drawable.ic_tab_recent)) |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 121 | .setContent(intent)); |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | private void setupDialerTab() { |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 125 | Intent intent = new Intent("com.android.phone.action.TOUCH_DIALER"); |
| 126 | intent.setClass(this, TwelveKeyDialer.class); |
| 127 | |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 128 | mTabHost.addTab(mTabHost.newTabSpec("dialer") |
| 129 | .setIndicator(getString(R.string.dialerIconLabel), |
| 130 | getResources().getDrawable(R.drawable.ic_tab_dialer)) |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 131 | .setContent(intent)); |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 132 | } |
| 133 | |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 134 | private void setupContactsTab() { |
| 135 | Intent intent = new Intent(UI.LIST_DEFAULT); |
| 136 | intent.setClass(this, ContactsListActivity.class); |
| 137 | |
| 138 | mTabHost.addTab(mTabHost.newTabSpec("contacts") |
| 139 | .setIndicator(getText(R.string.contactsIconLabel), |
| 140 | getResources().getDrawable(R.drawable.ic_tab_contacts)) |
| 141 | .setContent(intent)); |
| 142 | } |
| 143 | |
| 144 | private void setupFavoritesTab() { |
| 145 | Intent intent = new Intent(UI.LIST_STREQUENT_ACTION); |
| 146 | intent.setClass(this, ContactsListActivity.class); |
| 147 | |
| 148 | mTabHost.addTab(mTabHost.newTabSpec("favorites") |
| 149 | .setIndicator(getString(R.string.contactsFavoritesLabel), |
| 150 | getResources().getDrawable(R.drawable.ic_tab_starred)) |
| 151 | .setContent(intent)); |
| 152 | } |
| 153 | |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 154 | /** |
| 155 | * Returns true if the intent is due to hitting the green send key while in a call. |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 156 | * |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 157 | * @param intent the intent that launched this activity |
| 158 | * @param recentCallsRequest true if the intent is requesting to view recent calls |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 159 | * @return true if the intent is due to hitting the green send key while in a call |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 160 | */ |
| 161 | private boolean isSendKeyWhileInCall(final Intent intent, final boolean recentCallsRequest) { |
| 162 | // If there is a call in progress go to the call screen |
| 163 | if (recentCallsRequest) { |
| 164 | final boolean callKey = intent.getBooleanExtra("call_key", false); |
| 165 | |
| 166 | try { |
| 167 | ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone")); |
| 168 | if (callKey && phone != null && phone.showCallScreen()) { |
| 169 | return true; |
| 170 | } |
| 171 | } catch (RemoteException e) { |
| 172 | Log.e(TAG, "Failed to handle send while in call", e); |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | return false; |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * Sets the current tab based on the intent's request type |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 181 | * |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 182 | * @param recentCallsRequest true is the recent calls tab is desired, false otherwise |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 183 | */ |
| 184 | private void setCurrentTab(Intent intent) { |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 185 | // If we got here by hitting send and we're in call forward along to the in-call activity |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 186 | final boolean recentCallsRequest = Calls.CONTENT_TYPE.equals(intent.getType()); |
| 187 | if (isSendKeyWhileInCall(intent, recentCallsRequest)) { |
| 188 | finish(); |
| 189 | return; |
| 190 | } |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 191 | |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 192 | // Dismiss menu provided by any children activities |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 193 | Activity activity = getLocalActivityManager(). |
| 194 | getActivity(mTabHost.getCurrentTabTag()); |
| 195 | if (activity != null) { |
| 196 | activity.closeOptionsMenu(); |
| 197 | } |
| 198 | |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 199 | // Tell the children activities that they should ignore any possible saved |
| 200 | // state and instead reload their state from the parent's intent |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 201 | intent.putExtra(EXTRA_IGNORE_STATE, true); |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 202 | |
| 203 | // Choose the tab based on the inbound intent |
| 204 | String componentName = intent.getComponent().getClassName(); |
| 205 | if (getClass().getName().equals(componentName)) { |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 206 | if (recentCallsRequest) { |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 207 | mTabHost.setCurrentTab(TAB_INDEX_CALL_LOG); |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 208 | } else { |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 209 | mTabHost.setCurrentTab(TAB_INDEX_DIALER); |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 210 | } |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 211 | } else if (FAVORITES_ENTRY_COMPONENT.equals(componentName)) { |
| 212 | mTabHost.setCurrentTab(TAB_INDEX_FAVORITES); |
| 213 | } else { |
| 214 | SharedPreferences prefs = getSharedPreferences(PREFS_DIALTACTS, MODE_PRIVATE); |
| 215 | boolean favoritesAsContacts = prefs.getBoolean(PREF_FAVORITES_AS_CONTACTS, |
| 216 | PREF_FAVORITES_AS_CONTACTS_DEFAULT); |
| 217 | if (favoritesAsContacts) { |
| 218 | mTabHost.setCurrentTab(TAB_INDEX_FAVORITES); |
| 219 | } else { |
| 220 | mTabHost.setCurrentTab(TAB_INDEX_CONTACTS); |
| 221 | } |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 222 | } |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 223 | |
| 224 | // Tell the children activities that they should honor their saved states |
| 225 | // instead of the state from the parent's intent |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 226 | intent.putExtra(EXTRA_IGNORE_STATE, false); |
| 227 | } |
| 228 | |
| 229 | @Override |
| 230 | public void onNewIntent(Intent newIntent) { |
| 231 | setIntent(newIntent); |
| 232 | fixIntent(newIntent); |
| 233 | setCurrentTab(newIntent); |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 234 | final String action = newIntent.getAction(); |
Jeff Hamilton | b25c13e | 2009-09-21 09:22:16 -0500 | [diff] [blame^] | 235 | if (action.equals(UI.FILTER_CONTACTS_ACTION)) { |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 236 | setupFilterText(newIntent); |
| 237 | } else if (isDialIntent(newIntent)) { |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 238 | setupDialUri(newIntent); |
| 239 | } |
| 240 | } |
The Android Open Source Project | 1f62096 | 2009-03-09 11:52:14 -0700 | [diff] [blame] | 241 | |
| 242 | /** Returns true if the given intent contains a phone number to populate the dialer with */ |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 243 | private boolean isDialIntent(Intent intent) { |
| 244 | final String action = intent.getAction(); |
| 245 | if (Intent.ACTION_DIAL.equals(action)) { |
| 246 | return true; |
| 247 | } |
| 248 | if (Intent.ACTION_VIEW.equals(action)) { |
| 249 | final Uri data = intent.getData(); |
| 250 | if (data != null && "tel".equals(data.getScheme())) { |
| 251 | return true; |
| 252 | } |
| 253 | } |
| 254 | return false; |
| 255 | } |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 256 | |
| 257 | /** |
| 258 | * Retrieves the filter text stored in {@link #setupFilterText(Intent)}. |
| 259 | * This text originally came from a FILTER_CONTACTS_ACTION intent received |
| 260 | * by this activity. The stored text will then be cleared after after this |
| 261 | * method returns. |
| 262 | * |
| 263 | * @return The stored filter text |
| 264 | */ |
| 265 | public String getAndClearFilterText() { |
| 266 | String filterText = mFilterText; |
| 267 | mFilterText = null; |
| 268 | return filterText; |
| 269 | } |
| 270 | |
| 271 | /** |
| 272 | * Stores the filter text associated with a FILTER_CONTACTS_ACTION intent. |
| 273 | * This is so child activities can check if they are supposed to display a filter. |
| 274 | * |
| 275 | * @param intent The intent received in {@link #onNewIntent(Intent)} |
| 276 | */ |
| 277 | private void setupFilterText(Intent intent) { |
| 278 | // If the intent was relaunched from history, don't apply the filter text. |
| 279 | if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) { |
| 280 | return; |
| 281 | } |
Jeff Hamilton | b25c13e | 2009-09-21 09:22:16 -0500 | [diff] [blame^] | 282 | String filter = intent.getStringExtra(UI.FILTER_TEXT_EXTRA_KEY); |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 283 | if (filter != null && filter.length() > 0) { |
| 284 | mFilterText = filter; |
| 285 | } |
| 286 | } |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 287 | |
| 288 | /** |
| 289 | * Retrieves the uri stored in {@link #setupDialUri(Intent)}. This uri |
| 290 | * originally came from a dial intent received by this activity. The stored |
| 291 | * uri will then be cleared after after this method returns. |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 292 | * |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 293 | * @return The stored uri |
| 294 | */ |
| 295 | public Uri getAndClearDialUri() { |
| 296 | Uri dialUri = mDialUri; |
| 297 | mDialUri = null; |
| 298 | return dialUri; |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | * Stores the uri associated with a dial intent. This is so child activities can |
| 303 | * check if they are supposed to display new dial info. |
Jeff Hamilton | 9031377 | 2009-07-28 10:20:31 -0500 | [diff] [blame] | 304 | * |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 305 | * @param intent The intent received in {@link #onNewIntent(Intent)} |
| 306 | */ |
| 307 | private void setupDialUri(Intent intent) { |
| 308 | // If the intent was relaunched from history, don't reapply the intent. |
| 309 | if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) { |
| 310 | return; |
| 311 | } |
| 312 | mDialUri = intent.getData(); |
| 313 | } |
| 314 | |
| 315 | @Override |
Dianne Hackborn | 242599a | 2009-09-14 21:33:24 -0700 | [diff] [blame] | 316 | public void onBackPressed() { |
| 317 | if (isTaskRoot()) { |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 318 | // Instead of stopping, simply push this to the back of the stack. |
| 319 | // This is only done when running at the top of the stack; |
| 320 | // otherwise, we have been launched by someone else so need to |
| 321 | // allow the user to go back to the caller. |
| 322 | moveTaskToBack(false); |
Dianne Hackborn | 242599a | 2009-09-14 21:33:24 -0700 | [diff] [blame] | 323 | } else { |
| 324 | super.onBackPressed(); |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 325 | } |
The Android Open Source Project | 7aa0e4c | 2009-03-03 19:32:21 -0800 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | /** {@inheritDoc} */ |
| 329 | public void onTabChanged(String tabId) { |
| 330 | // Because we're using Activities as our tab children, we trigger |
| 331 | // onWindowFocusChanged() to let them know when they're active. This may |
| 332 | // seem to duplicate the purpose of onResume(), but it's needed because |
| 333 | // onResume() can't reliably check if a keyguard is active. |
| 334 | Activity activity = getLocalActivityManager().getActivity(tabId); |
| 335 | if (activity != null) { |
| 336 | activity.onWindowFocusChanged(true); |
| 337 | } |
| 338 | } |
| 339 | } |