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

Commit 9178eee8 authored by Issei Suzuki's avatar Issei Suzuki Committed by Android (Google) Code Review
Browse files

Merge "Add inheritShowWhenLocked System API to activity."

parents 91c29d0c 74e1eb22
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -199,6 +199,7 @@ package android {
  }
  public static final class R.attr {
    field public static final int inheritShowWhenLocked = 16844194; // 0x10105a2
    field public static final int isVrOnly = 16844152; // 0x1010578
    field public static final int requiredSystemPropertyName = 16844133; // 0x1010565
    field public static final int requiredSystemPropertyValue = 16844134; // 0x1010566
@@ -258,6 +259,7 @@ package android.app {
    method public boolean convertToTranslucent(android.app.Activity.TranslucentConversionListener, android.app.ActivityOptions);
    method public deprecated boolean isBackgroundVisibleBehind();
    method public deprecated void onBackgroundVisibleBehindChanged(boolean);
    method public void setInheritShowWhenLocked(boolean);
  }
  public static abstract interface Activity.TranslucentConversionListener {
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ package android.app {

  public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
    method public void onMovedToDisplay(int, android.content.res.Configuration);
    method public void setInheritShowWhenLocked(boolean);
  }

  public class ActivityManager {
+27 −0
Original line number Diff line number Diff line
@@ -8288,6 +8288,33 @@ public class Activity extends ContextThemeWrapper
        }
    }

    /**
     * Specifies whether this {@link Activity} should be shown on top of the lock screen whenever
     * the lockscreen is up and this activity has another activity behind it with the showWhenLock
     * attribute set. That is, this activity is only visible on the lock screen if there is another
     * activity with the showWhenLock attribute visible at the same time on the lock screen. A use
     * case for this is permission dialogs, that should only be visible on the lock screen if their
     * requesting activity is also visible. This value can be set as a manifest attribute using
     * android.R.attr#inheritShowWhenLocked.
     *
     * @param inheritShowWhenLocked {@code true} to show the {@link Activity} on top of the lock
     *                              screen when this activity has another activity behind it with
     *                              the showWhenLock attribute set; {@code false} otherwise.
     * @see #setShowWhenLocked(boolean)
     * See android.R.attr#inheritShowWhenLocked
     * @hide
     */
    @SystemApi
    @TestApi
    public void setInheritShowWhenLocked(boolean inheritShowWhenLocked) {
        try {
            ActivityTaskManager.getService().setInheritShowWhenLocked(
                    mToken, inheritShowWhenLocked);
        } catch (RemoteException e) {
            Log.e(TAG, "Failed to call setInheritShowWhenLocked", e);
        }
    }

    /**
     * Specifies whether the screen should be turned on when the {@link Activity} is resumed.
     * Normally an activity will be transitioned to the stopped state if it is started while the
+1 −0
Original line number Diff line number Diff line
@@ -419,6 +419,7 @@ interface IActivityTaskManager {
    void updateLockTaskFeatures(int userId, int flags);

    void setShowWhenLocked(in IBinder token, boolean showWhenLocked);
    void setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked);
    void setTurnScreenOn(in IBinder token, boolean turnScreenOn);

    /**
+21 −1
Original line number Diff line number Diff line
@@ -505,6 +505,22 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
     */
    public int flags;

    /**
     * Bit in {@link #privateFlags} indicating if the activity should be shown when locked in case
     * an activity behind this can also be shown when locked.
     * See android.R.attr#inheritShowWhenLocked
     * @hide
     */
    public static final int FLAG_INHERIT_SHOW_WHEN_LOCKED = 0x1;

    /**
     * Options that have been set in the activity declaration in the manifest.
     * These include:
     * {@link #FLAG_INHERIT_SHOW_WHEN_LOCKED}.
     * @hide
     */
    public int privateFlags;

    /** @hide */
    @IntDef(prefix = { "SCREEN_ORIENTATION_" }, value = {
            SCREEN_ORIENTATION_UNSET,
@@ -975,6 +991,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
        taskAffinity = orig.taskAffinity;
        targetActivity = orig.targetActivity;
        flags = orig.flags;
        privateFlags = orig.privateFlags;
        screenOrientation = orig.screenOrientation;
        configChanges = orig.configChanges;
        softInputMode = orig.softInputMode;
@@ -1122,9 +1139,10 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
                    + " targetActivity=" + targetActivity
                    + " persistableMode=" + persistableModeToString());
        }
        if (launchMode != 0 || flags != 0 || theme != 0) {
        if (launchMode != 0 || flags != 0 || privateFlags != 0 || theme != 0) {
            pw.println(prefix + "launchMode=" + launchMode
                    + " flags=0x" + Integer.toHexString(flags)
                    + " privateFlags=0x" + Integer.toHexString(privateFlags)
                    + " theme=0x" + Integer.toHexString(theme));
        }
        if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED
@@ -1178,6 +1196,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
        dest.writeString(targetActivity);
        dest.writeString(launchToken);
        dest.writeInt(flags);
        dest.writeInt(privateFlags);
        dest.writeInt(screenOrientation);
        dest.writeInt(configChanges);
        dest.writeInt(softInputMode);
@@ -1307,6 +1326,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
        targetActivity = source.readString();
        launchToken = source.readString();
        flags = source.readInt();
        privateFlags = source.readInt();
        screenOrientation = source.readInt();
        configChanges = source.readInt();
        softInputMode = source.readInt();
Loading