Loading core/java/android/hardware/location/ContextHubInfo.java +29 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package android.hardware.location; import android.annotation.Nullable; import android.annotation.SystemApi; import android.hardware.contexthub.V1_0.ContextHub; import android.os.Parcel; Loading Loading @@ -267,6 +268,34 @@ public class ContextHubInfo implements Parcelable { return retVal; } @Override public boolean equals(@Nullable Object object) { if (object == this) { return true; } boolean isEqual = false; if (object instanceof ContextHubInfo) { ContextHubInfo other = (ContextHubInfo) object; isEqual = (other.getId() == mId) && other.getName().equals(mName) && other.getVendor().equals(mVendor) && other.getToolchain().equals(mToolchain) && (other.getToolchainVersion() == mToolchainVersion) && (other.getStaticSwVersion() == getStaticSwVersion()) && (other.getChrePlatformId() == mChrePlatformId) && (other.getPeakMips() == mPeakMips) && (other.getStoppedPowerDrawMw() == mStoppedPowerDrawMw) && (other.getSleepPowerDrawMw() == mSleepPowerDrawMw) && (other.getPeakPowerDrawMw() == mPeakPowerDrawMw) && (other.getMaxPacketLengthBytes() == mMaxPacketLengthBytes) && Arrays.equals(other.getSupportedSensors(), mSupportedSensors) && Arrays.equals(other.getMemoryRegions(), mMemoryRegions); } return isEqual; } private ContextHubInfo(Parcel in) { mId = in.readInt(); mName = in.readString(); Loading core/java/android/hardware/location/ContextHubIntentEvent.java +32 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.hardware.location; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.PendingIntent; import android.content.Intent; Loading Loading @@ -206,6 +207,37 @@ public class ContextHubIntentEvent { return out + "]"; } @Override public boolean equals(@Nullable Object object) { if (object == this) { return true; } boolean isEqual = false; if (object instanceof ContextHubIntentEvent) { ContextHubIntentEvent other = (ContextHubIntentEvent) object; if (other.getEventType() == mEventType && other.getContextHubInfo().equals(mContextHubInfo)) { isEqual = true; try { if (mEventType != ContextHubManager.EVENT_HUB_RESET) { isEqual &= (other.getNanoAppId() == mNanoAppId); } if (mEventType == ContextHubManager.EVENT_NANOAPP_ABORTED) { isEqual &= (other.getNanoAppAbortCode() == mNanoAppAbortCode); } if (mEventType == ContextHubManager.EVENT_NANOAPP_MESSAGE) { isEqual &= other.getNanoAppMessage().equals(mNanoAppMessage); } } catch (UnsupportedOperationException e) { isEqual = false; } } } return isEqual; } private static void hasExtraOrThrow(Intent intent, String extra) { if (!intent.hasExtra(extra)) { throw new IllegalArgumentException("Intent did not have extra: " + extra); Loading core/java/android/hardware/location/MemoryRegion.java +20 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.hardware.location; import android.annotation.Nullable; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; Loading Loading @@ -105,6 +106,25 @@ public class MemoryRegion implements Parcelable{ return retVal; } @Override public boolean equals(@Nullable Object object) { if (object == this) { return true; } boolean isEqual = false; if (object instanceof MemoryRegion) { MemoryRegion other = (MemoryRegion) object; isEqual = (other.getCapacityBytes() == mSizeBytes) && (other.getFreeCapacityBytes() == mSizeBytesFree) && (other.isReadable() == mIsReadable) && (other.isWritable() == mIsWritable) && (other.isExecutable() == mIsExecutable); } return isEqual; } @Override public int describeContents() { return 0; Loading core/java/android/hardware/location/NanoAppMessage.java +21 −0 Original line number Diff line number Diff line Loading @@ -15,10 +15,13 @@ */ package android.hardware.location; import android.annotation.Nullable; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import java.util.Arrays; /** * A class describing messages send to or from nanoapps through the Context Hub Service. * Loading Loading @@ -168,4 +171,22 @@ public final class NanoAppMessage implements Parcelable { return ret; } @Override public boolean equals(@Nullable Object object) { if (object == this) { return true; } boolean isEqual = false; if (object instanceof NanoAppMessage) { NanoAppMessage other = (NanoAppMessage) object; isEqual = (other.getNanoAppId() == mNanoAppId) && (other.getMessageType() == mMessageType) && (other.isBroadcastMessage() == mIsBroadcasted) && Arrays.equals(other.getMessageBody(), mMessageBody); } return isEqual; } } Loading
core/java/android/hardware/location/ContextHubInfo.java +29 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package android.hardware.location; import android.annotation.Nullable; import android.annotation.SystemApi; import android.hardware.contexthub.V1_0.ContextHub; import android.os.Parcel; Loading Loading @@ -267,6 +268,34 @@ public class ContextHubInfo implements Parcelable { return retVal; } @Override public boolean equals(@Nullable Object object) { if (object == this) { return true; } boolean isEqual = false; if (object instanceof ContextHubInfo) { ContextHubInfo other = (ContextHubInfo) object; isEqual = (other.getId() == mId) && other.getName().equals(mName) && other.getVendor().equals(mVendor) && other.getToolchain().equals(mToolchain) && (other.getToolchainVersion() == mToolchainVersion) && (other.getStaticSwVersion() == getStaticSwVersion()) && (other.getChrePlatformId() == mChrePlatformId) && (other.getPeakMips() == mPeakMips) && (other.getStoppedPowerDrawMw() == mStoppedPowerDrawMw) && (other.getSleepPowerDrawMw() == mSleepPowerDrawMw) && (other.getPeakPowerDrawMw() == mPeakPowerDrawMw) && (other.getMaxPacketLengthBytes() == mMaxPacketLengthBytes) && Arrays.equals(other.getSupportedSensors(), mSupportedSensors) && Arrays.equals(other.getMemoryRegions(), mMemoryRegions); } return isEqual; } private ContextHubInfo(Parcel in) { mId = in.readInt(); mName = in.readString(); Loading
core/java/android/hardware/location/ContextHubIntentEvent.java +32 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.hardware.location; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.PendingIntent; import android.content.Intent; Loading Loading @@ -206,6 +207,37 @@ public class ContextHubIntentEvent { return out + "]"; } @Override public boolean equals(@Nullable Object object) { if (object == this) { return true; } boolean isEqual = false; if (object instanceof ContextHubIntentEvent) { ContextHubIntentEvent other = (ContextHubIntentEvent) object; if (other.getEventType() == mEventType && other.getContextHubInfo().equals(mContextHubInfo)) { isEqual = true; try { if (mEventType != ContextHubManager.EVENT_HUB_RESET) { isEqual &= (other.getNanoAppId() == mNanoAppId); } if (mEventType == ContextHubManager.EVENT_NANOAPP_ABORTED) { isEqual &= (other.getNanoAppAbortCode() == mNanoAppAbortCode); } if (mEventType == ContextHubManager.EVENT_NANOAPP_MESSAGE) { isEqual &= other.getNanoAppMessage().equals(mNanoAppMessage); } } catch (UnsupportedOperationException e) { isEqual = false; } } } return isEqual; } private static void hasExtraOrThrow(Intent intent, String extra) { if (!intent.hasExtra(extra)) { throw new IllegalArgumentException("Intent did not have extra: " + extra); Loading
core/java/android/hardware/location/MemoryRegion.java +20 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.hardware.location; import android.annotation.Nullable; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; Loading Loading @@ -105,6 +106,25 @@ public class MemoryRegion implements Parcelable{ return retVal; } @Override public boolean equals(@Nullable Object object) { if (object == this) { return true; } boolean isEqual = false; if (object instanceof MemoryRegion) { MemoryRegion other = (MemoryRegion) object; isEqual = (other.getCapacityBytes() == mSizeBytes) && (other.getFreeCapacityBytes() == mSizeBytesFree) && (other.isReadable() == mIsReadable) && (other.isWritable() == mIsWritable) && (other.isExecutable() == mIsExecutable); } return isEqual; } @Override public int describeContents() { return 0; Loading
core/java/android/hardware/location/NanoAppMessage.java +21 −0 Original line number Diff line number Diff line Loading @@ -15,10 +15,13 @@ */ package android.hardware.location; import android.annotation.Nullable; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import java.util.Arrays; /** * A class describing messages send to or from nanoapps through the Context Hub Service. * Loading Loading @@ -168,4 +171,22 @@ public final class NanoAppMessage implements Parcelable { return ret; } @Override public boolean equals(@Nullable Object object) { if (object == this) { return true; } boolean isEqual = false; if (object instanceof NanoAppMessage) { NanoAppMessage other = (NanoAppMessage) object; isEqual = (other.getNanoAppId() == mNanoAppId) && (other.getMessageType() == mMessageType) && (other.isBroadcastMessage() == mIsBroadcasted) && Arrays.equals(other.getMessageBody(), mMessageBody); } return isEqual; } }