Merge "Rewording comments around ACTION_NEW_OUTGOING_CALL"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2721a8b..93320f7 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -64,6 +64,7 @@
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.SEND_RESPOND_VIA_MESSAGE" />
+ <uses-permission android:name="android.permission.SET_TIME" />
<uses-permission android:name="android.permission.SET_TIME_ZONE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml
index c452cd3..8771747 100644
--- a/res/values-sw/strings.xml
+++ b/res/values-sw/strings.xml
@@ -521,7 +521,7 @@
<string name="pstn_phone" msgid="8782554491484326429">"Kupiga simu ya mkononi"</string>
<string name="internet_phone" msgid="1147922660195095810">"Simu ya wavuti"</string>
<string name="no_sip_account_found_title" msgid="6266249392379373628">"Hakuna akaunti ya upigaji simu wa Mtandao"</string>
- <string name="no_sip_account_found" msgid="724325811961769997">"Hakuna akaunti za kupiga simu za mtandao kwenye simu hii. Je, unataka kuongeza moja sasa?"</string>
+ <string name="no_sip_account_found" msgid="724325811961769997">"Hakuna akaunti za kupiga simu za mtandao kwenye simu hii. Je, ungependa kuongeza akaunti sasa?"</string>
<string name="sip_menu_add" msgid="8757508498518881500">"Ongeza"</string>
<string name="add_sip_account" msgid="5904858426290097611">"Ongeza akaunti"</string>
<string name="remove_sip_account" msgid="7645900420385682570">"Ondoa akaunti"</string>
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
index 25e7290..9178574 100644
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -75,7 +75,7 @@
<string name="sum_cw_disabled" msgid="3648693907300104575">"通話時如有來電請通知我"</string>
<string name="call_forwarding_settings" msgid="3378927671091537173">"來電轉接設定"</string>
<string name="labelCF" msgid="2574386948026924737">"來電轉接"</string>
- <string name="labelCFU" msgid="8147177368148660600">"永遠轉接"</string>
+ <string name="labelCFU" msgid="8147177368148660600">"一律轉接"</string>
<string name="messageCFU" msgid="3560082430662923687">"永遠使用此號碼"</string>
<string name="sum_cfu_enabled_indicator" msgid="4014187342724130197">"轉接所有來電"</string>
<string name="sum_cfu_enabled" msgid="2450052502198827927">"將所有來電轉接至 <xliff:g id="PHONENUMBER">{0}</xliff:g>"</string>
diff --git a/src/com/android/phone/CallHandlerServiceProxy.java b/src/com/android/phone/CallHandlerServiceProxy.java
index 7c8ace7..f5b6116 100644
--- a/src/com/android/phone/CallHandlerServiceProxy.java
+++ b/src/com/android/phone/CallHandlerServiceProxy.java
@@ -58,6 +58,7 @@
public static final int RETRY_DELAY_MILLIS = 2000;
public static final int RETRY_DELAY_LONG_MILLIS = 30 * 1000; // 30 seconds
private static final int BIND_RETRY_MSG = 1;
+ private static final int BIND_TIME_OUT = 2;
private static final int MAX_SHORT_DELAY_RETRY_COUNT = 5;
private AudioRouter mAudioRouter;
@@ -79,8 +80,28 @@
switch (msg.what) {
case BIND_RETRY_MSG:
+ // Remove any pending messages since we're already performing the action.
+ // If the call to setupServiceConnection() fails, it will queue up another retry.
+ removeMessages(BIND_RETRY_MSG);
handleConnectRetry();
break;
+ case BIND_TIME_OUT:
+ // Remove any pending messages since we're already performing the action.
+ // If the call to setupServiceConnection() fails, it will queue up another retry.
+ removeMessages(BIND_TIME_OUT);
+ synchronized (mServiceAndQueueLock) {
+ if(mCallHandlerServiceGuarded == null) {
+ Log.w(TAG, "Binding time out. InCallUI did not respond in time.");
+ try {
+ mContext.unbindService(mConnection);
+ } catch(Exception e) {
+ Log.w(TAG, "unbindservice exception", e);
+ }
+ mConnection = null;
+ handleConnectRetry();
+ }
+ }
+ break;
}
}
@@ -290,6 +311,10 @@
Log.d(TAG, "Service Connected");
}
onCallHandlerServiceConnected(ICallHandlerService.Stub.asInterface(service));
+ removeMessages(BIND_TIME_OUT);
+ if (DBG) {
+ Log.d(TAG, "Service Connected. Cancel timer");
+ }
resetConnectRetryCount();
}
@@ -390,7 +415,9 @@
if (failedConnection) {
mConnection = null;
- enqueueConnectRetry();
+ enqueueConnectRetry(BIND_RETRY_MSG);
+ } else {
+ enqueueConnectRetry(BIND_TIME_OUT);
}
} else {
Log.d(TAG, "Service connection to in call service already started.");
@@ -412,10 +439,6 @@
}
private void handleConnectRetry() {
- // Remove any pending messages since we're already performing the action.
- // If the call to setupServiceConnection() fails, it will queue up another retry.
- removeMessages(BIND_RETRY_MSG);
-
// Something else triggered the connection, cancel.
if (mConnection != null) {
Log.i(TAG, "Retry: already connected.");
@@ -449,14 +472,14 @@
* Called after the connection failed and a retry is needed.
* Queues up a retry to happen with a delay.
*/
- private void enqueueConnectRetry() {
+ private void enqueueConnectRetry(int msg) {
final boolean isLongDelay = (mBindRetryCount > MAX_SHORT_DELAY_RETRY_COUNT);
final int delay = isLongDelay ? RETRY_DELAY_LONG_MILLIS : RETRY_DELAY_MILLIS;
Log.w(TAG, "InCallUI Connection failed. Enqueuing delayed retry for " + delay + " ms." +
" retries(" + mBindRetryCount + ")");
- sendEmptyMessageDelayed(BIND_RETRY_MSG, delay);
+ sendEmptyMessageDelayed(msg, delay);
}
private void unbind() {
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 34ed832..ffae9ce 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -82,8 +82,10 @@
private static final int EVENT_NV_WRITE_CDMA_PRL_DONE = 18;
private static final int CMD_NV_RESET_CONFIG = 19;
private static final int EVENT_NV_RESET_CONFIG_DONE = 20;
- private static final int CMD_SET_RADIO_MODE = 21;
- private static final int EVENT_SET_RADIO_MODE_DONE = 22;
+ private static final int CMD_GET_PREFERRED_NETWORK_TYPE = 21;
+ private static final int EVENT_GET_PREFERRED_NETWORK_TYPE_DONE = 22;
+ private static final int CMD_SET_PREFERRED_NETWORK_TYPE = 23;
+ private static final int EVENT_SET_PREFERRED_NETWORK_TYPE_DONE = 24;
/** The singleton instance. */
@@ -341,6 +343,44 @@
handleNullReturnEvent(msg, "nvResetConfig");
break;
+ case CMD_GET_PREFERRED_NETWORK_TYPE:
+ request = (MainThreadRequest) msg.obj;
+ onCompleted = obtainMessage(EVENT_GET_PREFERRED_NETWORK_TYPE_DONE, request);
+ mPhone.getPreferredNetworkType(onCompleted);
+ break;
+
+ case EVENT_GET_PREFERRED_NETWORK_TYPE_DONE:
+ ar = (AsyncResult) msg.obj;
+ request = (MainThreadRequest) ar.userObj;
+ if (ar.exception == null && ar.result != null) {
+ request.result = ar.result; // Integer
+ } else {
+ request.result = -1;
+ if (ar.result == null) {
+ loge("getPreferredNetworkType: Empty response");
+ } else if (ar.exception instanceof CommandException) {
+ loge("getPreferredNetworkType: CommandException: " +
+ ar.exception);
+ } else {
+ loge("getPreferredNetworkType: Unknown exception");
+ }
+ }
+ synchronized (request) {
+ request.notifyAll();
+ }
+ break;
+
+ case CMD_SET_PREFERRED_NETWORK_TYPE:
+ request = (MainThreadRequest) msg.obj;
+ onCompleted = obtainMessage(EVENT_SET_PREFERRED_NETWORK_TYPE_DONE, request);
+ int networkType = (Integer) request.argument;
+ mPhone.setPreferredNetworkType(networkType, onCompleted);
+ break;
+
+ case EVENT_SET_PREFERRED_NETWORK_TYPE_DONE:
+ handleNullReturnEvent(msg, "setPreferredNetworkType");
+ break;
+
default:
Log.w(LOG_TAG, "MainThreadHandler: unexpected message code: " + msg.what);
break;
@@ -1211,4 +1251,36 @@
if (DBG) log("nvResetConfig: type " + resetType + ' ' + (success ? "ok" : "fail"));
return success;
}
+
+ /**
+ * Get the preferred network type.
+ * Used for device configuration by some CDMA operators.
+ *
+ * @return the preferred network type, defined in RILConstants.java.
+ */
+ @Override
+ public int getPreferredNetworkType() {
+ enforceModifyPermission();
+ if (DBG) log("getPreferredNetworkType");
+ int[] result = (int[]) sendRequest(CMD_GET_PREFERRED_NETWORK_TYPE, null);
+ int networkType = (result != null ? result[0] : -1);
+ if (DBG) log("getPreferredNetworkType: " + networkType);
+ return networkType;
+ }
+
+ /**
+ * Set the preferred network type.
+ * Used for device configuration by some CDMA operators.
+ *
+ * @param networkType the preferred network type, defined in RILConstants.java.
+ * @return true on success; false on any failure.
+ */
+ @Override
+ public boolean setPreferredNetworkType(int networkType) {
+ enforceModifyPermission();
+ if (DBG) log("setPreferredNetworkType: type " + networkType);
+ Boolean success = (Boolean) sendRequest(CMD_SET_PREFERRED_NETWORK_TYPE, networkType);
+ if (DBG) log("setPreferredNetworkType: " + (success ? "ok" : "fail"));
+ return success;
+ }
}