private void setDrawableInternal(Drawable drawable) {
    if (!mAttached) {
      throw new IllegalStateException("Must attach before setting background drawable");
    }

    if (mChangeRunnable != null) {
      mChangeRunnable.cancel();
    }
    mChangeRunnable = new ChangeBackgroundRunnable(drawable);

    mHandler.postDelayed(mChangeRunnable, CHANGE_BG_DELAY_MS);
  }
 /**
  * Release references to Drawables. Typically called to reduce memory overhead when not visible.
  *
  * <p>When an Activity is resumed, if the BackgroundManager has not been released, the continuity
  * service is updated from the BackgroundManager state. If the BackgroundManager was released, the
  * BackgroundManager inherits the current state from the continuity service.
  */
 public void release() {
   if (DEBUG) Log.v(TAG, "release");
   if (mLayerDrawable != null) {
     mLayerDrawable.setDrawableByLayerId(R.id.background_imagein, createEmptyDrawable());
     mLayerDrawable.setDrawableByLayerId(R.id.background_imageout, createEmptyDrawable());
     mLayerDrawable = null;
   }
   mLayerWrapper = null;
   mImageInWrapper = null;
   mImageOutWrapper = null;
   mColorWrapper = null;
   mDimWrapper = null;
   mThemeDrawable = null;
   if (mChangeRunnable != null) {
     mChangeRunnable.cancel();
     mChangeRunnable = null;
   }
   releaseBackgroundBitmap();
 }