diff options
author | Erica Chang <echang@cyngn.com> | 2016-03-08 18:09:45 -0800 |
---|---|---|
committer | Erica Chang <echang@cyngn.com> | 2016-04-07 12:05:50 -0700 |
commit | 64e5ffe387e08ab1ace20d93354c08e86f7cb625 (patch) | |
tree | 6a52f687830860de051b5d477ec2ec50e23225c9 | |
parent | 4bfb1738ea3c7ba4bbd4d63a292be208539f310b (diff) | |
download | android_packages_apps_Contacts-64e5ffe387e08ab1ace20d93354c08e86f7cb625.tar.gz android_packages_apps_Contacts-64e5ffe387e08ab1ace20d93354c08e86f7cb625.tar.bz2 android_packages_apps_Contacts-64e5ffe387e08ab1ace20d93354c08e86f7cb625.zip |
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
-rw-r--r-- | Android.mk | 1 | ||||
-rw-r--r-- | AndroidManifest.xml | 5 | ||||
-rw-r--r-- | AndroidManifest_cm.xml | 34 | ||||
-rw-r--r-- | src/com/android/contacts/activities/PeopleActivity.java | 10 | ||||
-rw-r--r-- | src/com/android/contacts/incall/CallMethodStatusReceiver.java | 17 |
5 files changed, 57 insertions, 10 deletions
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 @@ <uses-permission android:name="android.permission.READ_PHONE_BLACKLIST" /> <uses-permission android:name="android.permission.CHANGE_PHONE_BLACKLIST" /> - <!-- Receive plugin status changes --> - <uses-permission android:name="com.cyanogen.ambient.permission.PLUGIN_STATUS_CHANGED" /> - <!-- Connect to AmbientCore to use InCall Plugins --> - <uses-permission android:name="com.cyanogen.ambient.permission.BIND_INCALL_SERVICE" /> - <application android:name="com.android.contacts.ContactsApplication" android:label="@string/applicationLabel" diff --git a/AndroidManifest_cm.xml b/AndroidManifest_cm.xml new file mode 100644 index 000000000..c78f504dc --- /dev/null +++ b/AndroidManifest_cm.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2006 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.dialer"> + + <!-- Connect to AmbientCore to use InCall Plugins --> + <uses-permission android:name="com.cyanogen.ambient.permission.BIND_INCALL_SERVICE" /> + <uses-permission android:name="com.cyanogen.ambient.permission.PLUGIN_STATUS_CHANGED" /> + <application> + + <receiver android:name="com.android.contacts.incall.CallMethodStatusReceiver" + android:enabled="true" + android:exported="true"> + <intent-filter> + <action android:name="cyanogen.ambient.core.plugin.incall.action.plugin_status_changed"/> + </intent-filter> + </receiver> + + </application> +</manifest> 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(); + } +} |