Merge "Fix a bug in action menu measurement" into klp-dev
diff --git a/api/current.txt b/api/current.txt
index 689cdff..ed0d154 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -23774,6 +23774,8 @@
     method public java.lang.String getDeviceSoftwareVersion();
     method public java.lang.String getGroupIdLevel1();
     method public java.lang.String getLine1Number();
+    method public java.lang.String getMmsUAProfUrl();
+    method public java.lang.String getMmsUserAgent();
     method public java.util.List<android.telephony.NeighboringCellInfo> getNeighboringCellInfo();
     method public java.lang.String getNetworkCountryIso();
     method public java.lang.String getNetworkOperator();
diff --git a/core/java/android/net/CaptivePortalTracker.java b/core/java/android/net/CaptivePortalTracker.java
index 01977cd..d678f1e 100644
--- a/core/java/android/net/CaptivePortalTracker.java
+++ b/core/java/android/net/CaptivePortalTracker.java
@@ -179,10 +179,6 @@
     }
 
     private class DefaultState extends State {
-        @Override
-        public void enter() {
-            setNotificationOff();
-        }
 
         @Override
         public boolean processMessage(Message message) {
@@ -208,6 +204,7 @@
     private class NoActiveNetworkState extends State {
         @Override
         public void enter() {
+            setNotificationOff();
             mNetworkInfo = null;
         }
 
@@ -237,11 +234,6 @@
 
     private class ActiveNetworkState extends State {
         @Override
-        public void enter() {
-            setNotificationOff();
-        }
-
-        @Override
         public boolean processMessage(Message message) {
             NetworkInfo info;
             switch (message.what) {
@@ -284,6 +276,8 @@
             if (DBG) log(getName() + message.toString());
             switch (message.what) {
                 case CMD_DELAYED_CAPTIVE_CHECK:
+                    setNotificationOff();
+
                     if (message.arg1 == mDelayedCheckToken) {
                         InetAddress server = lookupHost(mServer);
                         boolean captive = server != null && isCaptivePortal(server);
@@ -362,8 +356,10 @@
 
     private void setNotificationOff() {
         try {
-            mConnService.setProvisioningNotificationVisible(false, ConnectivityManager.TYPE_NONE,
+            if (mNetworkInfo != null) {
+                mConnService.setProvisioningNotificationVisible(false, mNetworkInfo.getType(),
                     null, null);
+            }
         } catch (RemoteException e) {
             log("setNotificationOff: " + e);
         }
diff --git a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
index aad285a..cd1ccd3 100644
--- a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
@@ -76,7 +76,7 @@
     }
 
     // Tuneable parameters for animation
-    private static final int WAVE_ANIMATION_DURATION = 1350;
+    private static final int WAVE_ANIMATION_DURATION = 1000;
     private static final int RETURN_TO_HOME_DELAY = 1200;
     private static final int RETURN_TO_HOME_DURATION = 200;
     private static final int HIDE_ANIMATION_DELAY = 200;
diff --git a/core/java/com/android/internal/widget/multiwaveview/PointCloud.java b/core/java/com/android/internal/widget/multiwaveview/PointCloud.java
index bbd1276..f299935 100644
--- a/core/java/com/android/internal/widget/multiwaveview/PointCloud.java
+++ b/core/java/com/android/internal/widget/multiwaveview/PointCloud.java
@@ -45,8 +45,8 @@
 
     public class WaveManager {
         private float radius = 50;
-        private float width = 200.0f; // TODO: Make configurable
         private float alpha = 0.0f;
+
         public void setRadius(float r) {
             radius = r;
         }
@@ -186,13 +186,12 @@
 
         // Compute contribution from Wave
         float radius = hypot(point.x, point.y);
-        float distanceToWaveRing = (radius - waveManager.radius);
         float waveAlpha = 0.0f;
-        if (distanceToWaveRing < waveManager.width * 0.5f && distanceToWaveRing < 0.0f) {
-            float cosf = FloatMath.cos(PI * 0.25f * distanceToWaveRing / waveManager.width);
-            waveAlpha = waveManager.alpha * max(0.0f, (float) Math.pow(cosf, 20.0f));
+        if (radius < waveManager.radius * 2) {
+            float distanceToWaveRing = (radius - waveManager.radius);
+            float cosf = FloatMath.cos(PI * 0.5f * distanceToWaveRing / waveManager.radius);
+            waveAlpha = waveManager.alpha * max(0.0f, (float) Math.pow(cosf, 6.0f));
         }
-
         return (int) (max(glowAlpha, waveAlpha) * 255);
     }
 
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index e39fd2a..1ddf201 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -961,6 +961,12 @@
          If false, Content-disposition fragments are ignored -->
     <bool name="config_mms_content_disposition_support">true</bool>
 
+    <!-- MMS user agent string -->
+    <string name="config_mms_user_agent" translatable="false"></string>
+
+    <!-- MMS user agent prolfile url -->
+    <string name="config_mms_user_agent_profile_url" translatable="false"></string>
+
     <!-- National Language Identifier codes for the following two config items.
          (from 3GPP TS 23.038 V9.1.1 Table 6.2.1.2.4.1):
           0  - reserved
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index d483fe0..a541995 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -469,6 +469,8 @@
   <java-symbol type="string" name="chooseActivity" />
   <java-symbol type="string" name="config_default_dns_server" />
   <java-symbol type="string" name="config_ethernet_iface_regex" />
+  <java-symbol type="string" name="config_mms_user_agent" />
+  <java-symbol type="string" name="config_mms_user_agent_profile_url" />
   <java-symbol type="string" name="config_ntpServer" />
   <java-symbol type="string" name="config_tether_apndata" />
   <java-symbol type="string" name="config_useragentprofile_url" />
diff --git a/media/java/android/media/RemoteController.java b/media/java/android/media/RemoteController.java
index d056269..22f6343 100644
--- a/media/java/android/media/RemoteController.java
+++ b/media/java/android/media/RemoteController.java
@@ -153,7 +153,7 @@
          * @param state one of the playback states authorized
          *     in {@link RemoteControlClient#setPlaybackState(int)}.
          * @param stateChangeTimeMs the system time at which the state change was reported,
-         *     expressed in ms. Based on {@link android.os.SystemClock.elapsedRealtime()}.
+         *     expressed in ms. Based on {@link android.os.SystemClock#elapsedRealtime()}.
          * @param currentPosMs a positive value for the current media playback position expressed
          *     in ms, a negative value if the position is temporarily unknown.
          * @param speed  a value expressed as a ratio of 1x playback: 1.0f is normal playback,
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 3f13f3a..f005f5f 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -3987,8 +3987,8 @@
                 return timeOutMs;
             }
 
-            // Start off with notification off
-            setProvNotificationVisible(false, ConnectivityManager.TYPE_NONE, null, null);
+            // Start off with mobile notification off
+            setProvNotificationVisible(false, ConnectivityManager.TYPE_MOBILE_HIPRI, null, null);
 
             CheckMp checkMp = new CheckMp(mContext, this);
             CheckMp.CallBack cb = new CheckMp.CallBack() {
@@ -4013,7 +4013,8 @@
                             }
                             if (TextUtils.isEmpty(url) == false) {
                                 if (DBG) log("CheckMp.onComplete: warm (redirected), url=" + url);
-                                setProvNotificationVisible(true, ni.getType(), ni.getExtraInfo(),
+                                setProvNotificationVisible(true,
+                                        ConnectivityManager.TYPE_MOBILE_HIPRI, ni.getExtraInfo(),
                                         url);
                             } else {
                                 if (DBG) log("CheckMp.onComplete: warm (redirected), no url");
@@ -4024,7 +4025,8 @@
                             String url = getMobileProvisioningUrl();
                             if (TextUtils.isEmpty(url) == false) {
                                 if (DBG) log("CheckMp.onComplete: warm (no dns/tcp), url=" + url);
-                                setProvNotificationVisible(true, ni.getType(), ni.getExtraInfo(),
+                                setProvNotificationVisible(true,
+                                        ConnectivityManager.TYPE_MOBILE_HIPRI, ni.getExtraInfo(),
                                         url);
                             } else {
                                 if (DBG) log("CheckMp.onComplete: warm (no dns/tcp), no url");
@@ -4426,7 +4428,7 @@
 
     private void handleMobileProvisioningAction(String url) {
         // Notication mark notification as not visible
-        setProvNotificationVisible(false, ConnectivityManager.TYPE_NONE, null, null);
+        setProvNotificationVisible(false, ConnectivityManager.TYPE_MOBILE_HIPRI, null, null);
 
         // If provisioning network handle as a special case,
         // otherwise launch browser with the intent directly.
@@ -4512,14 +4514,14 @@
             notification.setLatestEventInfo(mContext, title, details, notification.contentIntent);
 
             try {
-                notificationManager.notify(NOTIFICATION_ID, 1, notification);
+                notificationManager.notify(NOTIFICATION_ID, networkType, notification);
             } catch (NullPointerException npe) {
                 loge("setNotificaitionVisible: visible notificationManager npe=" + npe);
                 npe.printStackTrace();
             }
         } else {
             try {
-                notificationManager.cancel(NOTIFICATION_ID, 1);
+                notificationManager.cancel(NOTIFICATION_ID, networkType);
             } catch (NullPointerException npe) {
                 loge("setNotificaitionVisible: cancel notificationManager npe=" + npe);
                 npe.printStackTrace();
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index ef50df7..0e0f156 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -515,8 +515,9 @@
                     ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity);
                     networkStats.bindConnectivityManager(connectivity);
                     networkPolicy.bindConnectivityManager(connectivity);
-                    wifi.checkAndStartWifi();
+
                     wifiP2p.connectivityServiceReady();
+                    wifi.checkAndStartWifi();
                 } catch (Throwable e) {
                     reportWtf("starting Connectivity Service", e);
                 }
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 7d8b64f..ea0d220 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -1400,4 +1400,22 @@
         } catch (NullPointerException ex) {
         }
     }
+
+    /**
+     * Returns the MMS user agent.
+     */
+    public String getMmsUserAgent() {
+        if (mContext == null) return null;
+        return mContext.getResources().getString(
+                com.android.internal.R.string.config_mms_user_agent);
+    }
+
+    /**
+     * Returns the MMS user agent profile URL.
+     */
+    public String getMmsUAProfUrl() {
+        if (mContext == null) return null;
+        return mContext.getResources().getString(
+                com.android.internal.R.string.config_mms_user_agent_profile_url);
+    }
 }