I've created a virtual device in AVD with a new hardware profile with sensors disabled. I'm then checking both getDefaultSensor for null and also PackageManager.FEATURE_SENSOR_ACCELEROMETER.
On the emulator with a no sensor hardware profile its reporting true for both.
Context context = mRegistrar.context();
SensorManager sensorManager = (SensorManager) context.getSystemService(context.SENSOR_SERVICE);
Sensor sensor = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
PackageManager manager = context.getPackageManager();
boolean hasAccelerometer = manager.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER);
result.success(hasAccelerometer);
Sensor is not null and returns
{Sensor name="Goldfish 3-axis Magnetic field sensor", vendor="The Android Open Source Project", version=1, type=2, maxRange=2000.0, resolution=1.0, power=6.7, minDelay=10000}
There also doesn't appear to be an option for disabling sensors in the emulator settings menu either.
Is there a way for the emulator to report the same way it would if running on a device with no sensors?