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

Commit 578b3bd5 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Deprecated onCreateThumbnail

API hasn't done anything in the platform for ages and there is not plan
to make it do anything.

Change-Id: I7d433a0d45aed860659c311381bc9f356eb9f986
Fixes: 73249948
Test: builds
parent 40ce0958
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3695,7 +3695,7 @@ package android.app {
    method public boolean onCreateOptionsMenu(android.view.Menu);
    method public boolean onCreatePanelMenu(int, android.view.Menu);
    method public android.view.View onCreatePanelView(int);
    method public boolean onCreateThumbnail(android.graphics.Bitmap, android.graphics.Canvas);
    method public deprecated boolean onCreateThumbnail(android.graphics.Bitmap, android.graphics.Canvas);
    method public android.view.View onCreateView(java.lang.String, android.content.Context, android.util.AttributeSet);
    method public android.view.View onCreateView(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet);
    method protected void onDestroy();
+5 −22
Original line number Diff line number Diff line
@@ -1733,7 +1733,7 @@ public class Activity extends ContextThemeWrapper
     *
     * <p>This callback and {@link #onUserInteraction} are intended to help
     * activities manage status bar notifications intelligently; specifically,
     * for helping activities determine the proper time to cancel a notfication.
     * for helping activities determine the proper time to cancel a notification.
     *
     * @see #onUserInteraction()
     */
@@ -1741,32 +1741,16 @@ public class Activity extends ContextThemeWrapper
    }

    /**
     * Generate a new thumbnail for this activity.  This method is called before
     * pausing the activity, and should draw into <var>outBitmap</var> the
     * imagery for the desired thumbnail in the dimensions of that bitmap.  It
     * can use the given <var>canvas</var>, which is configured to draw into the
     * bitmap, for rendering if desired.
     *
     * <p>The default implementation returns fails and does not draw a thumbnail;
     * this will result in the platform creating its own thumbnail if needed.
     *
     * @param outBitmap The bitmap to contain the thumbnail.
     * @param canvas Can be used to render into the bitmap.
     *
     * @return Return true if you have drawn into the bitmap; otherwise after
     *         you return it will be filled with a default thumbnail.
     *
     * @see #onCreateDescription
     * @see #onSaveInstanceState
     * @see #onPause
     * @deprecated Method doesn't do anything and will be removed in the future.
     */
    @Deprecated
    public boolean onCreateThumbnail(Bitmap outBitmap, Canvas canvas) {
        return false;
    }

    /**
     * Generate a new description for this activity.  This method is called
     * before pausing the activity and can, if desired, return some textual
     * before stopping the activity and can, if desired, return some textual
     * description of its current state to be displayed to the user.
     *
     * <p>The default implementation returns null, which will cause you to
@@ -1777,9 +1761,8 @@ public class Activity extends ContextThemeWrapper
     * @return A description of what the user is doing.  It should be short and
     *         sweet (only a few words).
     *
     * @see #onCreateThumbnail
     * @see #onSaveInstanceState
     * @see #onPause
     * @see #onStop
     */
    @Nullable
    public CharSequence onCreateDescription() {
+0 −56
Original line number Diff line number Diff line
@@ -3904,62 +3904,6 @@ public final class ActivityThread extends ClientTransactionHandler {
        }
    }

    private int mThumbnailWidth = -1;
    private int mThumbnailHeight = -1;
    private Bitmap mAvailThumbnailBitmap = null;
    private Canvas mThumbnailCanvas = null;

    private Bitmap createThumbnailBitmap(ActivityClientRecord r) {
        Bitmap thumbnail = mAvailThumbnailBitmap;
        try {
            if (thumbnail == null) {
                int w = mThumbnailWidth;
                int h;
                if (w < 0) {
                    Resources res = r.activity.getResources();
                    int wId = com.android.internal.R.dimen.thumbnail_width;
                    int hId = com.android.internal.R.dimen.thumbnail_height;
                    mThumbnailWidth = w = res.getDimensionPixelSize(wId);
                    mThumbnailHeight = h = res.getDimensionPixelSize(hId);
                } else {
                    h = mThumbnailHeight;
                }

                // On platforms where we don't want thumbnails, set dims to (0,0)
                if ((w > 0) && (h > 0)) {
                    thumbnail = Bitmap.createBitmap(r.activity.getResources().getDisplayMetrics(),
                            w, h, THUMBNAIL_FORMAT);
                    thumbnail.eraseColor(0);
                }
            }

            if (thumbnail != null) {
                Canvas cv = mThumbnailCanvas;
                if (cv == null) {
                    mThumbnailCanvas = cv = new Canvas();
                }

                cv.setBitmap(thumbnail);
                if (!r.activity.onCreateThumbnail(thumbnail, cv)) {
                    mAvailThumbnailBitmap = thumbnail;
                    thumbnail = null;
                }
                cv.setBitmap(null);
            }

        } catch (Exception e) {
            if (!mInstrumentation.onException(r.activity, e)) {
                throw new RuntimeException(
                        "Unable to create thumbnail of "
                        + r.intent.getComponent().toShortString()
                        + ": " + e.toString(), e);
            }
            thumbnail = null;
        }

        return thumbnail;
    }

    @Override
    public void handlePauseActivity(IBinder token, boolean finished, boolean userLeaving,
            int configChanges, boolean dontReport, PendingTransactionActions pendingActions) {