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 com.android.server.timezonedetector; 18 19 import android.annotation.NonNull; 20 import android.app.time.TimeZoneCapabilitiesAndConfig; 21 import android.app.time.TimeZoneConfiguration; 22 import android.app.timezonedetector.ManualTimeZoneSuggestion; 23 24 /** 25 * The internal (in-process) system server API for the time zone detector service. 26 * 27 * <p>The methods on this class can be called from any thread. 28 * 29 * <p>Methods marked with "[For device policy manager only]" are for use by the device policy 30 * manager to set device state and must not enforce device policy restrictions. 31 * 32 * @hide 33 */ 34 public interface TimeZoneDetectorInternal { 35 36 /** 37 * [For device policy manager only] Returns a snapshot of the configuration that controls time 38 * zone detector behavior for the current user. 39 */ 40 @NonNull getCapabilitiesAndConfigForDpm()41 TimeZoneCapabilitiesAndConfig getCapabilitiesAndConfigForDpm(); 42 43 /** 44 * [For device policy manager only] Updates the configuration properties that control a device's 45 * time zone behavior for the current user. 46 * 47 * <p>This method returns {@code true} if the configuration was changed, 48 * {@code false} otherwise. 49 */ updateConfigurationForDpm(@onNull TimeZoneConfiguration configuration)50 boolean updateConfigurationForDpm(@NonNull TimeZoneConfiguration configuration); 51 52 /** 53 * [For device policy manager only] Attempts to set the device to a manually entered time zone. 54 * Returns {@code false} if the suggestion is invalid, or the device configuration prevents the 55 * suggestion being used, {@code true} if the suggestion has been accepted. A suggestion that is 56 * valid but does not change the time zone because it matches the current device time zone is 57 * considered accepted. 58 */ setManualTimeZoneForDpm(@onNull ManualTimeZoneSuggestion suggestion)59 boolean setManualTimeZoneForDpm(@NonNull ManualTimeZoneSuggestion suggestion); 60 61 /** 62 * Handles the supplied {@link LocationAlgorithmEvent}. The detector may ignore the event based 63 * on system settings, whether better information is available, and so on. This method may be 64 * implemented asynchronously. 65 */ handleLocationAlgorithmEvent(@onNull LocationAlgorithmEvent locationAlgorithmEvent)66 void handleLocationAlgorithmEvent(@NonNull LocationAlgorithmEvent locationAlgorithmEvent); 67 68 /** Generates a state snapshot for metrics. */ 69 @NonNull generateMetricsState()70 MetricsTimeZoneDetectorState generateMetricsState(); 71 } 72