зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1470994 - remove unused accuracy field from SensorData; r=gsvelto
Reviewers: gsvelto Reviewed By: gsvelto Bug #: 1470994 Differential Revision: https://phabricator.services.mozilla.com/D1817 --HG-- extra : rebase_source : 03e1aee4934bcba96968578ba92d6c2ec6275747 extra : amend_source : 6f6e69fb6e18d092090e99db765e12c16021f265
This commit is contained in:
Родитель
3b7262f482
Коммит
ac56b410a9
|
@ -176,7 +176,6 @@ public:
|
|||
sensorData.values().AppendElement(0.5f);
|
||||
sensorData.values().AppendElement(0.5f);
|
||||
sensorData.values().AppendElement(0.5f);
|
||||
sensorData.accuracy() = SENSOR_ACCURACY_UNRELIABLE;
|
||||
mTarget->Notify(sensorData);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -34,18 +34,6 @@ class SensorData;
|
|||
|
||||
typedef Observer<SensorData> ISensorObserver;
|
||||
|
||||
/**
|
||||
* Enumeration of sensor accuracy types.
|
||||
*/
|
||||
enum SensorAccuracyType {
|
||||
SENSOR_ACCURACY_UNKNOWN = -1,
|
||||
SENSOR_ACCURACY_UNRELIABLE,
|
||||
SENSOR_ACCURACY_LOW,
|
||||
SENSOR_ACCURACY_MED,
|
||||
SENSOR_ACCURACY_HIGH,
|
||||
NUM_SENSOR_ACCURACY_TYPE
|
||||
};
|
||||
|
||||
class SensorAccuracy;
|
||||
|
||||
typedef Observer<SensorAccuracy> ISensorAccuracyObserver;
|
||||
|
@ -66,15 +54,6 @@ namespace IPC {
|
|||
mozilla::hal::SENSOR_UNKNOWN,
|
||||
mozilla::hal::NUM_SENSOR_TYPE> {
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::hal::SensorAccuracyType>:
|
||||
public ContiguousEnumSerializer<
|
||||
mozilla::hal::SensorAccuracyType,
|
||||
mozilla::hal::SENSOR_ACCURACY_UNKNOWN,
|
||||
mozilla::hal::NUM_SENSOR_ACCURACY_TYPE> {
|
||||
|
||||
};
|
||||
} // namespace IPC
|
||||
|
||||
#endif /* __HAL_SENSOR_H_ */
|
||||
|
|
|
@ -73,8 +73,7 @@ UpdateHandler(nsITimer *aTimer, void *aClosure)
|
|||
|
||||
hal::SensorData sdata(sensor,
|
||||
PR_Now(),
|
||||
values,
|
||||
hal::SENSOR_ACCURACY_UNKNOWN);
|
||||
values);
|
||||
hal::NotifySensorChange(sdata);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ include "mozilla/GfxMessageUtils.h";
|
|||
|
||||
using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
|
||||
using mozilla::hal::SensorType from "mozilla/HalSensor.h";
|
||||
using mozilla::hal::SensorAccuracyType from "mozilla/HalSensor.h";
|
||||
using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h";
|
||||
using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
|
||||
using nsIntRect from "nsRect.h";
|
||||
|
@ -30,7 +29,6 @@ struct SensorData {
|
|||
SensorType sensor;
|
||||
PRTime timestamp;
|
||||
float[] values;
|
||||
SensorAccuracyType accuracy;
|
||||
};
|
||||
|
||||
struct NetworkInformation {
|
||||
|
|
|
@ -92,8 +92,7 @@ public:
|
|||
|
||||
hal::SensorData sdata(hal::SENSOR_ACCELERATION,
|
||||
PR_Now(),
|
||||
values,
|
||||
hal::SENSOR_ACCURACY_UNKNOWN);
|
||||
values);
|
||||
hal::NotifySensorChange(sdata);
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -397,7 +397,7 @@ public class GeckoAppShell
|
|||
|
||||
@WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
|
||||
/* package */ static native void onSensorChanged(int hal_type, float x, float y, float z,
|
||||
float w, int accuracy, long time);
|
||||
float w, long time);
|
||||
|
||||
@WrapForJNI(calledFrom = "any", dispatchTo = "gecko")
|
||||
/* package */ static native void onLocationChanged(double latitude, double longitude,
|
||||
|
@ -415,26 +415,11 @@ public class GeckoAppShell
|
|||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||
}
|
||||
|
||||
private static int HalSensorAccuracyFor(int androidAccuracy) {
|
||||
switch (androidAccuracy) {
|
||||
case SensorManager.SENSOR_STATUS_UNRELIABLE:
|
||||
return GeckoHalDefines.SENSOR_ACCURACY_UNRELIABLE;
|
||||
case SensorManager.SENSOR_STATUS_ACCURACY_LOW:
|
||||
return GeckoHalDefines.SENSOR_ACCURACY_LOW;
|
||||
case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM:
|
||||
return GeckoHalDefines.SENSOR_ACCURACY_MED;
|
||||
case SensorManager.SENSOR_STATUS_ACCURACY_HIGH:
|
||||
return GeckoHalDefines.SENSOR_ACCURACY_HIGH;
|
||||
}
|
||||
return GeckoHalDefines.SENSOR_ACCURACY_UNKNOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSensorChanged(SensorEvent s) {
|
||||
int sensor_type = s.sensor.getType();
|
||||
int hal_type = 0;
|
||||
float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
|
||||
final int accuracy = HalSensorAccuracyFor(s.accuracy);
|
||||
// SensorEvent timestamp is in nanoseconds, Gecko expects microseconds.
|
||||
final long time = s.timestamp / 1000;
|
||||
|
||||
|
@ -493,7 +478,7 @@ public class GeckoAppShell
|
|||
break;
|
||||
}
|
||||
|
||||
GeckoAppShell.onSensorChanged(hal_type, x, y, z, w, accuracy, time);
|
||||
GeckoAppShell.onSensorChanged(hal_type, x, y, z, w, time);
|
||||
}
|
||||
|
||||
// Geolocation.
|
||||
|
|
|
@ -18,10 +18,4 @@ public class GeckoHalDefines
|
|||
public static final int SENSOR_LIGHT = 5;
|
||||
public static final int SENSOR_ROTATION_VECTOR = 6;
|
||||
public static final int SENSOR_GAME_ROTATION_VECTOR = 7;
|
||||
|
||||
public static final int SENSOR_ACCURACY_UNKNOWN = -1;
|
||||
public static final int SENSOR_ACCURACY_UNRELIABLE = 0;
|
||||
public static final int SENSOR_ACCURACY_LOW = 1;
|
||||
public static final int SENSOR_ACCURACY_MED = 2;
|
||||
public static final int SENSOR_ACCURACY_HIGH = 3;
|
||||
};
|
||||
|
|
|
@ -296,7 +296,7 @@ public:
|
|||
}
|
||||
|
||||
static void OnSensorChanged(int32_t aType, float aX, float aY, float aZ,
|
||||
float aW, int32_t aAccuracy, int64_t aTime)
|
||||
float aW, int64_t aTime)
|
||||
{
|
||||
AutoTArray<float, 4> values;
|
||||
|
||||
|
@ -336,8 +336,7 @@ public:
|
|||
"Unknown sensor type %d", aType);
|
||||
}
|
||||
|
||||
hal::SensorData sdata(hal::SensorType(aType), aTime, values,
|
||||
hal::SensorAccuracyType(aAccuracy));
|
||||
hal::SensorData sdata(hal::SensorType(aType), aTime, values);
|
||||
hal::NotifySensorChange(sdata);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче