Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16a1cf4b authored by Kenneth Ford's avatar Kenneth Ford
Browse files

Rename DeviceStateManager#INVALID_DEVICE_STATE_IDENTIFIER

Bug: 293636629
Test: Build
Change-Id: I8edf60fc393cb0dc8ab66d1393c0220fd4105d52
parent aec75f67
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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.
+4 −4
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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);
        }
    }
+8 −8
Original line number Diff line number Diff line
@@ -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;
@@ -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;

@@ -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());
@@ -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();
@@ -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;
        }

@@ -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) {
@@ -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;
        }

@@ -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(
+3 −2
Original line number Diff line number Diff line
@@ -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;

@@ -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();
@@ -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);
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -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