1 /* 2 * Copyright 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 com.android.internal.telephony.nitz; 18 19 import android.annotation.NonNull; 20 import android.app.timedetector.TelephonyTimeSuggestion; 21 import android.app.timezonedetector.TelephonyTimeZoneSuggestion; 22 23 import com.android.internal.annotations.VisibleForTesting; 24 import com.android.internal.util.IndentingPrintWriter; 25 26 import java.io.PrintWriter; 27 28 /** 29 * An interface to various time / time zone detection behaviors that are centralized into services. 30 * This interface exists to separate out behavior to enable easier testing of the 31 * {@link NitzStateMachineImpl}. 32 */ 33 @VisibleForTesting 34 public interface TimeServiceHelper { 35 36 /** 37 * Suggests the time to the time detector service. 38 * 39 * @param suggestion the time suggestion 40 */ suggestDeviceTime(@onNull TelephonyTimeSuggestion suggestion)41 void suggestDeviceTime(@NonNull TelephonyTimeSuggestion suggestion); 42 43 /** 44 * Suggests the time zone to the time zone detector service. 45 * 46 * <p>NOTE: The {@link TelephonyTimeZoneSuggestion} cannot be null. The zoneId it contains can 47 * be null to indicate there is no active suggestion; this can be used to clear a previous 48 * suggestion. 49 * 50 * @param suggestion the time zone suggestion 51 */ maybeSuggestDeviceTimeZone(@onNull TelephonyTimeZoneSuggestion suggestion)52 void maybeSuggestDeviceTimeZone(@NonNull TelephonyTimeZoneSuggestion suggestion); 53 54 /** 55 * Dumps any logs held to the supplied writer. 56 */ dumpLogs(IndentingPrintWriter ipw)57 void dumpLogs(IndentingPrintWriter ipw); 58 59 /** 60 * Dumps internal state such as field values. 61 */ dumpState(PrintWriter pw)62 void dumpState(PrintWriter pw); 63 } 64