Merge "Fix linter / errorprone issues"
This commit is contained in:
@@ -63,6 +63,12 @@ public final class TimeState implements Parcelable {
|
||||
return new TimeState(unixEpochTime, userShouldConfirmId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeParcelable(mUnixEpochTime, 0);
|
||||
dest.writeBoolean(mUserShouldConfirmTime);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@Nullable
|
||||
public static TimeState parseCommandLineArgs(@NonNull ShellCommand cmd) {
|
||||
@@ -119,12 +125,6 @@ public final class TimeState implements Parcelable {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeParcelable(mUnixEpochTime, 0);
|
||||
dest.writeBoolean(mUserShouldConfirmTime);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public UnixEpochTime getUnixEpochTime() {
|
||||
return mUnixEpochTime;
|
||||
|
||||
@@ -58,11 +58,17 @@ public final class TimeZoneState implements Parcelable {
|
||||
}
|
||||
|
||||
private static TimeZoneState createFromParcel(Parcel in) {
|
||||
String zoneId = in.readString();
|
||||
String zoneId = in.readString8();
|
||||
boolean userShouldConfirmId = in.readBoolean();
|
||||
return new TimeZoneState(zoneId, userShouldConfirmId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeString8(mId);
|
||||
dest.writeBoolean(mUserShouldConfirmId);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@Nullable
|
||||
public static TimeZoneState parseCommandLineArgs(@NonNull ShellCommand cmd) {
|
||||
@@ -107,12 +113,6 @@ public final class TimeZoneState implements Parcelable {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeString(mId);
|
||||
dest.writeBoolean(mUserShouldConfirmId);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getId() {
|
||||
return mId;
|
||||
|
||||
@@ -94,7 +94,6 @@ public final class UnixEpochTime implements Parcelable {
|
||||
}
|
||||
|
||||
/** Returns the unix epoch time value. See {@link UnixEpochTime} for more information. */
|
||||
@Nullable
|
||||
public long getUnixEpochTimeMillis() {
|
||||
return mUnixEpochTimeMillis;
|
||||
}
|
||||
@@ -109,7 +108,7 @@ public final class UnixEpochTime implements Parcelable {
|
||||
}
|
||||
UnixEpochTime that = (UnixEpochTime) o;
|
||||
return mElapsedRealtimeMillis == that.mElapsedRealtimeMillis
|
||||
&& Objects.equals(mUnixEpochTimeMillis, that.mUnixEpochTimeMillis);
|
||||
&& mUnixEpochTimeMillis == that.mUnixEpochTimeMillis;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,32 +124,19 @@ public final class UnixEpochTime implements Parcelable {
|
||||
+ '}';
|
||||
}
|
||||
|
||||
public static final @NonNull Creator<UnixEpochTime> CREATOR =
|
||||
new ClassLoaderCreator<UnixEpochTime>() {
|
||||
public static final @NonNull Creator<UnixEpochTime> CREATOR = new Creator<>() {
|
||||
@Override
|
||||
public UnixEpochTime createFromParcel(@NonNull Parcel source) {
|
||||
long elapsedRealtimeMillis = source.readLong();
|
||||
long unixEpochTimeMillis = source.readLong();
|
||||
return new UnixEpochTime(elapsedRealtimeMillis, unixEpochTimeMillis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnixEpochTime createFromParcel(@NonNull Parcel source) {
|
||||
return createFromParcel(source, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnixEpochTime createFromParcel(
|
||||
@NonNull Parcel source, @Nullable ClassLoader classLoader) {
|
||||
long elapsedRealtimeMillis = source.readLong();
|
||||
long unixEpochTimeMillis = source.readLong();
|
||||
return new UnixEpochTime(elapsedRealtimeMillis, unixEpochTimeMillis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnixEpochTime[] newArray(int size) {
|
||||
return new UnixEpochTime[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public UnixEpochTime[] newArray(int size) {
|
||||
return new UnixEpochTime[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
@@ -158,6 +144,11 @@ public final class UnixEpochTime implements Parcelable {
|
||||
dest.writeLong(mUnixEpochTimeMillis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Unix epoch time value at {@code elapsedRealtimeTimeMillis} by adjusting this
|
||||
* Unix epoch time by the difference between the elapsed realtime value supplied and the one
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package android.app.time;
|
||||
|
||||
import static android.app.timezonedetector.ParcelableTestSupport.assertRoundTripParcelable;
|
||||
import static android.app.timezonedetector.ShellCommandTestSupport.createShellCommandWithArgsAndOptions;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.ShellCommand;
|
||||
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
@@ -60,19 +60,8 @@ public class TimeStateTest {
|
||||
@Test
|
||||
public void testParceling() {
|
||||
UnixEpochTime time = new UnixEpochTime(1, 2);
|
||||
TimeState value = new TimeState(time, true);
|
||||
Parcel parcel = Parcel.obtain();
|
||||
try {
|
||||
parcel.writeParcelable(value, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
TimeState stringValueCopy =
|
||||
parcel.readParcelable(null /* classLoader */, TimeState.class);
|
||||
assertEquals(value, stringValueCopy);
|
||||
} finally {
|
||||
parcel.recycle();
|
||||
}
|
||||
assertRoundTripParcelable(new TimeState(time, true));
|
||||
assertRoundTripParcelable(new TimeState(time, false));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package android.app.time;
|
||||
|
||||
import static android.app.timezonedetector.ParcelableTestSupport.assertRoundTripParcelable;
|
||||
import static android.app.timezonedetector.ShellCommandTestSupport.createShellCommandWithArgsAndOptions;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.ShellCommand;
|
||||
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
@@ -59,19 +59,8 @@ public class TimeZoneStateTest {
|
||||
|
||||
@Test
|
||||
public void testParceling() {
|
||||
TimeZoneState value = new TimeZoneState("Europe/London", true);
|
||||
Parcel parcel = Parcel.obtain();
|
||||
try {
|
||||
parcel.writeParcelable(value, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
TimeZoneState stringValueCopy =
|
||||
parcel.readParcelable(null /* classLoader */, TimeZoneState.class);
|
||||
assertEquals(value, stringValueCopy);
|
||||
} finally {
|
||||
parcel.recycle();
|
||||
}
|
||||
assertRoundTripParcelable(new TimeZoneState("Europe/London", true));
|
||||
assertRoundTripParcelable(new TimeZoneState("Europe/London", false));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package android.app.time;
|
||||
|
||||
import static android.app.timezonedetector.ParcelableTestSupport.assertRoundTripParcelable;
|
||||
import static android.app.timezonedetector.ShellCommandTestSupport.createShellCommandWithArgsAndOptions;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.ShellCommand;
|
||||
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
@@ -57,19 +57,7 @@ public class UnixEpochTimeTest {
|
||||
|
||||
@Test
|
||||
public void testParceling() {
|
||||
UnixEpochTime value = new UnixEpochTime(1000, 1);
|
||||
Parcel parcel = Parcel.obtain();
|
||||
try {
|
||||
parcel.writeParcelable(value, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
UnixEpochTime stringValueCopy =
|
||||
parcel.readParcelable(null /* classLoader */, UnixEpochTime.class);
|
||||
assertEquals(value, stringValueCopy);
|
||||
} finally {
|
||||
parcel.recycle();
|
||||
}
|
||||
assertRoundTripParcelable(new UnixEpochTime(1000, 1));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
||||
Reference in New Issue
Block a user