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

Commit 4b212786 authored by Christopher Tate's avatar Christopher Tate Committed by Android Git Automerger
Browse files

am 96fecb7f: Merge "Make immersive mode public & imply update locking" into ics-aah

* commit '96fecb7f':
  Make immersive mode public & imply update locking
parents b7536cf1 96fecb7f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2557,6 +2557,7 @@ package android.app {
    method public boolean isChangingConfigurations();
    method public final boolean isChild();
    method public boolean isFinishing();
    method public boolean isImmersive();
    method public boolean isTaskRoot();
    method public final deprecated android.database.Cursor managedQuery(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String);
    method public boolean moveTaskToBack(boolean);
@@ -2638,6 +2639,7 @@ package android.app {
    method public final void setFeatureDrawableResource(int, int);
    method public final void setFeatureDrawableUri(int, android.net.Uri);
    method public void setFinishOnTouchOutside(boolean);
    method public void setImmersive(boolean);
    method public void setIntent(android.content.Intent);
    method public final void setProgress(int);
    method public final void setProgressBarIndeterminate(boolean);
@@ -5952,6 +5954,7 @@ package android.content.pm {
    field public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 256; // 0x100
    field public static final int FLAG_FINISH_ON_TASK_LAUNCH = 2; // 0x2
    field public static final int FLAG_HARDWARE_ACCELERATED = 512; // 0x200
    field public static final int FLAG_IMMERSIVE = 1024; // 0x400
    field public static final int FLAG_MULTIPROCESS = 1; // 0x1
    field public static final int FLAG_NO_HISTORY = 128; // 0x80
    field public static final int FLAG_STATE_NOT_NEEDED = 16; // 0x10
+0 −2
Original line number Diff line number Diff line
@@ -4318,7 +4318,6 @@ public class Activity extends ContextThemeWrapper
     * {@link #setImmersive}.
     *
     * @see android.content.pm.ActivityInfo#FLAG_IMMERSIVE
     * @hide
     */
    public boolean isImmersive() {
        try {
@@ -4341,7 +4340,6 @@ public class Activity extends ContextThemeWrapper
     *
     * @see #isImmersive
     * @see android.content.pm.ActivityInfo#FLAG_IMMERSIVE
     * @hide
     */
    public void setImmersive(boolean i) {
        try {
+0 −1
Original line number Diff line number Diff line
@@ -155,7 +155,6 @@ public class ActivityInfo extends ComponentInfo
     */
    public static final int FLAG_HARDWARE_ACCELERATED = 0x0200;
    /**
     * @hide
     * Bit in {@link #flags} corresponding to an immersive activity
     * that wishes not to be interrupted by notifications.
     * Applications that hide the system notification bar with
+37 −1
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UpdateLock;
import android.provider.Settings;
import android.text.format.Time;
import android.util.EventLog;
@@ -172,6 +173,7 @@ public final class ActivityManagerService extends ActivityManagerNative
    static final boolean DEBUG_CONFIGURATION = localLOGV || false;
    static final boolean DEBUG_POWER = localLOGV || false;
    static final boolean DEBUG_POWER_QUICK = DEBUG_POWER || false;
    static final boolean DEBUG_IMMERSIVE = localLOGV || true;
    static final boolean VALIDATE_TOKENS = false;
    static final boolean SHOW_ACTIVITY_START_TIME = true;
    
@@ -811,6 +813,12 @@ public final class ActivityManagerService extends ActivityManagerNative
    long mLastWriteTime = 0;
    /**
     * Used to retain an update lock when the foreground activity is in
     * immersive mode.
     */
    final UpdateLock mUpdateLock = new UpdateLock("immersive");
    /**
     * Set to true after the system has finished booting.
     */
@@ -1710,6 +1718,21 @@ public final class ActivityManagerService extends ActivityManagerNative
            if (r != null) {
                mWindowManager.setFocusedApp(r.appToken, true);
            }
            applyUpdateLockStateLocked(r);
        }
    }
    final void applyUpdateLockStateLocked(ActivityRecord r) {
        final boolean nextState = r != null && r.immersive;
        if (mUpdateLock.isHeld() != nextState) {
            if (DEBUG_IMMERSIVE) {
                Slog.d(TAG, "Applying new update lock state '" + nextState + "' for " + r);
            }
            if (nextState) {
                mUpdateLock.acquire();
            } else {
                mUpdateLock.release();
            }
        }
    }
@@ -6667,11 +6690,24 @@ public final class ActivityManagerService extends ActivityManagerNative
    public void setImmersive(IBinder token, boolean immersive) {
        synchronized(this) {
            ActivityRecord r = mMainStack.isInStackLocked(token);
            final ActivityRecord r = mMainStack.isInStackLocked(token);
            if (r == null) {
                throw new IllegalArgumentException();
            }
            r.immersive = immersive;
            // update associated state if we're frontmost
            if (r == mMainStack.topRunningActivityLocked(null)) {
                long oldId = Binder.clearCallingIdentity();
                try {
                    if (DEBUG_IMMERSIVE) {
                        Slog.d(TAG, "Frontmost changed immersion: "+ r);
                    }
                    applyUpdateLockStateLocked(r);
                } finally {
                    Binder.restoreCallingIdentity(oldId);
                }
            }
        }
    }