summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjiadongz <jiadongz@codeaurora.org>2014-01-22 13:23:02 +0800
committeremancebo <emancebo@cyngn.com>2014-09-03 16:58:11 -0700
commit2548933d51dea223c139a6848af16bfda3c3d159 (patch)
treee96e243c7e767ea2bb5e2235373a4bd7eff1dd6d
parentaab8fae3a5eccf6f305b2d1166accad454b3cac9 (diff)
downloadandroid_packages_apps_Dialer-2548933d51dea223c139a6848af16bfda3c3d159.tar.gz
android_packages_apps_Dialer-2548933d51dea223c139a6848af16bfda3c3d159.tar.bz2
android_packages_apps_Dialer-2548933d51dea223c139a6848af16bfda3c3d159.zip
CSVT: CSVT entry in Dialer App.
Conflicts: res/values/strings.xml Change-Id: If42e66fb490875e635648178da939249c318efdf
-rw-r--r--res/menu/dialpad_options.xml12
-rw-r--r--res/values/strings.xml15
-rw-r--r--src/com/android/dialer/DialtactsActivity.java56
-rw-r--r--[-rwxr-xr-x]src/com/android/dialer/dialpad/DialpadFragment.java59
4 files changed, 142 insertions, 0 deletions
diff --git a/res/menu/dialpad_options.xml b/res/menu/dialpad_options.xml
index 0727dd57c..a55e37060 100644
--- a/res/menu/dialpad_options.xml
+++ b/res/menu/dialpad_options.xml
@@ -29,4 +29,16 @@
android:title="@string/add_wait"
android:showAsAction="withText"
android:orderInCategory="1" />
+<!-- add for CSVT -->
+ <item
+ android:id="@+id/menu_video_call"
+ android:title="@string/video_call"
+ android:showAsAction="withText"
+ android:orderInCategory="1" />
+ <item
+ android:id="@+id/menu_video_call_settings"
+ android:title="@string/video_call_settings"
+ android:showAsAction="withText"
+ android:orderInCategory="1" />
+<!-- add for CSVT -->
</menu>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 702c1465d..1e9988756 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -757,6 +757,21 @@
<string name="calllog_search_hint">Search call log</string>
+ <!--add for csvt, Menu item label for call settings [CHAR LIMIT=30] -->
+ <string name="video_call">Video call</string>
+ <string name="video_call_settings">Video call settings</string>
+
+ <!-- add for csvt, Menu item used to initiate videocall from dialer -->
+ <string name="videocall">Video call</string>
+
+ <!-- add for csvt, Menu item used to initiate videocall settings from dialer -->
+ <string name="videocall_settings">Video call settings</string>
+
+ <!-- add for csvt, String describing the text for a Video call number in quick contact.
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView. -->
+ <string name="description_videocall">Video call <xliff:g id="name">%1$s</xliff:g></string>
+
<!-- for speed dial -->
<string name="set_speed_dial">Speed dial settings</string>
<string name="dialog_title">Tip</string>
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 11b43bc1b..0e9fe1502 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -94,6 +94,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+//add for CSVT
+import android.content.ServiceConnection;
+import org.codeaurora.ims.csvt.ICsvtService;
+import android.content.ComponentName;
+import android.os.IBinder;
+import android.os.SystemProperties;
+
+
/**
* The dialer tab's title is 'phone', a more common name (see strings.xml).
*/
@@ -186,6 +194,54 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
private boolean mInRegularSearch;
private boolean mClearSearchOnPause;
+ //add for CSVT
+
+ public static ICsvtService mCsvtService;
+
+ public static boolean isCsvtActive() {
+ boolean result = false;
+ if (mCsvtService != null) {
+ try{
+ result = mCsvtService.isActive();
+ if (DEBUG) Log.d(TAG, "mCsvtService.isActive = " + result);
+ } catch (RemoteException e) {
+ Log.e(TAG, Log.getStackTraceString(new Throwable()));
+ }
+ }
+ return result;
+ }
+
+ private boolean isVTSupported() {
+ return SystemProperties.getBoolean("persist.radio.csvt.enabled", false);
+ //return this.getResources().getBoolean(R.bool.csvt_enabled);
+ }
+
+
+ private void createCsvtService() {
+ if (isVTSupported()) {
+ try {
+ Intent intent = new Intent("org.codeaurora.ims.csvt.ICsvtService");
+ boolean bound = bindService(intent,
+ mCsvtServiceConnection, Context.BIND_AUTO_CREATE);
+ if (DEBUG) Log.d(TAG, "ICsvtService bound request : " + bound);
+ } catch (NoClassDefFoundError e) {
+ Log.e(TAG, "Ignoring ICsvtService class not found exception " + e);
+ }
+ }
+ }
+
+ private static ServiceConnection mCsvtServiceConnection = new ServiceConnection() {
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mCsvtService = ICsvtService.Stub.asInterface(service);
+ if (DEBUG) Log.d(TAG,"Csvt Service Connected: " + mCsvtService);
+ }
+
+ public void onServiceDisconnected(ComponentName arg0) {
+ if (DEBUG) Log.d(TAG,"Csvt Service onServiceDisconnected");
+ }
+ };
+ //add for CSVT
+
/**
* True if the dialpad is only temporarily showing due to being in call
*/
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index bcc988e61..4a2c4dae6 100755..100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -818,6 +818,12 @@ public class DialpadFragment extends Fragment
final MenuItem addToContactMenuItem = menu.findItem(R.id.menu_add_contacts);
final MenuItem twoSecPauseMenuItem = menu.findItem(R.id.menu_2s_pause);
final MenuItem waitMenuItem = menu.findItem(R.id.menu_add_wait);
+ final MenuItem videocallMenuItem = menu.findItem(R.id.menu_video_call);
+ final MenuItem videocallsettingsMenuItem = menu.findItem(R.id.menu_video_call_settings);
+
+ // We show "video call setting" menu only when the csvt is supported
+ //which means the prop "persist.radio.csvt.enabled" = true
+ videocallsettingsMenuItem.setVisible(isVTSupported());
// We show "add to contacts" menu only when the user is
// seeing usual dialpad and has typed at least one digit.
@@ -826,11 +832,18 @@ public class DialpadFragment extends Fragment
addToContactMenuItem.setVisible(false);
twoSecPauseMenuItem.setVisible(false);
waitMenuItem.setVisible(false);
+ videocallMenuItem.setVisible(false);
} else {
final CharSequence digits = mDigits.getText();
// Put the current digits string into an intent
addToContactMenuItem.setIntent(DialtactsActivity.getAddNumberToContactIntent(digits));
addToContactMenuItem.setVisible(true);
+
+ //add for csvt
+ videocallsettingsMenuItem.setVisible(isVTSupported());
+ if(isVTSupported()){
+ videocallMenuItem.setIntent(getVTCallIntent(digits.toString()));
+ }
}
}
@@ -1591,6 +1604,9 @@ public class DialpadFragment extends Fragment
case R.id.menu_add_wait:
updateDialString(WAIT);
return true;
+ case R.id.menu_video_call_settings:
+ startActivity(getVTCallSettingsIntent());
+ return true;
default:
return false;
}
@@ -1783,6 +1799,49 @@ public class DialpadFragment extends Fragment
return intent;
}
+ // add for CSVT start
+ private static Intent getVTCallIntent(String number) {
+ Intent intent = new Intent("com.borqs.videocall.action.LaunchVideoCallScreen");
+ intent.addCategory(Intent.CATEGORY_DEFAULT);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+
+ intent.putExtra("IsCallOrAnswer", true); // true as a
+ // call,
+ // while
+ // false as
+ // answer
+
+ intent.putExtra("LaunchMode", 1); // nLaunchMode: 1 as
+ // telephony, while
+ // 0 as socket
+ intent.putExtra("call_number_key", number);
+ return intent;
+ }
+
+ private static Intent getVTCallSettingsIntent() {
+ Intent intent = new Intent("com.borqs.videocall.action.LaunchVideoCallSettingsScreen");
+ intent.addCategory(Intent.CATEGORY_DEFAULT);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ return intent;
+ }
+
+ private String getValidDialNumber() {
+ if (mDigits != null)
+ return mDigits.getText().toString();
+ else
+ return null;
+ }
+
+ public static boolean isVTActive() {
+ return DialtactsActivity.isCsvtActive();
+ }
+ private boolean isVTSupported() {
+ return SystemProperties.getBoolean("persist.radio.csvt.enabled", false);
+ //return this.getResources().getBoolean(R.bool.csvt_enabled);
+ }
+
+ // add for csvt end
+
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);