diff options
author | Erica Chang <echang@cyngn.com> | 2016-03-07 17:57:39 -0800 |
---|---|---|
committer | Erica Chang <echang@cyngn.com> | 2016-04-07 12:05:49 -0700 |
commit | 00120c2802ae5aa6cec947b5a6ac1c8eb37e52fa (patch) | |
tree | 6517d124e30cb0e0b35404fb6c1768ac66570170 /src/com/android/contacts/activities/PeopleActivity.java | |
parent | 4f95d89bfb5dd9a46c2ba0914465383822bf0f5b (diff) | |
download | android_packages_apps_Contacts-00120c2802ae5aa6cec947b5a6ac1c8eb37e52fa.tar.gz android_packages_apps_Contacts-00120c2802ae5aa6cec947b5a6ac1c8eb37e52fa.tar.bz2 android_packages_apps_Contacts-00120c2802ae5aa6cec947b5a6ac1c8eb37e52fa.zip |
(2/2) Contacts: fixed auth state handling and account handle
Contacts wasn't able to update the fragment UI properly with
the auth state change. Also needed to lookup account handle
in the event where the plugin fails to report a valid one.
Issue-id: CD-448, CD-449
Change-Id: I118ba8bd152af19fbffee6a218c622d631aaf979
Diffstat (limited to 'src/com/android/contacts/activities/PeopleActivity.java')
-rw-r--r-- | src/com/android/contacts/activities/PeopleActivity.java | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java index f548976eb..665d3cf8f 100644 --- a/src/com/android/contacts/activities/PeopleActivity.java +++ b/src/com/android/contacts/activities/PeopleActivity.java @@ -394,6 +394,8 @@ public class PeopleActivity extends ContactsActivity implements mPluginLength = mPluginTabInfo.size(); for (int i = 0; i < mPluginLength; i++) { InCallPluginInfo pluginInfo = mPluginTabInfo.get(i); + mCallMethodMap.put(pluginInfo.mCallMethodInfo.mComponent, pluginInfo + .mCallMethodInfo); mTabTitles.add(TabState.GROUPS + i, new TabEntry(pluginInfo.mTabTag, pluginInfo.mCallMethodInfo.mName)); pluginInfo.mFragment = (PluginContactBrowseListFragment) fragmentManager @@ -1883,7 +1885,7 @@ public class PeopleActivity extends ContactsActivity implements private synchronized void updatePlugins(HashMap<ComponentName, CallMethodInfo> callMethodInfo) { HashMap<ComponentName, CallMethodInfo> newCmMap = (HashMap<ComponentName, - CallMethodInfo>) CallMethodHelper.getAllEnabledCallMethods().clone(); + CallMethodInfo>) CallMethodHelper.getAllEnabledCallMethods(); if (DEBUG) Log.d(TAG, "updatePlugins newCmMap size:" + newCmMap.size()); boolean updateTabs = false; String lastSelectedTabTag = mTabTitles.get(mActionBarAdapter.getCurrentTab()).mTag; @@ -1892,16 +1894,14 @@ public class PeopleActivity extends ContactsActivity implements FragmentManager fragmentManager = getFragmentManager(); for (ComponentName cn : mCallMethodMap.keySet()) { - CallMethodInfo cm = mCallMethodMap.get(cn); if (newCmMap.containsKey(cn)) { - // Check if update needed + // Update plugin info only, the plugin fragment keeps track of its state to + // determine if a UI update is necessary CallMethodInfo newCm = newCmMap.remove(cn); - if (!newCm.equals(cm) || newCm.mIsAuthenticated != cm.mIsAuthenticated) { - InCallPluginInfo pluginInfo = getPluginInfo(cn); - pluginInfo.mCallMethodInfo = newCm; - pluginInfo.mFragment.updateInCallPluginInfo(pluginInfo); - mCallMethodMap.put(cn, newCm); - } + InCallPluginInfo pluginInfo = getPluginInfo(cn); + pluginInfo.mCallMethodInfo = newCm; + pluginInfo.mFragment.updateInCallPluginInfo(pluginInfo); + mCallMethodMap.put(cn, newCm); } else { // Remove the tab associated with a plugin that's no longer available updateTabs = true; @@ -1916,7 +1916,7 @@ public class PeopleActivity extends ContactsActivity implements } } } - // add newly added tab from newCmMap (existing tab already removed in the logic above) + // add newly added tab from newCmMap for (ComponentName cn : newCmMap.keySet()) { InCallPluginInfo newInfo = new InCallPluginInfo(); newInfo.mTabTag = cn.toShortString(); @@ -1940,11 +1940,10 @@ public class PeopleActivity extends ContactsActivity implements executeFragTransact = true; } } - if (executeFragTransact) { fragmentManager.executePendingTransactions(); } - // update holders + // update view pager if (updateTabs) { mPluginLength = mPluginTabInfo.size(); mPageStateCount = TabState.COUNT + mPluginLength; |