1 /*
2  * Copyright (C) 2011 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.util;
18 
19 import android.compat.annotation.UnsupportedAppUsage;
20 import android.os.Build;
21 
22 /**
23  * Interface that provides trusted time information, possibly coming from an NTP
24  * server.
25  *
26  * @hide
27  * @deprecated Only kept for UnsupportedAppUsage. Do not use. See {@link NtpTrustedTime}
28  */
29 public interface TrustedTime {
30     /**
31      * Force update with an external trusted time source, returning {@code true}
32      * when successful.
33      *
34      * @deprecated Only kept for UnsupportedAppUsage. Do not use. See {@link NtpTrustedTime}
35      */
36     @Deprecated
37     @UnsupportedAppUsage
forceRefresh()38     public boolean forceRefresh();
39 
40     /**
41      * Check if this instance has cached a response from a trusted time source.
42      *
43      * @deprecated Only kept for UnsupportedAppUsage. Do not use. See {@link NtpTrustedTime}
44      */
45     @Deprecated
46     @UnsupportedAppUsage
hasCache()47     boolean hasCache();
48 
49     /**
50      * Return time since last trusted time source contact, or
51      * {@link Long#MAX_VALUE} if never contacted.
52      *
53      * @deprecated Only kept for UnsupportedAppUsage. Do not use. See {@link NtpTrustedTime}
54      */
55     @Deprecated
56     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
getCacheAge()57     public long getCacheAge();
58 
59     /**
60      * Return current time similar to {@link System#currentTimeMillis()},
61      * possibly using a cached authoritative time source.
62      *
63      * @deprecated Only kept for UnsupportedAppUsage. Do not use. See {@link NtpTrustedTime}
64      */
65     @Deprecated
66     @UnsupportedAppUsage
currentTimeMillis()67     long currentTimeMillis();
68 }
69