Merge "Import translations. DO NOT MERGE" into lmp-preview-dev
diff --git a/res/drawable-hdpi/ic_arrow_back_24dp.png b/res/drawable-hdpi/ic_arrow_back_24dp.png
new file mode 100644
index 0000000..86cb894
--- /dev/null
+++ b/res/drawable-hdpi/ic_arrow_back_24dp.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_back_arrow.png b/res/drawable-hdpi/ic_back_arrow.png
deleted file mode 100644
index aad4f36..0000000
--- a/res/drawable-hdpi/ic_back_arrow.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_arrow_back_24dp.png b/res/drawable-mdpi/ic_arrow_back_24dp.png
new file mode 100644
index 0000000..dc81cd1
--- /dev/null
+++ b/res/drawable-mdpi/ic_arrow_back_24dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_back_arrow.png b/res/drawable-mdpi/ic_back_arrow.png
deleted file mode 100644
index 56eb887..0000000
--- a/res/drawable-mdpi/ic_back_arrow.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_arrow_back_24dp.png b/res/drawable-xhdpi/ic_arrow_back_24dp.png
new file mode 100644
index 0000000..4f4fbaa
--- /dev/null
+++ b/res/drawable-xhdpi/ic_arrow_back_24dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_back_arrow.png b/res/drawable-xhdpi/ic_back_arrow.png
deleted file mode 100644
index 9d46e3d..0000000
--- a/res/drawable-xhdpi/ic_back_arrow.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_arrow_back_24dp.png b/res/drawable-xxhdpi/ic_arrow_back_24dp.png
new file mode 100644
index 0000000..46e90f7
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_arrow_back_24dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_back_arrow.png b/res/drawable-xxhdpi/ic_back_arrow.png
deleted file mode 100644
index 66b6e35..0000000
--- a/res/drawable-xxhdpi/ic_back_arrow.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/ic_back_arrow.xml b/res/drawable/ic_back_arrow.xml
new file mode 100644
index 0000000..68a875d
--- /dev/null
+++ b/res/drawable/ic_back_arrow.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2014 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
+  -->
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+        android:src="@drawable/ic_arrow_back_24dp"
+        android:autoMirrored="true"
+        android:tint="@color/actionbar_icon_color" />
\ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index a440608..5eab9e3 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -40,5 +40,14 @@
     <color name="phone_settings_actionbar_text_color">#FFFFFF</color>
     <!-- Background color of action bars.  Ensure this stays in sync with Dialer
          actionbar_background_color. -->
-    <color name="actionbar_background_color">#00AFCC</color>
+    <color name="actionbar_background_color">#0fc6dc</color>
+    <!-- Dark variant of the action bar color.  Ensure this stays in sync with Dialer version. -->
+    <color name="actionbar_background_color_dark">#008aa1</color>
+    <!-- Color for icons in the actionbar. Ensure this stays in sync with Dialer version. -->
+    <color name="actionbar_icon_color">#ffffff</color>
+
+    <!-- Color for the setting text. -->
+    <color name="setting_primary_color">#4d4c4c</color>
+    <!-- Color for the setting description text. -->
+    <color name="setting_secondary_color">#989898</color>
 </resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 5adfe52..7980f25 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -94,5 +94,6 @@
          Right now answer/decline/reject icons have 38dp width/height.
          So, (94 - 38)/2 ==> 28dp -->
     <dimen name="incoming_call_widget_asset_margin">28dp</dimen>
-
+    <!-- Height of the action bar.  Keep in sync with same value in Dialer. -->
+    <dimen name="action_bar_height">64dp</dimen>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 993f98a..7e51e97 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -133,7 +133,7 @@
     <!-- Mobile network settings screen, setting option name -->
     <string name="networks">Network operators</string>
     <!-- Call settings screen title -->
-    <string name="call_settings">Call settings</string>
+    <string name="call_settings">Call Settings</string>
     <!-- GSM Call settings screen, setting option name -->
     <string name="additional_gsm_call_settings">Additional settings</string>
     <!-- GSM-only Call settings screen, setting option name-->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1bb756c..5eb68f2 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -160,11 +160,18 @@
         <item name="android:windowCloseOnTouchOutside">true</item>
     </style>
 
-    <style name="SettingsLight" parent="@android:style/Theme.Holo.Light">
+    <style name="SettingsLight" parent="android:Theme.Quantum.Light">
         <item name="android:windowBackground">@color/phone_settings_background_color</item>
+        <item name="android:windowContentOverlay">@null</item>
         <item name="android:actionBarStyle">@style/DialtactsActionBarStyle</item>
         <item name="android:actionOverflowButtonStyle">@style/DialtactsActionBarOverflow</item>
         <item name="android:homeAsUpIndicator">@drawable/ic_back_arrow</item>
+        <item name="android:windowActionBarOverlay">false</item>
+        <item name="android:colorPrimaryDark">@color/actionbar_background_color_dark</item>
+        <!-- Setting text. -->
+        <item name="android:textColorPrimary">@color/setting_primary_color</item>
+        <!-- Setting description. -->
+        <item name="android:textColorSecondary">@color/setting_secondary_color</item>
     </style>
 
     <style name="Empty" parent="@android:style/Theme.Holo">
@@ -228,10 +235,10 @@
     </style>
 
     <!-- Style for the call settings action bar.  Should be kept in sync with Dialer. -->
-    <style name="DialtactsActionBarStyle" parent="android:Widget.Holo.ActionBar">
+    <style name="DialtactsActionBarStyle" parent="android:Widget.Quantum.ActionBar">
         <item name="android:background">@color/actionbar_background_color</item>
-        <item name="android:backgroundStacked">#ffffff</item>
         <item name="android:titleTextStyle">@style/DialtactsActionBarTitleText</item>
+        <item name="android:height">@dimen/action_bar_height</item>
         <!-- Empty icon -->
         <item name="android:icon">@android:color/transparent</item>
     </style>
diff --git a/src/com/android/phone/GetPin2Screen.java b/src/com/android/phone/GetPin2Screen.java
index a06b0cf..bf2e170 100644
--- a/src/com/android/phone/GetPin2Screen.java
+++ b/src/com/android/phone/GetPin2Screen.java
@@ -20,6 +20,7 @@
 import android.content.Intent;
 import android.net.Uri;
 import android.os.Bundle;
+import android.text.InputType;
 import android.text.TextUtils;
 import android.text.method.DigitsKeyListener;
 import android.util.Log;
@@ -49,6 +50,8 @@
         mPin2Field.setKeyListener(DigitsKeyListener.getInstance());
         mPin2Field.setMovementMethod(null);
         mPin2Field.setOnEditorActionListener(this);
+        mPin2Field.setInputType(
+                InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD);
 
         mOkButton = (Button) findViewById(R.id.ok);
         mOkButton.setOnClickListener(mClicked);
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 7c89b50..35b9a19 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -95,8 +95,6 @@
     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;
-    private static final int CMD_SEND_ENVELOPE = 25;
-    private static final int EVENT_SEND_ENVELOPE_DONE = 26;
 
     /** The singleton instance. */
     private static PhoneInterfaceManager sInstance;
@@ -267,34 +265,6 @@
                     }
                     break;
 
-                case CMD_SEND_ENVELOPE:
-                    request = (MainThreadRequest) msg.obj;
-                    onCompleted = obtainMessage(EVENT_SEND_ENVELOPE_DONE, request);
-                    UiccController.getInstance().getUiccCard().sendEnvelopeWithStatus(
-                            (String)request.argument, onCompleted);
-                    break;
-
-                case EVENT_SEND_ENVELOPE_DONE:
-                    ar = (AsyncResult) msg.obj;
-                    request = (MainThreadRequest) ar.userObj;
-                    if (ar.exception == null && ar.result != null) {
-                        request.result = ar.result;
-                    } else {
-                        request.result = new IccIoResult(0x6F, 0, (byte[])null);
-                        if (ar.result == null) {
-                            loge("sendEnvelopeWithStatus: Empty response");
-                        } else if (ar.exception instanceof CommandException) {
-                            loge("sendEnvelopeWithStatus: CommandException: " +
-                                    ar.exception);
-                        } else {
-                            loge("sendEnvelopeWithStatus: exception:" + ar.exception);
-                        }
-                    }
-                    synchronized (request) {
-                        request.notifyAll();
-                    }
-                    break;
-
                 case CMD_OPEN_CHANNEL:
                     request = (MainThreadRequest) msg.obj;
                     onCompleted = obtainMessage(EVENT_OPEN_CHANNEL_DONE, request);
@@ -1058,15 +1028,6 @@
                 null);
     }
 
-    /**
-     * Make sure the caller has SIM_COMMUNICATION permission.
-     *
-     * @throws SecurityException if the caller does not have the required permission.
-     */
-    private void enforceSimCommunicationPermission() {
-        mApp.enforceCallingOrSelfPermission(android.Manifest.permission.SIM_COMMUNICATION, null);
-    }
-
     private String createTelUrl(String number) {
         if (TextUtils.isEmpty(number)) {
             return null;
@@ -1191,175 +1152,6 @@
         return TelephonyManager.WifiCallingChoices.ALWAYS_USE;
     }
 
-    @Override
-    public int iccOpenLogicalChannel(String AID) {
-        enforceSimCommunicationPermission();
-
-        if (DBG) log("iccOpenLogicalChannel: " + AID);
-        Integer channel = (Integer)sendRequest(CMD_OPEN_CHANNEL, AID);
-        if (DBG) log("iccOpenLogicalChannel: " + channel);
-        return channel;
-    }
-
-    @Override
-    public boolean iccCloseLogicalChannel(int channel) {
-        enforceSimCommunicationPermission();
-
-        if (DBG) log("iccCloseLogicalChannel: " + channel);
-        if (channel < 0) {
-          return false;
-        }
-        Boolean success = (Boolean)sendRequest(CMD_CLOSE_CHANNEL, channel);
-        if (DBG) log("iccCloseLogicalChannel: " + success);
-        return success;
-    }
-
-    @Override
-    public String iccTransmitApduLogicalChannel(int channel, int cla,
-            int command, int p1, int p2, int p3, String data) {
-        enforceSimCommunicationPermission();
-
-        if (DBG) {
-            log("iccTransmitApduLogicalChannel: chnl=" + channel + " cla=" + cla +
-                    " cmd=" + command + " p1=" + p1 + " p2=" + p2 + " p3=" + p3 +
-                    " data=" + data);
-        }
-
-        if (channel < 0) {
-            return "";
-        }
-
-        IccIoResult response = (IccIoResult)sendRequest(CMD_TRANSMIT_APDU,
-                new IccAPDUArgument(channel, cla, command, p1, p2, p3, data));
-        if (DBG) log("iccTransmitApduLogicalChannel: " + response);
-
-        // If the payload is null, there was an error. Indicate that by returning
-        // an empty string.
-        if (response.payload == null) {
-          return "";
-        }
-
-        // Append the returned status code to the end of the response payload.
-        String s = Integer.toHexString(
-                (response.sw1 << 8) + response.sw2 + 0x10000).substring(1);
-        s = IccUtils.bytesToHexString(response.payload) + s;
-        return s;
-    }
-
-    @Override
-    public String sendEnvelopeWithStatus(String content) {
-        enforceSimCommunicationPermission();
-
-        IccIoResult response = (IccIoResult)sendRequest(CMD_SEND_ENVELOPE, content);
-        if (response.payload == null) {
-          return "";
-        }
-
-        // Append the returned status code to the end of the response payload.
-        String s = Integer.toHexString(
-                (response.sw1 << 8) + response.sw2 + 0x10000).substring(1);
-        s = IccUtils.bytesToHexString(response.payload) + s;
-        return s;
-    }
-
-    /**
-     * Read one of the NV items defined in {@link com.android.internal.telephony.RadioNVItems}
-     * and {@code ril_nv_items.h}. Used for device configuration by some CDMA operators.
-     *
-     * @param itemID the ID of the item to read
-     * @return the NV item as a String, or null on error.
-     */
-    @Override
-    public String nvReadItem(int itemID) {
-        enforceModifyPermission();
-        if (DBG) log("nvReadItem: item " + itemID);
-        String value = (String) sendRequest(CMD_NV_READ_ITEM, itemID);
-        if (DBG) log("nvReadItem: item " + itemID + " is \"" + value + '"');
-        return value;
-    }
-
-    /**
-     * Write one of the NV items defined in {@link com.android.internal.telephony.RadioNVItems}
-     * and {@code ril_nv_items.h}. Used for device configuration by some CDMA operators.
-     *
-     * @param itemID the ID of the item to read
-     * @param itemValue the value to write, as a String
-     * @return true on success; false on any failure
-     */
-    @Override
-    public boolean nvWriteItem(int itemID, String itemValue) {
-        enforceModifyPermission();
-        if (DBG) log("nvWriteItem: item " + itemID + " value \"" + itemValue + '"');
-        Boolean success = (Boolean) sendRequest(CMD_NV_WRITE_ITEM,
-                new Pair<Integer, String>(itemID, itemValue));
-        if (DBG) log("nvWriteItem: item " + itemID + ' ' + (success ? "ok" : "fail"));
-        return success;
-    }
-
-    /**
-     * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
-     * Used for device configuration by some CDMA operators.
-     *
-     * @param preferredRoamingList byte array containing the new PRL
-     * @return true on success; false on any failure
-     */
-    @Override
-    public boolean nvWriteCdmaPrl(byte[] preferredRoamingList) {
-        enforceModifyPermission();
-        if (DBG) log("nvWriteCdmaPrl: value: " + HexDump.toHexString(preferredRoamingList));
-        Boolean success = (Boolean) sendRequest(CMD_NV_WRITE_CDMA_PRL, preferredRoamingList);
-        if (DBG) log("nvWriteCdmaPrl: " + (success ? "ok" : "fail"));
-        return success;
-    }
-
-    /**
-     * Perform the specified type of NV config reset.
-     * Used for device configuration by some CDMA operators.
-     *
-     * @param resetType the type of reset to perform (1 == factory reset; 2 == NV-only reset)
-     * @return true on success; false on any failure
-     */
-    @Override
-    public boolean nvResetConfig(int resetType) {
-        enforceModifyPermission();
-        if (DBG) log("nvResetConfig: type " + resetType);
-        Boolean success = (Boolean) sendRequest(CMD_NV_RESET_CONFIG, resetType);
-        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;
-    }
-
     /**
      * Set mobile data enabled
      * Used by the user through settings etc to turn on/off mobile data
diff --git a/src/com/android/services/telephony/PstnConnectionService.java b/src/com/android/services/telephony/PstnConnectionService.java
index b692e73..cd3598e 100644
--- a/src/com/android/services/telephony/PstnConnectionService.java
+++ b/src/com/android/services/telephony/PstnConnectionService.java
@@ -49,6 +49,13 @@
     public void onCreateConnections(
             final ConnectionRequest request,
             final Response<ConnectionRequest, Connection> response) {
+
+        if (!canCall(request.getHandle())) {
+            Log.d(this, "Cannot place the call with %s", this.getClass().getSimpleName());
+            respondWithError(request, response, "Cannot place call.");
+            return;
+        }
+
         // TODO: Consider passing call emergency information as part of ConnectionRequest so
         // that we do not have to make the check here once again.
         String handle = request.getHandle().getSchemeSpecificPart();
@@ -64,7 +71,7 @@
                         if (isRadioReady) {
                             startCallWithPhone(phone, request, response);
                         } else {
-                            responseError(request, response, "Failed to turn on radio.");
+                            respondWithError(request, response, "Failed to turn on radio.");
                         }
                     }
                 }
@@ -93,7 +100,7 @@
             com.android.internal.telephony.Connection connection = call.getEarliestConnection();
 
             if (isConnectionKnown(connection)) {
-                responseError(
+                respondWithError(
                         request,
                         response,
                         "Cannot set incoming call ID, ringing connection already registered.");
@@ -110,17 +117,17 @@
                 try {
                     telephonyConnection = createTelephonyConnection(request, connection);
                 } catch (Exception e) {
-                    responseError(request, response, e.getMessage());
+                    respondWithError(request, response, e.getMessage());
                     return;
                 }
 
-                responseResult(
+                respondWithResult(
                         new ConnectionRequest(handle, request.getExtras()),
                         response,
                         telephonyConnection);
             }
         } else {
-            responseError(
+            respondWithError(
                     request,
                     response,
                     String.format("Found no ringing call, call state: %s", call.getState()));
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 24d11fb..185fa57 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -44,9 +44,9 @@
             Uri handle,
             Response<Uri, Subscription> response) {
         try {
-            responseResult(handle, response, canCall(handle) ? new Subscription() : null);
+            respondWithResult(handle, response, canCall(handle) ? new Subscription() : null);
         } catch (Exception e) {
-            responseError(handle, response, "onFindSubscriptions error: " + e.toString());
+            respondWithError(handle, response, "onFindSubscriptions error: " + e.toString());
         }
     }
 
@@ -64,18 +64,18 @@
         Log.d(this, "startCallWithPhone: %s.", request);
 
         if (phone == null) {
-            responseError(request, response, "Phone is null");
+            respondWithError(request, response, "Phone is null");
             return;
         }
 
         if (request.getHandle() == null) {
-            responseError(request, response, "Handle is null");
+            respondWithError(request, response, "Handle is null");
             return;
         }
 
         String number = request.getHandle().getSchemeSpecificPart();
         if (TextUtils.isEmpty(number)) {
-            responseError(request, response, "Unable to parse number");
+            respondWithError(request, response, "Unable to parse number");
             return;
         }
 
@@ -84,44 +84,44 @@
             connection = phone.dial(number);
         } catch (CallStateException e) {
             Log.e(this, e, "Call to Phone.dial failed with exception");
-            responseError(request, response, e.getMessage());
+            respondWithError(request, response, e.getMessage());
             return;
         }
 
         if (connection == null) {
-            responseError(request, response, "Call to phone.dial failed");
+            respondWithError(request, response, "Call to phone.dial failed");
             return;
         }
 
         try {
-            responseResult(request, response, createTelephonyConnection(request, connection));
+            respondWithResult(request, response, createTelephonyConnection(request, connection));
         } catch (Exception e) {
             Log.e(this, e, "Call to createConnection failed with exception");
-            responseError(request, response, e.getMessage());
+            respondWithError(request, response, e.getMessage());
         }
     }
 
-    protected <REQUEST, RESULT> void responseError(
+    protected <REQUEST, RESULT> void respondWithError(
             REQUEST request,
             Response<REQUEST, RESULT> response,
             String reason) {
-        Log.d(this, "responseError %s: %s", request, reason);
+        Log.d(this, "respondWithError %s: %s", request, reason);
         response.onError(request, reason);
     }
 
-    protected void responseResult(
+    protected void respondWithResult(
             Uri request,
             Response<Uri, Subscription> response,
             Subscription result) {
-        Log.d(this, "responseResult %s -> %s", request, result);
+        Log.d(this, "respondWithResult %s -> %s", request, result);
         response.onResult(request, result);
     }
 
-    protected void responseResult(
+    protected void respondWithResult(
             ConnectionRequest request,
             Response<ConnectionRequest, Connection> response,
             Connection result) {
-        Log.d(this, "responseResult %s -> %s", request, result);
+        Log.d(this, "respondWithResult %s -> %s", request, result);
         response.onResult(request, result);
     }