ksd to lmp-sprout-dev

Change-Id: I94eb65c62231b5831570bb0cbbbd9c916bee0a37
diff --git a/core/java/android/content/res/ResourcesKey.java b/core/java/android/content/res/ResourcesKey.java
index e0f1b3a..4ae3825 100644
--- a/core/java/android/content/res/ResourcesKey.java
+++ b/core/java/android/content/res/ResourcesKey.java
@@ -62,10 +62,15 @@
             return false;
         }
         ResourcesKey peer = (ResourcesKey) obj;
-        if (mResDir != peer.mResDir) {
-            if (mResDir == null || peer.mResDir == null) {
-                return false;
-            } else if (!mResDir.equals(peer.mResDir)) {
+
+        if ((mResDir == null) && (peer.mResDir != null)) {
+            return false;
+        }
+        if ((mResDir != null) && (peer.mResDir == null)) {
+            return false;
+        }
+        if ((mResDir != null) && (peer.mResDir != null)) {
+            if (!mResDir.equals(peer.mResDir)) {
                 return false;
             }
         }
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index 0202f91..08209fa 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -24,17 +24,13 @@
 import android.content.Intent;
 import android.content.pm.UserInfo;
 import android.database.Cursor;
-import android.location.Country;
-import android.location.CountryDetector;
 import android.net.Uri;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.ContactsContract.CommonDataKinds.Callable;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.Data;
 import android.provider.ContactsContract.DataUsageFeedback;
 import android.telecomm.PhoneAccountHandle;
-import android.telephony.PhoneNumberUtils;
 import android.text.TextUtils;
 
 import com.android.internal.telephony.CallerInfo;
@@ -389,10 +385,12 @@
         public static Uri addCall(CallerInfo ci, Context context, String number,
                 int presentation, int callType, int features, PhoneAccountHandle accountHandle,
                 long start, int duration, Long dataUsage) {
+            // FIXME using -1 as subId instead of SubscriptionManager.INVALID_SUB_ID
             return addCall(ci, context, number, presentation, callType, features, accountHandle,
                     start, duration, dataUsage, false);
         }
 
+
         /**
          * Adds a call to the call log.
          *
@@ -408,6 +406,7 @@
          * @param accountHandle The accountHandle object identifying the provider of the call
          * @param start time stamp for the call in milliseconds
          * @param duration call duration in seconds
+         * @param subId the subscription id.
          * @param dataUsage data usage for the call in bytes, null if data usage was not tracked for
          *                  the call.
          * @param addForAllUsers If true, the call is added to the call log of all currently
@@ -465,6 +464,7 @@
             values.put(PHONE_ACCOUNT_COMPONENT_NAME, accountComponentString);
             values.put(PHONE_ACCOUNT_ID, accountId);
             values.put(NEW, Integer.valueOf(1));
+
             if (callType == MISSED_TYPE) {
                 values.put(IS_READ, Integer.valueOf(0));
             }
@@ -505,13 +505,12 @@
                 if (cursor != null) {
                     try {
                         if (cursor.getCount() > 0 && cursor.moveToFirst()) {
-                            final String dataId = cursor.getString(0);
-                            updateDataUsageStatForData(resolver, dataId);
-                            if (duration >= MIN_DURATION_FOR_NORMALIZED_NUMBER_UPDATE_MS
-                                    && callType == Calls.OUTGOING_TYPE
-                                    && TextUtils.isEmpty(ci.normalizedNumber)) {
-                                updateNormalizedNumber(context, resolver, dataId, number);
-                            }
+                            final Uri feedbackUri = DataUsageFeedback.FEEDBACK_URI.buildUpon()
+                                    .appendPath(cursor.getString(0))
+                                    .appendQueryParameter(DataUsageFeedback.USAGE_TYPE,
+                                                DataUsageFeedback.USAGE_TYPE_CALL)
+                                    .build();
+                            resolver.update(feedbackUri, new ContentValues(), null, null);
                         }
                     } finally {
                         cursor.close();
@@ -584,53 +583,5 @@
                     + " LIMIT -1 OFFSET 500)", null);
             return result;
         }
-
-        private static void updateDataUsageStatForData(ContentResolver resolver, String dataId) {
-            final Uri feedbackUri = DataUsageFeedback.FEEDBACK_URI.buildUpon()
-                    .appendPath(dataId)
-                    .appendQueryParameter(DataUsageFeedback.USAGE_TYPE,
-                                DataUsageFeedback.USAGE_TYPE_CALL)
-                    .build();
-            resolver.update(feedbackUri, new ContentValues(), null, null);
-        }
-
-        /**
-         * Update the normalized phone number for the given dataId in the ContactsProvider, based
-         * on the user's current country.
-         */
-        private static void updateNormalizedNumber(Context context, ContentResolver resolver,
-                String dataId, String number) {
-            if (TextUtils.isEmpty(number) || TextUtils.isEmpty(dataId)) {
-                return;
-            }
-
-            final String countryIso = getCurrentCountryIso(context);
-            if (TextUtils.isEmpty(countryIso)) {
-                return;
-            }
-
-            final String normalizedNumber = PhoneNumberUtils.formatNumberToE164(number,
-                    getCurrentCountryIso(context));
-            if (TextUtils.isEmpty(normalizedNumber)) {
-                return;
-            }
-
-            final ContentValues values = new ContentValues();
-            values.put(Phone.NORMALIZED_NUMBER, normalizedNumber);
-            resolver.update(Data.CONTENT_URI, values, Data._ID + "=?", new String[] {dataId});
-        }
-
-        private static String getCurrentCountryIso(Context context) {
-            String countryIso = null;
-            final CountryDetector detector = (CountryDetector) context.getSystemService(
-                    Context.COUNTRY_DETECTOR);
-            if (detector != null) {
-                final Country country = detector.detectCountry();
-                if (country != null) {
-                    countryIso = country.getCountryIso();
-                }
-            }
-            return countryIso;
-        }
     }
 }
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 7c5233c..3429fdb 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -271,6 +271,8 @@
 
     <protected-broadcast android:name="android.intent.action.PHONE_STATE" />
 
+    <protected-broadcast android:name="android.intent.action.SUB_DEFAULT_CHANGED" />
+
     <protected-broadcast android:name="android.location.GPS_ENABLED_CHANGE" />
     <protected-broadcast android:name="android.location.PROVIDERS_CHANGED" />
     <protected-broadcast android:name="android.location.MODE_CHANGED" />
@@ -291,6 +293,12 @@
     <protected-broadcast android:name="android.nfc.handover.intent.action.TRANSFER_PROGRESS" />
     <protected-broadcast android:name="android.nfc.handover.intent.action.TRANSFER_DONE" />
 
+    <protected-broadcast android:name="android.intent.action.ACTION_DEFAULT_SUBSCRIPTION_CHANGED" />
+    <protected-broadcast android:name="android.intent.action.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED" />
+    <protected-broadcast android:name="android.intent.action.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED" />
+    <protected-broadcast android:name="android.intent.action.ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED" />
+    <protected-broadcast android:name="android.intent.action.ACTION_SUBINFO_CONTENT_CHANGE" />
+    <protected-broadcast android:name="android.intent.action.ACTION_SUBINFO_RECORD_UPDATED" />
 
     <!-- ====================================== -->
     <!-- Permissions for things that cost money -->
diff --git a/core/res/res/layout/subscription_item_layout.xml b/core/res/res/layout/subscription_item_layout.xml
index 9f8f2b3..aa835f4 100755
--- a/core/res/res/layout/subscription_item_layout.xml
+++ b/core/res/res/layout/subscription_item_layout.xml
@@ -36,7 +36,7 @@
             android:id="@+id/sub_short_number"
             android:layout_marginBottom="2dip"
             android:layout_marginEnd="4dip"
-            android:layout_alignParentEnd="true" 
+            android:layout_alignParentEnd="true"
             android:layout_alignParentBottom="true"
             android:textSize="12sp"
             android:singleLine="true"
@@ -54,8 +54,6 @@
             android:id="@+id/sub_name"
             android:singleLine="true"
             android:ellipsize="none"
-            android:requiresFadingEdge="horizontal"
-            android:scrollHorizontally="true"
             android:textAppearance="?android:attr/textAppearanceMedium"/>
         <TextView
             android:layout_width="wrap_content"
@@ -65,8 +63,7 @@
             android:layout_alignStart="@+id/sub_name"
             android:singleLine="true"
             android:ellipsize="none"
-            android:requiresFadingEdge="horizontal"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textColor="?android:attr/textColorSecondary"/>
     </RelativeLayout>
-</LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index af213ba..6c2d27d 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -944,6 +944,9 @@
          device is data-only. -->
     <bool name="config_voice_capable">true</bool>
 
+    <!-- Flag indicating if the user is notified when the mobile network access is restricted -->
+    <bool name="config_user_notification_of_restrictied_mobile_access">true</bool>
+
     <!-- Flag indicating whether the current device allows sms service.
          If true, this means that the device supports both sending and
          receiving sms via the telephony network.
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index f1ec5d2..fe55238 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1718,6 +1718,11 @@
         various peripherals for the purpose of hardware testing.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permlab_fm">access FM radio</string>
+    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permdesc_fm">Allows the app to access FM radio to listen to programs.</string>
+
+    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_callPhone">directly call phone numbers</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permdesc_callPhone">Allows the app to call phone numbers
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 622a01a..b81eab7e 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -267,6 +267,7 @@
   <java-symbol type="bool" name="config_ui_enableFadingMarquee" />
   <java-symbol type="bool" name="config_use_strict_phone_number_comparation" />
   <java-symbol type="bool" name="config_voice_capable" />
+  <java-symbol type="bool" name="config_user_notification_of_restrictied_mobile_access" />
   <java-symbol type="bool" name="config_wifiDisplaySupportsProtectedBuffers" />
   <java-symbol type="bool" name="preferences_prefer_dual_pane" />
   <java-symbol type="bool" name="skip_restoring_network_selection" />