Loading core/java/android/hardware/devicestate/DeviceStateManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,22 @@ public final class DeviceStateManager { /** The maximum allowed device state identifier. */ public static final int MAXIMUM_DEVICE_STATE = 255; /** * Intent needed to launch the rear display overlay activity from SysUI * * @hide */ public static final String ACTION_SHOW_REAR_DISPLAY_OVERLAY = "com.android.intent.action.SHOW_REAR_DISPLAY_OVERLAY"; /** * Intent extra sent to the rear display overlay activity of the current base state * * @hide */ public static final String EXTRA_ORIGINAL_DEVICE_BASE_STATE = "original_device_base_state"; private final DeviceStateManagerGlobal mGlobal; /** @hide */ Loading core/java/android/hardware/devicestate/DeviceStateManagerGlobal.java +17 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ public final class DeviceStateManagerGlobal { * connection with the device state service couldn't be established. */ @Nullable static DeviceStateManagerGlobal getInstance() { public static DeviceStateManagerGlobal getInstance() { synchronized (DeviceStateManagerGlobal.class) { if (sInstance == null) { IBinder b = ServiceManager.getService(Context.DEVICE_STATE_SERVICE); Loading Loading @@ -259,6 +259,22 @@ public final class DeviceStateManagerGlobal { } } /** * Provides notification to the system server that a device state feature overlay * was dismissed. This should only be called from the {@link android.app.Activity} that * was showing the overlay corresponding to the feature. * * Validation of there being an overlay visible and pending state request is handled on the * system server. */ public void onStateRequestOverlayDismissed(boolean shouldCancelRequest) { try { mDeviceStateManager.onStateRequestOverlayDismissed(shouldCancelRequest); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } } private void registerCallbackIfNeededLocked() { if (mCallback == null) { mCallback = new DeviceStateManagerCallback(); Loading core/java/android/hardware/devicestate/IDeviceStateManager.aidl +11 −0 Original line number Diff line number Diff line Loading @@ -103,4 +103,15 @@ interface IDeviceStateManager { @JavaPassthrough(annotation= "@android.annotation.RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_STATE)") void cancelBaseStateOverride(); /** * Notifies the system service that the educational overlay that was launched * before entering a requested state was dismissed or closed, and provides * the system information on if the pairing mode should be canceled or not. * * This should only be called from the overlay itself. */ @JavaPassthrough(annotation= "@android.annotation.RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_STATE)") void onStateRequestOverlayDismissed(boolean shouldCancelRequest); } core/tests/devicestatetests/src/android/hardware/devicestate/DeviceStateManagerGlobalTest.java +5 −0 Original line number Diff line number Diff line Loading @@ -377,6 +377,11 @@ public final class DeviceStateManagerGlobalTest { notifyDeviceStateInfoChanged(); } // No-op in the test since DeviceStateManagerGlobal just calls into the system server with // no business logic around it. @Override public void onStateRequestOverlayDismissed(boolean shouldCancelMode) {} public void setSupportedStates(int[] states) { mSupportedStates = states; notifyDeviceStateInfoChanged(); Loading services/core/java/com/android/server/devicestate/DeviceState.java +10 −1 Original line number Diff line number Diff line Loading @@ -18,11 +18,11 @@ package com.android.server.devicestate; import static android.hardware.devicestate.DeviceStateManager.MAXIMUM_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.IntRange; import android.annotation.NonNull; import android.hardware.devicestate.DeviceStateManager; import com.android.internal.util.Preconditions; Loading Loading @@ -55,6 +55,15 @@ public final class DeviceState { */ public static final int FLAG_APP_INACCESSIBLE = 1 << 1; /** * Some device states can be both entered through a physical configuration as well as emulation * through {@link DeviceStateManager#requestState}, while some states can only be entered * through emulation and have no physical configuration to match. * * This flag indicates that the corresponding state can only be entered through emulation. */ public static final int FLAG_EMULATED_ONLY = 1 << 2; /** @hide */ @IntDef(prefix = {"FLAG_"}, flag = true, value = { FLAG_CANCEL_OVERRIDE_REQUESTS, Loading Loading
core/java/android/hardware/devicestate/DeviceStateManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,22 @@ public final class DeviceStateManager { /** The maximum allowed device state identifier. */ public static final int MAXIMUM_DEVICE_STATE = 255; /** * Intent needed to launch the rear display overlay activity from SysUI * * @hide */ public static final String ACTION_SHOW_REAR_DISPLAY_OVERLAY = "com.android.intent.action.SHOW_REAR_DISPLAY_OVERLAY"; /** * Intent extra sent to the rear display overlay activity of the current base state * * @hide */ public static final String EXTRA_ORIGINAL_DEVICE_BASE_STATE = "original_device_base_state"; private final DeviceStateManagerGlobal mGlobal; /** @hide */ Loading
core/java/android/hardware/devicestate/DeviceStateManagerGlobal.java +17 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ public final class DeviceStateManagerGlobal { * connection with the device state service couldn't be established. */ @Nullable static DeviceStateManagerGlobal getInstance() { public static DeviceStateManagerGlobal getInstance() { synchronized (DeviceStateManagerGlobal.class) { if (sInstance == null) { IBinder b = ServiceManager.getService(Context.DEVICE_STATE_SERVICE); Loading Loading @@ -259,6 +259,22 @@ public final class DeviceStateManagerGlobal { } } /** * Provides notification to the system server that a device state feature overlay * was dismissed. This should only be called from the {@link android.app.Activity} that * was showing the overlay corresponding to the feature. * * Validation of there being an overlay visible and pending state request is handled on the * system server. */ public void onStateRequestOverlayDismissed(boolean shouldCancelRequest) { try { mDeviceStateManager.onStateRequestOverlayDismissed(shouldCancelRequest); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } } private void registerCallbackIfNeededLocked() { if (mCallback == null) { mCallback = new DeviceStateManagerCallback(); Loading
core/java/android/hardware/devicestate/IDeviceStateManager.aidl +11 −0 Original line number Diff line number Diff line Loading @@ -103,4 +103,15 @@ interface IDeviceStateManager { @JavaPassthrough(annotation= "@android.annotation.RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_STATE)") void cancelBaseStateOverride(); /** * Notifies the system service that the educational overlay that was launched * before entering a requested state was dismissed or closed, and provides * the system information on if the pairing mode should be canceled or not. * * This should only be called from the overlay itself. */ @JavaPassthrough(annotation= "@android.annotation.RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_STATE)") void onStateRequestOverlayDismissed(boolean shouldCancelRequest); }
core/tests/devicestatetests/src/android/hardware/devicestate/DeviceStateManagerGlobalTest.java +5 −0 Original line number Diff line number Diff line Loading @@ -377,6 +377,11 @@ public final class DeviceStateManagerGlobalTest { notifyDeviceStateInfoChanged(); } // No-op in the test since DeviceStateManagerGlobal just calls into the system server with // no business logic around it. @Override public void onStateRequestOverlayDismissed(boolean shouldCancelMode) {} public void setSupportedStates(int[] states) { mSupportedStates = states; notifyDeviceStateInfoChanged(); Loading
services/core/java/com/android/server/devicestate/DeviceState.java +10 −1 Original line number Diff line number Diff line Loading @@ -18,11 +18,11 @@ package com.android.server.devicestate; import static android.hardware.devicestate.DeviceStateManager.MAXIMUM_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.IntRange; import android.annotation.NonNull; import android.hardware.devicestate.DeviceStateManager; import com.android.internal.util.Preconditions; Loading Loading @@ -55,6 +55,15 @@ public final class DeviceState { */ public static final int FLAG_APP_INACCESSIBLE = 1 << 1; /** * Some device states can be both entered through a physical configuration as well as emulation * through {@link DeviceStateManager#requestState}, while some states can only be entered * through emulation and have no physical configuration to match. * * This flag indicates that the corresponding state can only be entered through emulation. */ public static final int FLAG_EMULATED_ONLY = 1 << 2; /** @hide */ @IntDef(prefix = {"FLAG_"}, flag = true, value = { FLAG_CANCEL_OVERRIDE_REQUESTS, Loading