private void maybeSwapSearchIcon() {
   if (mAssistComponent != null) {
     replaceDrawable(
         mView.getOrb().getLogo(),
         mAssistComponent,
         ASSIST_ICON_METADATA_NAME,
         isAssistantService());
   } else {
     mView.getOrb().getLogo().setImageDrawable(null);
   }
 }
  public void onConfigurationChanged() {
    boolean visible = false;
    if (mView != null) {
      visible = mView.isShowing();
      mWindowManager.removeView(mView);
    }

    mView = (AssistOrbContainer) LayoutInflater.from(mContext).inflate(R.layout.assist_orb, null);
    mView.setVisibility(View.GONE);
    mView.setSystemUiVisibility(
        View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    WindowManager.LayoutParams lp = getLayoutParams();
    mWindowManager.addView(mView, lp);
    if (visible) {
      mView.show(true /* show */, false /* animate */);
    }
  }
  public void startAssist(Bundle args) {
    updateAssistInfo();
    if (mAssistComponent == null) {
      return;
    }

    final boolean isService = isAssistantService();
    if (!isService || !isVoiceSessionRunning()) {
      showOrb();
      mView.postDelayed(mHideRunnable, isService ? TIMEOUT_SERVICE : TIMEOUT_ACTIVITY);
    }
    startAssistInternal(args);
  }
 @Override
 public void run() {
   mView.removeCallbacks(this);
   mView.show(false /* show */, true /* animate */);
 }
 @Override
 public void onShown() throws RemoteException {
   mView.post(mHideRunnable);
 }
 private void showOrb() {
   maybeSwapSearchIcon();
   mView.show(true /* show */, true /* animate */);
 }