@Override
 public void surfaceCreated(SurfaceHolder holder) {
   try {
     Log.v("shine", "===surfaceCreated===");
     TvManager.getPlayerManager().setDisplay(holder);
   } catch (TvCommonException e) {
     e.printStackTrace();
   }
 }
  public void BackHomeSource() {
    ITvServiceServer tvService =
        ITvServiceServer.Stub.asInterface(ServiceManager.checkService(Context.TV_SERVICE));
    if (tvService == null) {
      // Log.w(TAG, "Unable to find ITvService interface.");
    } else {
      try {
        ITvServiceServerCommon commonService = tvService.getCommonManager();
        EN_INPUT_SOURCE_TYPE currentSource = commonService.GetCurrentInputSource();
        if (currentSource.equals(EN_INPUT_SOURCE_TYPE.E_INPUT_SOURCE_STORAGE) == false) {
          commonService.SetInputSource(EN_INPUT_SOURCE_TYPE.E_INPUT_SOURCE_STORAGE);
        }

        EN_INPUT_SOURCE_TYPE currentSource1 = commonService.GetCurrentInputSource();

        if (currentSource1.equals(EN_INPUT_SOURCE_TYPE.E_INPUT_SOURCE_STORAGE)) {
          commonService.SetInputSource(EN_INPUT_SOURCE_TYPE.E_INPUT_SOURCE_ATV);

          try {

            VideoWindowType videoWindowType = new VideoWindowType();
            videoWindowType.x = getResources().getDimensionPixelSize(R.dimen.tv_x);
            videoWindowType.y = getResources().getDimensionPixelSize(R.dimen.tv_y);
            videoWindowType.width = getResources().getDimensionPixelSize(R.dimen.tv_width);
            videoWindowType.height = getResources().getDimensionPixelSize(R.dimen.tv_height);
            Log.d("shine", "x=" + videoWindowType.x);
            Log.d("shine", "y=" + videoWindowType.y);
            Log.d("shine", "w=" + videoWindowType.width);
            Log.d("shine", "h=" + videoWindowType.height);
            TvManager.getPictureManager().selectWindow(EnumScalerWindow.E_MAIN_WINDOW);
            TvManager.getPictureManager().setDisplayWindow(videoWindowType);

          } catch (TvCommonException e) {
            e.printStackTrace();
          }
          int channel = mTvService.getChannelManager().getCurrentChannelNumber();
          Log.w("shine", "channel=" + channel);
          if ((channel < 0) || (channel > 255)) {
            channel = 0;
          }
          mTvService
              .getChannelManager()
              .programSel(channel, EN_MEMBER_SERVICE_TYPE.E_SERVICETYPE_ATV);
        } else {
          setPipscale();
        }
      } catch (RemoteException e) {
        e.printStackTrace();
      }
    }
  }
  private void setPipscale() {

    try {

      VideoWindowType videoWindowType = new VideoWindowType();
      videoWindowType.x = getResources().getDimensionPixelSize(R.dimen.tv_x);
      videoWindowType.y = getResources().getDimensionPixelSize(R.dimen.tv_y);
      videoWindowType.width = getResources().getDimensionPixelSize(R.dimen.tv_width);
      videoWindowType.height = getResources().getDimensionPixelSize(R.dimen.tv_height);
      Log.d("shine", "x=" + videoWindowType.x);
      Log.d("shine", "y=" + videoWindowType.y);
      Log.d("shine", "w=" + videoWindowType.width);
      Log.d("shine", "h=" + videoWindowType.height);

      TvManager.getPictureManager().selectWindow(EnumScalerWindow.E_MAIN_WINDOW);
      TvManager.getPictureManager().setDisplayWindow(videoWindowType);
      TvManager.getPictureManager().scaleWindow();

    } catch (TvCommonException e) {
      e.printStackTrace();
    }
  }