OSDN Git Service

Clarify that UiModeManager sets global night mode
authorLucas Dupin <dupin@google.com>
Wed, 19 Sep 2018 16:51:02 +0000 (09:51 -0700)
committerLucas Dupin <dupin@google.com>
Wed, 19 Sep 2018 18:44:31 +0000 (11:44 -0700)
Test: repo upload
Fixes: 116121230
Change-Id: I127c169eb9cb6f951943879bd4bdaca2a00ed222

core/java/android/app/UiModeManager.java

index 0da5e24..adc592a 100644 (file)
@@ -24,7 +24,6 @@ import android.content.res.Configuration;
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.ServiceManager.ServiceNotFoundException;
-import android.util.Log;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -212,7 +211,7 @@ public class UiModeManager {
     }
 
     /**
-     * Sets the night mode.
+     * Sets the system-wide night mode.
      * <p>
      * The mode can be one of:
      * <ul>
@@ -229,6 +228,12 @@ public class UiModeManager {
      * are only effective when the {@link Configuration#UI_MODE_TYPE_CAR car}
      * or {@link Configuration#UI_MODE_TYPE_DESK desk} mode is enabled on a
      * device. Starting in API 23, changes to night mode are always effective.
+     * <p>
+     * Changes to night mode take effect globally and will result in a configuration change
+     * (and potentially an Activity lifecycle event) being applied to all running apps.
+     * Developers interested in an app-local implementation of night mode should consider using
+     * {@link androidx.appcompat.app.AppCompatDelegate#setDefaultNightMode(int)} to manage the
+     * -night qualifier locally.
      *
      * @param mode the night mode to set
      * @see #getNightMode()