Loading core/java/android/app/time/TimeState.java +6 −6 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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; Loading core/java/android/app/time/TimeZoneState.java +7 −7 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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; Loading core/java/android/app/time/UnixEpochTime.java +18 −27 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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 Loading @@ -125,17 +124,9 @@ 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) { 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); Loading @@ -147,17 +138,17 @@ public final class UnixEpochTime implements Parcelable { } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeLong(mElapsedRealtimeMillis); 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 Loading core/tests/coretests/src/android/app/time/TimeStateTest.java +3 −14 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) Loading core/tests/coretests/src/android/app/time/TimeZoneStateTest.java +3 −14 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) Loading Loading
core/java/android/app/time/TimeState.java +6 −6 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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; Loading
core/java/android/app/time/TimeZoneState.java +7 −7 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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; Loading
core/java/android/app/time/UnixEpochTime.java +18 −27 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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 Loading @@ -125,17 +124,9 @@ 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) { 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); Loading @@ -147,17 +138,17 @@ public final class UnixEpochTime implements Parcelable { } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeLong(mElapsedRealtimeMillis); 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 Loading
core/tests/coretests/src/android/app/time/TimeStateTest.java +3 −14 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) Loading
core/tests/coretests/src/android/app/time/TimeZoneStateTest.java +3 −14 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) Loading