OSDN Git Service

Don't leak guts.
authorJulia Reynolds <juliacr@google.com>
Thu, 2 Jun 2016 20:04:56 +0000 (16:04 -0400)
committerJulia Reynolds <juliacr@google.com>
Fri, 3 Jun 2016 13:17:47 +0000 (13:17 +0000)
Change-Id: I7a9080ce4d360ed67b884eb9cbd8597496388389
Fixes: 29064258

packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java

index b523a11..5bbca15 100644 (file)
@@ -93,7 +93,6 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab
     public NotificationGuts(Context context, AttributeSet attrs) {
         super(context, attrs);
         setWillNotDraw(false);
-        TunerService.get(mContext).addTunable(this, SHOW_SLIDER);
         mHandler = new Handler();
         mFalsingCheck = new Runnable() {
             @Override
@@ -110,6 +109,18 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab
         ta.recycle();
     }
 
+    @Override
+    protected void onAttachedToWindow() {
+        super.onAttachedToWindow();
+        TunerService.get(mContext).addTunable(this, SHOW_SLIDER);
+    }
+
+    @Override
+    protected void onDetachedFromWindow() {
+        TunerService.get(mContext).removeTunable(this);
+        super.onDetachedFromWindow();
+    }
+
     public void resetFalsingCheck() {
         mHandler.removeCallbacks(mFalsingCheck);
         if (mNeedsFalsingProtection && mExposed) {