summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard MacGregor <rmacgregor@cyngn.com>2016-01-26 10:29:44 -0800
committerRichard MacGregor <rmacgregor@cyngn.com>2016-04-08 10:42:50 -0700
commit22fef9c20c52c127c95a50e357324ed921332647 (patch)
tree84d39868b1f6fc056c0b0ce7cff7e8886fcddbbe
parent3d48977a8539104fd6ffff38d0fdc3d64f289db0 (diff)
downloadandroid_packages_apps_PhoneCommon-22fef9c20c52c127c95a50e357324ed921332647.tar.gz
android_packages_apps_PhoneCommon-22fef9c20c52c127c95a50e357324ed921332647.tar.bz2
android_packages_apps_PhoneCommon-22fef9c20c52c127c95a50e357324ed921332647.zip
CallMethodHelper/Info: Add icon and mimetype
Add video callable mimetype Add single color brand icon Change-Id: Ia4a023f125e613e70afb6022f834996a124d2d86
-rw-r--r--src-ambient/incall/CallMethodHelper.java56
-rw-r--r--src-ambient/incall/CallMethodInfo.java12
2 files changed, 61 insertions, 7 deletions
diff --git a/src-ambient/incall/CallMethodHelper.java b/src-ambient/incall/CallMethodHelper.java
index e1ace99..c1219cb 100644
--- a/src-ambient/incall/CallMethodHelper.java
+++ b/src-ambient/incall/CallMethodHelper.java
@@ -86,7 +86,7 @@ public class CallMethodHelper {
// To prevent multiple broadcasts and force us to wait for all items to be complete
// this is the count of callbacks we should get for each item. Increase this if we add more.
- private static int EXPECTED_RESULT_CALLBACKS = 8;
+ private static int EXPECTED_RESULT_CALLBACKS = 9;
// To prevent multiple broadcasts and force us to wait for all items to be complete
// this is the count of callbacks we should get for each item. Increase this if we add more.
@@ -339,6 +339,30 @@ public class CallMethodHelper {
return mimeTypes;
}
+ /**
+ * A few items need a list of video callable mime types in a comma delimited list.
+ * Since we are already querying all the plugins. We can easily build this list ahead of time.
+ *
+ * Items that require this should subscribe and grab this updated list when needed.
+ * @return string of enabled video callable mime types
+ */
+ public static String getAllEnabledVideoCallableMimeTypes() {
+ String mimeTypes = "";
+
+ List<String> enabledMimeTypes = new ArrayList<>();
+
+ for (CallMethodInfo cmi : mCallMethodInfos.values()) {
+ if (cmi.mStatus == PluginStatus.ENABLED) {
+ enabledMimeTypes.add(cmi.mVideoCallableMimeType);
+ }
+ }
+
+ if (!enabledMimeTypes.isEmpty()) {
+ mimeTypes = Joiner.on(",").skipNulls().join(enabledMimeTypes);
+ }
+ return mimeTypes;
+ }
+
public static void updateCreditInfo(ComponentName name, GetCreditInfoResult gcir) {
CallMethodInfo cmi = getCallMethodIfExists(name);
if (cmi != null) {
@@ -419,6 +443,7 @@ public class CallMethodHelper {
getCallMethodInfo(cn);
getCallMethodStatus(cn);
getCallMethodMimeType(cn);
+ getCallMethodVideoCallableMimeType(cn);
getCallMethodAuthenticated(cn, false);
getSettingsIntent(cn);
getCreditInfo(cn, false);
@@ -469,10 +494,14 @@ public class CallMethodHelper {
try {
cmi.mBrandIcon = pluginResources.getDrawable(icpi.getBrandIcon(), null);
+ cmi.mSingleColorBrandIcon =
+ pluginResources.getDrawable(icpi.getSingleColorBrandIcon(), null);
cmi.mBadgeIcon = pluginResources.getDrawable(icpi.getBadgeIcon(), null);
cmi.mLoginIcon = pluginResources.getDrawable(icpi.getLoginIcon(), null);
- cmi.mActionOneIcon = pluginResources.getDrawable(icpi.getActionOneIcon(), null);
- cmi.mActionTwoIcon = pluginResources.getDrawable(icpi.getActionTwoIcon(), null);
+ cmi.mActionOneIcon =
+ pluginResources.getDrawable(icpi.getActionOneIcon(), null);
+ cmi.mActionTwoIcon =
+ pluginResources.getDrawable(icpi.getActionTwoIcon(), null);
} catch (Resources.NotFoundException e) {
Log.e(TAG, "Resource Not found: " + cn);
mCallMethodInfos.remove(cn);
@@ -566,6 +595,27 @@ public class CallMethodHelper {
}
/**
+ * Get the call method mime type
+ * @param cn
+ */
+ private static void getCallMethodVideoCallableMimeType(final ComponentName cn) {
+ getInstance().mInCallApi.getVideoCallableMimeType(getInstance().mClient, cn)
+ .setResultCallback(new ResultCallback<MimeTypeResult>() {
+ @Override
+ public void onResult(MimeTypeResult mimeTypeResult) {
+ synchronized (mCallMethodInfos) {
+ CallMethodInfo cmi = getCallMethodIfExists(cn);
+ if (cmi != null) {
+ cmi.mVideoCallableMimeType = mimeTypeResult.mimeType;
+ mCallMethodInfos.put(cn, cmi);
+ maybeBroadcastToSubscribers();
+ }
+ }
+ }
+ });
+ }
+
+ /**
* Get the Authentication state of the callmethod
* @param cn
*/
diff --git a/src-ambient/incall/CallMethodInfo.java b/src-ambient/incall/CallMethodInfo.java
index 26f5018..467ace3 100644
--- a/src-ambient/incall/CallMethodInfo.java
+++ b/src-ambient/incall/CallMethodInfo.java
@@ -50,11 +50,13 @@ public class CallMethodInfo {
public int mStatus;
public boolean mIsAuthenticated;
public String mMimeType;
+ public String mVideoCallableMimeType;
public String mSubscriptionButtonText;
public String mCreditButtonText;
public String mT9HintDescription;
public PendingIntent mSettingsIntent;
public Drawable mBrandIcon;
+ public Drawable mSingleColorBrandIcon;
public Drawable mBadgeIcon;
public Drawable mLoginIcon;
public Drawable mActionOneIcon;
@@ -70,10 +72,10 @@ public class CallMethodInfo {
@Override
public int hashCode() {
return Objects.hashCode(mId, mUserHandle, mComponent, mName, mSummary, mSlotId, mSubId,
- mColor, mStatus, mIsAuthenticated, mMimeType, mSubscriptionButtonText,
- mCreditButtonText, mT9HintDescription, mSettingsIntent, mBrandIcon, mBadgeIcon,
- mLoginIcon, mActionOneIcon, mActionTwoIcon, pluginResources, mActionOneText,
- mActionTwoText, mIsInCallProvider);
+ mColor, mStatus, mIsAuthenticated, mMimeType, mVideoCallableMimeType,
+ mSubscriptionButtonText, mCreditButtonText, mT9HintDescription, mSettingsIntent,
+ mBrandIcon, mSingleColorBrandIcon, mBadgeIcon, mLoginIcon, mActionOneIcon,
+ mActionTwoIcon, pluginResources, mActionOneText, mActionTwoText, mIsInCallProvider);
}
public static final String TAG = "CallMethodInfo";
@@ -96,11 +98,13 @@ public class CallMethodInfo {
&& Objects.equal(this.mStatus, info.mStatus)
&& Objects.equal(this.mIsAuthenticated, info.mIsAuthenticated)
&& Objects.equal(this.mMimeType, info.mMimeType)
+ && Objects.equal(this.mVideoCallableMimeType, info.mVideoCallableMimeType)
&& Objects.equal(this.mSubscriptionButtonText, info.mSubscriptionButtonText)
&& Objects.equal(this.mCreditButtonText, info.mCreditButtonText)
&& Objects.equal(this.mT9HintDescription, info.mT9HintDescription)
&& Objects.equal(this.mSettingsIntent, info.mSettingsIntent)
&& Objects.equal(this.mBrandIcon, info.mBrandIcon)
+ && Objects.equal(this.mSingleColorBrandIcon, info.mSingleColorBrandIcon)
&& Objects.equal(this.mBadgeIcon, info.mBadgeIcon)
&& Objects.equal(this.mLoginIcon, info.mLoginIcon)
&& Objects.equal(this.mActionOneIcon, info.mActionOneIcon)