Kenny Root | 15a4d2f | 2010-03-11 18:20:12 -0800 | [diff] [blame] | 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 | |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 17 | package android.app; |
| 18 | |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 19 | import android.annotation.IntDef; |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 20 | import android.annotation.SystemService; |
Keun-young Park | 078f9b9 | 2016-03-02 02:18:19 +0000 | [diff] [blame] | 21 | import android.annotation.TestApi; |
Mathew Inwood | 4fb17d1 | 2018-08-14 14:25:44 +0100 | [diff] [blame] | 22 | import android.annotation.UnsupportedAppUsage; |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 23 | import android.content.Context; |
| 24 | import android.content.res.Configuration; |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 25 | import android.os.RemoteException; |
| 26 | import android.os.ServiceManager; |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 27 | import android.os.ServiceManager.ServiceNotFoundException; |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 28 | |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 29 | import java.lang.annotation.Retention; |
| 30 | import java.lang.annotation.RetentionPolicy; |
| 31 | |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 32 | /** |
| 33 | * This class provides access to the system uimode services. These services |
| 34 | * allow applications to control UI modes of the device. |
| 35 | * It provides functionality to disable the car mode and it gives access to the |
| 36 | * night mode settings. |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 37 | * |
| 38 | * <p>These facilities are built on top of the underlying |
| 39 | * {@link android.content.Intent#ACTION_DOCK_EVENT} broadcasts that are sent when the user |
| 40 | * physical places the device into and out of a dock. When that happens, |
| 41 | * the UiModeManager switches the system {@link android.content.res.Configuration} |
| 42 | * to the appropriate UI mode, sends broadcasts about the mode switch, and |
| 43 | * starts the corresponding mode activity if appropriate. See the |
| 44 | * broadcasts {@link #ACTION_ENTER_CAR_MODE} and |
| 45 | * {@link #ACTION_ENTER_DESK_MODE} for more information. |
| 46 | * |
| 47 | * <p>In addition, the user may manually switch the system to car mode without |
| 48 | * physically being in a dock. While in car mode -- whether by manual action |
| 49 | * from the user or being physically placed in a dock -- a notification is |
| 50 | * displayed allowing the user to exit dock mode. Thus the dock mode |
| 51 | * represented here may be different than the current state of the underlying |
| 52 | * dock event broadcast. |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 53 | */ |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 54 | @SystemService(Context.UI_MODE_SERVICE) |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 55 | public class UiModeManager { |
| 56 | private static final String TAG = "UiModeManager"; |
| 57 | |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 58 | /** |
| 59 | * Broadcast sent when the device's UI has switched to car mode, either |
| 60 | * by being placed in a car dock or explicit action of the user. After |
| 61 | * sending the broadcast, the system will start the intent |
| 62 | * {@link android.content.Intent#ACTION_MAIN} with category |
| 63 | * {@link android.content.Intent#CATEGORY_CAR_DOCK} |
| 64 | * to display the car UI, which typically what an application would |
| 65 | * implement to provide their own interface. However, applications can |
| 66 | * also monitor this Intent in order to be informed of mode changes or |
| 67 | * prevent the normal car UI from being displayed by setting the result |
| 68 | * of the broadcast to {@link Activity#RESULT_CANCELED}. |
| 69 | */ |
| 70 | public static String ACTION_ENTER_CAR_MODE = "android.app.action.ENTER_CAR_MODE"; |
| 71 | |
| 72 | /** |
| 73 | * Broadcast sent when the device's UI has switch away from car mode back |
| 74 | * to normal mode. Typically used by a car mode app, to dismiss itself |
| 75 | * when the user exits car mode. |
| 76 | */ |
| 77 | public static String ACTION_EXIT_CAR_MODE = "android.app.action.EXIT_CAR_MODE"; |
| 78 | |
| 79 | /** |
| 80 | * Broadcast sent when the device's UI has switched to desk mode, |
| 81 | * by being placed in a desk dock. After |
| 82 | * sending the broadcast, the system will start the intent |
| 83 | * {@link android.content.Intent#ACTION_MAIN} with category |
| 84 | * {@link android.content.Intent#CATEGORY_DESK_DOCK} |
| 85 | * to display the desk UI, which typically what an application would |
| 86 | * implement to provide their own interface. However, applications can |
| 87 | * also monitor this Intent in order to be informed of mode changes or |
| 88 | * prevent the normal desk UI from being displayed by setting the result |
| 89 | * of the broadcast to {@link Activity#RESULT_CANCELED}. |
| 90 | */ |
| 91 | public static String ACTION_ENTER_DESK_MODE = "android.app.action.ENTER_DESK_MODE"; |
| 92 | |
| 93 | /** |
Daniel Sandler | b999abc | 2010-03-11 15:19:53 -0500 | [diff] [blame] | 94 | * Broadcast sent when the device's UI has switched away from desk mode back |
| 95 | * to normal mode. Typically used by a desk mode app, to dismiss itself |
| 96 | * when the user exits desk mode. |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 97 | */ |
| 98 | public static String ACTION_EXIT_DESK_MODE = "android.app.action.EXIT_DESK_MODE"; |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 99 | |
| 100 | /** @hide */ |
Jeff Sharkey | ce8db99 | 2017-12-13 20:05:05 -0700 | [diff] [blame] | 101 | @IntDef(prefix = { "MODE_" }, value = { |
| 102 | MODE_NIGHT_AUTO, |
| 103 | MODE_NIGHT_NO, |
| 104 | MODE_NIGHT_YES |
| 105 | }) |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 106 | @Retention(RetentionPolicy.SOURCE) |
| 107 | public @interface NightMode {} |
| 108 | |
| 109 | /** |
| 110 | * Constant for {@link #setNightMode(int)} and {@link #getNightMode()}: |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 111 | * automatically switch night mode on and off based on the time. |
| 112 | */ |
| 113 | public static final int MODE_NIGHT_AUTO = Configuration.UI_MODE_NIGHT_UNDEFINED >> 4; |
| 114 | |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 115 | /** |
| 116 | * Constant for {@link #setNightMode(int)} and {@link #getNightMode()}: |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 117 | * never run in night mode. |
| 118 | */ |
| 119 | public static final int MODE_NIGHT_NO = Configuration.UI_MODE_NIGHT_NO >> 4; |
| 120 | |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 121 | /** |
| 122 | * Constant for {@link #setNightMode(int)} and {@link #getNightMode()}: |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 123 | * always run in night mode. |
| 124 | */ |
| 125 | public static final int MODE_NIGHT_YES = Configuration.UI_MODE_NIGHT_YES >> 4; |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 126 | |
| 127 | private IUiModeManager mService; |
| 128 | |
Mathew Inwood | 4fb17d1 | 2018-08-14 14:25:44 +0100 | [diff] [blame] | 129 | @UnsupportedAppUsage |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 130 | /*package*/ UiModeManager() throws ServiceNotFoundException { |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 131 | mService = IUiModeManager.Stub.asInterface( |
Jeff Sharkey | 49ca529 | 2016-05-10 12:54:45 -0600 | [diff] [blame] | 132 | ServiceManager.getServiceOrThrow(Context.UI_MODE_SERVICE)); |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | /** |
Dianne Hackborn | f5c5d22 | 2010-04-09 13:14:48 -0700 | [diff] [blame] | 136 | * Flag for use with {@link #enableCarMode(int)}: go to the car |
| 137 | * home activity as part of the enable. Enabling this way ensures |
| 138 | * a clean transition between the current activity (in non-car-mode) and |
| 139 | * the car home activity that will serve as home while in car mode. This |
| 140 | * will switch to the car home activity even if we are already in car mode. |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 141 | */ |
Dianne Hackborn | f5c5d22 | 2010-04-09 13:14:48 -0700 | [diff] [blame] | 142 | public static final int ENABLE_CAR_MODE_GO_CAR_HOME = 0x0001; |
keunyoung | 1d0a7cc | 2014-07-28 13:12:50 -0700 | [diff] [blame] | 143 | |
| 144 | /** |
keunyoung | c093bf2 | 2014-08-11 18:51:15 -0700 | [diff] [blame] | 145 | * Flag for use with {@link #enableCarMode(int)}: allow sleep mode while in car mode. |
| 146 | * By default, when this flag is not set, the system may hold a full wake lock to keep the |
| 147 | * screen turned on and prevent the system from entering sleep mode while in car mode. |
| 148 | * Setting this flag disables such behavior and the system may enter sleep mode |
| 149 | * if there is no other user activity and no other wake lock held. |
keunyoung | 1d0a7cc | 2014-07-28 13:12:50 -0700 | [diff] [blame] | 150 | * Setting this flag can be relevant for a car dock application that does not require the |
| 151 | * screen kept on. |
| 152 | */ |
keunyoung | c093bf2 | 2014-08-11 18:51:15 -0700 | [diff] [blame] | 153 | public static final int ENABLE_CAR_MODE_ALLOW_SLEEP = 0x0002; |
keunyoung | 1d0a7cc | 2014-07-28 13:12:50 -0700 | [diff] [blame] | 154 | |
Dianne Hackborn | d49258f | 2010-03-26 00:44:29 -0700 | [diff] [blame] | 155 | /** |
Dianne Hackborn | 9c9c532 | 2010-03-30 23:12:22 -0700 | [diff] [blame] | 156 | * Force device into car mode, like it had been placed in the car dock. |
| 157 | * This will cause the device to switch to the car home UI as part of |
| 158 | * the mode switch. |
| 159 | * @param flags Must be 0. |
| 160 | */ |
| 161 | public void enableCarMode(int flags) { |
| 162 | if (mService != null) { |
| 163 | try { |
Dianne Hackborn | f5c5d22 | 2010-04-09 13:14:48 -0700 | [diff] [blame] | 164 | mService.enableCarMode(flags); |
Dianne Hackborn | 9c9c532 | 2010-03-30 23:12:22 -0700 | [diff] [blame] | 165 | } catch (RemoteException e) { |
Jeff Sharkey | c53962d | 2016-03-01 19:27:23 -0700 | [diff] [blame] | 166 | throw e.rethrowFromSystemServer(); |
Dianne Hackborn | 9c9c532 | 2010-03-30 23:12:22 -0700 | [diff] [blame] | 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | /** |
Dianne Hackborn | f5c5d22 | 2010-04-09 13:14:48 -0700 | [diff] [blame] | 172 | * Flag for use with {@link #disableCarMode(int)}: go to the normal |
| 173 | * home activity as part of the disable. Disabling this way ensures |
| 174 | * a clean transition between the current activity (in car mode) and |
| 175 | * the original home activity (which was typically last running without |
| 176 | * being in car mode). |
| 177 | */ |
| 178 | public static final int DISABLE_CAR_MODE_GO_HOME = 0x0001; |
| 179 | |
| 180 | /** |
Dianne Hackborn | d49258f | 2010-03-26 00:44:29 -0700 | [diff] [blame] | 181 | * Turn off special mode if currently in car mode. |
| 182 | * @param flags May be 0 or {@link #DISABLE_CAR_MODE_GO_HOME}. |
| 183 | */ |
| 184 | public void disableCarMode(int flags) { |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 185 | if (mService != null) { |
| 186 | try { |
Dianne Hackborn | d49258f | 2010-03-26 00:44:29 -0700 | [diff] [blame] | 187 | mService.disableCarMode(flags); |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 188 | } catch (RemoteException e) { |
Jeff Sharkey | c53962d | 2016-03-01 19:27:23 -0700 | [diff] [blame] | 189 | throw e.rethrowFromSystemServer(); |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 190 | } |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | /** |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 195 | * Return the current running mode type. May be one of |
| 196 | * {@link Configuration#UI_MODE_TYPE_NORMAL Configuration.UI_MODE_TYPE_NORMAL}, |
John Spurlock | 6c19129 | 2014-04-03 16:37:27 -0400 | [diff] [blame] | 197 | * {@link Configuration#UI_MODE_TYPE_DESK Configuration.UI_MODE_TYPE_DESK}, |
| 198 | * {@link Configuration#UI_MODE_TYPE_CAR Configuration.UI_MODE_TYPE_CAR}, |
| 199 | * {@link Configuration#UI_MODE_TYPE_TELEVISION Configuration.UI_MODE_TYPE_TELEVISION}, |
Zak Cohen | 1a6acdb | 2016-12-12 15:21:21 -0800 | [diff] [blame] | 200 | * {@link Configuration#UI_MODE_TYPE_APPLIANCE Configuration.UI_MODE_TYPE_APPLIANCE}, |
| 201 | * {@link Configuration#UI_MODE_TYPE_WATCH Configuration.UI_MODE_TYPE_WATCH}, or |
| 202 | * {@link Configuration#UI_MODE_TYPE_VR_HEADSET Configuration.UI_MODE_TYPE_VR_HEADSET}. |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 203 | */ |
| 204 | public int getCurrentModeType() { |
| 205 | if (mService != null) { |
| 206 | try { |
| 207 | return mService.getCurrentModeType(); |
| 208 | } catch (RemoteException e) { |
Jeff Sharkey | c53962d | 2016-03-01 19:27:23 -0700 | [diff] [blame] | 209 | throw e.rethrowFromSystemServer(); |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 210 | } |
| 211 | } |
| 212 | return Configuration.UI_MODE_TYPE_NORMAL; |
| 213 | } |
| 214 | |
| 215 | /** |
Lucas Dupin | b01c390 | 2018-09-19 09:51:02 -0700 | [diff] [blame] | 216 | * Sets the system-wide night mode. |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 217 | * <p> |
| 218 | * The mode can be one of: |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 219 | * <ul> |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 220 | * <li><em>{@link #MODE_NIGHT_NO}<em> sets the device into |
| 221 | * {@code notnight} mode</li> |
| 222 | * <li><em>{@link #MODE_NIGHT_YES}</em> sets the device into |
| 223 | * {@code night} mode</li> |
| 224 | * <li><em>{@link #MODE_NIGHT_AUTO}</em> automatically switches between |
| 225 | * {@code night} and {@code notnight} based on the device's current |
| 226 | * location and certain other sensors</li> |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 227 | * </ul> |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 228 | * <p> |
| 229 | * <strong>Note:</strong> On API 22 and below, changes to the night mode |
| 230 | * are only effective when the {@link Configuration#UI_MODE_TYPE_CAR car} |
| 231 | * or {@link Configuration#UI_MODE_TYPE_DESK desk} mode is enabled on a |
| 232 | * device. Starting in API 23, changes to night mode are always effective. |
Lucas Dupin | b01c390 | 2018-09-19 09:51:02 -0700 | [diff] [blame] | 233 | * <p> |
| 234 | * Changes to night mode take effect globally and will result in a configuration change |
| 235 | * (and potentially an Activity lifecycle event) being applied to all running apps. |
| 236 | * Developers interested in an app-local implementation of night mode should consider using |
Nan Zhang | 99adf3c | 2018-09-21 14:51:38 -0700 | [diff] [blame] | 237 | * {@link android.support.v7.app.AppCompatDelegate#setDefaultNightMode(int)} to manage the |
Lucas Dupin | b01c390 | 2018-09-19 09:51:02 -0700 | [diff] [blame] | 238 | * -night qualifier locally. |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 239 | * |
| 240 | * @param mode the night mode to set |
| 241 | * @see #getNightMode() |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 242 | */ |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 243 | public void setNightMode(@NightMode int mode) { |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 244 | if (mService != null) { |
| 245 | try { |
| 246 | mService.setNightMode(mode); |
| 247 | } catch (RemoteException e) { |
Jeff Sharkey | c53962d | 2016-03-01 19:27:23 -0700 | [diff] [blame] | 248 | throw e.rethrowFromSystemServer(); |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 249 | } |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | /** |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 254 | * Returns the currently configured night mode. |
| 255 | * <p> |
| 256 | * May be one of: |
| 257 | * <ul> |
| 258 | * <li>{@link #MODE_NIGHT_NO}</li> |
| 259 | * <li>{@link #MODE_NIGHT_YES}</li> |
| 260 | * <li>{@link #MODE_NIGHT_AUTO}</li> |
| 261 | * <li>{@code -1} on error</li> |
| 262 | * </ul> |
| 263 | * |
| 264 | * @return the current night mode, or {@code -1} on error |
| 265 | * @see #setNightMode(int) |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 266 | */ |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 267 | public @NightMode int getNightMode() { |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 268 | if (mService != null) { |
| 269 | try { |
| 270 | return mService.getNightMode(); |
| 271 | } catch (RemoteException e) { |
Jeff Sharkey | c53962d | 2016-03-01 19:27:23 -0700 | [diff] [blame] | 272 | throw e.rethrowFromSystemServer(); |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 273 | } |
| 274 | } |
| 275 | return -1; |
| 276 | } |
keunyoung | a771049 | 2015-09-23 11:33:58 -0700 | [diff] [blame] | 277 | |
| 278 | /** |
| 279 | * @return If UI mode is locked or not. When UI mode is locked, calls to change UI mode |
| 280 | * like {@link #enableCarMode(int)} will silently fail. |
Keun-young Park | 078f9b9 | 2016-03-02 02:18:19 +0000 | [diff] [blame] | 281 | * @hide |
keunyoung | a771049 | 2015-09-23 11:33:58 -0700 | [diff] [blame] | 282 | */ |
Keun-young Park | 078f9b9 | 2016-03-02 02:18:19 +0000 | [diff] [blame] | 283 | @TestApi |
keunyoung | a771049 | 2015-09-23 11:33:58 -0700 | [diff] [blame] | 284 | public boolean isUiModeLocked() { |
| 285 | if (mService != null) { |
| 286 | try { |
| 287 | return mService.isUiModeLocked(); |
| 288 | } catch (RemoteException e) { |
Jeff Sharkey | c53962d | 2016-03-01 19:27:23 -0700 | [diff] [blame] | 289 | throw e.rethrowFromSystemServer(); |
keunyoung | a771049 | 2015-09-23 11:33:58 -0700 | [diff] [blame] | 290 | } |
| 291 | } |
| 292 | return true; |
| 293 | } |
| 294 | |
| 295 | /** |
Alan Viverette | 5794a5b | 2016-01-12 15:04:18 -0500 | [diff] [blame] | 296 | * Returns whether night mode is locked or not. |
| 297 | * <p> |
| 298 | * When night mode is locked, only privileged system components may change |
| 299 | * night mode and calls from non-privileged applications to change night |
| 300 | * mode will fail silently. |
| 301 | * |
| 302 | * @return {@code true} if night mode is locked or {@code false} otherwise |
Keun-young Park | 078f9b9 | 2016-03-02 02:18:19 +0000 | [diff] [blame] | 303 | * @hide |
keunyoung | a771049 | 2015-09-23 11:33:58 -0700 | [diff] [blame] | 304 | */ |
Keun-young Park | 078f9b9 | 2016-03-02 02:18:19 +0000 | [diff] [blame] | 305 | @TestApi |
keunyoung | a771049 | 2015-09-23 11:33:58 -0700 | [diff] [blame] | 306 | public boolean isNightModeLocked() { |
| 307 | if (mService != null) { |
| 308 | try { |
| 309 | return mService.isNightModeLocked(); |
| 310 | } catch (RemoteException e) { |
Jeff Sharkey | c53962d | 2016-03-01 19:27:23 -0700 | [diff] [blame] | 311 | throw e.rethrowFromSystemServer(); |
keunyoung | a771049 | 2015-09-23 11:33:58 -0700 | [diff] [blame] | 312 | } |
| 313 | } |
| 314 | return true; |
| 315 | } |
Tobias Haamel | 5333288 | 2010-02-18 16:15:43 -0800 | [diff] [blame] | 316 | } |