From 64e5ffe387e08ab1ace20d93354c08e86f7cb625 Mon Sep 17 00:00:00 2001 From: Erica Chang Date: Tue, 8 Mar 2016 18:09:45 -0800 Subject: Contacts: add plugin status change receiver Contacts now receives updates and updates UI accordingly based on plugin status. CD-452, CD-464 Change-Id: Ib5c3d7cd683a09d07d3f466248129d31c321123d --- Android.mk | 1 + AndroidManifest.xml | 5 ---- AndroidManifest_cm.xml | 34 ++++++++++++++++++++++ .../contacts/activities/PeopleActivity.java | 10 +++---- .../contacts/incall/CallMethodStatusReceiver.java | 17 +++++++++++ 5 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 AndroidManifest_cm.xml create mode 100644 src/com/android/contacts/incall/CallMethodStatusReceiver.java diff --git a/Android.mk b/Android.mk index 3d19b64c1..4a94da848 100644 --- a/Android.mk +++ b/Android.mk @@ -24,6 +24,7 @@ LOCAL_AAPT_FLAGS := \ --extra-packages com.cyanogen.ambient LOCAL_JAVA_LIBRARIES := telephony-common voip-common +LOCAL_FULL_LIBS_MANIFEST_FILES := $(LOCAL_PATH)/AndroidManifest_cm.xml LOCAL_STATIC_JAVA_LIBRARIES := \ com.android.vcard \ android-common \ diff --git a/AndroidManifest.xml b/AndroidManifest.xml index c5c4a5dbe..319857c04 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -49,11 +49,6 @@ - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java index 665d3cf8f..06e4b1356 100644 --- a/src/com/android/contacts/activities/PeopleActivity.java +++ b/src/com/android/contacts/activities/PeopleActivity.java @@ -1864,13 +1864,13 @@ public class PeopleActivity extends ContactsActivity implements return null; } - private void removePluginInfo(ComponentName cn) { + private InCallPluginInfo removePluginInfo(ComponentName cn) { for (int i = 0; i < mPluginTabInfo.size(); i++) { if (mPluginTabInfo.get(i).mCallMethodInfo.mComponent.equals(cn)) { - mPluginTabInfo.remove(i); - break; + return mPluginTabInfo.remove(i); } } + return null; } private void removeTabTitle(ComponentName cn) { @@ -1905,9 +1905,9 @@ public class PeopleActivity extends ContactsActivity implements } else { // Remove the tab associated with a plugin that's no longer available updateTabs = true; + mCallMethodMap.remove(cn); removeTabTitle(cn); - removePluginInfo(cn); - InCallPluginInfo removePlugin = getPluginInfo(cn); + InCallPluginInfo removePlugin = removePluginInfo(cn); if (removePlugin != null) { transaction = fragmentManager.beginTransaction(); transaction.remove(removePlugin.mFragment); diff --git a/src/com/android/contacts/incall/CallMethodStatusReceiver.java b/src/com/android/contacts/incall/CallMethodStatusReceiver.java new file mode 100644 index 000000000..0cc7fd559 --- /dev/null +++ b/src/com/android/contacts/incall/CallMethodStatusReceiver.java @@ -0,0 +1,17 @@ +package com.android.contacts.incall; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class CallMethodStatusReceiver extends BroadcastReceiver { + private static final String TAG = CallMethodStatusReceiver.class.getSimpleName(); + private static final boolean DEBUG = false; + + @Override + public void onReceive(Context context, Intent intent) { + if (DEBUG) Log.d(TAG, "plugin status changed"); + InCallPluginHelper.refresh(); + } +} -- cgit v1.2.3