Neil Fuller | 328532a | 2017-03-16 18:32:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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.timezone; |
| 18 | |
| 19 | /** |
| 20 | * An easy-to-mock interface around intent sending / receiving for use by {@link PackageTracker}; |
| 21 | * it is not possible to test various cases with the real one because of the need to simulate |
| 22 | * receiving and broadcasting intents. |
| 23 | */ |
Neil Fuller | b144227 | 2017-12-18 15:59:50 +0000 | [diff] [blame] | 24 | interface PackageTrackerIntentHelper { |
Neil Fuller | 328532a | 2017-03-16 18:32:21 +0000 | [diff] [blame] | 25 | |
Neil Fuller | cd1a109 | 2017-09-13 21:59:59 +0100 | [diff] [blame] | 26 | void initialize(String updateAppPackageName, String dataAppPackageName, |
| 27 | PackageTracker packageTracker); |
Neil Fuller | 328532a | 2017-03-16 18:32:21 +0000 | [diff] [blame] | 28 | |
| 29 | void sendTriggerUpdateCheck(CheckToken checkToken); |
| 30 | |
Neil Fuller | cd1a109 | 2017-09-13 21:59:59 +0100 | [diff] [blame] | 31 | /** |
| 32 | * Schedule a "reliability trigger" after at least minimumDelayMillis, replacing any existing |
| 33 | * scheduled one. A reliability trigger ensures that the {@link PackageTracker} can pick up |
| 34 | * reliably if a previous update check did not complete for some reason. It can happen when |
| 35 | * the device is idle. The trigger is expected to call |
| 36 | * {@link PackageTracker#triggerUpdateIfNeeded(boolean)} with a {@code false} value. |
| 37 | */ |
| 38 | void scheduleReliabilityTrigger(long minimumDelayMillis); |
Neil Fuller | 328532a | 2017-03-16 18:32:21 +0000 | [diff] [blame] | 39 | |
Neil Fuller | cd1a109 | 2017-09-13 21:59:59 +0100 | [diff] [blame] | 40 | /** |
| 41 | * Make sure there is no reliability trigger scheduled. No-op if there wasn't one. |
| 42 | */ |
| 43 | void unscheduleReliabilityTrigger(); |
Neil Fuller | 328532a | 2017-03-16 18:32:21 +0000 | [diff] [blame] | 44 | } |