am 7f3fb7de: Merge change 26130 into eclair

Merge commit '7f3fb7dec2afdffa37e3067ca8a5b9d01809a9ce' into eclair-plus-aosp

* commit '7f3fb7dec2afdffa37e3067ca8a5b9d01809a9ce':
  Turn animations on by default.
This commit is contained in:
Dianne Hackborn
2009-09-21 17:40:06 -07:00
committed by Android Git Automerger
27 changed files with 291 additions and 82 deletions

View File

@ -36741,6 +36741,17 @@
visibility="public"
>
</field>
<field name="FLAG_ACTIVITY_NO_ANIMATION"
type="int"
transient="false"
volatile="false"
value="65536"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="FLAG_ACTIVITY_NO_HISTORY"
type="int"
transient="false"
@ -134820,6 +134831,21 @@
<parameter name="addr" type="int">
</parameter>
</method>
<method name="formatShortFileSize"
return="java.lang.String"
abstract="false"
native="false"
synchronized="false"
static="true"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="context" type="android.content.Context">
</parameter>
<parameter name="number" type="long">
</parameter>
</method>
</class>
<class name="Time"
extends="java.lang.Object"

View File

@ -790,8 +790,8 @@ public class Activity extends ContextThemeWrapper
* @see #onPostCreate
*/
protected void onCreate(Bundle savedInstanceState) {
mVisibleFromClient = mWindow.getWindowStyle().getBoolean(
com.android.internal.R.styleable.Window_windowNoDisplay, true);
mVisibleFromClient = !mWindow.getWindowStyle().getBoolean(
com.android.internal.R.styleable.Window_windowNoDisplay, false);
mCalled = true;
}

View File

@ -2317,6 +2317,18 @@ public class Intent implements Parcelable {
* specified.
*/
public static final int FLAG_ACTIVITY_REORDER_TO_FRONT = 0X00020000;
/**
* If set in an Intent passed to {@link Context#startActivity Context.startActivity()},
* this flag will prevent the system from applying an activity transition
* animation to go to the next activity state. This doesn't mean an
* animation will never run -- if another activity change happens that doesn't
* specify this flag before the activity started here is displayed, then
* that transition will be used. This this flag can be put to good use
* when you are going to do a series of activity operations but the
* animation seen by the user shouldn't be driven by the first activity
* change but rather a later one.
*/
public static final int FLAG_ACTIVITY_NO_ANIMATION = 0X00010000;
/**
* If set, when sending a broadcast only registered receivers will be
* called -- no BroadcastReceiver components will be launched.

View File

@ -32,6 +32,18 @@ public final class Formatter {
* @return formated string with the number
*/
public static String formatFileSize(Context context, long number) {
return formatFileSize(context, number, false);
}
/**
* Like {@link #formatFileSize}, but trying to generate shorter numbers
* (showing fewer digits of precisin).
*/
public static String formatShortFileSize(Context context, long number) {
return formatFileSize(context, number, true);
}
private static String formatFileSize(Context context, long number, boolean shorter) {
if (context == null) {
return "";
}
@ -58,13 +70,24 @@ public final class Formatter {
suffix = com.android.internal.R.string.petabyteShort;
result = result / 1024;
}
if (result < 100) {
String value = String.format("%.2f", result);
return context.getResources().
getString(com.android.internal.R.string.fileSizeSuffix,
value, context.getString(suffix));
String value;
if (result < 1) {
value = String.format("%.2f", result);
} else if (result < 10) {
if (shorter) {
value = String.format("%.1f", result);
} else {
value = String.format("%.2f", result);
}
} else if (result < 100) {
if (shorter) {
value = String.format("%.0f", result);
} else {
value = String.format("%.2f", result);
}
} else {
value = String.format("%.0f", result);
}
String value = String.format("%.0f", result);
return context.getResources().
getString(com.android.internal.R.string.fileSizeSuffix,
value, context.getString(suffix));

View File

@ -314,7 +314,9 @@ public interface WindowManagerPolicy {
public boolean showLw(boolean doAnimation);
}
/** No transition happening. */
/** Not set up for a transition. */
public final int TRANSIT_UNSET = 0;
/** No animation for transition. */
public final int TRANSIT_NONE = 0;
/** Window has been added to the screen. */
public final int TRANSIT_ENTER = 1;

View File

@ -21,5 +21,5 @@
android:interpolator="@anim/decelerate_interpolator"
android:zAdjustment="top">
<translate android:fromXDelta="-100%" android:toXDelta="0"
android:duration="@android:integer/config_mediumAnimTime"/>
android:duration="@android:integer/config_shortAnimTime"/>
</set>

View File

@ -20,5 +20,5 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator">
<translate android:fromXDelta="0%" android:toXDelta="33%"
android:duration="@android:integer/config_mediumAnimTime"/>
android:duration="@android:integer/config_shortAnimTime"/>
</set>

View File

@ -20,5 +20,5 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator">
<translate android:fromXDelta="33%" android:toXDelta="0"
android:duration="@android:integer/config_mediumAnimTime"/>
android:duration="@android:integer/config_shortAnimTime"/>
</set>

View File

@ -21,5 +21,5 @@
android:interpolator="@anim/decelerate_interpolator"
android:zAdjustment="top">
<translate android:fromXDelta="0%" android:toXDelta="-100%"
android:duration="@android:integer/config_mediumAnimTime"/>
android:duration="@android:integer/config_shortAnimTime"/>
</set>

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/anim/fade_in.xml
**
/*
** Copyright 2007, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/anim/fade_out.xml
**
/*
** Copyright 2007, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
@ -17,6 +16,7 @@
** limitations under the License.
*/
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/accelerate_interpolator">
<scale android:fromXScale="1.0" android:toXScale="0.9"

View File

@ -19,10 +19,10 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator">
<scale android:fromXScale="2.0" android:toXScale="1.0"
android:fromYScale="2.0" android:toYScale="1.0"
<scale android:fromXScale="0.9" android:toXScale="1.0"
android:fromYScale="0.9" android:toYScale="1.0"
android:pivotX="50%" android:pivotY="50%"
android:duration="@android:integer/config_mediumAnimTime" />
android:duration="@android:integer/config_shortAnimTime" />
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_mediumAnimTime"/>
android:duration="@android:integer/config_shortAnimTime" />
</set>

View File

@ -18,12 +18,11 @@
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator"
android:zAdjustment="top">
<scale android:fromXScale="1.0" android:toXScale="2.0"
android:fromYScale="1.0" android:toYScale="2.0"
android:interpolator="@anim/accelerate_interpolator">
<scale android:fromXScale="1.0" android:toXScale="0.9"
android:fromYScale="1.0" android:toYScale="0.9"
android:pivotX="50%" android:pivotY="50%"
android:duration="@android:integer/config_mediumAnimTime" />
<alpha android:fromAlpha="1.0" android:toAlpha="0"
android:duration="@android:integer/config_mediumAnimTime"/>
android:duration="@android:integer/config_shortAnimTime" />
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:duration="@android:integer/config_shortAnimTime"/>
</set>

View File

@ -18,8 +18,7 @@
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator"
android:zAdjustment="top">
android:interpolator="@anim/decelerate_interpolator">
<scale android:fromXScale="1.0" android:toXScale="2.0"
android:fromYScale="1.0" android:toYScale="2.0"
android:pivotX="50%p" android:pivotY="50%p"

View File

@ -20,7 +20,7 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator">
<translate android:fromXDelta="75%" android:toXDelta="0"
android:duration="@android:integer/config_mediumAnimTime"/>
android:duration="@android:integer/config_shortAnimTime"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_mediumAnimTime"/>
android:duration="@android:integer/config_shortAnimTime"/>
</set>

View File

@ -20,7 +20,7 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/accelerate_interpolator">
<translate android:fromXDelta="0%" android:toXDelta="75%"
android:duration="@android:integer/config_mediumAnimTime"/>
android:duration="@android:integer/config_shortAnimTime"/>
<alpha android:fromAlpha="1.0" android:toAlpha="0"
android:duration="@android:integer/config_mediumAnimTime"/>
android:duration="@android:integer/config_shortAnimTime"/>
</set>

View File

@ -17,8 +17,22 @@
*/
-->
<!-- This version zooms the new non-wallpaper down on top of the
wallpaper. -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator">
<scale android:fromXScale="2.0" android:toXScale="1.0"
android:fromYScale="2.0" android:toYScale="1.0"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="@android:integer/config_mediumAnimTime" />
</set>
<!-- This version is a variation on the inter-activity slide that
also scales the wallpaper. -->
<!--
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator">
<translate android:fromXDelta="33%" android:toXDelta="0"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
-->

View File

@ -17,6 +17,22 @@
*/
-->
<!-- This version zooms the new non-wallpaper down on top of the
wallpaper. The wallpaper here just stays fixed behind. -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator"
android:zAdjustment="top">
<scale android:fromXScale="1.0" android:toXScale=".5"
android:fromYScale="1.0" android:toYScale=".5"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="@android:integer/config_mediumAnimTime" />
<alpha android:fromAlpha="1.0" android:toAlpha="0"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
<!-- This version is a variation on the inter-activity slide that
also scales the wallpaper. -->
<!--
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator"
android:zAdjustment="top">
@ -27,3 +43,4 @@
<translate android:fromXDelta="0%" android:toXDelta="-100%"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
-->

View File

@ -17,6 +17,22 @@
*/
-->
<!-- This version zooms the new non-wallpaper up off the wallpaper the
wallpaper. The wallpaper here just stays fixed behind. -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator"
android:zAdjustment="top">
<scale android:fromXScale=".5" android:toXScale="1.0"
android:fromYScale=".5" android:toYScale="1.0"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="@android:integer/config_mediumAnimTime" />
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
<!-- This version is a variation on the inter-activity slide that
also scales the wallpaper. -->
<!--
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator"
android:zAdjustment="top">
@ -27,3 +43,4 @@
<translate android:fromXDelta="-100%" android:toXDelta="0"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
-->

View File

@ -17,8 +17,22 @@
*/
-->
<!-- This version zooms the new non-wallpaper down on top of the
wallpaper. -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator">
<scale android:fromXScale="1.0" android:toXScale="2.0"
android:fromYScale="1.0" android:toYScale="2.0"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="@android:integer/config_mediumAnimTime" />
</set>
<!-- This version is a variation on the inter-activity slide that
also scales the wallpaper. -->
<!--
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/decelerate_interpolator">
<translate android:fromXDelta="0%" android:toXDelta="33%"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
-->

View File

@ -27,13 +27,13 @@
<bool name="config_sf_limitedAlpha">false</bool>
<!-- The duration (in milliseconds) of a short animation. -->
<integer name="config_shortAnimTime">100</integer>
<integer name="config_shortAnimTime">150</integer>
<!-- The duration (in milliseconds) of a medium-length animation. -->
<integer name="config_mediumAnimTime">150</integer>
<integer name="config_mediumAnimTime">250</integer>
<!-- The duration (in milliseconds) of a long animation. -->
<integer name="config_longAnimTime">300</integer>
<integer name="config_longAnimTime">400</integer>
<!-- XXXXX NOTE THE FOLLOWING RESOURCES USE THE WRONG NAMING CONVENTION.
Please don't copy them, copy anything else. -->

View File

@ -58,6 +58,19 @@
<item name="activityOpenExitAnimation">@anim/activity_open_exit</item>
<item name="activityCloseEnterAnimation">@anim/activity_close_enter</item>
<item name="activityCloseExitAnimation">@anim/activity_close_exit</item>
<item name="taskOpenEnterAnimation">@anim/activity_open_enter</item>
<item name="taskOpenExitAnimation">@anim/activity_open_exit</item>
<item name="taskCloseEnterAnimation">@anim/activity_close_enter</item>
<item name="taskCloseExitAnimation">@anim/activity_close_exit</item>
<item name="taskToFrontEnterAnimation">@anim/activity_open_enter</item>
<item name="taskToFrontExitAnimation">@anim/activity_open_exit</item>
<item name="taskToBackEnterAnimation">@anim/activity_close_enter</item>
<item name="taskToBackExitAnimation">@anim/activity_close_exit</item>
<!-- There is a good argument to be made that the user shouldn't
be aware of task transitions, so we are going to use the same
animation for them as we do for regular activity transitions. -->
<!-- These provide an alternative animation for task transitions. -->
<!--
<item name="taskOpenEnterAnimation">@anim/task_open_enter</item>
<item name="taskOpenExitAnimation">@anim/task_open_exit</item>
<item name="taskCloseEnterAnimation">@anim/task_close_enter</item>
@ -66,6 +79,7 @@
<item name="taskToFrontExitAnimation">@anim/task_open_exit</item>
<item name="taskToBackEnterAnimation">@anim/task_close_enter</item>
<item name="taskToBackExitAnimation">@anim/task_close_exit</item>
-->
<item name="wallpaperOpenEnterAnimation">@anim/wallpaper_open_enter</item>
<item name="wallpaperOpenExitAnimation">@anim/wallpaper_open_exit</item>
<item name="wallpaperCloseEnterAnimation">@anim/wallpaper_close_enter</item>

View File

@ -354,7 +354,7 @@
<style name="Theme.NoDisplay">
<item name="android:windowBackground">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:windowNoDisplay">true</item>

View File

@ -29,7 +29,7 @@
<integer name="def_screen_brightness">102</integer>
<bool name="def_screen_brightness_automatic_mode">false</bool>
<fraction name="def_window_animation_scale">100%</fraction>
<fraction name="def_window_transition_scale">0%</fraction>
<fraction name="def_window_transition_scale">100%</fraction>
<bool name="def_bluetooth_on">false</bool>
<bool name="def_install_non_market_apps">false</bool>

View File

@ -71,7 +71,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
// database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
// is properly propagated through your change. Not doing so will result in a loss of user
// settings.
private static final int DATABASE_VERSION = 40;
private static final int DATABASE_VERSION = 41;
private Context mContext;
@ -481,6 +481,27 @@ public class DatabaseHelper extends SQLiteOpenHelper {
upgradeVersion = 40;
}
if (upgradeVersion == 40) {
/*
* All animations are now turned on by default!
*/
db.beginTransaction();
try {
db.execSQL("DELETE FROM system WHERE name='"
+ Settings.System.WINDOW_ANIMATION_SCALE + "'");
db.execSQL("DELETE FROM system WHERE name='"
+ Settings.System.TRANSITION_ANIMATION_SCALE + "'");
SQLiteStatement stmt = db.compileStatement("INSERT INTO system(name,value)"
+ " VALUES(?,?);");
loadDefaultAnimationSettings(stmt);
stmt.close();
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
upgradeVersion = 41;
}
if (upgradeVersion != currentVersion) {
Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion
+ ", must wipe the settings provider");

View File

@ -372,7 +372,7 @@ public class WindowManagerService extends IWindowManager.Stub
// perform or TRANSIT_NONE if we are not waiting. If we are waiting,
// mOpeningApps and mClosingApps are the lists of tokens that will be
// made visible or hidden at the next transition.
int mNextAppTransition = WindowManagerPolicy.TRANSIT_NONE;
int mNextAppTransition = WindowManagerPolicy.TRANSIT_UNSET;
boolean mAppTransitionReady = false;
boolean mAppTransitionRunning = false;
boolean mAppTransitionTimeout = false;
@ -932,7 +932,7 @@ public class WindowManagerService extends IWindowManager.Stub
+ " layer=" + highestTarget.mAnimLayer
+ " new layer=" + w.mAnimLayer);
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_NONE) {
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
// If we are currently setting up for an animation,
// hold everything until we can find out what will happen.
mInputMethodTargetWaitingAnim = true;
@ -1270,7 +1270,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_NONE) {
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
// If we are currently waiting for an app transition, and either
// the current target or the next target are involved with it,
// then hold off on doing anything with the wallpaper.
@ -2542,7 +2542,7 @@ public class WindowManagerService extends IWindowManager.Stub
: com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseExitAnimation;
break;
}
a = loadAnimation(lp, animAttr);
a = animAttr != 0 ? loadAnimation(lp, animAttr) : null;
if (DEBUG_ANIM) Log.v(TAG, "applyAnimation: wtoken=" + wtoken
+ " anim=" + a
+ " animAttr=0x" + Integer.toHexString(animAttr)
@ -2990,7 +2990,8 @@ public class WindowManagerService extends IWindowManager.Stub
TAG, "Prepare app transition: transit=" + transit
+ " mNextAppTransition=" + mNextAppTransition);
if (!mDisplayFrozen) {
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET
|| mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
mNextAppTransition = transit;
} else if (transit == WindowManagerPolicy.TRANSIT_TASK_OPEN
&& mNextAppTransition == WindowManagerPolicy.TRANSIT_TASK_CLOSE) {
@ -3025,7 +3026,7 @@ public class WindowManagerService extends IWindowManager.Stub
synchronized(mWindowMap) {
if (DEBUG_APP_TRANSITIONS) Log.v(
TAG, "Execute app transition: mNextAppTransition=" + mNextAppTransition);
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_NONE) {
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
mAppTransitionReady = true;
final long origId = Binder.clearCallingIdentity();
performLayoutAndPlaceSurfacesLocked();
@ -3228,7 +3229,7 @@ public class WindowManagerService extends IWindowManager.Stub
boolean runningAppAnimation = false;
if (transit != WindowManagerPolicy.TRANSIT_NONE) {
if (transit != WindowManagerPolicy.TRANSIT_UNSET) {
if (wtoken.animation == sDummyAnimation) {
wtoken.animation = null;
}
@ -3328,7 +3329,7 @@ public class WindowManagerService extends IWindowManager.Stub
// If we are preparing an app transition, then delay changing
// the visibility of this token until we execute that transition.
if (!mDisplayFrozen && mNextAppTransition != WindowManagerPolicy.TRANSIT_NONE) {
if (!mDisplayFrozen && mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
// Already in requested state, don't do anything more.
if (wtoken.hiddenRequested != visible) {
return;
@ -3367,7 +3368,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
final long origId = Binder.clearCallingIdentity();
setTokenVisibilityLocked(wtoken, null, visible, WindowManagerPolicy.TRANSIT_NONE, true);
setTokenVisibilityLocked(wtoken, null, visible, WindowManagerPolicy.TRANSIT_UNSET, true);
wtoken.updateReportedVisibilityLocked();
Binder.restoreCallingIdentity(origId);
}
@ -3493,13 +3494,13 @@ public class WindowManagerService extends IWindowManager.Stub
mTokenList.remove(basewtoken);
if (basewtoken != null && (wtoken=basewtoken.appWindowToken) != null) {
if (DEBUG_APP_TRANSITIONS) Log.v(TAG, "Removing app token: " + wtoken);
delayed = setTokenVisibilityLocked(wtoken, null, false, WindowManagerPolicy.TRANSIT_NONE, true);
delayed = setTokenVisibilityLocked(wtoken, null, false, WindowManagerPolicy.TRANSIT_UNSET, true);
wtoken.inPendingTransaction = false;
mOpeningApps.remove(wtoken);
wtoken.waitingToShow = false;
if (mClosingApps.contains(wtoken)) {
delayed = true;
} else if (mNextAppTransition != WindowManagerPolicy.TRANSIT_NONE) {
} else if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
mClosingApps.add(wtoken);
wtoken.waitingToHide = true;
delayed = true;
@ -3781,7 +3782,7 @@ public class WindowManagerService extends IWindowManager.Stub
AppWindowToken wt = findAppWindowToken(tokens.get(i));
if (wt != null) {
mAppTokens.add(wt);
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_NONE) {
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
mToTopApps.remove(wt);
mToBottomApps.remove(wt);
mToTopApps.add(wt);
@ -3791,7 +3792,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET) {
moveAppWindowsLocked(tokens, mAppTokens.size());
}
}
@ -3813,7 +3814,7 @@ public class WindowManagerService extends IWindowManager.Stub
AppWindowToken wt = findAppWindowToken(tokens.get(i));
if (wt != null) {
mAppTokens.add(pos, wt);
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_NONE) {
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
mToTopApps.remove(wt);
mToBottomApps.remove(wt);
mToBottomApps.add(i, wt);
@ -3824,7 +3825,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET) {
moveAppWindowsLocked(tokens, 0);
}
}
@ -7459,7 +7460,7 @@ public class WindowManagerService extends IWindowManager.Stub
*/
boolean isReadyForDisplay() {
if (mRootToken.waitingToShow &&
mNextAppTransition != WindowManagerPolicy.TRANSIT_NONE) {
mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
return false;
}
final AppWindowToken atoken = mAppToken;
@ -8530,7 +8531,7 @@ public class WindowManagerService extends IWindowManager.Stub
case APP_TRANSITION_TIMEOUT: {
synchronized (mWindowMap) {
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_NONE) {
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
"*** APP TRANSITION TIMEOUT");
mAppTransitionReady = true;
@ -9074,9 +9075,9 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_APP_TRANSITIONS) Log.v(TAG, "**** GOOD TO GO");
int transit = mNextAppTransition;
if (mSkipAppTransitionAnimation) {
transit = WindowManagerPolicy.TRANSIT_NONE;
transit = WindowManagerPolicy.TRANSIT_UNSET;
}
mNextAppTransition = WindowManagerPolicy.TRANSIT_NONE;
mNextAppTransition = WindowManagerPolicy.TRANSIT_UNSET;
mAppTransitionReady = false;
mAppTransitionRunning = true;
mAppTransitionTimeout = false;
@ -10092,8 +10093,8 @@ public class WindowManagerService extends IWindowManager.Stub
}
mDisplayFrozen = true;
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_NONE) {
mNextAppTransition = WindowManagerPolicy.TRANSIT_NONE;
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
mNextAppTransition = WindowManagerPolicy.TRANSIT_UNSET;
mAppTransitionReady = true;
}

View File

@ -457,6 +457,13 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
final ArrayList<HistoryRecord> mStoppingActivities
= new ArrayList<HistoryRecord>();
/**
* Animations that for the current transition have requested not to
* be considered for the transition animation.
*/
final ArrayList<HistoryRecord> mNoAnimActivities
= new ArrayList<HistoryRecord>();
/**
* List of intents that were used to start the most recent tasks.
*/
@ -2249,6 +2256,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
next.resumeKeyDispatchingLocked();
ensureActivitiesVisibleLocked(null, 0);
mWindowManager.executeAppTransition();
mNoAnimActivities.clear();
// Mark the point when the activity is resuming
// TODO: To be more accurate, the mark should be before the onCreate,
@ -2565,6 +2573,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// Make sure we have executed any pending transitions, since there
// should be nothing left to do at this point.
mWindowManager.executeAppTransition();
mNoAnimActivities.clear();
return false;
}
@ -2575,6 +2584,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// Make sure we have executed any pending transitions, since there
// should be nothing left to do at this point.
mWindowManager.executeAppTransition();
mNoAnimActivities.clear();
return false;
}
@ -2637,17 +2647,25 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
if (prev.finishing) {
if (DEBUG_TRANSITION) Log.v(TAG,
"Prepare close transition: prev=" + prev);
mWindowManager.prepareAppTransition(prev.task == next.task
? WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE
: WindowManagerPolicy.TRANSIT_TASK_CLOSE);
if (mNoAnimActivities.contains(prev)) {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_NONE);
} else {
mWindowManager.prepareAppTransition(prev.task == next.task
? WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE
: WindowManagerPolicy.TRANSIT_TASK_CLOSE);
}
mWindowManager.setAppWillBeHidden(prev);
mWindowManager.setAppVisibility(prev, false);
} else {
if (DEBUG_TRANSITION) Log.v(TAG,
"Prepare open transition: prev=" + prev);
mWindowManager.prepareAppTransition(prev.task == next.task
? WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN
: WindowManagerPolicy.TRANSIT_TASK_OPEN);
if (mNoAnimActivities.contains(next)) {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_NONE);
} else {
mWindowManager.prepareAppTransition(prev.task == next.task
? WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN
: WindowManagerPolicy.TRANSIT_TASK_OPEN);
}
}
if (false) {
mWindowManager.setAppWillBeHidden(prev);
@ -2656,7 +2674,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
} else if (mHistory.size() > 1) {
if (DEBUG_TRANSITION) Log.v(TAG,
"Prepare open transition: no previous");
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN);
if (mNoAnimActivities.contains(next)) {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_NONE);
} else {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN);
}
}
if (next.app != null && next.app.thread != null) {
@ -2699,6 +2721,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
mHandler.sendEmptyMessage(RESUME_TOP_ACTIVITY_MSG);
}
mWindowManager.executeAppTransition();
mNoAnimActivities.clear();
return true;
}
@ -2859,9 +2882,18 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
}
if (DEBUG_TRANSITION) Log.v(TAG,
"Prepare open transition: starting " + r);
mWindowManager.prepareAppTransition(newTask
? WindowManagerPolicy.TRANSIT_TASK_OPEN
: WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN);
if ((r.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_NONE);
mNoAnimActivities.add(r);
} else if ((r.intent.getFlags()&Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) != 0) {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_TASK_OPEN);
mNoAnimActivities.remove(r);
} else {
mWindowManager.prepareAppTransition(newTask
? WindowManagerPolicy.TRANSIT_TASK_OPEN
: WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN);
mNoAnimActivities.remove(r);
}
mWindowManager.addAppToken(
addPos, r, r.task.taskId, r.info.screenOrientation, r.fullscreen);
boolean doShow = true;
@ -3336,7 +3368,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
if (callerAtFront) {
// We really do want to push this one into the
// user's face, right now.
moveTaskToFrontLocked(taskTop.task);
moveTaskToFrontLocked(taskTop.task, r);
}
}
// If the caller has requested that the target task be
@ -6923,14 +6955,14 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
for (int i=0; i<N; i++) {
TaskRecord tr = mRecentTasks.get(i);
if (tr.taskId == task) {
moveTaskToFrontLocked(tr);
moveTaskToFrontLocked(tr, null);
return;
}
}
for (int i=mHistory.size()-1; i>=0; i--) {
HistoryRecord hr = (HistoryRecord)mHistory.get(i);
if (hr.task.taskId == task) {
moveTaskToFrontLocked(hr.task);
moveTaskToFrontLocked(hr.task, null);
return;
}
}
@ -6940,7 +6972,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
}
}
private final void moveTaskToFrontLocked(TaskRecord tr) {
private final void moveTaskToFrontLocked(TaskRecord tr, HistoryRecord reason) {
if (DEBUG_SWITCH) Log.v(TAG, "moveTaskToFront: " + tr);
final int task = tr.taskId;
@ -6951,10 +6983,6 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
return;
}
if (DEBUG_TRANSITION) Log.v(TAG,
"Prepare to front transition: task=" + tr);
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_TASK_TO_FRONT);
ArrayList moved = new ArrayList();
// Applying the affinities may have removed entries from the history,
@ -6983,6 +7011,19 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
pos--;
}
if (DEBUG_TRANSITION) Log.v(TAG,
"Prepare to front transition: task=" + tr);
if (reason != null &&
(reason.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_NONE);
HistoryRecord r = topRunningActivityLocked(null);
if (r != null) {
mNoAnimActivities.add(r);
}
} else {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_TASK_TO_FRONT);
}
mWindowManager.moveAppTokensToTop(moved);
if (VALIDATE_TOKENS) {
mWindowManager.validateAppTokens(mHistory);
@ -7008,7 +7049,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
}
}
final long origId = Binder.clearCallingIdentity();
moveTaskToBackLocked(task);
moveTaskToBackLocked(task, null);
Binder.restoreCallingIdentity(origId);
}
}
@ -7027,7 +7068,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
final long origId = Binder.clearCallingIdentity();
int taskId = getTaskForActivityLocked(token, !nonRoot);
if (taskId >= 0) {
return moveTaskToBackLocked(taskId);
return moveTaskToBackLocked(taskId, null);
}
Binder.restoreCallingIdentity(origId);
}
@ -7045,7 +7086,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
* @param task The taskId to collect and move to the bottom.
* @return Returns true if the move completed, false if not.
*/
private final boolean moveTaskToBackLocked(int task) {
private final boolean moveTaskToBackLocked(int task, HistoryRecord reason) {
Log.i(TAG, "moveTaskToBack: " + task);
// If we have a watcher, preflight the move before committing to it. First check
@ -7096,6 +7137,16 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
pos++;
}
if (reason != null &&
(reason.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_NONE);
HistoryRecord r = topRunningActivityLocked(null);
if (r != null) {
mNoAnimActivities.add(r);
}
} else {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_TASK_TO_FRONT);
}
mWindowManager.moveAppTokensToBottom(moved);
if (VALIDATE_TOKENS) {
mWindowManager.validateAppTokens(mHistory);