Loading core/java/android/window/KeyguardState.aidl 0 → 100644 +22 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.window; /** * @hide */ parcelable KeyguardState; core/java/android/window/KeyguardState.java 0 → 100644 +160 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.window; import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; import java.util.Objects; /** * Data object of params for Keyguard related {@link WindowContainerTransaction} operation. * * @hide */ public final class KeyguardState implements Parcelable { private final int mDisplayId; private final boolean mKeyguardShowing; private final boolean mAodShowing; private KeyguardState(int displayId, boolean keyguardShowing, boolean aodShowing) { mDisplayId = displayId; mKeyguardShowing = keyguardShowing; mAodShowing = aodShowing; } private KeyguardState(Parcel in) { mDisplayId = in.readInt(); mKeyguardShowing = in.readBoolean(); mAodShowing = in.readBoolean(); } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeInt(mDisplayId); dest.writeBoolean(mKeyguardShowing); dest.writeBoolean(mAodShowing); } @NonNull public static final Creator<KeyguardState> CREATOR = new Creator<KeyguardState>() { @Override public KeyguardState createFromParcel(Parcel in) { return new KeyguardState(in); } @Override public KeyguardState[] newArray(int size) { return new KeyguardState[size]; } }; /** * Gets the display id of this {@link KeyguardState}. */ public int getDisplayId() { return mDisplayId; } /** Returns the keyguard showing value. */ public boolean getKeyguardShowing() { return mKeyguardShowing; } /** Returns the aod showing value. */ public boolean getAodShowing() { return mAodShowing; } @Override public String toString() { return "KeyguardState{ displayId=" + mDisplayId + ", keyguardShowing=" + mKeyguardShowing + ", aodShowing=" + mAodShowing + '}'; } @Override public int hashCode() { return Objects.hash(mDisplayId, mKeyguardShowing, mAodShowing); } @Override public boolean equals(@Nullable Object obj) { if (!(obj instanceof KeyguardState other)) { return false; } return mDisplayId == other.mDisplayId && mKeyguardShowing == other.mKeyguardShowing && mAodShowing == other.mAodShowing; } @Override public int describeContents() { return 0; } /** Builder to construct the {@link KeyguardState}. */ public static final class Builder { private final int mDisplayId; private boolean mKeyguardShowing; private boolean mAodShowing; /** * @param displayId the display of this {@link KeyguardState}. */ public Builder(int displayId) { mDisplayId = displayId; } /** * Sets the boolean value for this operation. */ @NonNull public Builder setKeyguardShowing(boolean keyguardShowing) { mKeyguardShowing = keyguardShowing; return this; } /** * Sets the boolean value for this operation. */ @NonNull public Builder setAodShowing(boolean aodShowing) { mAodShowing = aodShowing; return this; } /** * Constructs the {@link KeyguardState}. */ @NonNull public KeyguardState build() { return new KeyguardState(mDisplayId, mKeyguardShowing, mAodShowing); } } } core/java/android/window/WindowContainerTransaction.java +43 −0 Original line number Diff line number Diff line Loading @@ -868,6 +868,24 @@ public final class WindowContainerTransaction implements Parcelable { return this; } /** * Adds a {@link KeyguardState} to apply to the given displays. * * @hide */ @NonNull public WindowContainerTransaction addKeyguardState( @NonNull KeyguardState keyguardState) { Objects.requireNonNull(keyguardState); final HierarchyOp hierarchyOp = new HierarchyOp.Builder( HierarchyOp.HIERARCHY_OP_TYPE_SET_KEYGUARD_STATE) .setKeyguardState(keyguardState) .build(); mHierarchyOps.add(hierarchyOp); return this; } /** * Sets/removes the always on top flag for this {@code windowContainer}. See * {@link com.android.server.wm.ConfigurationContainer#setAlwaysOnTop(boolean)}. Loading Loading @@ -1469,6 +1487,7 @@ public final class WindowContainerTransaction implements Parcelable { public static final int HIERARCHY_OP_TYPE_SET_IS_TRIMMABLE = 19; public static final int HIERARCHY_OP_TYPE_RESTORE_BACK_NAVIGATION = 20; public static final int HIERARCHY_OP_TYPE_SET_EXCLUDE_INSETS_TYPES = 21; public static final int HIERARCHY_OP_TYPE_SET_KEYGUARD_STATE = 22; // The following key(s) are for use with mLaunchOptions: // When launching a task (eg. from recents), this is the taskId to be launched. Loading Loading @@ -1515,6 +1534,9 @@ public final class WindowContainerTransaction implements Parcelable { @Nullable private TaskFragmentOperation mTaskFragmentOperation; @Nullable private KeyguardState mKeyguardState; @Nullable private PendingIntent mPendingIntent; Loading Loading @@ -1666,6 +1688,7 @@ public final class WindowContainerTransaction implements Parcelable { mLaunchOptions = copy.mLaunchOptions; mActivityIntent = copy.mActivityIntent; mTaskFragmentOperation = copy.mTaskFragmentOperation; mKeyguardState = copy.mKeyguardState; mPendingIntent = copy.mPendingIntent; mShortcutInfo = copy.mShortcutInfo; mAlwaysOnTop = copy.mAlwaysOnTop; Loading @@ -1689,6 +1712,7 @@ public final class WindowContainerTransaction implements Parcelable { mLaunchOptions = in.readBundle(); mActivityIntent = in.readTypedObject(Intent.CREATOR); mTaskFragmentOperation = in.readTypedObject(TaskFragmentOperation.CREATOR); mKeyguardState = in.readTypedObject(KeyguardState.CREATOR); mPendingIntent = in.readTypedObject(PendingIntent.CREATOR); mShortcutInfo = in.readTypedObject(ShortcutInfo.CREATOR); mAlwaysOnTop = in.readBoolean(); Loading Loading @@ -1769,6 +1793,11 @@ public final class WindowContainerTransaction implements Parcelable { return mTaskFragmentOperation; } @Nullable public KeyguardState getKeyguardState() { return mKeyguardState; } @Nullable public PendingIntent getPendingIntent() { return mPendingIntent; Loading Loading @@ -1902,6 +1931,9 @@ public final class WindowContainerTransaction implements Parcelable { .append(" mExcludeInsetsTypes= ") .append(WindowInsets.Type.toString(mExcludeInsetsTypes)); break; case HIERARCHY_OP_TYPE_SET_KEYGUARD_STATE: sb.append("KeyguardState= ").append(mKeyguardState); break; case HIERARCHY_OP_TYPE_SET_IS_TRIMMABLE: sb.append("container= ").append(mContainer) .append(" isTrimmable= ") Loading Loading @@ -1932,6 +1964,7 @@ public final class WindowContainerTransaction implements Parcelable { dest.writeBundle(mLaunchOptions); dest.writeTypedObject(mActivityIntent, flags); dest.writeTypedObject(mTaskFragmentOperation, flags); dest.writeTypedObject(mKeyguardState, flags); dest.writeTypedObject(mPendingIntent, flags); dest.writeTypedObject(mShortcutInfo, flags); dest.writeBoolean(mAlwaysOnTop); Loading Loading @@ -1992,6 +2025,9 @@ public final class WindowContainerTransaction implements Parcelable { @Nullable private TaskFragmentOperation mTaskFragmentOperation; @Nullable private KeyguardState mKeyguardState; @Nullable private PendingIntent mPendingIntent; Loading Loading @@ -2081,6 +2117,12 @@ public final class WindowContainerTransaction implements Parcelable { return this; } Builder setKeyguardState( @Nullable KeyguardState keyguardState) { mKeyguardState = keyguardState; return this; } Builder setReparentLeafTaskIfRelaunch(boolean reparentLeafTaskIfRelaunch) { mReparentLeafTaskIfRelaunch = reparentLeafTaskIfRelaunch; return this; Loading Loading @@ -2130,6 +2172,7 @@ public final class WindowContainerTransaction implements Parcelable { hierarchyOp.mPendingIntent = mPendingIntent; hierarchyOp.mAlwaysOnTop = mAlwaysOnTop; hierarchyOp.mTaskFragmentOperation = mTaskFragmentOperation; hierarchyOp.mKeyguardState = mKeyguardState; hierarchyOp.mShortcutInfo = mShortcutInfo; hierarchyOp.mBounds = mBounds; hierarchyOp.mIncludingParents = mIncludingParents; Loading libs/WindowManager/Shell/src/com/android/wm/shell/keyguard/KeyguardTransitionHandler.java +16 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_LOCKED; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_OCCLUDING; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_UNOCCLUDING; import static android.view.WindowManager.TRANSIT_SLEEP; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static com.android.wm.shell.shared.TransitionUtil.isOpeningType; Loading @@ -44,6 +46,7 @@ import android.view.SurfaceControl; import android.view.WindowManager; import android.window.IRemoteTransition; import android.window.IRemoteTransitionFinishedCallback; import android.window.KeyguardState; import android.window.TransitionInfo; import android.window.TransitionRequestInfo; import android.window.WindowContainerToken; Loading Loading @@ -388,5 +391,18 @@ public class KeyguardTransitionHandler mMainExecutor.execute(() -> mIsLaunchingActivityOverLockscreen = isLaunchingActivityOverLockscreen); } @Override public void startKeyguardTransition(boolean keyguardShowing, boolean aodShowing) { final WindowContainerTransaction wct = new WindowContainerTransaction(); final KeyguardState keyguardState = new KeyguardState.Builder(android.view.Display.DEFAULT_DISPLAY) .setKeyguardShowing(keyguardShowing).setAodShowing(aodShowing).build(); wct.addKeyguardState(keyguardState); mMainExecutor.execute(() -> { mTransitions.startTransition(keyguardShowing ? TRANSIT_TO_FRONT : TRANSIT_TO_BACK, wct, KeyguardTransitionHandler.this); }); } } } libs/WindowManager/Shell/src/com/android/wm/shell/keyguard/KeyguardTransitions.java +7 −0 Original line number Diff line number Diff line Loading @@ -44,4 +44,11 @@ public interface KeyguardTransitions { * Notify whether keyguard has created a remote animation runner for next app launch. */ default void setLaunchingActivityOverLockscreen(boolean isLaunchingActivityOverLockscreen) {} /** * Notifies Shell to start a keyguard transition directly. * @param keyguardShowing whether keyguard is showing or not. * @param aodShowing whether aod is showing or not. */ default void startKeyguardTransition(boolean keyguardShowing, boolean aodShowing) {} } Loading
core/java/android/window/KeyguardState.aidl 0 → 100644 +22 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.window; /** * @hide */ parcelable KeyguardState;
core/java/android/window/KeyguardState.java 0 → 100644 +160 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.window; import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; import java.util.Objects; /** * Data object of params for Keyguard related {@link WindowContainerTransaction} operation. * * @hide */ public final class KeyguardState implements Parcelable { private final int mDisplayId; private final boolean mKeyguardShowing; private final boolean mAodShowing; private KeyguardState(int displayId, boolean keyguardShowing, boolean aodShowing) { mDisplayId = displayId; mKeyguardShowing = keyguardShowing; mAodShowing = aodShowing; } private KeyguardState(Parcel in) { mDisplayId = in.readInt(); mKeyguardShowing = in.readBoolean(); mAodShowing = in.readBoolean(); } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeInt(mDisplayId); dest.writeBoolean(mKeyguardShowing); dest.writeBoolean(mAodShowing); } @NonNull public static final Creator<KeyguardState> CREATOR = new Creator<KeyguardState>() { @Override public KeyguardState createFromParcel(Parcel in) { return new KeyguardState(in); } @Override public KeyguardState[] newArray(int size) { return new KeyguardState[size]; } }; /** * Gets the display id of this {@link KeyguardState}. */ public int getDisplayId() { return mDisplayId; } /** Returns the keyguard showing value. */ public boolean getKeyguardShowing() { return mKeyguardShowing; } /** Returns the aod showing value. */ public boolean getAodShowing() { return mAodShowing; } @Override public String toString() { return "KeyguardState{ displayId=" + mDisplayId + ", keyguardShowing=" + mKeyguardShowing + ", aodShowing=" + mAodShowing + '}'; } @Override public int hashCode() { return Objects.hash(mDisplayId, mKeyguardShowing, mAodShowing); } @Override public boolean equals(@Nullable Object obj) { if (!(obj instanceof KeyguardState other)) { return false; } return mDisplayId == other.mDisplayId && mKeyguardShowing == other.mKeyguardShowing && mAodShowing == other.mAodShowing; } @Override public int describeContents() { return 0; } /** Builder to construct the {@link KeyguardState}. */ public static final class Builder { private final int mDisplayId; private boolean mKeyguardShowing; private boolean mAodShowing; /** * @param displayId the display of this {@link KeyguardState}. */ public Builder(int displayId) { mDisplayId = displayId; } /** * Sets the boolean value for this operation. */ @NonNull public Builder setKeyguardShowing(boolean keyguardShowing) { mKeyguardShowing = keyguardShowing; return this; } /** * Sets the boolean value for this operation. */ @NonNull public Builder setAodShowing(boolean aodShowing) { mAodShowing = aodShowing; return this; } /** * Constructs the {@link KeyguardState}. */ @NonNull public KeyguardState build() { return new KeyguardState(mDisplayId, mKeyguardShowing, mAodShowing); } } }
core/java/android/window/WindowContainerTransaction.java +43 −0 Original line number Diff line number Diff line Loading @@ -868,6 +868,24 @@ public final class WindowContainerTransaction implements Parcelable { return this; } /** * Adds a {@link KeyguardState} to apply to the given displays. * * @hide */ @NonNull public WindowContainerTransaction addKeyguardState( @NonNull KeyguardState keyguardState) { Objects.requireNonNull(keyguardState); final HierarchyOp hierarchyOp = new HierarchyOp.Builder( HierarchyOp.HIERARCHY_OP_TYPE_SET_KEYGUARD_STATE) .setKeyguardState(keyguardState) .build(); mHierarchyOps.add(hierarchyOp); return this; } /** * Sets/removes the always on top flag for this {@code windowContainer}. See * {@link com.android.server.wm.ConfigurationContainer#setAlwaysOnTop(boolean)}. Loading Loading @@ -1469,6 +1487,7 @@ public final class WindowContainerTransaction implements Parcelable { public static final int HIERARCHY_OP_TYPE_SET_IS_TRIMMABLE = 19; public static final int HIERARCHY_OP_TYPE_RESTORE_BACK_NAVIGATION = 20; public static final int HIERARCHY_OP_TYPE_SET_EXCLUDE_INSETS_TYPES = 21; public static final int HIERARCHY_OP_TYPE_SET_KEYGUARD_STATE = 22; // The following key(s) are for use with mLaunchOptions: // When launching a task (eg. from recents), this is the taskId to be launched. Loading Loading @@ -1515,6 +1534,9 @@ public final class WindowContainerTransaction implements Parcelable { @Nullable private TaskFragmentOperation mTaskFragmentOperation; @Nullable private KeyguardState mKeyguardState; @Nullable private PendingIntent mPendingIntent; Loading Loading @@ -1666,6 +1688,7 @@ public final class WindowContainerTransaction implements Parcelable { mLaunchOptions = copy.mLaunchOptions; mActivityIntent = copy.mActivityIntent; mTaskFragmentOperation = copy.mTaskFragmentOperation; mKeyguardState = copy.mKeyguardState; mPendingIntent = copy.mPendingIntent; mShortcutInfo = copy.mShortcutInfo; mAlwaysOnTop = copy.mAlwaysOnTop; Loading @@ -1689,6 +1712,7 @@ public final class WindowContainerTransaction implements Parcelable { mLaunchOptions = in.readBundle(); mActivityIntent = in.readTypedObject(Intent.CREATOR); mTaskFragmentOperation = in.readTypedObject(TaskFragmentOperation.CREATOR); mKeyguardState = in.readTypedObject(KeyguardState.CREATOR); mPendingIntent = in.readTypedObject(PendingIntent.CREATOR); mShortcutInfo = in.readTypedObject(ShortcutInfo.CREATOR); mAlwaysOnTop = in.readBoolean(); Loading Loading @@ -1769,6 +1793,11 @@ public final class WindowContainerTransaction implements Parcelable { return mTaskFragmentOperation; } @Nullable public KeyguardState getKeyguardState() { return mKeyguardState; } @Nullable public PendingIntent getPendingIntent() { return mPendingIntent; Loading Loading @@ -1902,6 +1931,9 @@ public final class WindowContainerTransaction implements Parcelable { .append(" mExcludeInsetsTypes= ") .append(WindowInsets.Type.toString(mExcludeInsetsTypes)); break; case HIERARCHY_OP_TYPE_SET_KEYGUARD_STATE: sb.append("KeyguardState= ").append(mKeyguardState); break; case HIERARCHY_OP_TYPE_SET_IS_TRIMMABLE: sb.append("container= ").append(mContainer) .append(" isTrimmable= ") Loading Loading @@ -1932,6 +1964,7 @@ public final class WindowContainerTransaction implements Parcelable { dest.writeBundle(mLaunchOptions); dest.writeTypedObject(mActivityIntent, flags); dest.writeTypedObject(mTaskFragmentOperation, flags); dest.writeTypedObject(mKeyguardState, flags); dest.writeTypedObject(mPendingIntent, flags); dest.writeTypedObject(mShortcutInfo, flags); dest.writeBoolean(mAlwaysOnTop); Loading Loading @@ -1992,6 +2025,9 @@ public final class WindowContainerTransaction implements Parcelable { @Nullable private TaskFragmentOperation mTaskFragmentOperation; @Nullable private KeyguardState mKeyguardState; @Nullable private PendingIntent mPendingIntent; Loading Loading @@ -2081,6 +2117,12 @@ public final class WindowContainerTransaction implements Parcelable { return this; } Builder setKeyguardState( @Nullable KeyguardState keyguardState) { mKeyguardState = keyguardState; return this; } Builder setReparentLeafTaskIfRelaunch(boolean reparentLeafTaskIfRelaunch) { mReparentLeafTaskIfRelaunch = reparentLeafTaskIfRelaunch; return this; Loading Loading @@ -2130,6 +2172,7 @@ public final class WindowContainerTransaction implements Parcelable { hierarchyOp.mPendingIntent = mPendingIntent; hierarchyOp.mAlwaysOnTop = mAlwaysOnTop; hierarchyOp.mTaskFragmentOperation = mTaskFragmentOperation; hierarchyOp.mKeyguardState = mKeyguardState; hierarchyOp.mShortcutInfo = mShortcutInfo; hierarchyOp.mBounds = mBounds; hierarchyOp.mIncludingParents = mIncludingParents; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/keyguard/KeyguardTransitionHandler.java +16 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_LOCKED; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_OCCLUDING; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_UNOCCLUDING; import static android.view.WindowManager.TRANSIT_SLEEP; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static com.android.wm.shell.shared.TransitionUtil.isOpeningType; Loading @@ -44,6 +46,7 @@ import android.view.SurfaceControl; import android.view.WindowManager; import android.window.IRemoteTransition; import android.window.IRemoteTransitionFinishedCallback; import android.window.KeyguardState; import android.window.TransitionInfo; import android.window.TransitionRequestInfo; import android.window.WindowContainerToken; Loading Loading @@ -388,5 +391,18 @@ public class KeyguardTransitionHandler mMainExecutor.execute(() -> mIsLaunchingActivityOverLockscreen = isLaunchingActivityOverLockscreen); } @Override public void startKeyguardTransition(boolean keyguardShowing, boolean aodShowing) { final WindowContainerTransaction wct = new WindowContainerTransaction(); final KeyguardState keyguardState = new KeyguardState.Builder(android.view.Display.DEFAULT_DISPLAY) .setKeyguardShowing(keyguardShowing).setAodShowing(aodShowing).build(); wct.addKeyguardState(keyguardState); mMainExecutor.execute(() -> { mTransitions.startTransition(keyguardShowing ? TRANSIT_TO_FRONT : TRANSIT_TO_BACK, wct, KeyguardTransitionHandler.this); }); } } }
libs/WindowManager/Shell/src/com/android/wm/shell/keyguard/KeyguardTransitions.java +7 −0 Original line number Diff line number Diff line Loading @@ -44,4 +44,11 @@ public interface KeyguardTransitions { * Notify whether keyguard has created a remote animation runner for next app launch. */ default void setLaunchingActivityOverLockscreen(boolean isLaunchingActivityOverLockscreen) {} /** * Notifies Shell to start a keyguard transition directly. * @param keyguardShowing whether keyguard is showing or not. * @param aodShowing whether aod is showing or not. */ default void startKeyguardTransition(boolean keyguardShowing, boolean aodShowing) {} }