Fix guts are not bound properly.

When binding importance to guts, applying findViewById
to ExpandableNotificationRow of group's parents could
cause to return the reference of child notications's guts
which also has the same id. As a result guts are
not bound properly, and show weird guts.

Fixes: 29452827
Change-Id: Iaf8ee74b988bf41680857e9c3c3ae9e3bd8e4e1b
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index eb69f55..b50555d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -1083,8 +1083,8 @@
             pkgicon = pmUser.getDefaultActivityIcon();
         }
 
-        ((ImageView) row.findViewById(R.id.app_icon)).setImageDrawable(pkgicon);
-        ((TextView) row.findViewById(R.id.pkgname)).setText(appname);
+        ((ImageView) guts.findViewById(R.id.app_icon)).setImageDrawable(pkgicon);
+        ((TextView) guts.findViewById(R.id.pkgname)).setText(appname);
 
         final View settingsButton = guts.findViewById(R.id.more_settings);
         if (appUid >= 0) {
@@ -1100,8 +1100,9 @@
             settingsButton.setVisibility(View.GONE);
         }
 
-        guts.bindImportance(pmUser, sbn, row, mNotificationData.getImportance(sbn.getKey()));
-        row.findViewById(R.id.done).setOnClickListener(new View.OnClickListener() {
+        guts.bindImportance(pmUser, sbn, mNotificationData.getImportance(sbn.getKey()));
+
+        guts.findViewById(R.id.done).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 // If the user has security enabled, show challenge if the setting is changed.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java
index 5bbca15..5eef805 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java
@@ -173,7 +173,7 @@
     }
 
     void bindImportance(final PackageManager pm, final StatusBarNotification sbn,
-            final ExpandableNotificationRow row, final int importance) {
+            final int importance) {
         mINotificationManager = INotificationManager.Stub.asInterface(
                 ServiceManager.getService(Context.NOTIFICATION_SERVICE));
         mStartingUserImportance = NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED;
@@ -191,8 +191,8 @@
             // unlikely.
         }
 
-        final View importanceSlider = row.findViewById(R.id.importance_slider);
-        final View importanceButtons = row.findViewById(R.id.importance_buttons);
+        final View importanceSlider = findViewById(R.id.importance_slider);
+        final View importanceButtons = findViewById(R.id.importance_buttons);
         if (mShowSlider) {
             bindSlider(importanceSlider, systemApp);
             importanceSlider.setVisibility(View.VISIBLE);