am 534de491
: Merge "Make immersive mode public & imply update locking" into jb-mr1-aah-dev
* commit '534de491e6522465a7ad12d7cba9b2f80deab364': Make immersive mode public & imply update locking
This commit is contained in:
@ -2683,6 +2683,7 @@ package android.app {
|
|||||||
method public final boolean isChild();
|
method public final boolean isChild();
|
||||||
method public boolean isDestroyed();
|
method public boolean isDestroyed();
|
||||||
method public boolean isFinishing();
|
method public boolean isFinishing();
|
||||||
|
method public boolean isImmersive();
|
||||||
method public boolean isTaskRoot();
|
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 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);
|
method public boolean moveTaskToBack(boolean);
|
||||||
@ -2770,6 +2771,7 @@ package android.app {
|
|||||||
method public final void setFeatureDrawableResource(int, int);
|
method public final void setFeatureDrawableResource(int, int);
|
||||||
method public final void setFeatureDrawableUri(int, android.net.Uri);
|
method public final void setFeatureDrawableUri(int, android.net.Uri);
|
||||||
method public void setFinishOnTouchOutside(boolean);
|
method public void setFinishOnTouchOutside(boolean);
|
||||||
|
method public void setImmersive(boolean);
|
||||||
method public void setIntent(android.content.Intent);
|
method public void setIntent(android.content.Intent);
|
||||||
method public final void setProgress(int);
|
method public final void setProgress(int);
|
||||||
method public final void setProgressBarIndeterminate(boolean);
|
method public final void setProgressBarIndeterminate(boolean);
|
||||||
@ -6330,6 +6332,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_CLOSE_SYSTEM_DIALOGS = 256; // 0x100
|
||||||
field public static final int FLAG_FINISH_ON_TASK_LAUNCH = 2; // 0x2
|
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_HARDWARE_ACCELERATED = 512; // 0x200
|
||||||
|
field public static final int FLAG_IMMERSIVE = 2048; // 0x800
|
||||||
field public static final int FLAG_MULTIPROCESS = 1; // 0x1
|
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_NO_HISTORY = 128; // 0x80
|
||||||
field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000
|
field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000
|
||||||
|
@ -4818,8 +4818,8 @@ public class Activity extends ContextThemeWrapper
|
|||||||
* <code>android:immersive</code> but may be changed at runtime by
|
* <code>android:immersive</code> but may be changed at runtime by
|
||||||
* {@link #setImmersive}.
|
* {@link #setImmersive}.
|
||||||
*
|
*
|
||||||
|
* @see #setImmersive(boolean)
|
||||||
* @see android.content.pm.ActivityInfo#FLAG_IMMERSIVE
|
* @see android.content.pm.ActivityInfo#FLAG_IMMERSIVE
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
public boolean isImmersive() {
|
public boolean isImmersive() {
|
||||||
try {
|
try {
|
||||||
@ -4840,9 +4840,8 @@ public class Activity extends ContextThemeWrapper
|
|||||||
* always have its {@link android.content.pm.ActivityInfo#FLAG_IMMERSIVE
|
* always have its {@link android.content.pm.ActivityInfo#FLAG_IMMERSIVE
|
||||||
* FLAG_IMMERSIVE} bit set.
|
* FLAG_IMMERSIVE} bit set.
|
||||||
*
|
*
|
||||||
* @see #isImmersive
|
* @see #isImmersive()
|
||||||
* @see android.content.pm.ActivityInfo#FLAG_IMMERSIVE
|
* @see android.content.pm.ActivityInfo#FLAG_IMMERSIVE
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
public void setImmersive(boolean i) {
|
public void setImmersive(boolean i) {
|
||||||
try {
|
try {
|
||||||
|
@ -161,7 +161,6 @@ public class ActivityInfo extends ComponentInfo
|
|||||||
*/
|
*/
|
||||||
public static final int FLAG_SHOW_ON_LOCK_SCREEN = 0x0400;
|
public static final int FLAG_SHOW_ON_LOCK_SCREEN = 0x0400;
|
||||||
/**
|
/**
|
||||||
* @hide
|
|
||||||
* Bit in {@link #flags} corresponding to an immersive activity
|
* Bit in {@link #flags} corresponding to an immersive activity
|
||||||
* that wishes not to be interrupted by notifications.
|
* that wishes not to be interrupted by notifications.
|
||||||
* Applications that hide the system notification bar with
|
* Applications that hide the system notification bar with
|
||||||
@ -174,7 +173,14 @@ public class ActivityInfo extends ComponentInfo
|
|||||||
* {@link #FLAG_IMMERSIVE} set, however, will not be interrupted; the
|
* {@link #FLAG_IMMERSIVE} set, however, will not be interrupted; the
|
||||||
* notification may be shown in some other way (such as a small floating
|
* notification may be shown in some other way (such as a small floating
|
||||||
* "toast" window).
|
* "toast" window).
|
||||||
* {@see android.app.Notification#FLAG_HIGH_PRIORITY}
|
*
|
||||||
|
* Note that this flag will always reflect the Activity's
|
||||||
|
* <code>android:immersive</code> manifest definition, even if the Activity's
|
||||||
|
* immersive state is changed at runtime via
|
||||||
|
* {@link android.app.Activity#setImmersive(boolean)}.
|
||||||
|
*
|
||||||
|
* @see android.app.Notification#FLAG_HIGH_PRIORITY
|
||||||
|
* @see android.app.Activity#setImmersive(boolean)
|
||||||
*/
|
*/
|
||||||
public static final int FLAG_IMMERSIVE = 0x0800;
|
public static final int FLAG_IMMERSIVE = 0x0800;
|
||||||
/**
|
/**
|
||||||
|
@ -115,6 +115,7 @@ import android.os.ServiceManager;
|
|||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
|
import android.os.UpdateLock;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.format.Time;
|
import android.text.format.Time;
|
||||||
@ -191,6 +192,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
static final boolean DEBUG_POWER = localLOGV || false;
|
static final boolean DEBUG_POWER = localLOGV || false;
|
||||||
static final boolean DEBUG_POWER_QUICK = DEBUG_POWER || false;
|
static final boolean DEBUG_POWER_QUICK = DEBUG_POWER || false;
|
||||||
static final boolean DEBUG_MU = localLOGV || false;
|
static final boolean DEBUG_MU = localLOGV || false;
|
||||||
|
static final boolean DEBUG_IMMERSIVE = localLOGV || false;
|
||||||
static final boolean VALIDATE_TOKENS = false;
|
static final boolean VALIDATE_TOKENS = false;
|
||||||
static final boolean SHOW_ACTIVITY_START_TIME = true;
|
static final boolean SHOW_ACTIVITY_START_TIME = true;
|
||||||
|
|
||||||
@ -826,6 +828,12 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
|
|
||||||
long mLastWriteTime = 0;
|
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.
|
* Set to true after the system has finished booting.
|
||||||
*/
|
*/
|
||||||
@ -895,6 +903,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
static final int REPORT_USER_SWITCH_MSG = 34;
|
static final int REPORT_USER_SWITCH_MSG = 34;
|
||||||
static final int CONTINUE_USER_SWITCH_MSG = 35;
|
static final int CONTINUE_USER_SWITCH_MSG = 35;
|
||||||
static final int USER_SWITCH_TIMEOUT_MSG = 36;
|
static final int USER_SWITCH_TIMEOUT_MSG = 36;
|
||||||
|
static final int IMMERSIVE_MODE_LOCK_MSG = 37;
|
||||||
|
|
||||||
static final int FIRST_ACTIVITY_STACK_MSG = 100;
|
static final int FIRST_ACTIVITY_STACK_MSG = 100;
|
||||||
static final int FIRST_BROADCAST_QUEUE_MSG = 200;
|
static final int FIRST_BROADCAST_QUEUE_MSG = 200;
|
||||||
@ -1356,6 +1365,21 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
timeoutUserSwitch((UserStartedState)msg.obj, msg.arg1, msg.arg2);
|
timeoutUserSwitch((UserStartedState)msg.obj, msg.arg1, msg.arg2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case IMMERSIVE_MODE_LOCK_MSG: {
|
||||||
|
final boolean nextState = (msg.arg1 != 0);
|
||||||
|
if (mUpdateLock.isHeld() != nextState) {
|
||||||
|
if (DEBUG_IMMERSIVE) {
|
||||||
|
final ActivityRecord r = (ActivityRecord) msg.obj;
|
||||||
|
Slog.d(TAG, "Applying new update lock state '" + nextState + "' for " + r);
|
||||||
|
}
|
||||||
|
if (nextState) {
|
||||||
|
mUpdateLock.acquire();
|
||||||
|
} else {
|
||||||
|
mUpdateLock.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1822,9 +1846,20 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
if (r != null) {
|
if (r != null) {
|
||||||
mWindowManager.setFocusedApp(r.appToken, true);
|
mWindowManager.setFocusedApp(r.appToken, true);
|
||||||
}
|
}
|
||||||
|
applyUpdateLockStateLocked(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final void applyUpdateLockStateLocked(ActivityRecord r) {
|
||||||
|
// Modifications to the UpdateLock state are done on our handler, outside
|
||||||
|
// the activity manager's locks. The new state is determined based on the
|
||||||
|
// state *now* of the relevant activity record. The object is passed to
|
||||||
|
// the handler solely for logging detail, not to be consulted/modified.
|
||||||
|
final boolean nextState = r != null && r.immersive;
|
||||||
|
mHandler.sendMessage(
|
||||||
|
mHandler.obtainMessage(IMMERSIVE_MODE_LOCK_MSG, (nextState) ? 1 : 0, 0, r));
|
||||||
|
}
|
||||||
|
|
||||||
private final void updateLruProcessInternalLocked(ProcessRecord app, int bestPos) {
|
private final void updateLruProcessInternalLocked(ProcessRecord app, int bestPos) {
|
||||||
// put it on the LRU to keep track of when it should be exited.
|
// put it on the LRU to keep track of when it should be exited.
|
||||||
int lrui = mLruProcesses.indexOf(app);
|
int lrui = mLruProcesses.indexOf(app);
|
||||||
@ -7421,11 +7456,19 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
|
|
||||||
public void setImmersive(IBinder token, boolean immersive) {
|
public void setImmersive(IBinder token, boolean immersive) {
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
ActivityRecord r = mMainStack.isInStackLocked(token);
|
final ActivityRecord r = mMainStack.isInStackLocked(token);
|
||||||
if (r == null) {
|
if (r == null) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
r.immersive = immersive;
|
r.immersive = immersive;
|
||||||
|
|
||||||
|
// update associated state if we're frontmost
|
||||||
|
if (r == mFocusedActivity) {
|
||||||
|
if (DEBUG_IMMERSIVE) {
|
||||||
|
Slog.d(TAG, "Frontmost changed immersion: "+ r);
|
||||||
|
}
|
||||||
|
applyUpdateLockStateLocked(r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user