How do i read input from accelerometer from a phone without gyroscope?

I tried using input motion to get acceleration from a Galaxy J1 but all sensor related parameters give me 0 values, I reported it as a bug and bug submission told me that is because the phone doesn’t have gyroscope and I had to modify onSensorChanged() from GameActivity.java

public void onSensorChanged(SensorEvent event)
{
	if (bAllowIMU && accelerometer != null && magnetometer != null)
	{
		boolean bUpdate = false;
		boolean bGyroUpdate = false;

		if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER)
		{
			System.arraycopy(event.values, 0, current_accelerometer, 0, 3);
			bUpdate = true;

			// We use a low-pass filter to synthesize the gravity vector.
			if (!first_acceleration_sample)
			{
				filtered_gravity[0] = last_gravity[0] * SampleDecayRate + current_accelerometer[0]*(1.0f - SampleDecayRate);
				filtered_gravity[1] = last_gravity[1] * SampleDecayRate + current_accelerometer[1]*(1.0f - SampleDecayRate);
				filtered_gravity[2] = last_gravity[2] * SampleDecayRate + current_accelerometer[2]*(1.0f - SampleDecayRate);
			}
			first_acceleration_sample = false;
			last_gravity = filtered_gravity;
		}
		else if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD)
		{
			System.arraycopy(event.values, 0, current_magnetometer, 0, 3);
			bUpdate = true;
		}
		else if (event.sensor.getType() == Sensor.TYPE_GYROSCOPE)
		{
			System.arraycopy(event.values, 0, current_gyroscope, 0, 3);
			bUpdate = true;
			bGyroUpdate = true;
		}

		// If we have motion samples we generate the single event.
		if (bUpdate)
		{
			// get the rotation matrix value, the convert those to Euler angle rotation values
			sensorManager.getRotationMatrix(rotationMatrix, null, current_accelerometer, current_magnetometer);
			sensorManager.getOrientation(rotationMatrix, orientationAngles);

			// protect against request from other thread
			synchronized(this)
			{
				// remember gravity
				current_gravity = filtered_gravity;

				// fix up the tilt mapping to proper coordinate frame
				current_tilt[0] = orientationAngles[1];
				current_tilt[1] = orientationAngles[2];
				current_tilt[2] = orientationAngles[0];

				// And take out the gravity from the accel to get the linear acceleration.
				current_acceleration[0] = current_accelerometer[0] - current_gravity[0];
				current_acceleration[1] = current_accelerometer[1] - current_gravity[1];
				current_acceleration[2] = current_accelerometer[2] - current_gravity[2];

				// Figure out the rotation rate
				if (bGyroUpdate)
				{
					// The rotation rate is the what the gyroscope gives us.
					current_rotation_rate = current_gyroscope;
				}
				else if (null == gyroscope)
				{
					// If we don't have a gyroscope at all we need to calc a rotation rate from delta from previous tilt.
					current_rotation_rate[0] = current_tilt[0] - last_tilt[0];
					current_rotation_rate[1] = current_tilt[1] - last_tilt[1];
					current_rotation_rate[2] = current_tilt[2] - last_tilt[2];
				}
				last_tilt = current_tilt;
			}

			// flag new sensor data ready
			bSensorDataUpdated = true;
		}
	}
}

I don’t understand why this doesn’t read sensors just because the phone doesn’t have a gyroscope, hence I don’t know what to modify to be able to.