Merge "Sync read and deleted messages with the imap server."
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c7adf1c..0e87095 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -278,6 +278,18 @@
             </intent-filter>
         </activity>
 
+        <!-- Trampoline activity that handles the SIM_ACTIVATION_REQUEST intent. -->
+        <activity android:name="com.android.services.telephony.activation.SimActivationActivity"
+                android:permission="android.permission.PERFORM_SIM_ACTIVATION"
+                android:label="@string/phoneIconLabel"
+                android:theme="@android:style/Theme.NoDisplay"
+                android:excludeFromRecents="true">
+            <intent-filter>
+                <action android:name="android.intent.action.SIM_ACTIVATION_REQUEST" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+
         <!-- "Mobile network settings" screen, used on both
              non-voice-capable tablets and regular phone devices. -->
         <activity android:name="MobileNetworkSettings"
diff --git a/res/drawable-hdpi/ic_signal_wifi_4_bar_24dp.png b/res/drawable-hdpi/ic_signal_wifi_4_bar_24dp.png
new file mode 100644
index 0000000..5a53192
--- /dev/null
+++ b/res/drawable-hdpi/ic_signal_wifi_4_bar_24dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_signal_wifi_4_bar_24dp.png b/res/drawable-mdpi/ic_signal_wifi_4_bar_24dp.png
new file mode 100644
index 0000000..dd5a42f
--- /dev/null
+++ b/res/drawable-mdpi/ic_signal_wifi_4_bar_24dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_signal_wifi_4_bar_24dp.png b/res/drawable-xhdpi/ic_signal_wifi_4_bar_24dp.png
new file mode 100644
index 0000000..28b5afa
--- /dev/null
+++ b/res/drawable-xhdpi/ic_signal_wifi_4_bar_24dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_signal_wifi_4_bar_24dp.png b/res/drawable-xxhdpi/ic_signal_wifi_4_bar_24dp.png
new file mode 100644
index 0000000..f4105ec
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_signal_wifi_4_bar_24dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_signal_wifi_4_bar_24dp.png b/res/drawable-xxxhdpi/ic_signal_wifi_4_bar_24dp.png
new file mode 100644
index 0000000..58a4f9c
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_signal_wifi_4_bar_24dp.png
Binary files differ
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4aa3922..7887bf6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -148,8 +148,6 @@
 
     <!-- Title for setting to select Wi-Fi call manager account -->
     <string name="wifi_calling">Wi-Fi calling</string>
-    <!-- Summary label for wi-fi calling when it is turned off. [CHAR LIMIT=NONE] -->
-    <string name="wifi_calling_off_summary">Off</string>
     <!-- Indication for option to not use a Wi-Fi call manager -->
     <string name="wifi_calling_do_not_use">Do not use Wi-Fi calling</string>
     <!-- Indication for option to not use a call assistant. -->
@@ -431,13 +429,6 @@
     <!-- Cellular network 4G summary [CHAR LIMIT=80] -->
     <string name="enhanced_4g_lte_mode_summary">Use LTE services to improve voice and other communications (recommended)</string>
 
-    <!-- WFC, summary for Wi-Fi Preferred [CHAR LIMIT=100] -->
-    <string name="wfc_mode_wifi_preferred_summary">Wi-Fi preferred (Uses cell network only if Wi-Fi isn\'t available)</string>
-    <!-- WFC, summary for Cellular Preferred [CHAR LIMIT=100] -->
-    <string name="wfc_mode_cellular_preferred_summary">Cellular preferred (Uses Wi-Fi only if cell network isn\'t available)</string>
-    <!-- WFC, summary for Wi-Fi Only [CHAR LIMIT=100] -->
-    <string name="wfc_mode_wifi_only_summary">Wi-Fi only (Never uses cell network. Can\'t make or receive calls if Wi-Fi isn\'t available)</string>
-
     <!-- Mobile network settings screen, data enabling checkbox name -->
     <string name="data_enabled">Data enabled</string>
     <!-- Mobile network settings screen, setting summary text when check box is not selected (explains what selecting it would do) [CHAR LIMITS=40] -->
@@ -1284,6 +1275,12 @@
     <!-- Configuration setting for world mode Format is <true;GID if any to be checked>-->
     <string translatable="false" name="config_world_mode"/>
 
+    <!-- Status hint label for an incoming call over a wifi network which has not been accepted yet.
+         [CHAR LIMIT=25] -->
+    <string name="status_hint_label_incoming_wifi_call">Incoming Wi-Fi call</string>
+    <!-- Status hint label for a call being made over a wifi network. [CHAR LIMIT=25] -->
+    <string name="status_hint_label_wifi_call">Wi-Fi call</string>
+
     <!-- DO NOT TRANSLATE. Internal key for a voicemail notification preference. -->
     <string name="voicemail_notification_ringtone_key">voicemail_notification_ringtone_key</string>
     <!-- DO NOT TRANSLATE. Internal key for a voicemail notification preference. -->
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 3bb3080..a3270e8 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -1239,18 +1239,18 @@
         if (!ImsManager.isWfcEnabledByPlatform(mPhone.getContext())) {
             prefSet.removePreference(wifiCallingSettings);
         } else {
-            int resId = R.string.wifi_calling_off_summary;
+            int resId = com.android.internal.R.string.wifi_calling_off_summary;
             if (ImsManager.isWfcEnabledByUser(mPhone.getContext())) {
                 int wfcMode = ImsManager.getWfcMode(mPhone.getContext());
                 switch (wfcMode) {
                     case ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY:
-                        resId = R.string.wfc_mode_wifi_only_summary;
+                        resId = com.android.internal.R.string.wfc_mode_wifi_only_summary;
                         break;
                     case ImsConfig.WfcModeFeatureValueConstants.CELLULAR_PREFERRED:
-                        resId = R.string.wfc_mode_cellular_preferred_summary;
+                        resId = com.android.internal.R.string.wfc_mode_cellular_preferred_summary;
                         break;
                     case ImsConfig.WfcModeFeatureValueConstants.WIFI_PREFERRED:
-                        resId = R.string.wfc_mode_wifi_preferred_summary;
+                        resId = com.android.internal.R.string.wfc_mode_wifi_preferred_summary;
                         break;
                     default:
                         if (DBG) log("Unexpected WFC mode value: " + wfcMode);
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 7c2e6e7..80e7f2a 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -16,6 +16,8 @@
 
 package com.android.services.telephony;
 
+import android.content.ComponentName;
+import android.content.Context;
 import android.net.Uri;
 import android.os.AsyncResult;
 import android.os.Handler;
@@ -24,12 +26,14 @@
 import android.telecom.ConferenceParticipant;
 import android.telecom.Connection;
 import android.telecom.PhoneAccount;
+import android.telecom.StatusHints;
 
 import com.android.internal.telephony.Call;
 import com.android.internal.telephony.CallStateException;
 import com.android.internal.telephony.Connection.PostDialListener;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.imsphone.ImsPhoneConnection;
+import com.android.phone.R;
 
 import java.lang.Override;
 import java.util.Collections;
@@ -263,6 +267,7 @@
     @Override
     public void onStateChanged(int state) {
         Log.v(this, "onStateChanged, state: " + Connection.stateToString(state));
+        updateStatusHints();
     }
 
     @Override
@@ -797,6 +802,7 @@
     public void setWifi(boolean isWifi) {
         mIsWifi = isWifi;
         updateConnectionCapabilities();
+        updateStatusHints();
     }
 
     /**
@@ -869,6 +875,24 @@
         }
     }
 
+    private void updateStatusHints() {
+        if (mIsWifi && (mOriginalConnection.getState() == Call.State.INCOMING
+                || mOriginalConnection.getState() == Call.State.ACTIVE)) {
+            int labelId = mOriginalConnection.getState() == Call.State.INCOMING
+                    ? R.string.status_hint_label_incoming_wifi_call
+                    : R.string.status_hint_label_wifi_call;
+
+            Context context = getPhone().getContext();
+            setStatusHints(new StatusHints(
+                    new ComponentName(context, TelephonyConnectionService.class),
+                    context.getString(labelId),
+                    R.drawable.ic_signal_wifi_4_bar_24dp,
+                    null /* extras */));
+        } else {
+            setStatusHints(null);
+        }
+    }
+
     /**
      * Register a listener for {@link TelephonyConnection} specific triggers.
      * @param l The instance of the listener to add
diff --git a/src/com/android/services/telephony/activation/SimActivationActivity.java b/src/com/android/services/telephony/activation/SimActivationActivity.java
new file mode 100644
index 0000000..acc0cdf
--- /dev/null
+++ b/src/com/android/services/telephony/activation/SimActivationActivity.java
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package com.android.services.telephony.activation;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+
+import com.android.services.telephony.Log;
+
+/**
+ * Invisible activity that handles the android.intent.action.SIM_ACTIVATION_REQUEST intent.
+ * This activity is protected by the android.permission.PERFORM_SIM_ACTIVATION permission.
+ */
+public class SimActivationActivity extends Activity {
+    @Override
+    protected void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+
+        Intent intent = getIntent();
+        if (Intent.ACTION_SIM_ACTIVATION_REQUEST.equals(intent.getAction())) {
+            Log.i(this, "Activation requested " + intent);
+        }
+        finish();
+    }
+}