Merge "Fix bug #15086008 NPE observed after user setup device daydream followed by device orientation"
diff --git a/res/drawable/dashboard_tile_background.xml b/res/drawable/dashboard_tile_background.xml
index 55cb4c9..92b6f42 100644
--- a/res/drawable/dashboard_tile_background.xml
+++ b/res/drawable/dashboard_tile_background.xml
@@ -14,10 +14,10 @@
      limitations under the License.
 -->
 
-<touch-feedback xmlns:android="http://schemas.android.com/apk/res/android"
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
                 android:tint="?android:attr/colorButtonPressed">
     <item>
         <color android:color="@android:color/white" />
     </item>
-</touch-feedback>
+</ripple>
 
diff --git a/res/drawable/preference_highlight.xml b/res/drawable/preference_highlight.xml
index 0b704f7..615a360 100644
--- a/res/drawable/preference_highlight.xml
+++ b/res/drawable/preference_highlight.xml
@@ -14,10 +14,10 @@
      limitations under the License.
 -->
 
-<touch-feedback xmlns:android="http://schemas.android.com/apk/res/android"
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
                 android:tint="?android:attr/colorButtonPressed"
                 android:pinned="true">
     <item android:id="@android:id/mask"
           android:drawable="@android:color/white" />
-</touch-feedback>
+</ripple>
 
diff --git a/res/layout/notification_app.xml b/res/layout/notification_app.xml
index 1bb11a0..8f5f8e6 100644
--- a/res/layout/notification_app.xml
+++ b/res/layout/notification_app.xml
@@ -31,7 +31,7 @@
             android:layout_height="@dimen/notification_app_icon_size"
             android:layout_centerVertical="true"
             android:contentDescription="@null"
-            android:scaleType="center" />
+            android:padding="8dp" />
 
         <TextView
             android:id="@android:id/title"
diff --git a/res/layout/notification_app_dialog.xml b/res/layout/notification_app_dialog.xml
index 5b2fd1a..bbd4846 100644
--- a/res/layout/notification_app_dialog.xml
+++ b/res/layout/notification_app_dialog.xml
@@ -19,10 +19,10 @@
 
     <ImageView
         android:id="@android:id/icon"
+        android:padding="8dp"
         android:layout_width="@dimen/notification_app_icon_size"
         android:layout_height="@dimen/notification_app_icon_size"
-        android:contentDescription="@null"
-        android:scaleType="center" />
+        android:contentDescription="@null" />
 
     <TextView
         android:id="@android:id/title"
diff --git a/src/com/android/settings/HighlightingFragment.java b/src/com/android/settings/HighlightingFragment.java
index a1d6be0..3595eec 100644
--- a/src/com/android/settings/HighlightingFragment.java
+++ b/src/com/android/settings/HighlightingFragment.java
@@ -83,8 +83,9 @@
                 public void run() {
                     final int centerX = view.getWidth() / 2;
                     final int centerY = view.getHeight() / 2;
-                    highlight.setHotspot(0, centerX, centerY);
-                    highlight.clearHotspots();
+                    highlight.setHotspot(centerX, centerY);
+                    view.setPressed(true);
+                    view.setPressed(false);
                 }
             }, DELAY_HIGHLIGHT_DURATION_MILLIS);
 
diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java
index 2c290b1..9fbdebe 100644
--- a/src/com/android/settings/SettingsPreferenceFragment.java
+++ b/src/com/android/settings/SettingsPreferenceFragment.java
@@ -183,10 +183,12 @@
                     listView.postDelayed(new Runnable() {
                         @Override
                         public void run() {
-                            final int centerX = listView.getWidth() / 2;
-                            final int centerY = listView.getChildAt(0).getHeight() / 2;
-                            highlight.setHotspot(0, centerX, centerY);
-                            highlight.clearHotspots();
+                            final View v = listView.getChildAt(0);
+                            final int centerX = v.getWidth() / 2;
+                            final int centerY = v.getHeight() / 2;
+                            highlight.setHotspot(centerX, centerY);
+                            v.setPressed(true);
+                            v.setPressed(false);
                             ((PreferenceGroupAdapter) adapter).setHighlighted(-1);
                         }
                     }, DELAY_HIGHLIGHT_DURATION_MILLIS);
@@ -201,8 +203,9 @@
                 preferenceView.setBackground(highlight);
                 final int centerX = preferenceView.getWidth() / 2;
                 final int centerY = preferenceView.getHeight() / 2;
-                highlight.setHotspot(0, centerX, centerY);
-                highlight.clearHotspots();
+                highlight.setHotspot(centerX, centerY);
+                preferenceView.setPressed(true);
+                preferenceView.setPressed(false);
             }
         }
     }