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