summaryrefslogtreecommitdiff
path: root/service/java/com/android/server/deviceconfig/UnattendedRebootManagerInjector.java
blob: 5ca3e1e1f19fe8f830a2117e392351bc6458f390 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.android.server.deviceconfig;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.content.IntentSender;
import android.os.RecoverySystem;

import java.io.IOException;
import java.time.ZoneId;

/**
 * Dependency injectors for {@link com.android.server.deviceconfig.UnattendedRebootManager} to
 * enable unit testing.
 */
interface UnattendedRebootManagerInjector {

  /** Time injectors. */
  long now();

  ZoneId zoneId();

  long elapsedRealtime();

  /** Reboot time injectors. */
  int getRebootStartTime();

  int getRebootEndTime();

  int getRebootFrequency();

  /** Reboot Alarm injector. */
  void setRebootAlarm(Context context, long rebootTimeMillis);

  /** Connectivity injector. */
  void triggerRebootOnNetworkAvailable(Context context);

  /** {@link RecoverySystem} methods injectors. */
  int rebootAndApply(@NonNull Context context, @NonNull String reason, boolean slotSwitch)
      throws IOException;

  void prepareForUnattendedUpdate(
      @NonNull Context context, @NonNull String updateToken, @Nullable IntentSender intentSender)
      throws IOException;

  boolean isPreparedForUnattendedUpdate(@NonNull Context context) throws IOException;

  /** Regular reboot injector. */
  void regularReboot(Context context);
}