summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamaljeet Maini <kmaini@cyngn.com>2016-03-08 15:45:39 -0800
committerRichard MacGregor <rmacgregor@cyngn.com>2016-04-08 10:42:51 -0700
commitcf732b7076d62e2e2862dd2b320c67f101a2fadf (patch)
tree75bef09134517efa26cd3c0d29809d195fea4b3b
parentade2cdf6b973a6e9e03a7cacf6f624608c42d7ff (diff)
downloadandroid_packages_apps_PhoneCommon-cf732b7076d62e2e2862dd2b320c67f101a2fadf.tar.gz
android_packages_apps_PhoneCommon-cf732b7076d62e2e2862dd2b320c67f101a2fadf.tar.bz2
android_packages_apps_PhoneCommon-cf732b7076d62e2e2862dd2b320c67f101a2fadf.zip
Move VoLTE changes to PhoneCommon
While porting VoLTE support from DialerNext to AOSP Dialer, some of the relevant changes are moved to PhoneCommon. Change-Id: Id18fe4743af5df133069e889c817937d7847c3b6 Issue-Id: DIALER-720
-rw-r--r--res/drawable/ic_volte.xml74
-rw-r--r--res/layout/call_method_multiple_providers.xml38
-rw-r--r--res/layout/call_method_spinner_dropdown_item.xml28
-rw-r--r--res/layout/call_method_spinner_item.xml28
-rw-r--r--res/layout/dialer_volte_label.xml35
-rw-r--r--res/layout/dialpad_view_unthemed.xml14
-rw-r--r--res/values/cm_dimens.xml4
-rw-r--r--res/values/cm_strings.xml3
-rw-r--r--src-ambient/incall/CallMethodSpinnerAdapter.java77
-rw-r--r--src/com/android/phone/common/dialpad/DialpadView.java4
-rw-r--r--src/com/android/phone/common/util/VolteUtils.java43
11 files changed, 314 insertions, 34 deletions
diff --git a/res/drawable/ic_volte.xml b/res/drawable/ic_volte.xml
new file mode 100644
index 0000000..593f1b8
--- /dev/null
+++ b/res/drawable/ic_volte.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="29dp"
+ android:height="11dp"
+ android:viewportWidth="29"
+ android:viewportHeight="9">
+
+ <group
+ android:translateX="-13.000000"
+ android:translateY="-308.000000">
+ <group
+ android:translateX="12.000000"
+ android:translateY="281.000000">
+ <group
+ android:translateY="22.000000">
+ <path
+ android:fillColor="#FFFFFF"
+ android:fillAlpha="0"
+ android:pathData="M 0 0 H 30 V 18 H 0 V 0 Z" />
+ <path
+ android:fillColor="#B2A8A5"
+ android:fillAlpha="0.8"
+ android:strokeAlpha="0.8"
+ android:pathData="M4.02246094,11.046875 L6.20019531,5.890625 L8.11425781,5.890625 L4.67675781,13
+ L2.85058594,13 L1.65917969,5.890625 L3.46582031,5.890625 L4.02246094,11.046875 Z
+ M7.43554687,10.34375 C7.47786479,9.96288872 7.57307869,9.60481938
+ 7.72119141,9.26953125 C7.86930413,8.93424312 8.06461467,8.64290488
+ 8.30712891,8.39550781 C8.54964314,8.14811074 8.83447102,7.95442778
+ 9.16162109,7.81445312 C9.48877117,7.67447847 9.85579224,7.60937495
+ 10.2626953,7.61914062 C10.6468118,7.62565107 10.9796535,7.70133391
+ 11.2612305,7.84619141 C11.5428074,7.9910489 11.7731111,8.18554565
+ 11.9521484,8.4296875 C12.1311858,8.67382935 12.2565101,8.95621584
+ 12.328125,9.27685547 C12.3997399,9.59749509 12.4176434,9.93684717
+ 12.3818359,10.2949219 L12.3720703,10.4023438 C12.3264972,10.783205
+ 12.2288419,11.1396468 12.0791016,11.4716797 C11.9293612,11.8037126
+ 11.7332369,12.0917957 11.4907227,12.3359375 C11.2482084,12.5800793
+ 10.9625667,12.7705071 10.6337891,12.9072266 C10.3050114,13.043946
+ 9.94043169,13.1074219 9.54003906,13.0976562 C9.15917778,13.0911458
+ 8.82714985,13.0162768 8.54394531,12.8730469 C8.26074077,12.729817
+ 8.03043708,12.5377616 7.85302734,12.296875 C7.6756176,12.0559884
+ 7.55029333,11.7768571 7.47705078,11.4594727 C7.40380823,11.1420883
+ 7.38509097,10.8043638 7.42089844,10.4462891 L7.43554687,10.34375 Z
+ M9.02734375,10.4462891 C9.01432285,10.5797533 9.00537112,10.7254224
+ 9.00048828,10.8833008 C8.99560544,11.0411792 9.01106753,11.1901035
+ 9.046875,11.3300781 C9.08268247,11.4700528 9.14697219,11.5880529
+ 9.23974609,11.684082 C9.33252,11.7801112 9.47005117,11.8313802
+ 9.65234375,11.8378906 C9.84765723,11.8444011 10.0120436,11.8028976
+ 10.1455078,11.7133789 C10.278972,11.6238602 10.3888342,11.5083015
+ 10.4750977,11.3666992 C10.5613611,11.2250969 10.6264646,11.0680347
+ 10.6704102,10.8955078 C10.7143557,10.7229809 10.7460937,10.5585945
+ 10.765625,10.4023438 L10.7753906,10.2998047 C10.7819011,10.2119136
+ 10.7884114,10.1166997 10.7949219,10.0141602 C10.8014323,9.91162058
+ 10.8014323,9.80908254 10.7949219,9.70654297 C10.7884114,9.60400339
+ 10.7737631,9.50390674 10.7509766,9.40625 C10.72819,9.30859326
+ 10.6923831,9.22151731 10.6435547,9.14501953 C10.5947263,9.06852175
+ 10.5296228,9.00667341 10.4482422,8.95947266 C10.3668616,8.9122719
+ 10.2659511,8.88704429 10.1455078,8.88378906 C9.95019434,8.87727861
+ 9.78580796,8.92040969 9.65234375,9.01318359 C9.51887954,9.1059575
+ 9.40983115,9.22477141 9.32519531,9.36962891 C9.24055947,9.5144864
+ 9.17626975,9.67399001 9.13232422,9.84814453 C9.08837869,10.022299
+ 9.05664072,10.1874992 9.03710938,10.34375 L9.02734375,10.4462891 Z
+ M14.6376953,11.6816406 L17.5332031,11.6816406 L17.3037109,13 L12.7382812,13
+ L13.96875,5.890625 L15.6435547,5.890625 L14.6376953,11.6816406 Z
+ M23.4707031,7.21386719 L21.4003906,7.21386719 L20.3994141,13 L18.7246094,13
+ L19.7304688,7.21386719 L17.6943359,7.21386719 L17.9287109,5.890625
+ L23.7001953,5.890625 L23.4707031,7.21386719 Z M28.0166016,9.98730469
+ L25.4042969,9.98730469 L25.1064453,11.6816406 L28.1972656,11.6816406
+ L27.9677734,13 L23.2070312,13 L24.4375,5.890625 L29.2080078,5.890625
+ L28.9785156,7.21386719 L25.8828125,7.21386719 L25.6191406,8.71289062
+ L28.2363281,8.71289062 L28.0166016,9.98730469 Z" />
+ </group>
+ </group>
+ </group>
+</vector>
diff --git a/res/layout/call_method_multiple_providers.xml b/res/layout/call_method_multiple_providers.xml
new file mode 100644
index 0000000..c7373c0
--- /dev/null
+++ b/res/layout/call_method_multiple_providers.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<!-- Sim card selection and VoLTE annunciator. This entire vertical layout
+ goes away if neither are displayed. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/call_method_multiple_providers"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:visibility="visible" >
+
+ <!-- Call method spinner. Visible if there is more than one call
+ method available (e.g. multiple sims or sim + Skype) -->
+ <Spinner
+ android:id="@+id/call_method_spinner"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:dropDownWidth="wrap_content"
+ android:background="@drawable/btn_dialpad_key"
+ android:gravity="center_vertical"
+ android:paddingStart="@dimen/call_method_spinner_padding_start"
+ android:paddingEnd="@dimen/dialpad_digits_padding" />
+
+</LinearLayout>
diff --git a/res/layout/call_method_spinner_dropdown_item.xml b/res/layout/call_method_spinner_dropdown_item.xml
index 02ca7fd..dc3d7b1 100644
--- a/res/layout/call_method_spinner_dropdown_item.xml
+++ b/res/layout/call_method_spinner_dropdown_item.xml
@@ -16,16 +16,32 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
- android:layout_width="match_parent"
+ android:layout_width="@dimen/call_method_spinner_dropdown_item_width"
android:layout_height="@dimen/dialpad_digits_height"
android:paddingStart="@dimen/call_method_spinner_item_default_padding"
android:paddingEnd="@dimen/call_method_spinner_item_default_padding">
- <ImageView
- android:id="@+id/call_method_spinner_item_image"
- android:layout_width="@dimen/call_method_spinner_icon_size"
- android:layout_height="@dimen/call_method_spinner_icon_size"
- android:layout_gravity="center_vertical" />
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical">
+
+ <ImageView
+ android:id="@+id/call_method_spinner_item_image"
+ android:layout_width="@dimen/call_method_spinner_icon_size"
+ android:layout_height="@dimen/call_method_spinner_icon_size"
+ android:layout_gravity="center_horizontal" />
+
+ <!-- VoLTE annunciator. Carriers may customize this annunciator
+ by overlaying the ic_volte.xml drawable. -->
+ <ImageView
+ android:id="@+id/call_method_spinner_volte_image"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_volte"
+ android:layout_gravity="center_horizontal" />
+ </LinearLayout>
<TextView
android:id="@+id/call_method_spinner_item_text"
diff --git a/res/layout/call_method_spinner_item.xml b/res/layout/call_method_spinner_item.xml
index a361306..83f9068 100644
--- a/res/layout/call_method_spinner_item.xml
+++ b/res/layout/call_method_spinner_item.xml
@@ -20,15 +20,31 @@
android:layout_height="match_parent"
android:paddingStart="@dimen/call_method_spinner_item_default_padding" >
- <ImageView
- android:id="@+id/call_method_spinner_item_image"
- android:layout_width="@dimen/call_method_spinner_icon_size"
- android:layout_height="@dimen/call_method_spinner_icon_size"
- android:layout_gravity="center_vertical" />
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical">
+
+ <ImageView
+ android:id="@+id/call_method_spinner_item_image"
+ android:layout_width="@dimen/call_method_spinner_icon_size"
+ android:layout_height="@dimen/call_method_spinner_icon_size"
+ android:layout_gravity="center_horizontal" />
+
+ <!-- VoLTE annunciator. Carriers may customize this annunciator
+ by overlaying the ic_volte.xml drawable. -->
+ <ImageView
+ android:id="@+id/call_method_spinner_volte_image"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_volte"
+ android:layout_gravity="center_horizontal" />
+ </LinearLayout>
<ImageView
android:id="@+id/call_method_spinner_drop_down_arrow"
- android:layout_width="wrap_content"
+ android:layout_width="@dimen/call_method_spinner_arrow_width"
android:layout_height="wrap_content"
android:paddingStart="@dimen/call_method_spinner_item_secondary_padding"
android:paddingEnd="@dimen/call_method_spinner_item_secondary_padding"
diff --git a/res/layout/dialer_volte_label.xml b/res/layout/dialer_volte_label.xml
new file mode 100644
index 0000000..461af18
--- /dev/null
+++ b/res/layout/dialer_volte_label.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<!-- Sim card selection and VoLTE annunciator. This entire vertical layout
+ goes away if neither are displayed. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/call_method_volte_single_provider"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <!-- VoLTE annunciator. Visible or gone depending on whether
+ VoLTE is in use. Carriers may customize this annunciator
+ by overlaying the ic_volte.xml drawable. -->
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ android:src="@drawable/ic_volte"
+ android:paddingStart ="@dimen/volte_padding_start"
+ android:layout_gravity="center_horizontal" />
+
+</LinearLayout>
diff --git a/res/layout/dialpad_view_unthemed.xml b/res/layout/dialpad_view_unthemed.xml
index 7ff0280..3ac2f55 100644
--- a/res/layout/dialpad_view_unthemed.xml
+++ b/res/layout/dialpad_view_unthemed.xml
@@ -107,18 +107,12 @@
android:gravity="center"
android:visibility="invisible" />
- <Spinner
- android:id="@+id/call_method_spinner"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:dropDownWidth="wrap_content"
- android:background="@drawable/btn_dialpad_key"
- android:gravity="center_vertical"
- android:paddingStart="@dimen/call_method_spinner_padding_start"
- android:paddingEnd="@dimen/dialpad_digits_padding" />
+ <!-- Sim card selection and VoLTE annunciator. -->
+ <include layout="@layout/dialer_volte_label" />
+ <include layout="@layout/call_method_multiple_providers" />
<view class="com.android.phone.common.dialpad.DigitsEditText"
- xmlns:ex="http://schemas.android.com/apk/res-auto"
+ xmlns:ex="http://schemas.android.com/apk/res-autos"
android:id="@+id/digits"
android:layout_width="0dp"
android:layout_height="match_parent"
diff --git a/res/values/cm_dimens.xml b/res/values/cm_dimens.xml
index 64968eb..1749454 100644
--- a/res/values/cm_dimens.xml
+++ b/res/values/cm_dimens.xml
@@ -29,6 +29,10 @@
<dimen name="call_method_spinner_item_text_left_margin">16dp</dimen>
<dimen name="call_method_spinner_dropdown_item_width">134dp</dimen>
<dimen name="call_method_spinner_icon_size">24dp</dimen>
+ <dimen name="call_method_spinner_arrow_width">24dp</dimen>
<dimen name="dialpad_credits_padding">14dp</dimen>
+
+ <!-- Dimensions for VoLTE annunciator -->
+ <dimen name="volte_padding_start">11dp</dimen>
</resources> \ No newline at end of file
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 8a61ea4..e2934dd 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -30,4 +30,7 @@
<!-- InCall Sign in button -->
<string name="sign_in_credit_banner_text">SIGN IN</string>
+
+ <string name="call_method_spinner_volte_drop_down_tag">Spinner Volte Drop Down Tag</string>
+ <string name="call_method_spinner_drop_down_tag">Spinner Drop Down Tag</string>
</resources>
diff --git a/src-ambient/incall/CallMethodSpinnerAdapter.java b/src-ambient/incall/CallMethodSpinnerAdapter.java
index 2a6f387..c3a61d3 100644
--- a/src-ambient/incall/CallMethodSpinnerAdapter.java
+++ b/src-ambient/incall/CallMethodSpinnerAdapter.java
@@ -30,6 +30,7 @@ import android.widget.SpinnerAdapter;
import android.widget.TextView;
import com.android.phone.common.R;
+import com.android.phone.common.util.VolteUtils;
import java.util.Collection;
import java.util.HashMap;
@@ -45,11 +46,14 @@ public class CallMethodSpinnerAdapter extends ArrayAdapter<CallMethodInfo>
private final Context mContext;
private Map<String, Integer> mComponentMap;
+ private boolean mShowVolte = false;
- public CallMethodSpinnerAdapter(Context context, List<CallMethodInfo> objects) {
+ public CallMethodSpinnerAdapter(Context context, List<CallMethodInfo> objects, boolean
+ showVolte) {
super(context, 0, objects);
mContext = context.getApplicationContext();
processCallMethods(objects);
+ mShowVolte = showVolte;
}
/**
@@ -114,11 +118,29 @@ public class CallMethodSpinnerAdapter extends ArrayAdapter<CallMethodInfo>
@Override
public View getView(int position, View convertView, ViewGroup parent) {
CallMethodInfo callMethodInfo = getItem(position);
- if (convertView == null) {
- convertView = LayoutInflater.from(mContext)
- .inflate(R.layout.call_method_spinner_item, parent, false);
- }
+ boolean volteInUse = (callMethodInfo.mSubId > 0) &&
+ VolteUtils.isVolteInUse(mContext, callMethodInfo.mSubId);
+ SpinnerItemViewHolder holder = null;
+ // Note: if mVolteInUse changes, it invalidates cached views
+ if (convertView == null || (holder = (SpinnerItemViewHolder)convertView.getTag()) == null
+ || holder.volteInUse != volteInUse)
+ {
+ convertView = LayoutInflater.from(mContext).inflate(R.layout
+ .call_method_spinner_item, parent, false);
+ if (holder == null) holder = new SpinnerItemViewHolder();
+ convertView.setTag(holder);
+ holder.volteInUse = volteInUse;
+ holder.callTypeIcon = (ImageView) convertView.findViewById(R.id
+ .call_method_spinner_item_image);
+ holder.volteIcon = (ImageView) convertView.findViewById(R.id
+ .call_method_spinner_volte_image);
+ }
+ if (mShowVolte && volteInUse) {
+ holder.volteIcon.setVisibility(View.VISIBLE);
+ } else {
+ holder.volteIcon.setVisibility(View.GONE);
+ }
setIcon(convertView, callMethodInfo);
return convertView;
@@ -140,15 +162,33 @@ public class CallMethodSpinnerAdapter extends ArrayAdapter<CallMethodInfo>
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
CallMethodInfo callMethodInfo = getItem(position);
- if (convertView == null) {
- convertView = LayoutInflater.from(mContext)
- .inflate(R.layout.call_method_spinner_dropdown_item, parent, false);
- }
+ boolean volteInUse = (callMethodInfo.mSubId > 0) &&
+ VolteUtils.isVolteInUse(mContext, callMethodInfo.mSubId);
+ SpinnerDropDownItemViewHolder holder = null;
+ int tag = volteInUse ? R.string.call_method_spinner_volte_drop_down_tag :
+ R.string.call_method_spinner_drop_down_tag;
+ if (convertView == null || (holder = (SpinnerDropDownItemViewHolder) convertView.getTag
+ (tag)) == null) {
+ int resId = R.layout.call_method_spinner_dropdown_item;
+ convertView = LayoutInflater.from(mContext).inflate(resId, parent, false);
+ holder = new SpinnerDropDownItemViewHolder();
+ holder.volteInUse = volteInUse;
+ holder.callTypeIcon = (ImageView) convertView.findViewById(R.id
+ .call_method_spinner_item_image);
+ holder.volteIcon = (ImageView) convertView.findViewById(R.id
+ .call_method_spinner_volte_image);
+ holder.textView = (TextView) convertView.findViewById(R.id
+ .call_method_spinner_item_text);
+ convertView.setTag(tag, holder);
+ }
+ if (mShowVolte && volteInUse) {
+ holder.volteIcon.setVisibility(View.VISIBLE);
+ } else {
+ holder.volteIcon.setVisibility(View.GONE);
+ }
setIcon(convertView, callMethodInfo);
-
- TextView text=(TextView) convertView.findViewById(R.id.call_method_spinner_item_text);
- text.setText(callMethodInfo.mName);
+ holder.textView.setText(callMethodInfo.mName);
return convertView;
}
@@ -247,4 +287,17 @@ public class CallMethodSpinnerAdapter extends ArrayAdapter<CallMethodInfo>
}
return String.valueOf(info.hashCode());
}
+
+ private static class SpinnerItemViewHolder {
+ ImageView callTypeIcon;
+ ImageView volteIcon;
+ boolean volteInUse;
+ }
+
+ private static class SpinnerDropDownItemViewHolder {
+ ImageView callTypeIcon;
+ ImageView volteIcon;
+ TextView textView;
+ boolean volteInUse;
+ }
}
diff --git a/src/com/android/phone/common/dialpad/DialpadView.java b/src/com/android/phone/common/dialpad/DialpadView.java
index 2b44b0d..8a4aacc 100644
--- a/src/com/android/phone/common/dialpad/DialpadView.java
+++ b/src/com/android/phone/common/dialpad/DialpadView.java
@@ -71,6 +71,7 @@ public class DialpadView extends LinearLayout {
private View mOverflowMenuButton;
private ColorStateList mRippleColor;
private Spinner mCallMethodSpinner;
+ private View mVolteLabel;
private ViewGroup mRateContainer;
private TextView mIldCountry;
@@ -121,6 +122,7 @@ public class DialpadView extends LinearLayout {
mIldCountry = (TextView) mRateContainer.findViewById(R.id.ild_country);
mIldRate = (TextView) mRateContainer.findViewById(R.id.ild_rate);
mCallMethodSpinner = (Spinner) findViewById(R.id.call_method_spinner);
+ mVolteLabel = findViewById(R.id.call_method_volte_single_provider);
AccessibilityManager accessibilityManager = (AccessibilityManager)
getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
@@ -333,6 +335,8 @@ public class DialpadView extends LinearLayout {
public Spinner getCallMethodSpinner() { return mCallMethodSpinner; }
+ public View getVolteLabel() { return mVolteLabel; }
+
public View getOverflowMenuButton() {
return mOverflowMenuButton;
}
diff --git a/src/com/android/phone/common/util/VolteUtils.java b/src/com/android/phone/common/util/VolteUtils.java
new file mode 100644
index 0000000..cde35a2
--- /dev/null
+++ b/src/com/android/phone/common/util/VolteUtils.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 The CyanogenMod 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.
+ */
+
+/**
+ * @file
+ * @brief VoLTE related utilities for Dialer
+ */
+
+package com.android.phone.common.util;
+
+import android.content.Context;
+import com.android.ims.ImsManager;
+
+/**
+ * Collection of utilities that glue the Dialer and Telephony
+ * layers together.
+ */
+public class VolteUtils {
+ private static final String TAG = VolteUtils.class.getSimpleName();
+
+ public static boolean isVolteAvailable(Context context, int subId) {
+ return ImsManager.isVolteEnabledByPlatform(context) &&
+ ImsManager.isVolteProvisionedOnDevice(context, subId);
+ }
+
+ public static boolean isVolteInUse(Context context, int subId) {
+ return isVolteAvailable(context, subId) &&
+ ImsManager.isEnhanced4gLteModeSettingEnabledByUser(context);
+ }
+}