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

Commit 62df8ad0 authored by chaviw's avatar chaviw
Browse files

Make setRecentsScreenshotEnabled public

Enable setRecentsScreenshotEnabled as a public API to allow apps to
disable the screenshot that is shown in recents.

There's no need for a getter method because it's only set by the app so
it will not be changed by system

Test: SnapshotTaskTests
Fixes: 166729178
Change-Id: I06f1e4fa62ad50c050b6259e04a4af27cd25be67
parent 083297ec
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4221,6 +4221,7 @@ package android.app {
    method @Deprecated public final void setProgressBarIndeterminate(boolean);
    method @Deprecated public final void setProgressBarIndeterminateVisibility(boolean);
    method @Deprecated public final void setProgressBarVisibility(boolean);
    method public void setRecentsScreenshotEnabled(boolean);
    method public void setRequestedOrientation(int);
    method public final void setResult(int);
    method public final void setResult(int, android.content.Intent);
+1 −0
Original line number Diff line number Diff line
@@ -2850,6 +2850,7 @@ package android.view {
    method public default void setShouldShowSystemDecors(int, boolean);
    method public default void setShouldShowWithInsecureKeyguard(int, boolean);
    method public default boolean shouldShowSystemDecors(int);
    method @Nullable public default android.graphics.Bitmap snapshotTaskForRecents(@IntRange(from=0) int);
    field public static final int DISPLAY_IME_POLICY_FALLBACK_DISPLAY = 1; // 0x1
    field public static final int DISPLAY_IME_POLICY_HIDE = 2; // 0x2
    field public static final int DISPLAY_IME_POLICY_LOCAL = 0; // 0x0
+15 −7
Original line number Diff line number Diff line
@@ -8517,8 +8517,18 @@ public class Activity extends ContextThemeWrapper
    }

    /**
     * If set to true, this indicates to the system that it should never take a
     * screenshot of the activity to be used as a representation while it is not in a started state.
     * @hide
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.S,
            publicAlternatives = "Use {@link #setRecentsScreenshotEnabled(boolean)} instead.")
    public void setDisablePreviewScreenshots(boolean disable) {
        setRecentsScreenshotEnabled(!disable);
    }

    /**
     * If set to false, this indicates to the system that it should never take a
     * screenshot of the activity to be used as a representation in recents screen. By default, this
     * value is {@code true}.
     * <p>
     * Note that the system may use the window background of the theme instead to represent
     * the window when it is not running.
@@ -8531,12 +8541,10 @@ public class Activity extends ContextThemeWrapper
     * {@link android.service.voice.VoiceInteractionService} requests a screenshot via
     * {@link android.service.voice.VoiceInteractionSession#SHOW_WITH_SCREENSHOT}.
     *
     * @param disable {@code true} to disable preview screenshots; {@code false} otherwise.
     * @hide
     * @param enabled {@code true} to enable recents screenshots; {@code false} otherwise.
     */
    @UnsupportedAppUsage
    public void setDisablePreviewScreenshots(boolean disable) {
        ActivityClient.getInstance().setDisablePreviewScreenshots(mToken, disable);
    public void setRecentsScreenshotEnabled(boolean enabled) {
        ActivityClient.getInstance().setRecentsScreenshotEnabled(mToken, enabled);
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -438,9 +438,9 @@ public class ActivityClient {
        }
    }

    void setDisablePreviewScreenshots(IBinder token, boolean disable) {
    void setRecentsScreenshotEnabled(IBinder token, boolean enabled) {
        try {
            getActivityClientController().setDisablePreviewScreenshots(token, disable);
            getActivityClientController().setRecentsScreenshotEnabled(token, enabled);
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
+2 −2
Original line number Diff line number Diff line
@@ -115,8 +115,8 @@ interface IActivityClientController {
            int enterAnim, int exitAnim, int backgroundColor);
    int setVrMode(in IBinder token, boolean enabled, in ComponentName packageName);

    /** See {@link android.app.Activity#setDisablePreviewScreenshots}. */
    oneway void setDisablePreviewScreenshots(in IBinder token, boolean disable);
    /** See {@link android.app.Activity#setRecentsScreenshotEnabled}. */
    oneway void setRecentsScreenshotEnabled(in IBinder token, boolean enabled);

    /**
     * It should only be called from home activity to remove its outdated snapshot. The home
Loading