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  */
24 interface PackageTrackerIntentHelper {
25 
initialize(String updateAppPackageName, String dataAppPackageName, PackageTracker packageTracker)26     void initialize(String updateAppPackageName, String dataAppPackageName,
27             PackageTracker packageTracker);
28 
sendTriggerUpdateCheck(CheckToken checkToken)29     void sendTriggerUpdateCheck(CheckToken checkToken);
30 
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      */
scheduleReliabilityTrigger(long minimumDelayMillis)38     void scheduleReliabilityTrigger(long minimumDelayMillis);
39 
40     /**
41      * Make sure there is no reliability trigger scheduled. No-op if there wasn't one.
42      */
unscheduleReliabilityTrigger()43     void unscheduleReliabilityTrigger();
44 }
45