1 /* 2 * Copyright (C) 2013 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 package com.android.internal.policy; 17 18 import android.content.Intent; 19 import com.android.internal.policy.IKeyguardDrawnCallback; 20 import com.android.internal.policy.IKeyguardDismissCallback; 21 import com.android.internal.policy.IKeyguardStateCallback; 22 import com.android.internal.policy.IKeyguardExitCallback; 23 24 import android.os.Bundle; 25 26 oneway interface IKeyguardService { 27 28 /** 29 * Sets the Keyguard as occluded when a window dismisses the Keyguard with flag 30 * FLAG_SHOW_ON_LOCK_SCREEN. 31 * 32 * @param isOccluded Whether the Keyguard is occluded by another window. 33 * @param animate Whether to play an animation for the state change. 34 */ setOccluded(boolean isOccluded, boolean animate)35 void setOccluded(boolean isOccluded, boolean animate); 36 addStateMonitorCallback(IKeyguardStateCallback callback)37 void addStateMonitorCallback(IKeyguardStateCallback callback); verifyUnlock(IKeyguardExitCallback callback)38 void verifyUnlock(IKeyguardExitCallback callback); dismiss(IKeyguardDismissCallback callback, CharSequence message)39 void dismiss(IKeyguardDismissCallback callback, CharSequence message); onDreamingStarted()40 void onDreamingStarted(); onDreamingStopped()41 void onDreamingStopped(); 42 43 /** 44 * Called when the device has started going to sleep. 45 * 46 * @param pmSleepReason One of PowerManager.GO_TO_SLEEP_REASON_*, detailing the specific reason 47 * we're going to sleep, such as GO_TO_SLEEP_REASON_POWER_BUTTON or GO_TO_SLEEP_REASON_TIMEOUT. 48 */ onStartedGoingToSleep(int pmSleepReason)49 void onStartedGoingToSleep(int pmSleepReason); 50 51 /** 52 * Called when the device has finished going to sleep. 53 * 54 * @param pmSleepReason One of PowerManager.GO_TO_SLEEP_REASON_*, detailing the specific reason 55 * we're going to sleep, such as GO_TO_SLEEP_REASON_POWER_BUTTON or GO_TO_SLEEP_REASON_TIMEOUT. 56 * @param cameraGestureTriggered whether the camera gesture was triggered between 57 * {@link #onStartedGoingToSleep} and this method; if it's been 58 * triggered, we shouldn't lock the device. 59 */ onFinishedGoingToSleep(int pmSleepReason, boolean cameraGestureTriggered)60 void onFinishedGoingToSleep(int pmSleepReason, boolean cameraGestureTriggered); 61 62 /** 63 * Called when the device has started waking up. 64 65 * @param pmWakeReason One of PowerManager.WAKE_REASON_*, detailing the reason we're waking up, 66 * such as WAKE_REASON_POWER_BUTTON or WAKE_REASON_GESTURE. 67 * @param cameraGestureTriggered Whether we're waking up due to a power button double tap 68 * gesture. 69 */ onStartedWakingUp(int pmWakeReason, boolean cameraGestureTriggered)70 void onStartedWakingUp(int pmWakeReason, boolean cameraGestureTriggered); 71 72 /** 73 * Called when the device has finished waking up. 74 */ onFinishedWakingUp()75 void onFinishedWakingUp(); 76 77 /** 78 * Called when the device screen is turning on. 79 */ onScreenTurningOn(IKeyguardDrawnCallback callback)80 void onScreenTurningOn(IKeyguardDrawnCallback callback); 81 82 /** 83 * Called when the screen has actually turned on. 84 */ onScreenTurnedOn()85 void onScreenTurnedOn(); 86 87 /** 88 * Called when the screen starts turning off. 89 */ onScreenTurningOff()90 void onScreenTurningOff(); 91 92 /** 93 * Called when the screen has turned off. 94 */ onScreenTurnedOff()95 void onScreenTurnedOff(); 96 97 @UnsupportedAppUsage setKeyguardEnabled(boolean enabled)98 void setKeyguardEnabled(boolean enabled); onSystemReady()99 void onSystemReady(); 100 @UnsupportedAppUsage doKeyguardTimeout(in Bundle options)101 void doKeyguardTimeout(in Bundle options); setSwitchingUser(boolean switching)102 void setSwitchingUser(boolean switching); setCurrentUser(int userId)103 void setCurrentUser(int userId); onBootCompleted()104 void onBootCompleted(); 105 106 /** 107 * Notifies that the activity behind has now been drawn and it's safe to remove the wallpaper 108 * and keyguard flag. 109 * 110 * @param startTime the start time of the animation in uptime milliseconds 111 * @param fadeoutDuration the duration of the exit animation, in milliseconds 112 */ startKeyguardExitAnimation(long startTime, long fadeoutDuration)113 void startKeyguardExitAnimation(long startTime, long fadeoutDuration); 114 115 /** 116 * Notifies the Keyguard that the power key was pressed while locked and launched Home rather 117 * than putting the device to sleep or waking up. Note that it's called only if the device is 118 * interactive. 119 */ onShortPowerPressedGoHome()120 void onShortPowerPressedGoHome(); 121 122 /** 123 * Notifies the Keyguard that it needs to bring up a bouncer and then launch the intent as soon 124 * as user unlocks the watch. 125 */ dismissKeyguardToLaunch(in Intent intentToLaunch)126 void dismissKeyguardToLaunch(in Intent intentToLaunch); 127 128 /** 129 * Notifies the Keyguard that a key was pressed while locked so the Keyguard can handle it. 130 * Note that it's called only if the device is interactive. 131 */ onSystemKeyPressed(int keycode)132 void onSystemKeyPressed(int keycode); 133 134 /** 135 * Requests to show the keyguard immediately without locking the device. Keyguard will show 136 * whether a screen lock was configured or not (including if screen lock is SWIPE or NONE). 137 */ showDismissibleKeyguard()138 void showDismissibleKeyguard(); 139 } 140