1 /*
2  * Copyright (C) 2019 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.timezonedetector;
18 
19 import android.annotation.NonNull;
20 import android.annotation.RequiresPermission;
21 import android.annotation.SystemService;
22 import android.content.Context;
23 
24 /**
25  * The interface through which system components can send signals to the TimeZoneDetectorService.
26  *
27  * @hide
28  */
29 @SystemService(Context.TIME_ZONE_DETECTOR_SERVICE)
30 public interface TimeZoneDetector {
31 
32     /**
33      * A shared utility method to create a {@link ManualTimeZoneSuggestion}.
34      *
35      * @hide
36      */
createManualTimeZoneSuggestion(String tzId, String debugInfo)37     static ManualTimeZoneSuggestion createManualTimeZoneSuggestion(String tzId, String debugInfo) {
38         ManualTimeZoneSuggestion suggestion = new ManualTimeZoneSuggestion(tzId);
39         suggestion.addDebugInfo(debugInfo);
40         return suggestion;
41     }
42 
43     /**
44      * Suggests the current time zone, determined using the user's manually entered information, to
45      * the detector. The detector may ignore the signal based on system settings.
46      *
47      * @hide
48      */
49     @RequiresPermission(android.Manifest.permission.SUGGEST_MANUAL_TIME_AND_ZONE)
suggestManualTimeZone(@onNull ManualTimeZoneSuggestion timeZoneSuggestion)50     void suggestManualTimeZone(@NonNull ManualTimeZoneSuggestion timeZoneSuggestion);
51 
52     /**
53      * Suggests the current time zone, determined using telephony signals, to the detector. The
54      * detector may ignore the signal based on system settings, whether better information is
55      * available, and so on.
56      *
57      * @hide
58      */
59     @RequiresPermission(android.Manifest.permission.SUGGEST_TELEPHONY_TIME_AND_ZONE)
suggestTelephonyTimeZone(@onNull TelephonyTimeZoneSuggestion timeZoneSuggestion)60     void suggestTelephonyTimeZone(@NonNull TelephonyTimeZoneSuggestion timeZoneSuggestion);
61 }
62