code: @NonNull
      @VisibleForTesting
      float[] getRotationVectorFromSensorEvent(@NonNull SensorEvent event) {
          if (event.values.length > 4) {
              // On some Samsung devices SensorManager.getRotationMatrixFromVector
              // appears to throw an exception if rotation vector has length > 4.
              // For the purposes of this class the first 4 values of the
              // rotation vector are sufficient (see crbug.com/335298 for details).
              if (mTruncatedRotationVector == null) {
                  mTruncatedRotationVector = new float[4];
              }
              System.arraycopy(event.values, 0, mTruncatedRotationVector, 0, 4);
              return mTruncatedRotationVector;
          } else {
              return event.values;
          }
      }
docs: Pulls out the rotation vector from a {@link SensorEvent}, with a maximum length
  vector of four elements to avoid potential compatibility issues.
  
  @param event the sensor event
  @return the events rotation vector, potentially truncated