Skip to content

Commit 6a2ef12

Browse files
author
Jeff Brown
committed
Add a toString() method to Sensor for debugging purposes.
Also made the class final, since it cannot be instantiated by applications. Change-Id: I540ad56d19debd99426d37b9b63c163827b4c2fc
1 parent 75f0fac commit 6a2ef12

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

api/17.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9802,7 +9802,7 @@ package android.hardware {
98029802
method public float getZ();
98039803
}
98049804

9805-
public class Sensor {
9805+
public final class Sensor {
98069806
method public float getMaximumRange();
98079807
method public int getMinDelay();
98089808
method public java.lang.String getName();

api/current.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9847,7 +9847,7 @@ package android.hardware {
98479847
method public float getZ();
98489848
}
98499849

9850-
public class Sensor {
9850+
public final class Sensor {
98519851
method public float getMaximumRange();
98529852
method public int getMinDelay();
98539853
method public java.lang.String getName();

core/java/android/hardware/Sensor.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* @see SensorEvent
2727
*
2828
*/
29-
public class Sensor {
29+
public final class Sensor {
3030

3131
/**
3232
* A constant describing an accelerometer sensor type. See
@@ -202,4 +202,11 @@ void setRange(float max, float res) {
202202
mMaxRange = max;
203203
mResolution = res;
204204
}
205+
206+
@Override
207+
public String toString() {
208+
return "{Sensor name=\"" + mName + "\", vendor=\"" + mVendor + "\", version=" + mVersion
209+
+ ", type=" + mType + ", maxRange=" + mMaxRange + ", resolution=" + mResolution
210+
+ ", power=" + mPower + ", minDelay=" + mMinDelay + "}";
211+
}
205212
}

0 commit comments

Comments
 (0)