1 /* 2 * Copyright (C) 2019 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; 18 19 import com.android.server.deviceidle.IDeviceIdleConstraint; 20 21 public interface DeviceIdleInternal { onConstraintStateChanged(IDeviceIdleConstraint constraint, boolean active)22 void onConstraintStateChanged(IDeviceIdleConstraint constraint, boolean active); 23 registerDeviceIdleConstraint(IDeviceIdleConstraint constraint, String name, @IDeviceIdleConstraint.MinimumState int minState)24 void registerDeviceIdleConstraint(IDeviceIdleConstraint constraint, String name, 25 @IDeviceIdleConstraint.MinimumState int minState); 26 unregisterDeviceIdleConstraint(IDeviceIdleConstraint constraint)27 void unregisterDeviceIdleConstraint(IDeviceIdleConstraint constraint); 28 exitIdle(String reason)29 void exitIdle(String reason); 30 31 // duration in milliseconds addPowerSaveTempWhitelistApp(int callingUid, String packageName, long duration, int userId, boolean sync, String reason)32 void addPowerSaveTempWhitelistApp(int callingUid, String packageName, 33 long duration, int userId, boolean sync, String reason); 34 35 // duration in milliseconds addPowerSaveTempWhitelistAppDirect(int uid, long duration, boolean sync, String reason)36 void addPowerSaveTempWhitelistAppDirect(int uid, long duration, boolean sync, 37 String reason); 38 39 // duration in milliseconds getNotificationWhitelistDuration()40 long getNotificationWhitelistDuration(); 41 setJobsActive(boolean active)42 void setJobsActive(boolean active); 43 44 // Up-call from alarm manager. setAlarmsActive(boolean active)45 void setAlarmsActive(boolean active); 46 isAppOnWhitelist(int appid)47 boolean isAppOnWhitelist(int appid); 48 getPowerSaveWhitelistUserAppIds()49 int[] getPowerSaveWhitelistUserAppIds(); 50 getPowerSaveTempWhitelistAppIds()51 int[] getPowerSaveTempWhitelistAppIds(); 52 53 /** 54 * Listener to be notified when DeviceIdleController determines that the device has moved or is 55 * stationary. 56 */ 57 interface StationaryListener { onDeviceStationaryChanged(boolean isStationary)58 void onDeviceStationaryChanged(boolean isStationary); 59 } 60 61 /** 62 * Registers a listener that will be notified when the system has detected that the device is 63 * stationary or in motion. 64 */ registerStationaryListener(StationaryListener listener)65 void registerStationaryListener(StationaryListener listener); 66 67 /** 68 * Unregisters a registered stationary listener from being notified when the system has detected 69 * that the device is stationary or in motion. 70 */ unregisterStationaryListener(StationaryListener listener)71 void unregisterStationaryListener(StationaryListener listener); 72 } 73