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

Commit f440a0b1 authored by Ben Lin's avatar Ben Lin Committed by Automerger Merge Worker
Browse files

Merge "Add Activity#onPictureInPictureUiStateChanged and...

Merge "Add Activity#onPictureInPictureUiStateChanged and PictureInPictureUiState." into sc-dev am: 6e6e6b51

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13988447

Change-Id: Ic50543002ab0bb068e6b2b537ac4244cac65d7a6
parents 73c0925b 6e6e6b51
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -4023,6 +4023,7 @@ package android.app {
    method public void onPictureInPictureModeChanged(boolean, android.content.res.Configuration);
    method @Deprecated public void onPictureInPictureModeChanged(boolean);
    method public boolean onPictureInPictureRequested();
    method public void onPictureInPictureUiStateChanged(@NonNull android.app.PictureInPictureUiState);
    method @CallSuper protected void onPostCreate(@Nullable android.os.Bundle);
    method public void onPostCreate(@Nullable android.os.Bundle, @Nullable android.os.PersistableBundle);
    method @CallSuper protected void onPostResume();
@@ -6415,6 +6416,13 @@ package android.app {
    method public android.app.PictureInPictureParams.Builder setSourceRectHint(android.graphics.Rect);
  }
  public final class PictureInPictureUiState implements android.os.Parcelable {
    method public int describeContents();
    method public boolean isStashed();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.PictureInPictureUiState> CREATOR;
  }
  public class Presentation extends android.app.Dialog {
    ctor public Presentation(android.content.Context, android.view.Display);
    ctor public Presentation(android.content.Context, android.view.Display, int);
+4 −0
Original line number Diff line number Diff line
@@ -347,6 +347,10 @@ package android.app {
    method public boolean isSeamlessResizeEnabled();
  }

  public final class PictureInPictureUiState implements android.os.Parcelable {
    ctor public PictureInPictureUiState(boolean);
  }

  public class StatusBarManager {
    method public void clickNotification(@Nullable String, int, int, boolean);
    method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void collapsePanels();
+23 −0
Original line number Diff line number Diff line
@@ -2812,6 +2812,29 @@ public class Activity extends ContextThemeWrapper
        onPictureInPictureModeChanged(isInPictureInPictureMode);
    }

    /**
     * Called by the system when the activity is in PiP and has state changes.
     *
     * Compare to {@link #onPictureInPictureModeChanged(boolean, Configuration)}, which is only
     * called when PiP mode changes (meaning, enters or exits PiP), this can be called at any time
     * while the activity is in PiP mode. Therefore, all invocation can only happen after
     * {@link #onPictureInPictureModeChanged(boolean, Configuration)} is called with true, and
     * before {@link #onPictureInPictureModeChanged(boolean, Configuration)} is called with false.
     * You would not need to worry about cases where this is called and the activity is not in
     * Picture-In-Picture mode. For managing cases where the activity enters/exits
     * Picture-in-Picture (e.g. resources clean-up on exit), use
     * {@link #onPictureInPictureModeChanged(boolean, Configuration)}.
     *
     * The default state is everything declared in {@link PictureInPictureUiState} is false, such as
     * {@link PictureInPictureUiState#isStashed()}.
     *
     * @param pipState the new Picture-in-Picture state.
     */
    public void onPictureInPictureUiStateChanged(@NonNull PictureInPictureUiState pipState) {
        // Left deliberately empty. There should be no side effects if a direct
        // subclass of Activity does not call super.
    }

    /**
     * Called by the system when the activity changes to and from picture-in-picture mode.
     *
+6 −0
Original line number Diff line number Diff line
@@ -3999,6 +3999,12 @@ public final class ActivityThread extends ClientTransactionHandler
        }
    }

    @Override
    public void handlePictureInPictureStateChanged(@NonNull ActivityClientRecord r,
            PictureInPictureUiState pipState) {
        r.activity.onPictureInPictureUiStateChanged(pipState);
    }

    /**
     * Register a splash screen manager to this process.
     */
+4 −0
Original line number Diff line number Diff line
@@ -159,6 +159,10 @@ public abstract class ClientTransactionHandler {
    /** Request that an activity enter picture-in-picture. */
    public abstract void handlePictureInPictureRequested(@NonNull ActivityClientRecord r);

    /** Signal to an activity (that is currently in PiP) of PiP state changes. */
    public abstract void handlePictureInPictureStateChanged(@NonNull ActivityClientRecord r,
            PictureInPictureUiState pipState);

    /** Whether the activity want to handle splash screen exit animation */
    public abstract boolean isHandleSplashScreenExit(@NonNull IBinder token);

Loading