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.devicestate; 18 19 import android.annotation.NonNull; 20 21 /** 22 * Interface for the component responsible for supplying the current device state as well as 23 * configuring the state of the system in response to device state changes. 24 * 25 * @see DeviceStateManagerService 26 */ 27 public interface DeviceStatePolicy { 28 /** Returns the provider of device states. */ getDeviceStateProvider()29 DeviceStateProvider getDeviceStateProvider(); 30 31 /** 32 * Configures the system into the provided state. Guaranteed not to be called again until the 33 * {@code onComplete} callback has been executed. 34 * 35 * @param state the state the system should be configured for. 36 * @param onComplete a callback that must be triggered once the system has been properly 37 * configured to match the supplied state. 38 */ configureDeviceForState(int state, @NonNull Runnable onComplete)39 void configureDeviceForState(int state, @NonNull Runnable onComplete); 40 } 41