Loading core/java/android/hardware/devicestate/DeviceStateManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ public final class DeviceStateManager { * * @hide */ public static final int INVALID_DEVICE_STATE = -1; public static final int INVALID_DEVICE_STATE_IDENTIFIER = -1; /** * The minimum allowed device state identifier. Loading libs/WindowManager/Jetpack/src/androidx/window/common/DeviceStateManagerFoldingFeatureProducer.java +4 −4 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package androidx.window.common; import static android.hardware.devicestate.DeviceStateManager.INVALID_DEVICE_STATE; import static android.hardware.devicestate.DeviceStateManager.INVALID_DEVICE_STATE_IDENTIFIER; import static androidx.window.common.CommonFoldingFeature.COMMON_STATE_UNKNOWN; import static androidx.window.common.CommonFoldingFeature.COMMON_STATE_USE_BASE_STATE; Loading Loading @@ -69,14 +69,14 @@ public final class DeviceStateManagerFoldingFeatureProducer * example is activated via public API and can be active in both the "open" and "half folded" * device states. */ private int mCurrentDeviceState = INVALID_DEVICE_STATE; private int mCurrentDeviceState = INVALID_DEVICE_STATE_IDENTIFIER; /** * Base device state received via * {@link DeviceStateManager.DeviceStateCallback#onBaseStateChanged(int)}. * "Base" in this context means the "physical" state of the device. */ private int mCurrentBaseDeviceState = INVALID_DEVICE_STATE; private int mCurrentBaseDeviceState = INVALID_DEVICE_STATE_IDENTIFIER; @NonNull private final RawFoldingFeatureProducer mRawFoldSupplier; Loading Loading @@ -177,7 +177,7 @@ public final class DeviceStateManagerFoldingFeatureProducer if (hasListeners()) { mRawFoldSupplier.addDataChangedCallback(this::notifyFoldingFeatureChange); } else { mCurrentDeviceState = INVALID_DEVICE_STATE; mCurrentDeviceState = INVALID_DEVICE_STATE_IDENTIFIER; mRawFoldSupplier.removeDataChangedCallback(this::notifyFoldingFeatureChange); } } Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/area/WindowAreaComponentImpl.java +8 −8 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package androidx.window.extensions.area; import static android.hardware.devicestate.DeviceStateManager.INVALID_DEVICE_STATE; import static android.hardware.devicestate.DeviceStateManager.INVALID_DEVICE_STATE_IDENTIFIER; import android.app.Activity; import android.content.Context; Loading Loading @@ -79,7 +79,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, private int mRearDisplaySessionStatus = WindowAreaComponent.SESSION_STATE_INACTIVE; @GuardedBy("mLock") private int mCurrentDeviceState = INVALID_DEVICE_STATE; private int mCurrentDeviceState = INVALID_DEVICE_STATE_IDENTIFIER; @GuardedBy("mLock") private int[] mCurrentSupportedDeviceStates; Loading Loading @@ -143,7 +143,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, mRearDisplayStatusListeners.add(consumer); // If current device state is still invalid, the initial value has not been provided. if (mCurrentDeviceState == INVALID_DEVICE_STATE) { if (mCurrentDeviceState == INVALID_DEVICE_STATE_IDENTIFIER) { return; } consumer.accept(getCurrentRearDisplayModeStatus()); Loading Loading @@ -308,7 +308,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, mRearDisplayPresentationStatusListeners.add(consumer); // If current device state is still invalid, the initial value has not been provided if (mCurrentDeviceState == INVALID_DEVICE_STATE) { if (mCurrentDeviceState == INVALID_DEVICE_STATE_IDENTIFIER) { return; } @WindowAreaStatus int currentStatus = getCurrentRearDisplayPresentationModeStatus(); Loading Loading @@ -467,7 +467,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, @GuardedBy("mLock") private int getCurrentRearDisplayModeStatus() { if (mRearDisplayState == INVALID_DEVICE_STATE) { if (mRearDisplayState == INVALID_DEVICE_STATE_IDENTIFIER) { return WindowAreaComponent.STATUS_UNSUPPORTED; } Loading Loading @@ -495,7 +495,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, @GuardedBy("mLock") private void updateRearDisplayStatusListeners(@WindowAreaStatus int windowAreaStatus) { if (mRearDisplayState == INVALID_DEVICE_STATE) { if (mRearDisplayState == INVALID_DEVICE_STATE_IDENTIFIER) { return; } synchronized (mLock) { Loading @@ -507,7 +507,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, @GuardedBy("mLock") private int getCurrentRearDisplayPresentationModeStatus() { if (mConcurrentDisplayState == INVALID_DEVICE_STATE) { if (mConcurrentDisplayState == INVALID_DEVICE_STATE_IDENTIFIER) { return WindowAreaComponent.STATUS_UNSUPPORTED; } Loading @@ -530,7 +530,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, @GuardedBy("mLock") private void updateRearDisplayPresentationStatusListeners( @WindowAreaStatus int windowAreaStatus) { if (mConcurrentDisplayState == INVALID_DEVICE_STATE) { if (mConcurrentDisplayState == INVALID_DEVICE_STATE_IDENTIFIER) { return; } RearDisplayPresentationStatus consumerValue = new RearDisplayPresentationStatus( Loading services/core/java/com/android/server/devicestate/DeviceStateManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREG import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.hardware.devicestate.DeviceState.PROPERTY_POLICY_CANCEL_OVERRIDE_REQUESTS; import static android.hardware.devicestate.DeviceState.PROPERTY_POLICY_CANCEL_WHEN_REQUESTER_NOT_ON_TOP; import static android.hardware.devicestate.DeviceStateManager.INVALID_DEVICE_STATE_IDENTIFIER; import static android.hardware.devicestate.DeviceStateManager.MAXIMUM_DEVICE_STATE_IDENTIFIER; import static android.hardware.devicestate.DeviceStateManager.MINIMUM_DEVICE_STATE_IDENTIFIER; Loading Loading @@ -113,7 +114,7 @@ public final class DeviceStateManagerService extends SystemService { /** {@link DeviceState} to model an invalid device state */ // TODO(b/328314031): Investigate how we can remove this constant private static final DeviceState INVALID_DEVICE_STATE = new DeviceState( new DeviceState.Configuration.Builder(DeviceStateManager.INVALID_DEVICE_STATE, new DeviceState.Configuration.Builder(INVALID_DEVICE_STATE_IDENTIFIER, "INVALID").build()); private final Object mLock = new Object(); Loading Loading @@ -475,7 +476,7 @@ public final class DeviceStateManagerService extends SystemService { private void setRearDisplayStateLocked() { int rearDisplayIdentifier = getContext().getResources().getInteger( R.integer.config_deviceStateRearDisplay); if (rearDisplayIdentifier != INVALID_DEVICE_STATE.getIdentifier()) { if (rearDisplayIdentifier != INVALID_DEVICE_STATE_IDENTIFIER) { mRearDisplayState = mDeviceStates.get(rearDisplayIdentifier); } } Loading services/core/java/com/android/server/devicestate/DeviceStateNotificationController.java +1 −1 Original line number Diff line number Diff line Loading @@ -323,7 +323,7 @@ class DeviceStateNotificationController extends BroadcastReceiver { for (int i = 0; i < stateIdentifiers.length; i++) { int identifier = stateIdentifiers[i]; if (identifier == DeviceStateManager.INVALID_DEVICE_STATE) { if (identifier == DeviceStateManager.INVALID_DEVICE_STATE_IDENTIFIER) { continue; } Loading Loading
core/java/android/hardware/devicestate/DeviceStateManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ public final class DeviceStateManager { * * @hide */ public static final int INVALID_DEVICE_STATE = -1; public static final int INVALID_DEVICE_STATE_IDENTIFIER = -1; /** * The minimum allowed device state identifier. Loading
libs/WindowManager/Jetpack/src/androidx/window/common/DeviceStateManagerFoldingFeatureProducer.java +4 −4 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package androidx.window.common; import static android.hardware.devicestate.DeviceStateManager.INVALID_DEVICE_STATE; import static android.hardware.devicestate.DeviceStateManager.INVALID_DEVICE_STATE_IDENTIFIER; import static androidx.window.common.CommonFoldingFeature.COMMON_STATE_UNKNOWN; import static androidx.window.common.CommonFoldingFeature.COMMON_STATE_USE_BASE_STATE; Loading Loading @@ -69,14 +69,14 @@ public final class DeviceStateManagerFoldingFeatureProducer * example is activated via public API and can be active in both the "open" and "half folded" * device states. */ private int mCurrentDeviceState = INVALID_DEVICE_STATE; private int mCurrentDeviceState = INVALID_DEVICE_STATE_IDENTIFIER; /** * Base device state received via * {@link DeviceStateManager.DeviceStateCallback#onBaseStateChanged(int)}. * "Base" in this context means the "physical" state of the device. */ private int mCurrentBaseDeviceState = INVALID_DEVICE_STATE; private int mCurrentBaseDeviceState = INVALID_DEVICE_STATE_IDENTIFIER; @NonNull private final RawFoldingFeatureProducer mRawFoldSupplier; Loading Loading @@ -177,7 +177,7 @@ public final class DeviceStateManagerFoldingFeatureProducer if (hasListeners()) { mRawFoldSupplier.addDataChangedCallback(this::notifyFoldingFeatureChange); } else { mCurrentDeviceState = INVALID_DEVICE_STATE; mCurrentDeviceState = INVALID_DEVICE_STATE_IDENTIFIER; mRawFoldSupplier.removeDataChangedCallback(this::notifyFoldingFeatureChange); } } Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/area/WindowAreaComponentImpl.java +8 −8 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package androidx.window.extensions.area; import static android.hardware.devicestate.DeviceStateManager.INVALID_DEVICE_STATE; import static android.hardware.devicestate.DeviceStateManager.INVALID_DEVICE_STATE_IDENTIFIER; import android.app.Activity; import android.content.Context; Loading Loading @@ -79,7 +79,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, private int mRearDisplaySessionStatus = WindowAreaComponent.SESSION_STATE_INACTIVE; @GuardedBy("mLock") private int mCurrentDeviceState = INVALID_DEVICE_STATE; private int mCurrentDeviceState = INVALID_DEVICE_STATE_IDENTIFIER; @GuardedBy("mLock") private int[] mCurrentSupportedDeviceStates; Loading Loading @@ -143,7 +143,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, mRearDisplayStatusListeners.add(consumer); // If current device state is still invalid, the initial value has not been provided. if (mCurrentDeviceState == INVALID_DEVICE_STATE) { if (mCurrentDeviceState == INVALID_DEVICE_STATE_IDENTIFIER) { return; } consumer.accept(getCurrentRearDisplayModeStatus()); Loading Loading @@ -308,7 +308,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, mRearDisplayPresentationStatusListeners.add(consumer); // If current device state is still invalid, the initial value has not been provided if (mCurrentDeviceState == INVALID_DEVICE_STATE) { if (mCurrentDeviceState == INVALID_DEVICE_STATE_IDENTIFIER) { return; } @WindowAreaStatus int currentStatus = getCurrentRearDisplayPresentationModeStatus(); Loading Loading @@ -467,7 +467,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, @GuardedBy("mLock") private int getCurrentRearDisplayModeStatus() { if (mRearDisplayState == INVALID_DEVICE_STATE) { if (mRearDisplayState == INVALID_DEVICE_STATE_IDENTIFIER) { return WindowAreaComponent.STATUS_UNSUPPORTED; } Loading Loading @@ -495,7 +495,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, @GuardedBy("mLock") private void updateRearDisplayStatusListeners(@WindowAreaStatus int windowAreaStatus) { if (mRearDisplayState == INVALID_DEVICE_STATE) { if (mRearDisplayState == INVALID_DEVICE_STATE_IDENTIFIER) { return; } synchronized (mLock) { Loading @@ -507,7 +507,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, @GuardedBy("mLock") private int getCurrentRearDisplayPresentationModeStatus() { if (mConcurrentDisplayState == INVALID_DEVICE_STATE) { if (mConcurrentDisplayState == INVALID_DEVICE_STATE_IDENTIFIER) { return WindowAreaComponent.STATUS_UNSUPPORTED; } Loading @@ -530,7 +530,7 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, @GuardedBy("mLock") private void updateRearDisplayPresentationStatusListeners( @WindowAreaStatus int windowAreaStatus) { if (mConcurrentDisplayState == INVALID_DEVICE_STATE) { if (mConcurrentDisplayState == INVALID_DEVICE_STATE_IDENTIFIER) { return; } RearDisplayPresentationStatus consumerValue = new RearDisplayPresentationStatus( Loading
services/core/java/com/android/server/devicestate/DeviceStateManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREG import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.hardware.devicestate.DeviceState.PROPERTY_POLICY_CANCEL_OVERRIDE_REQUESTS; import static android.hardware.devicestate.DeviceState.PROPERTY_POLICY_CANCEL_WHEN_REQUESTER_NOT_ON_TOP; import static android.hardware.devicestate.DeviceStateManager.INVALID_DEVICE_STATE_IDENTIFIER; import static android.hardware.devicestate.DeviceStateManager.MAXIMUM_DEVICE_STATE_IDENTIFIER; import static android.hardware.devicestate.DeviceStateManager.MINIMUM_DEVICE_STATE_IDENTIFIER; Loading Loading @@ -113,7 +114,7 @@ public final class DeviceStateManagerService extends SystemService { /** {@link DeviceState} to model an invalid device state */ // TODO(b/328314031): Investigate how we can remove this constant private static final DeviceState INVALID_DEVICE_STATE = new DeviceState( new DeviceState.Configuration.Builder(DeviceStateManager.INVALID_DEVICE_STATE, new DeviceState.Configuration.Builder(INVALID_DEVICE_STATE_IDENTIFIER, "INVALID").build()); private final Object mLock = new Object(); Loading Loading @@ -475,7 +476,7 @@ public final class DeviceStateManagerService extends SystemService { private void setRearDisplayStateLocked() { int rearDisplayIdentifier = getContext().getResources().getInteger( R.integer.config_deviceStateRearDisplay); if (rearDisplayIdentifier != INVALID_DEVICE_STATE.getIdentifier()) { if (rearDisplayIdentifier != INVALID_DEVICE_STATE_IDENTIFIER) { mRearDisplayState = mDeviceStates.get(rearDisplayIdentifier); } } Loading
services/core/java/com/android/server/devicestate/DeviceStateNotificationController.java +1 −1 Original line number Diff line number Diff line Loading @@ -323,7 +323,7 @@ class DeviceStateNotificationController extends BroadcastReceiver { for (int i = 0; i < stateIdentifiers.length; i++) { int identifier = stateIdentifiers[i]; if (identifier == DeviceStateManager.INVALID_DEVICE_STATE) { if (identifier == DeviceStateManager.INVALID_DEVICE_STATE_IDENTIFIER) { continue; } Loading