Merge "Convert more loadIcon() to IconDrawableFactory"
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 6b21128..3caa8ab 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -647,6 +647,10 @@
         }
         final int position = mRecyclerView.getChildAdapterPosition(view);
 
+        if (position == RecyclerView.NO_POSITION) {
+            Log.w(TAG, "Cannot find position for child, skipping onClick handling");
+            return;
+        }
         if (mApplications.getApplicationCount() > position) {
             ApplicationsState.AppEntry entry = mApplications.getAppEntry(position);
             mCurrentPkgName = entry.info.packageName;
diff --git a/src/com/android/settings/datetime/TimeFormatPreferenceController.java b/src/com/android/settings/datetime/TimeFormatPreferenceController.java
index c594b26..302c624 100644
--- a/src/com/android/settings/datetime/TimeFormatPreferenceController.java
+++ b/src/com/android/settings/datetime/TimeFormatPreferenceController.java
@@ -103,6 +103,7 @@
 
     static void timeUpdated(Context context, Boolean is24Hour) {
         Intent timeChanged = new Intent(Intent.ACTION_TIME_CHANGED);
+        timeChanged.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
         int timeFormatPreference;
         if (is24Hour == null) {
             timeFormatPreference = Intent.EXTRA_TIME_PREF_VALUE_USE_LOCALE_DEFAULT;
diff --git a/tests/robotests/src/com/android/settings/datetime/TimeChangeListenerMixinTest.java b/tests/robotests/src/com/android/settings/datetime/TimeChangeListenerMixinTest.java
index 843c753..ada59f4 100644
--- a/tests/robotests/src/com/android/settings/datetime/TimeChangeListenerMixinTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/TimeChangeListenerMixinTest.java
@@ -66,7 +66,8 @@
     public void onResume_shouldRegisterIntentFilter() {
         mMixin.onResume();
         mContext.sendBroadcast(new Intent(Intent.ACTION_TIME_TICK));
-        mContext.sendBroadcast(new Intent(Intent.ACTION_TIME_CHANGED));
+        mContext.sendBroadcast(new Intent(Intent.ACTION_TIME_CHANGED)
+                .addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND));
         mContext.sendBroadcast(new Intent(Intent.ACTION_TIMEZONE_CHANGED));
 
         verify(mCallback, times(3)).updateTimeAndDateDisplay(mContext);
@@ -77,7 +78,8 @@
         mMixin.onResume();
         mMixin.onPause();
         mContext.sendBroadcast(new Intent(Intent.ACTION_TIME_TICK));
-        mContext.sendBroadcast(new Intent(Intent.ACTION_TIME_CHANGED));
+        mContext.sendBroadcast(new Intent(Intent.ACTION_TIME_CHANGED)
+                .addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND));
         mContext.sendBroadcast(new Intent(Intent.ACTION_TIMEZONE_CHANGED));
 
         verify(mCallback, never()).updateTimeAndDateDisplay(mContext);