Debian Codegraph @

core/java/android/app/time/TimeZoneCapabilitiesAndConfig.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package android.app.time;
18
19 import android.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.annotation.SystemApi;
22 import android.os.Parcel;
23 import android.os.Parcelable;
24
25 import java.util.Objects;
26
27 /**
28 * A pair containing a user's {@link TimeZoneCapabilities} and {@link TimeZoneConfiguration}.
29 *
30 * @hide
31 */
32 @SystemApi
33 public final class TimeZoneCapabilitiesAndConfig implements Parcelable {
34
35 public static final @NonNull Creator<TimeZoneCapabilitiesAndConfig> CREATOR =
36 new Creator<TimeZoneCapabilitiesAndConfig>() {
37 public TimeZoneCapabilitiesAndConfig createFromParcel(Parcel in) {
38 return TimeZoneCapabilitiesAndConfig.createFromParcel(in);
39 }
40
41 public TimeZoneCapabilitiesAndConfig[] newArray(int size) {
42 return new TimeZoneCapabilitiesAndConfig[size];
43 }
44 };
45
46
47 @NonNull private final TimeZoneCapabilities mCapabilities;
48 @NonNull private final TimeZoneConfiguration mConfiguration;
49
50 /**
51 * Creates a new instance.
52 *
53 * @hide
54 */
55 public TimeZoneCapabilitiesAndConfig(
56 @NonNull TimeZoneCapabilities capabilities,
57 @NonNull TimeZoneConfiguration configuration) {
58 this.mCapabilities = Objects.requireNonNull(capabilities);
59 this.mConfiguration = Objects.requireNonNull(configuration);
60 }
61
62 @NonNull
63 private static TimeZoneCapabilitiesAndConfig createFromParcel(Parcel in) {
64 TimeZoneCapabilities capabilities = in.readParcelable(null, android.app.time.TimeZoneCapabilities.class);
65 TimeZoneConfiguration configuration = in.readParcelable(null, android.app.time.TimeZoneConfiguration.class);
66 return new TimeZoneCapabilitiesAndConfig(capabilities, configuration);
67 }
68
69 @Override
70 public void writeToParcel(@NonNull Parcel dest, int flags) {
71 dest.writeParcelable(mCapabilities, flags);
72 dest.writeParcelable(mConfiguration, flags);
73 }
74
75 /**
76 * Returns the user's time zone behavior capabilities.
77 */
78 @NonNull
79 public TimeZoneCapabilities getCapabilities() {
80 return mCapabilities;
81 }
82
83 /**
84 * Returns the user's time zone behavior configuration.
85 */
86 @NonNull
87 public TimeZoneConfiguration getConfiguration() {
88 return mConfiguration;
89 }
90
91 @Override
92 public int describeContents() {
93 return 0;
94 }
95
96 @Override
97 public boolean equals(@Nullable Object o) {
98 if (this == o) {
99 return true;
100 }
101 if (o == null || getClass() != o.getClass()) {
102 return false;
103 }
104 TimeZoneCapabilitiesAndConfig that = (TimeZoneCapabilitiesAndConfig) o;
105 return mCapabilities.equals(that.mCapabilities)
106 && mConfiguration.equals(that.mConfiguration);
107 }
108
109 @Override
110 public int hashCode() {
111 return Objects.hash(mCapabilities, mConfiguration);
112 }
113
114 @Override
115 public String toString() {
116 return "TimeZoneCapabilitiesAndConfig{"
117 + "mCapabilities=" + mCapabilities
118 + ", mConfiguration=" + mConfiguration
119 + '}';
120 }
121 }