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

Commit a6066bb7 authored by Craig Mautner's avatar Craig Mautner Committed by Android Git Automerger
Browse files

am 35fc6a02: Merge "Implement setActivityLabelAndIcon()."

* commit '35fc6a02':
  Implement setActivityLabelAndIcon().
parents 18d08469 35fc6a02
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -3262,6 +3262,7 @@ package android.app {
    method public void reportFullyDrawn();
    method public void reportFullyDrawn();
    method public final boolean requestWindowFeature(int);
    method public final boolean requestWindowFeature(int);
    method public final void runOnUiThread(java.lang.Runnable);
    method public final void runOnUiThread(java.lang.Runnable);
    method public void setActivityLabelAndIcon(java.lang.CharSequence, android.graphics.Bitmap);
    method public void setContentTransitionManager(android.transition.TransitionManager);
    method public void setContentTransitionManager(android.transition.TransitionManager);
    method public void setContentView(int);
    method public void setContentView(int);
    method public void setContentView(android.view.View);
    method public void setContentView(android.view.View);
@@ -3278,8 +3279,6 @@ package android.app {
    method public final void setProgressBarIndeterminate(boolean);
    method public final void setProgressBarIndeterminate(boolean);
    method public final void setProgressBarIndeterminateVisibility(boolean);
    method public final void setProgressBarIndeterminateVisibility(boolean);
    method public final void setProgressBarVisibility(boolean);
    method public final void setProgressBarVisibility(boolean);
    method public void setRecentsIcon(android.graphics.Bitmap);
    method public void setRecentsLabel(java.lang.CharSequence);
    method public void setRequestedOrientation(int);
    method public void setRequestedOrientation(int);
    method public final void setResult(int);
    method public final void setResult(int);
    method public final void setResult(int, android.content.Intent);
    method public final void setResult(int, android.content.Intent);
+17 −26
Original line number Original line Diff line number Diff line
@@ -4701,42 +4701,33 @@ public class Activity extends ContextThemeWrapper
    }
    }


    /**
    /**
     * Set a label to be used in the Recents task display. The activities of a task are traversed
     * Set a label and icon to be used in the Recents task display. When {@link
     * in order from the topmost activity to the bottommost. As soon as one activity returns a
     * ActivityManager#getRecentTasks} is called, the activities of each task are
     * non-null Recents label the traversal is ended and that value will be used in
     * traversed in order from the topmost activity to the bottommost. As soon as one activity is
     * {@link ActivityManager.RecentTaskInfo#activityLabel}
     * found with either a non-null label or a non-null icon set by this call the traversal is
     * ended. For each task those values will be returned in {@link
     * ActivityManager.RecentTaskInfo#activityLabel} and {@link
     * ActivityManager.RecentTaskInfo#activityIcon}. The {link Intent} for the activity that set
     * activityLabel and activityIcon will be returned in {@link
     * ActivityManager.RecentTaskInfo#activityIntent}
     *
     *
     * @see ActivityManager#getRecentTasks
     * @see ActivityManager#getRecentTasks
     * @see ActivityManager.RecentTaskInfo
     *
     *
     * @param recentsLabel The label to use in the RecentTaskInfo.
     * @param activityLabel The label to use in the RecentTaskInfo.
     * @param activityIcon The Bitmap to use in the RecentTaskInfo.
     */
     */
    public void setRecentsLabel(CharSequence recentsLabel) {
    public void setActivityLabelAndIcon(CharSequence activityLabel, Bitmap activityIcon) {
        try {
            ActivityManagerNative.getDefault().setRecentsLabel(mToken, recentsLabel);
        } catch (RemoteException e) {
        }
    }

    /**
     * Set an icon to be used in the Recents task display. The activities of a task are traversed
     * in order from the topmost activity to the bottommost. As soon as one activity returns a
     * non-null Recents icon the traversal is ended and that value will be used in
     * {@link ActivityManager.RecentTaskInfo#activityIcon}.
     *
     * @see ActivityManager#getRecentTasks
     *
     * @param recentsIcon The Bitmap to use in the RecentTaskInfo.
     */
    public void setRecentsIcon(Bitmap recentsIcon) {
        final Bitmap scaledIcon;
        final Bitmap scaledIcon;
        if (recentsIcon != null) {
        if (activityIcon != null) {
            final int size = ActivityManager.getLauncherLargeIconSizeInner(this);
            final int size = ActivityManager.getLauncherLargeIconSizeInner(this);
            scaledIcon = Bitmap.createScaledBitmap(recentsIcon, size, size, true);
            scaledIcon = Bitmap.createScaledBitmap(activityIcon, size, size, true);
        } else {
        } else {
            scaledIcon = null;
            scaledIcon = null;
        }
        }
        try {
        try {
            ActivityManagerNative.getDefault().setRecentsIcon(mToken, scaledIcon);
            ActivityManagerNative.getDefault().setActivityLabelAndIcon(mToken, activityLabel,
                    scaledIcon);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
        }
        }
    }
    }
+4 −8
Original line number Original line Diff line number Diff line
@@ -516,14 +516,14 @@ public class ActivityManager {
        public int userId;
        public int userId;


        /**
        /**
         * The label of the highest activity in the task stack to have set a label
         * The label of the highest activity in the task stack to have set a label using
         * {@link Activity#setRecentsLabel}.
         * {@link Activity#setActivityLabelAndIcon(CharSequence, android.graphics.Bitmap)}.
         */
         */
        public CharSequence activityLabel;
        public CharSequence activityLabel;


        /**
        /**
         * The Bitmap icon of the highest activity in the task stack to set a Bitmap using
         * The Bitmap icon of the highest activity in the task stack to set a Bitmap using
         * {@link Activity#setRecentsIcon}.
         * {@link Activity#setActivityLabelAndIcon(CharSequence, android.graphics.Bitmap)}.
         */
         */
        public Bitmap activityIcon;
        public Bitmap activityIcon;


@@ -563,11 +563,7 @@ public class ActivityManager {
        public void readFromParcel(Parcel source) {
        public void readFromParcel(Parcel source) {
            id = source.readInt();
            id = source.readInt();
            persistentId = source.readInt();
            persistentId = source.readInt();
            if (source.readInt() != 0) {
            baseIntent = source.readInt() > 0 ? Intent.CREATOR.createFromParcel(source) : null;
                baseIntent = Intent.CREATOR.createFromParcel(source);
            } else {
                baseIntent = null;
            }
            origActivity = ComponentName.readFromParcel(source);
            origActivity = ComponentName.readFromParcel(source);
            description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
            description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
            activityLabel = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
            activityLabel = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
+11 −29
Original line number Original line Diff line number Diff line
@@ -2129,21 +2129,13 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            return true;
            return true;
        }
        }


        case SET_RECENTS_LABEL_TRANSACTION: {
        case SET_ACTIVITY_LABEL_ICON_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            data.enforceInterface(IActivityManager.descriptor);
            IBinder token = data.readStrongBinder();
            IBinder token = data.readStrongBinder();
            CharSequence recentsLabel = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
            CharSequence activityLabel = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
            setRecentsLabel(token, recentsLabel);
            Bitmap activityIcon = data.readInt() > 0
            reply.writeNoException();
            return true;
        }

        case SET_RECENTS_ICON_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            IBinder token = data.readStrongBinder();
            Bitmap recentsIcon = data.readInt() != 0
                    ? Bitmap.CREATOR.createFromParcel(data) : null;
                    ? Bitmap.CREATOR.createFromParcel(data) : null;
            setRecentsIcon(token, recentsIcon);
            setActivityLabelAndIcon(token, activityLabel, activityIcon);
            reply.writeNoException();
            reply.writeNoException();
            return true;
            return true;
        }
        }
@@ -4918,32 +4910,22 @@ class ActivityManagerProxy implements IActivityManager
        return isInLockTaskMode;
        return isInLockTaskMode;
    }
    }


    public void setRecentsLabel(IBinder token, CharSequence recentsLabel) throws RemoteException
    @Override
    {
    public void setActivityLabelAndIcon(IBinder token, CharSequence activityLabel,
        Parcel data = Parcel.obtain();
            Bitmap activityIcon) throws RemoteException
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeStrongBinder(token);
        TextUtils.writeToParcel(recentsLabel, data, 0);
        mRemote.transact(SET_RECENTS_LABEL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
        reply.readException();
        data.recycle();
        reply.recycle();
    }

    public void setRecentsIcon(IBinder token, Bitmap recentsBitmap) throws RemoteException
    {
    {
        Parcel data = Parcel.obtain();
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeStrongBinder(token);
        data.writeStrongBinder(token);
        if (recentsBitmap != null) {
        TextUtils.writeToParcel(activityLabel, data, 0);
        if (activityIcon != null) {
            data.writeInt(1);
            data.writeInt(1);
            recentsBitmap.writeToParcel(data, 0);
            activityIcon.writeToParcel(data, 0);
        } else {
        } else {
            data.writeInt(0);
            data.writeInt(0);
        }
        }
        mRemote.transact(SET_RECENTS_ICON_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
        mRemote.transact(SET_ACTIVITY_LABEL_ICON_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
        reply.readException();
        reply.readException();
        data.recycle();
        data.recycle();
        reply.recycle();
        reply.recycle();
+3 −6
Original line number Original line Diff line number Diff line
@@ -437,10 +437,8 @@ public interface IActivityManager extends IInterface {
    public boolean isInLockTaskMode() throws RemoteException;
    public boolean isInLockTaskMode() throws RemoteException;


    /** @hide */
    /** @hide */
    public void setRecentsLabel(IBinder token, CharSequence recentsLabel) throws RemoteException;
    public void setActivityLabelAndIcon(IBinder token, CharSequence activityLabel,

            Bitmap activityBitmap) throws RemoteException;
    /** @hide */
    public void setRecentsIcon(IBinder token, Bitmap recentsBitmap) throws RemoteException;


    /*
    /*
     * Private non-Binder interfaces
     * Private non-Binder interfaces
@@ -741,6 +739,5 @@ public interface IActivityManager extends IInterface {
    int START_LOCK_TASK_BY_TOKEN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+214;
    int START_LOCK_TASK_BY_TOKEN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+214;
    int STOP_LOCK_TASK_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+215;
    int STOP_LOCK_TASK_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+215;
    int IS_IN_LOCK_TASK_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+216;
    int IS_IN_LOCK_TASK_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+216;
    int SET_RECENTS_LABEL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+217;
    int SET_ACTIVITY_LABEL_ICON_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+217;
    int SET_RECENTS_ICON_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+218;
}
}
Loading