am 642421aa: am 5c31e487: Merge "Introduce new UI_MODE_TYPE_WATCH and qualifier." into klp-modular-dev
* commit '642421aa7f284817cc1a972a7f9c7a64696a0116': Introduce new UI_MODE_TYPE_WATCH and qualifier.
This commit is contained in:
@@ -8158,6 +8158,7 @@ package android.content.res {
|
||||
field public static final int UI_MODE_TYPE_NORMAL = 1; // 0x1
|
||||
field public static final int UI_MODE_TYPE_TELEVISION = 4; // 0x4
|
||||
field public static final int UI_MODE_TYPE_UNDEFINED = 0; // 0x0
|
||||
field public static final int UI_MODE_TYPE_WATCH = 6; // 0x6
|
||||
field public int densityDpi;
|
||||
field public float fontScale;
|
||||
field public int hardKeyboardHidden;
|
||||
|
||||
@@ -166,9 +166,11 @@ public class UiModeManager {
|
||||
/**
|
||||
* Return the current running mode type. May be one of
|
||||
* {@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_APPLIANCE}.
|
||||
* {@link Configuration#UI_MODE_TYPE_DESK Configuration.UI_MODE_TYPE_DESK},
|
||||
* {@link Configuration#UI_MODE_TYPE_CAR Configuration.UI_MODE_TYPE_CAR},
|
||||
* {@link Configuration#UI_MODE_TYPE_TELEVISION Configuration.UI_MODE_TYPE_TELEVISION},
|
||||
* {@link Configuration#UI_MODE_TYPE_APPLIANCE Configuration.UI_MODE_TYPE_APPLIANCE}, or
|
||||
* {@link Configuration#UI_MODE_TYPE_WATCH Configuration.UI_MODE_TYPE_WATCH}.
|
||||
*/
|
||||
public int getCurrentModeType() {
|
||||
if (mService != null) {
|
||||
|
||||
@@ -440,6 +440,11 @@ public final class Configuration implements Parcelable, Comparable<Configuration
|
||||
* <a href="{@docRoot}guide/topics/resources/providing-resources.html#UiModeQualifier">appliance</a>
|
||||
* resource qualifier. */
|
||||
public static final int UI_MODE_TYPE_APPLIANCE = 0x05;
|
||||
/** Constant for {@link #uiMode}: a {@link #UI_MODE_TYPE_MASK}
|
||||
* value that corresponds to the
|
||||
* <a href="{@docRoot}guide/topics/resources/providing-resources.html#UiModeQualifier">watch</a>
|
||||
* resource qualifier. */
|
||||
public static final int UI_MODE_TYPE_WATCH = 0x06;
|
||||
|
||||
/** Constant for {@link #uiMode}: bits that encode the night mode. */
|
||||
public static final int UI_MODE_NIGHT_MASK = 0x30;
|
||||
@@ -462,8 +467,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},
|
||||
* {@link #UI_MODE_TYPE_CAR}, {@link #UI_MODE_TYPE_TELEVISION}, or
|
||||
* {@link #UI_MODE_TYPE_APPLIANCE}.
|
||||
* {@link #UI_MODE_TYPE_CAR}, {@link #UI_MODE_TYPE_TELEVISION},
|
||||
* {@link #UI_MODE_TYPE_APPLIANCE}, or {@link #UI_MODE_TYPE_WATCH}.
|
||||
*
|
||||
* <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},
|
||||
@@ -700,6 +705,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
|
||||
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;
|
||||
case UI_MODE_TYPE_WATCH: sb.append(" watch"); break;
|
||||
default: sb.append(" uimode="); sb.append(uiMode&UI_MODE_TYPE_MASK); break;
|
||||
}
|
||||
switch ((uiMode&UI_MODE_NIGHT_MASK)) {
|
||||
|
||||
@@ -467,6 +467,7 @@
|
||||
1 UI_MODE_TYPE_NORMAL
|
||||
4 UI_MODE_TYPE_TELEVISION
|
||||
5 UI_MODE_TYPE_APPLIANCE
|
||||
6 UI_MODE_TYPE_WATCH
|
||||
Any other values will have surprising consequences. -->
|
||||
<integer name="config_defaultUiModeType">1</integer>
|
||||
|
||||
|
||||
@@ -562,6 +562,7 @@ which indicates the current device orientation.</p>
|
||||
<code>desk</code><br/>
|
||||
<code>television<br/>
|
||||
<code>appliance</code>
|
||||
<code>watch</code>
|
||||
</td>
|
||||
<td>
|
||||
<ul class="nolist">
|
||||
@@ -573,8 +574,9 @@ which indicates the current device orientation.</p>
|
||||
non-pointer interaction</li>
|
||||
<li>{@code appliance}: Device is serving as an appliance, with
|
||||
no display</li>
|
||||
<li>{@code watch}: Device has a display and is worn on the wrist</li>
|
||||
</ul>
|
||||
<p><em>Added in API level 8, television added in API 13.</em></p>
|
||||
<p><em>Added in API level 8, television added in API 13, watch added in API 20.</em></p>
|
||||
<p>For information about how your app can respond when the device is inserted into or
|
||||
removed from a dock, read <a
|
||||
href="{@docRoot}training/monitoring-device-state/docking-monitoring.html">Determining
|
||||
|
||||
@@ -1054,6 +1054,7 @@ struct ResTable_config
|
||||
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,
|
||||
UI_MODE_TYPE_WATCH = ACONFIGURATION_UI_MODE_TYPE_WATCH,
|
||||
|
||||
// uiMode bits for the night switch.
|
||||
MASK_UI_MODE_NIGHT = 0x30,
|
||||
|
||||
@@ -2557,6 +2557,9 @@ String8 ResTable_config::toString() const {
|
||||
case ResTable_config::UI_MODE_TYPE_APPLIANCE:
|
||||
res.append("appliance");
|
||||
break;
|
||||
case ResTable_config::UI_MODE_TYPE_WATCH:
|
||||
res.append("watch");
|
||||
break;
|
||||
default:
|
||||
res.appendFormat("uiModeType=%d",
|
||||
dtohs(screenLayout&ResTable_config::MASK_UI_MODE_TYPE));
|
||||
|
||||
@@ -71,6 +71,7 @@ final class UiModeManagerService extends SystemService {
|
||||
private boolean mCarModeKeepsScreenOn;
|
||||
private boolean mDeskModeKeepsScreenOn;
|
||||
private boolean mTelevision;
|
||||
private boolean mWatch;
|
||||
private boolean mComputedNightMode;
|
||||
|
||||
int mCurUiMode = 0;
|
||||
@@ -176,6 +177,7 @@ final class UiModeManagerService extends SystemService {
|
||||
PackageManager.FEATURE_TELEVISION) ||
|
||||
context.getPackageManager().hasSystemFeature(
|
||||
PackageManager.FEATURE_LEANBACK);
|
||||
mWatch = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH);
|
||||
|
||||
mNightMode = Settings.Secure.getInt(context.getContentResolver(),
|
||||
Settings.Secure.UI_NIGHT_MODE, UiModeManager.MODE_NIGHT_AUTO);
|
||||
@@ -339,8 +341,12 @@ final class UiModeManagerService extends SystemService {
|
||||
}
|
||||
|
||||
private void updateConfigurationLocked() {
|
||||
int uiMode = mTelevision ? Configuration.UI_MODE_TYPE_TELEVISION : mDefaultUiModeType;
|
||||
if (mCarModeEnabled) {
|
||||
int uiMode = mDefaultUiModeType;
|
||||
if (mTelevision) {
|
||||
uiMode = Configuration.UI_MODE_TYPE_TELEVISION;
|
||||
} else if (mWatch) {
|
||||
uiMode = Configuration.UI_MODE_TYPE_WATCH;
|
||||
} else if (mCarModeEnabled) {
|
||||
uiMode = Configuration.UI_MODE_TYPE_CAR;
|
||||
} else if (isDeskDockState(mDockState)) {
|
||||
uiMode = Configuration.UI_MODE_TYPE_DESK;
|
||||
|
||||
@@ -1342,6 +1342,11 @@ bool AaptGroupEntry::getUiModeTypeName(const char* name,
|
||||
(out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE)
|
||||
| ResTable_config::UI_MODE_TYPE_APPLIANCE;
|
||||
return true;
|
||||
} else if (strcmp(name, "watch") == 0) {
|
||||
if (out) out->uiMode =
|
||||
(out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE)
|
||||
| ResTable_config::UI_MODE_TYPE_WATCH;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user