• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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.wm.shell.sysui;
18 
19 import android.content.Context;
20 import android.content.pm.UserInfo;
21 import android.content.res.Configuration;
22 import android.os.Bundle;
23 
24 import androidx.annotation.NonNull;
25 
26 import java.io.PrintWriter;
27 import java.util.List;
28 import java.util.concurrent.Executor;
29 
30 /**
31  * General interface for notifying the Shell of common SysUI events like configuration or keyguard
32  * changes.
33  */
34 public interface ShellInterface {
35 
36     /**
37      * Initializes the shell state.
38      */
onInit()39     default void onInit() {}
40 
41     /**
42      * Notifies the Shell that the configuration has changed.
43      */
onConfigurationChanged(Configuration newConfiguration)44     default void onConfigurationChanged(Configuration newConfiguration) {}
45 
46     /**
47      * Notifies the Shell that the keyguard is showing (and if so, whether it is occluded) or not
48      * showing, and whether it is animating a dismiss.
49      */
onKeyguardVisibilityChanged(boolean visible, boolean occluded, boolean animatingDismiss)50     default void onKeyguardVisibilityChanged(boolean visible, boolean occluded,
51             boolean animatingDismiss) {}
52 
53     /**
54      * Notifies the Shell when the keyguard dismiss animation has finished.
55      */
onKeyguardDismissAnimationFinished()56     default void onKeyguardDismissAnimationFinished() {}
57 
58     /**
59      * Notifies the Shell when the user changes.
60      */
onUserChanged(int newUserId, @NonNull Context userContext)61     default void onUserChanged(int newUserId, @NonNull Context userContext) {}
62 
63     /**
64      * Notifies the Shell when a profile belonging to the user changes.
65      */
onUserProfilesChanged(@onNull List<UserInfo> profiles)66     default void onUserProfilesChanged(@NonNull List<UserInfo> profiles) {}
67 
68     /**
69      * Registers a DisplayImeChangeListener to monitor for changes on Ime
70      * position and visibility.
71      */
addDisplayImeChangeListener(DisplayImeChangeListener listener, Executor executor)72     default void addDisplayImeChangeListener(DisplayImeChangeListener listener,
73             Executor executor) {}
74 
75     /**
76      * Removes a registered DisplayImeChangeListener.
77      */
removeDisplayImeChangeListener(DisplayImeChangeListener listener)78     default void removeDisplayImeChangeListener(DisplayImeChangeListener listener) {}
79 
80     /**
81      * Handles a shell command.
82      */
handleCommand(final String[] args, PrintWriter pw)83     default boolean handleCommand(final String[] args, PrintWriter pw) {
84         return false;
85     }
86 
87     /**
88      * Updates the given {@param bundle} with the set of exposed interfaces.
89      */
createExternalInterfaces(Bundle bundle)90     default void createExternalInterfaces(Bundle bundle) {}
91 
92     /**
93      * Dumps the shell state.
94      */
dump(PrintWriter pw)95     default void dump(PrintWriter pw) {}
96 }
97