Merge "Creates new FLAG_APP_INACCESSIBLE flag for DeviceState" into tm-dev am: 03d89f9e58
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18351213 Change-Id: I6fdeac98e0d2885f20f03805c3a4126038433113 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.server.devicestate;
|
|||||||
|
|
||||||
import static android.hardware.devicestate.DeviceStateManager.MAXIMUM_DEVICE_STATE;
|
import static android.hardware.devicestate.DeviceStateManager.MAXIMUM_DEVICE_STATE;
|
||||||
import static android.hardware.devicestate.DeviceStateManager.MINIMUM_DEVICE_STATE;
|
import static android.hardware.devicestate.DeviceStateManager.MINIMUM_DEVICE_STATE;
|
||||||
|
import static android.view.Display.DEFAULT_DISPLAY;
|
||||||
|
|
||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
import android.annotation.IntRange;
|
import android.annotation.IntRange;
|
||||||
@@ -48,9 +49,16 @@ public final class DeviceState {
|
|||||||
*/
|
*/
|
||||||
public static final int FLAG_CANCEL_OVERRIDE_REQUESTS = 1 << 0;
|
public static final int FLAG_CANCEL_OVERRIDE_REQUESTS = 1 << 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag that indicates this device state is inaccessible for applications to be placed in. This
|
||||||
|
* could be a device-state where the {@link DEFAULT_DISPLAY} is not enabled.
|
||||||
|
*/
|
||||||
|
public static final int FLAG_APP_INACCESSIBLE = 1 << 1;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@IntDef(prefix = {"FLAG_"}, flag = true, value = {
|
@IntDef(prefix = {"FLAG_"}, flag = true, value = {
|
||||||
FLAG_CANCEL_OVERRIDE_REQUESTS,
|
FLAG_CANCEL_OVERRIDE_REQUESTS,
|
||||||
|
FLAG_APP_INACCESSIBLE
|
||||||
})
|
})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface DeviceStateFlags {}
|
public @interface DeviceStateFlags {}
|
||||||
@@ -97,7 +105,8 @@ public final class DeviceState {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "DeviceState{" + "identifier=" + mIdentifier + ", name='" + mName + '\'' + '}';
|
return "DeviceState{" + "identifier=" + mIdentifier + ", name='" + mName + '\''
|
||||||
|
+ ", app_accessible=" + !hasFlag(FLAG_APP_INACCESSIBLE) + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ public final class DeviceStateProviderImpl implements DeviceStateProvider,
|
|||||||
private static final String DATA_CONFIG_FILE_PATH = "system/devicestate/";
|
private static final String DATA_CONFIG_FILE_PATH = "system/devicestate/";
|
||||||
private static final String CONFIG_FILE_NAME = "device_state_configuration.xml";
|
private static final String CONFIG_FILE_NAME = "device_state_configuration.xml";
|
||||||
private static final String FLAG_CANCEL_OVERRIDE_REQUESTS = "FLAG_CANCEL_OVERRIDE_REQUESTS";
|
private static final String FLAG_CANCEL_OVERRIDE_REQUESTS = "FLAG_CANCEL_OVERRIDE_REQUESTS";
|
||||||
|
private static final String FLAG_APP_INACCESSIBLE = "FLAG_APP_INACCESSIBLE";
|
||||||
|
|
||||||
/** Interface that allows reading the device state configuration. */
|
/** Interface that allows reading the device state configuration. */
|
||||||
interface ReadableConfig {
|
interface ReadableConfig {
|
||||||
@@ -145,6 +146,9 @@ public final class DeviceStateProviderImpl implements DeviceStateProvider,
|
|||||||
case FLAG_CANCEL_OVERRIDE_REQUESTS:
|
case FLAG_CANCEL_OVERRIDE_REQUESTS:
|
||||||
flags |= DeviceState.FLAG_CANCEL_OVERRIDE_REQUESTS;
|
flags |= DeviceState.FLAG_CANCEL_OVERRIDE_REQUESTS;
|
||||||
break;
|
break;
|
||||||
|
case FLAG_APP_INACCESSIBLE:
|
||||||
|
flags |= DeviceState.FLAG_APP_INACCESSIBLE;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Slog.w(TAG, "Parsed unknown flag with name: "
|
Slog.w(TAG, "Parsed unknown flag with name: "
|
||||||
+ configFlagString);
|
+ configFlagString);
|
||||||
|
|||||||
Reference in New Issue
Block a user