summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/app/UiModeManager.java2
-rw-r--r--core/java/android/content/res/Configuration.java5
-rwxr-xr-xcore/res/res/values/config.xml12
-rw-r--r--include/utils/ResourceTypes.h1
-rw-r--r--native/include/android/configuration.h1
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java4
-rw-r--r--services/java/com/android/server/UiModeManagerService.java5
-rw-r--r--tools/aapt/AaptAssets.cpp5
9 files changed, 30 insertions, 6 deletions
diff --git a/api/current.txt b/api/current.txt
index 9eb2075..e027150 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -6558,6 +6558,7 @@ package android.content.res {
field public static final int UI_MODE_NIGHT_NO = 16; // 0x10
field public static final int UI_MODE_NIGHT_UNDEFINED = 0; // 0x0
field public static final int UI_MODE_NIGHT_YES = 32; // 0x20
+ field public static final int UI_MODE_TYPE_APPLIANCE = 5; // 0x5
field public static final int UI_MODE_TYPE_CAR = 3; // 0x3
field public static final int UI_MODE_TYPE_DESK = 2; // 0x2
field public static final int UI_MODE_TYPE_MASK = 15; // 0xf
diff --git a/core/java/android/app/UiModeManager.java b/core/java/android/app/UiModeManager.java
index 71f6445..0c22740 100644
--- a/core/java/android/app/UiModeManager.java
+++ b/core/java/android/app/UiModeManager.java
@@ -168,7 +168,7 @@ public class UiModeManager {
* {@link Configuration#UI_MODE_TYPE_NORMAL Configuration.UI_MODE_TYPE_NORMAL},
* {@link Configuration#UI_MODE_TYPE_DESK Configuration.UI_MODE_TYPE_DESK}, or
* {@link Configuration#UI_MODE_TYPE_CAR Configuration.UI_MODE_TYPE_CAR}, or
- * {@link Configuration#UI_MODE_TYPE_TELEVISION Configuration.UI_MODE_TYPE_TV}.
+ * {@link Configuration#UI_MODE_TYPE_TELEVISION Configuration.UI_MODE_TYPE_APPLIANCE}.
*/
public int getCurrentModeType() {
if (mService != null) {
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 5c3a17a..6015668 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -228,6 +228,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
public static final int UI_MODE_TYPE_DESK = 0x02;
public static final int UI_MODE_TYPE_CAR = 0x03;
public static final int UI_MODE_TYPE_TELEVISION = 0x04;
+ public static final int UI_MODE_TYPE_APPLIANCE = 0x05;
public static final int UI_MODE_NIGHT_MASK = 0x30;
public static final int UI_MODE_NIGHT_UNDEFINED = 0x00;
@@ -239,7 +240,8 @@ public final class Configuration implements Parcelable, Comparable<Configuration
* <p>The {@link #UI_MODE_TYPE_MASK} bits define the overall ui mode of the
* device. They may be one of {@link #UI_MODE_TYPE_UNDEFINED},
* {@link #UI_MODE_TYPE_NORMAL}, {@link #UI_MODE_TYPE_DESK},
- * or {@link #UI_MODE_TYPE_CAR}.
+ * {@link #UI_MODE_TYPE_CAR}, {@link #UI_MODE_TYPE_TELEVISION}, or
+ * {@link #UI_MODE_TYPE_APPLIANCE}.
*
* <p>The {@link #UI_MODE_NIGHT_MASK} defines whether the screen
* is in a special mode. They may be one of {@link #UI_MODE_NIGHT_UNDEFINED},
@@ -391,6 +393,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
case UI_MODE_TYPE_DESK: sb.append(" desk"); break;
case UI_MODE_TYPE_CAR: sb.append(" car"); break;
case UI_MODE_TYPE_TELEVISION: sb.append(" television"); break;
+ case UI_MODE_TYPE_APPLIANCE: sb.append(" appliance"); break;
default: sb.append(" uimode="); sb.append(uiMode&UI_MODE_TYPE_MASK); break;
}
switch ((uiMode&UI_MODE_NIGHT_MASK)) {
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 3ab72f4..3979b98 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -270,14 +270,14 @@
<!-- Don't name config resources like this. It should look like config_annoyDianne -->
<bool name="config_annoy_dianne">true</bool>
+ <!-- XXXXXX END OF RESOURCES USING WRONG NAMING CONVENTION -->
+
<!-- If this is true, the screen will come on when you unplug usb/power/whatever. -->
<bool name="config_unplugTurnsOnScreen">false</bool>
<!-- If this is true, the screen will fade off. -->
<bool name="config_animateScreenLights">true</bool>
- <!-- XXXXXX END OF RESOURCES USING WRONG NAMING CONVENTION -->
-
<!-- If true, the screen can be rotated via the accelerometer in all 4
rotations as the default behavior. -->
<bool name="config_allowAllRotations">false</bool>
@@ -301,6 +301,14 @@
A value of -1 means no change in orientation by default. -->
<integer name="config_carDockRotation">-1</integer>
+ <!-- Control the default UI mode type to use when there is no other type override
+ happening. One of the following values (See Configuration.java):
+ 1 UI_MODE_TYPE_NORMAL
+ 4 UI_MODE_TYPE_TELEVISION
+ 5 UI_MODE_TYPE_APPLIANCE
+ Any other values will have surprising consequences. -->
+ <integer name="config_defaultUiModeType">1</integer>
+
<!-- Control whether being in the desk dock (and powered) always
keeps the screen on. By default it stays on when plugged in to
AC. 0 will not keep it on; or together 1 to stay on when plugged
diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h
index 612ff93..e045b2c 100644
--- a/include/utils/ResourceTypes.h
+++ b/include/utils/ResourceTypes.h
@@ -955,6 +955,7 @@ struct ResTable_config
UI_MODE_TYPE_DESK = ACONFIGURATION_UI_MODE_TYPE_DESK,
UI_MODE_TYPE_CAR = ACONFIGURATION_UI_MODE_TYPE_CAR,
UI_MODE_TYPE_TELEVISION = ACONFIGURATION_UI_MODE_TYPE_TELEVISION,
+ UI_MODE_TYPE_APPLIANCE = ACONFIGURATION_UI_MODE_TYPE_APPLIANCE,
// uiMode bits for the night switch.
MASK_UI_MODE_NIGHT = 0x30,
diff --git a/native/include/android/configuration.h b/native/include/android/configuration.h
index 2444c4b..4d683fb 100644
--- a/native/include/android/configuration.h
+++ b/native/include/android/configuration.h
@@ -79,6 +79,7 @@ enum {
ACONFIGURATION_UI_MODE_TYPE_DESK = 0x02,
ACONFIGURATION_UI_MODE_TYPE_CAR = 0x03,
ACONFIGURATION_UI_MODE_TYPE_TELEVISION = 0x04,
+ ACONFIGURATION_UI_MODE_TYPE_APPLIANCE = 0x05,
ACONFIGURATION_UI_MODE_NIGHT_ANY = 0x00,
ACONFIGURATION_UI_MODE_NIGHT_NO = 0x1,
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 1a252fa..468f0d5 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -319,7 +319,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
boolean mSystemReady;
boolean mSystemBooted;
boolean mHdmiPlugged;
- int mUiMode = Configuration.UI_MODE_TYPE_NORMAL;
+ int mUiMode;
int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED;
int mLidOpenRotation;
int mCarDockRotation;
@@ -793,6 +793,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
settingsObserver.observe();
mShortcutManager = new ShortcutManager(context, mHandler);
mShortcutManager.observe();
+ mUiMode = context.getResources().getInteger(
+ com.android.internal.R.integer.config_defaultUiModeType);
mHomeIntent = new Intent(Intent.ACTION_MAIN, null);
mHomeIntent.addCategory(Intent.CATEGORY_HOME);
mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
diff --git a/services/java/com/android/server/UiModeManagerService.java b/services/java/com/android/server/UiModeManagerService.java
index e6392d7..c5c2901 100644
--- a/services/java/com/android/server/UiModeManagerService.java
+++ b/services/java/com/android/server/UiModeManagerService.java
@@ -90,6 +90,7 @@ class UiModeManagerService extends IUiModeManager.Stub {
private int mNightMode = UiModeManager.MODE_NIGHT_NO;
private boolean mCarModeEnabled = false;
private boolean mCharging = false;
+ private final int mDefaultUiModeType;
private final boolean mCarModeKeepsScreenOn;
private final boolean mDeskModeKeepsScreenOn;
@@ -347,6 +348,8 @@ class UiModeManagerService extends IUiModeManager.Stub {
mConfiguration.setToDefaults();
+ mDefaultUiModeType = context.getResources().getInteger(
+ com.android.internal.R.integer.config_defaultUiModeType);
mCarModeKeepsScreenOn = (context.getResources().getInteger(
com.android.internal.R.integer.config_carDockKeepsScreenOn) == 1);
mDeskModeKeepsScreenOn = (context.getResources().getInteger(
@@ -452,7 +455,7 @@ class UiModeManagerService extends IUiModeManager.Stub {
}
final void updateConfigurationLocked(boolean sendIt) {
- int uiMode = Configuration.UI_MODE_TYPE_NORMAL;
+ int uiMode = mDefaultUiModeType;
if (mCarModeEnabled) {
uiMode = Configuration.UI_MODE_TYPE_CAR;
} else if (isDeskDockState(mDockState)) {
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
index 3d6537a..f0c215e 100644
--- a/tools/aapt/AaptAssets.cpp
+++ b/tools/aapt/AaptAssets.cpp
@@ -1019,6 +1019,11 @@ bool AaptGroupEntry::getUiModeTypeName(const char* name,
(out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE)
| ResTable_config::UI_MODE_TYPE_TELEVISION;
return true;
+ } else if (strcmp(name, "appliance") == 0) {
+ if (out) out->uiMode =
+ (out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE)
+ | ResTable_config::UI_MODE_TYPE_APPLIANCE;
+ return true;
}
return false;