• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 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 android.app;
18 
19 import android.app.IOnProjectionStateChangedListener;
20 
21 /**
22  * Interface used to control special UI modes.
23  * @hide
24  */
25 interface IUiModeManager {
26     /**
27      * Enables the car mode. Only the system can do this.
28      * @hide
29      */
enableCarMode(int flags, int priority, String callingPackage)30     void enableCarMode(int flags, int priority, String callingPackage);
31 
32     /**
33      * Disables the car mode.
34      */
35     @UnsupportedAppUsage(maxTargetSdk = 28)
disableCarMode(int flags)36     void disableCarMode(int flags);
37 
38     /**
39      * Disables car mode (the original version is marked unsupported app usage so cannot be changed
40      * for the time being).
41      */
disableCarModeByCallingPackage(int flags, String callingPackage)42     void disableCarModeByCallingPackage(int flags, String callingPackage);
43 
44     /**
45      * Return the current running mode.
46      */
getCurrentModeType()47     int getCurrentModeType();
48 
49     /**
50      * Sets the night mode.
51      * The mode can be one of:
52      *   1 - notnight mode
53      *   2 - night mode
54      *   3 - automatic mode switching
55      */
setNightMode(int mode)56     void setNightMode(int mode);
57 
58     /**
59      * Gets the currently configured night mode.  Return 1 for notnight,
60      * 2 for night, and 3 for automatic mode switching.
61      */
getNightMode()62     int getNightMode();
63 
64     /**
65      * Sets the dark mode for the given application. This setting is persisted and will override the
66      * system configuration for this application.
67      *   1 - notnight mode
68      *   2 - night mode
69      *   3 - automatic mode switching
70      */
setApplicationNightMode(in int mode)71     void setApplicationNightMode(in int mode);
72 
73     /**
74      * Tells if UI mode is locked or not.
75      */
isUiModeLocked()76     boolean isUiModeLocked();
77 
78     /**
79      * Tells if Night mode is locked or not.
80      */
isNightModeLocked()81     boolean isNightModeLocked();
82 
83     /**
84     * [De]Activates night mode
85     */
setNightModeActivated(boolean active)86     boolean setNightModeActivated(boolean active);
87 
88     /**
89     * Returns custom start clock time
90     */
getCustomNightModeStart()91     long getCustomNightModeStart();
92 
93     /**
94     * Sets custom start clock time
95     */
setCustomNightModeStart(long time)96     void setCustomNightModeStart(long time);
97 
98     /**
99     * Returns custom end clock time
100     */
getCustomNightModeEnd()101     long getCustomNightModeEnd();
102 
103     /**
104     * Sets custom end clock time
105     */
setCustomNightModeEnd(long time)106     void setCustomNightModeEnd(long time);
107 
108     /**
109     * Sets projection state for the caller for the given projection type.
110     */
requestProjection(in IBinder binder, int projectionType, String callingPackage)111     boolean requestProjection(in IBinder binder, int projectionType, String callingPackage);
112 
113     /**
114     * Releases projection state for the caller for the given projection type.
115     */
releaseProjection(int projectionType, String callingPackage)116     boolean releaseProjection(int projectionType, String callingPackage);
117 
118     /**
119     * Registers a listener for changes to projection state.
120     */
addOnProjectionStateChangedListener(in IOnProjectionStateChangedListener listener, int projectionType)121     void addOnProjectionStateChangedListener(in IOnProjectionStateChangedListener listener, int projectionType);
122 
123     /**
124     * Unregisters a listener for changes to projection state.
125     */
removeOnProjectionStateChangedListener(in IOnProjectionStateChangedListener listener)126     void removeOnProjectionStateChangedListener(in IOnProjectionStateChangedListener listener);
127 
128     /**
129     * Returns packages that have currently set the given projection type.
130     */
getProjectingPackages(int projectionType)131     List<String> getProjectingPackages(int projectionType);
132 
133     /**
134     * Returns currently set projection types.
135     */
getActiveProjectionTypes()136     int getActiveProjectionTypes();
137 }
138