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

Commit 5fb5881d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Adding support for PIP actions."

parents 0a5aeecf a29eb98d
Loading
Loading
Loading
Loading
+18 −0
Original line number Original line Diff line number Diff line
@@ -3657,6 +3657,7 @@ package android.app {
    method public void setIntent(android.content.Intent);
    method public void setIntent(android.content.Intent);
    method public final void setMediaController(android.media.session.MediaController);
    method public final void setMediaController(android.media.session.MediaController);
    method public void setOverlayWithDecorCaptionEnabled(boolean);
    method public void setOverlayWithDecorCaptionEnabled(boolean);
    method public void setPictureInPictureActions(java.util.List<android.app.RemoteAction>);
    method public void setPictureInPictureAspectRatio(float);
    method public void setPictureInPictureAspectRatio(float);
    method public final deprecated void setProgress(int);
    method public final deprecated void setProgress(int);
    method public final deprecated void setProgressBarIndeterminate(boolean);
    method public final deprecated void setProgressBarIndeterminate(boolean);
@@ -3737,6 +3738,7 @@ package android.app {
    method public int getLauncherLargeIconDensity();
    method public int getLauncherLargeIconDensity();
    method public int getLauncherLargeIconSize();
    method public int getLauncherLargeIconSize();
    method public int getLockTaskModeState();
    method public int getLockTaskModeState();
    method public static int getMaxNumPictureInPictureActions();
    method public int getMemoryClass();
    method public int getMemoryClass();
    method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo);
    method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo);
    method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo);
    method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo);
@@ -5547,6 +5549,22 @@ package android.app {
    field public static final int STYLE_SPINNER = 0; // 0x0
    field public static final int STYLE_SPINNER = 0; // 0x0
  }
  }
  public final class RemoteAction implements android.os.Parcelable {
    ctor public RemoteAction(android.graphics.drawable.Icon, java.lang.CharSequence, java.lang.CharSequence, android.app.RemoteAction.OnActionListener);
    method public android.app.RemoteAction clone();
    method public int describeContents();
    method public void dump(java.lang.String, java.io.PrintWriter);
    method public java.lang.CharSequence getContentDescription();
    method public android.graphics.drawable.Icon getIcon();
    method public java.lang.CharSequence getTitle();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR;
  }
  public static abstract interface RemoteAction.OnActionListener {
    method public abstract void onAction(android.app.RemoteAction);
  }
  public final class RemoteInput implements android.os.Parcelable {
  public final class RemoteInput implements android.os.Parcelable {
    method public static void addResultsToIntent(android.app.RemoteInput[], android.content.Intent, android.os.Bundle);
    method public static void addResultsToIntent(android.app.RemoteInput[], android.content.Intent, android.os.Bundle);
    method public int describeContents();
    method public int describeContents();
+18 −0
Original line number Original line Diff line number Diff line
@@ -3776,6 +3776,7 @@ package android.app {
    method public void setIntent(android.content.Intent);
    method public void setIntent(android.content.Intent);
    method public final void setMediaController(android.media.session.MediaController);
    method public final void setMediaController(android.media.session.MediaController);
    method public void setOverlayWithDecorCaptionEnabled(boolean);
    method public void setOverlayWithDecorCaptionEnabled(boolean);
    method public void setPictureInPictureActions(java.util.List<android.app.RemoteAction>);
    method public void setPictureInPictureAspectRatio(float);
    method public void setPictureInPictureAspectRatio(float);
    method public final deprecated void setProgress(int);
    method public final deprecated void setProgress(int);
    method public final deprecated void setProgressBarIndeterminate(boolean);
    method public final deprecated void setProgressBarIndeterminate(boolean);
@@ -3862,6 +3863,7 @@ package android.app {
    method public int getLauncherLargeIconDensity();
    method public int getLauncherLargeIconDensity();
    method public int getLauncherLargeIconSize();
    method public int getLauncherLargeIconSize();
    method public int getLockTaskModeState();
    method public int getLockTaskModeState();
    method public static int getMaxNumPictureInPictureActions();
    method public int getMemoryClass();
    method public int getMemoryClass();
    method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo);
    method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo);
    method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo);
    method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo);
@@ -5715,6 +5717,22 @@ package android.app {
    field public static final int STYLE_SPINNER = 0; // 0x0
    field public static final int STYLE_SPINNER = 0; // 0x0
  }
  }
  public final class RemoteAction implements android.os.Parcelable {
    ctor public RemoteAction(android.graphics.drawable.Icon, java.lang.CharSequence, java.lang.CharSequence, android.app.RemoteAction.OnActionListener);
    method public android.app.RemoteAction clone();
    method public int describeContents();
    method public void dump(java.lang.String, java.io.PrintWriter);
    method public java.lang.CharSequence getContentDescription();
    method public android.graphics.drawable.Icon getIcon();
    method public java.lang.CharSequence getTitle();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR;
  }
  public static abstract interface RemoteAction.OnActionListener {
    method public abstract void onAction(android.app.RemoteAction);
  }
  public final class RemoteInput implements android.os.Parcelable {
  public final class RemoteInput implements android.os.Parcelable {
    method public static void addResultsToIntent(android.app.RemoteInput[], android.content.Intent, android.os.Bundle);
    method public static void addResultsToIntent(android.app.RemoteInput[], android.content.Intent, android.os.Bundle);
    method public int describeContents();
    method public int describeContents();
+18 −0
Original line number Original line Diff line number Diff line
@@ -3659,6 +3659,7 @@ package android.app {
    method public void setIntent(android.content.Intent);
    method public void setIntent(android.content.Intent);
    method public final void setMediaController(android.media.session.MediaController);
    method public final void setMediaController(android.media.session.MediaController);
    method public void setOverlayWithDecorCaptionEnabled(boolean);
    method public void setOverlayWithDecorCaptionEnabled(boolean);
    method public void setPictureInPictureActions(java.util.List<android.app.RemoteAction>);
    method public void setPictureInPictureAspectRatio(float);
    method public void setPictureInPictureAspectRatio(float);
    method public final deprecated void setProgress(int);
    method public final deprecated void setProgress(int);
    method public final deprecated void setProgressBarIndeterminate(boolean);
    method public final deprecated void setProgressBarIndeterminate(boolean);
@@ -3740,6 +3741,7 @@ package android.app {
    method public int getLauncherLargeIconDensity();
    method public int getLauncherLargeIconDensity();
    method public int getLauncherLargeIconSize();
    method public int getLauncherLargeIconSize();
    method public int getLockTaskModeState();
    method public int getLockTaskModeState();
    method public static int getMaxNumPictureInPictureActions();
    method public int getMemoryClass();
    method public int getMemoryClass();
    method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo);
    method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo);
    method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo);
    method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo);
@@ -5558,6 +5560,22 @@ package android.app {
    field public static final int STYLE_SPINNER = 0; // 0x0
    field public static final int STYLE_SPINNER = 0; // 0x0
  }
  }
  public final class RemoteAction implements android.os.Parcelable {
    ctor public RemoteAction(android.graphics.drawable.Icon, java.lang.CharSequence, java.lang.CharSequence, android.app.RemoteAction.OnActionListener);
    method public android.app.RemoteAction clone();
    method public int describeContents();
    method public void dump(java.lang.String, java.io.PrintWriter);
    method public java.lang.CharSequence getContentDescription();
    method public android.graphics.drawable.Icon getIcon();
    method public java.lang.CharSequence getTitle();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR;
  }
  public static abstract interface RemoteAction.OnActionListener {
    method public abstract void onAction(android.app.RemoteAction);
  }
  public final class RemoteInput implements android.os.Parcelable {
  public final class RemoteInput implements android.os.Parcelable {
    method public static void addResultsToIntent(android.app.RemoteInput[], android.content.Intent, android.os.Bundle);
    method public static void addResultsToIntent(android.app.RemoteInput[], android.content.Intent, android.os.Bundle);
    method public int describeContents();
    method public int describeContents();
+34 −15
Original line number Original line Diff line number Diff line
@@ -45,6 +45,7 @@ import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ParceledListSlice;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.TypedArray;
@@ -2019,7 +2020,29 @@ public class Activity extends ContextThemeWrapper
    }
    }


    /**
    /**
     * Updates the aspect ratio of the current picture-in-picture activity.
     * Requests to the system that the activity can be automatically put into picture-in-picture
     * mode when the user leaves the activity causing it normally to be hidden.  Generally, this
     * happens when another task is brought to the forground or the task containing this activity
     * is moved to the background.  This is a *not* a guarantee that the activity will actually be
     * put in picture-in-picture mode, and depends on a number of factors, including whether there
     * is already something in picture-in-picture.
     *
     * @param enterPictureInPictureOnMoveToBg whether or not this activity can automatically enter
     *                                        picture-in-picture
     */
    public void enterPictureInPictureModeOnMoveToBackground(
            boolean enterPictureInPictureOnMoveToBg) {
        try {
            ActivityManagerNative.getDefault().enterPictureInPictureModeOnMoveToBackground(mToken,
                    enterPictureInPictureOnMoveToBg);
        } catch (RemoteException e) {
        }
    }

    /**
     * Updates the aspect ratio of the current picture-in-picture activity if this activity is
     * already in picture-in-picture mode, or sets it to be used later if
     * {@link #enterPictureInPictureModeOnMoveToBackground(boolean)} is requested.
     *
     *
     * @param aspectRatio the new aspect ratio of the picture-in-picture.
     * @param aspectRatio the new aspect ratio of the picture-in-picture.
     */
     */
@@ -2031,23 +2054,19 @@ public class Activity extends ContextThemeWrapper
    }
    }


    /**
    /**
     * Requests to the system that the activity can be automatically put into picture-in-picture
     * Updates the set of user actions associated with the picture-in-picture activity.
     * mode when the user leaves the activity causing it normally to be hidden.  This is a *not*
     * a guarantee that the activity will actually be put in picture-in-picture mode, and depends
     * on a number of factors, including whether there is already something in picture-in-picture.
     *
     * If {@param enterPictureInPictureOnMoveToBg} is true, then you may also call
     * {@link #setPictureInPictureAspectRatio(float)} to specify the aspect ratio to automatically
     * enter picture-in-picture with.
     *
     *
     * @param enterPictureInPictureOnMoveToBg whether or not this activity can automatically enter
     * @param actions the new actions for picture-in-picture (can be null to reset the set of
     *                                     picture-in-picture
     *                actions).  The maximum number of actions that will be displayed on this device
     *                is defined by {@link ActivityManager#getMaxNumPictureInPictureActions()}.
     */
     */
    public void enterPictureInPictureModeOnMoveToBackground(
    public void setPictureInPictureActions(List<RemoteAction> actions) {
            boolean enterPictureInPictureOnMoveToBg) {
        try {
        try {
            ActivityManagerNative.getDefault().enterPictureInPictureModeOnMoveToBackground(mToken,
            if (actions == null) {
                    enterPictureInPictureOnMoveToBg);
                actions = new ArrayList<>();
            }
            ActivityManagerNative.getDefault().setPictureInPictureActions(mToken,
                    new ParceledListSlice<RemoteAction>(actions));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
        }
        }
    }
    }
+10 −2
Original line number Original line Diff line number Diff line
@@ -87,8 +87,9 @@ public class ActivityManager {


    private static int gMaxRecentTasks = -1;
    private static int gMaxRecentTasks = -1;


    private static final int NUM_ALLOWED_PIP_ACTIONS = 3;

    private final Context mContext;
    private final Context mContext;
    private final Handler mHandler;


    private static volatile boolean sSystemReady = false;
    private static volatile boolean sSystemReady = false;


@@ -491,7 +492,6 @@ public class ActivityManager {


    /*package*/ ActivityManager(Context context, Handler handler) {
    /*package*/ ActivityManager(Context context, Handler handler) {
        mContext = context;
        mContext = context;
        mHandler = handler;
    }
    }


    /**
    /**
@@ -1011,6 +1011,14 @@ public class ActivityManager {
                    com.android.internal.R.bool.config_supportsSplitScreenMultiWindow);
                    com.android.internal.R.bool.config_supportsSplitScreenMultiWindow);
    }
    }


    /**
     * Return the maximum number of actions that will be displayed in the picture-in-picture UI when
     * the user interacts with the activity currently in picture-in-picture mode.
     */
    public static int getMaxNumPictureInPictureActions() {
        return NUM_ALLOWED_PIP_ACTIONS;
    }

    /**
    /**
     * Information you can set and retrieve about the current activity within the recent task list.
     * Information you can set and retrieve about the current activity within the recent task list.
     */
     */
Loading