Loading core/java/android/app/Activity.java +12 −0 Original line number Diff line number Diff line Loading @@ -1627,6 +1627,18 @@ public class Activity extends ContextThemeWrapper } } /** * Clear the splash screen view if exist. * @hide */ public void detachSplashScreenView() { synchronized (this) { if (mSplashScreenView != null) { mSplashScreenView = null; } } } /** * Same as {@link #onCreate(android.os.Bundle)} but called for those activities created with * the attribute {@link android.R.attr#persistableMode} set to Loading core/java/android/app/ActivityThread.java +1 −20 Original line number Diff line number Diff line Loading @@ -292,7 +292,6 @@ public final class ActivityThread extends ClientTransactionHandler /** Use background GC policy and default JIT threshold. */ private static final int VM_PROCESS_STATE_JANK_IMPERCEPTIBLE = 1; private static final int REMOVE_SPLASH_SCREEN_VIEW_TIMEOUT = 5000; /** * Denotes an invalid sequence number corresponding to a process state change. */ Loading Loading @@ -1956,8 +1955,6 @@ public final class ActivityThread extends ClientTransactionHandler public static final int INSTRUMENT_WITHOUT_RESTART = 170; public static final int FINISH_INSTRUMENTATION_WITHOUT_RESTART = 171; public static final int REMOVE_SPLASH_SCREEN_VIEW = 172; String codeToString(int code) { if (DEBUG_MESSAGES) { switch (code) { Loading Loading @@ -2006,8 +2003,6 @@ public final class ActivityThread extends ClientTransactionHandler case INSTRUMENT_WITHOUT_RESTART: return "INSTRUMENT_WITHOUT_RESTART"; case FINISH_INSTRUMENTATION_WITHOUT_RESTART: return "FINISH_INSTRUMENTATION_WITHOUT_RESTART"; case REMOVE_SPLASH_SCREEN_VIEW: return "REMOVE_SPLASH_SCREEN_VIEW"; } } return Integer.toString(code); Loading Loading @@ -2204,9 +2199,6 @@ public final class ActivityThread extends ClientTransactionHandler case FINISH_INSTRUMENTATION_WITHOUT_RESTART: handleFinishInstrumentationWithoutRestart(); break; case REMOVE_SPLASH_SCREEN_VIEW: handleRemoveSplashScreenView((ActivityClientRecord) msg.obj); break; } Object obj = msg.obj; if (obj instanceof SomeArgs) { Loading Loading @@ -4020,6 +4012,7 @@ public final class ActivityThread extends ClientTransactionHandler view.cacheRootWindow(r.window); view.makeSystemUIColorsTransparent(); r.activity.mSplashScreenView = view; view.attachHostActivity(r.activity); view.requestLayout(); // Ensure splash screen view is shown before remove the splash screen window. final ViewRootImpl impl = decorView.getViewRootImpl(); Loading Loading @@ -4062,8 +4055,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override public void handOverSplashScreenView(@NonNull ActivityClientRecord r) { if (r.activity.mSplashScreenView != null) { Message msg = mH.obtainMessage(H.REMOVE_SPLASH_SCREEN_VIEW, r); mH.sendMessageDelayed(msg, REMOVE_SPLASH_SCREEN_VIEW_TIMEOUT); synchronized (this) { if (mSplashScreenGlobal != null) { mSplashScreenGlobal.dispatchOnExitAnimation(r.token, Loading @@ -4073,16 +4064,6 @@ public final class ActivityThread extends ClientTransactionHandler } } /** * Force remove splash screen view. */ private void handleRemoveSplashScreenView(@NonNull ActivityClientRecord r) { if (r.activity.mSplashScreenView != null) { r.activity.mSplashScreenView.remove(); r.activity.mSplashScreenView = null; } } /** * Cycle activity through onPause and onUserLeaveHint so that PIP is entered if supported, then * return to its previous state. This allows activities that rely on onUserLeaveHint instead of Loading core/java/android/window/SplashScreenView.java +14 −4 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.annotation.ColorInt; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.TestApi; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; Loading @@ -46,8 +47,6 @@ import android.widget.FrameLayout; import com.android.internal.R; import com.android.internal.policy.DecorView; import java.util.function.Consumer; /** * <p>The view which allows an activity to customize its splash screen exit animation.</p> * Loading Loading @@ -79,8 +78,8 @@ public final class SplashScreenView extends FrameLayout { private Animatable mAnimatableIcon; private ValueAnimator mAnimator; private Runnable mAnimationFinishListener; private Consumer<Canvas> mOnDrawCallback; // The host activity when transfer view to it. private Activity mHostActivity; // cache original window and status private Window mWindow; private boolean mDrawBarBackground; Loading Loading @@ -334,6 +333,17 @@ public final class SplashScreenView extends FrameLayout { restoreSystemUIColors(); mWindow = null; } if (mHostActivity != null) { mHostActivity.detachSplashScreenView(); } } /** * Called when this view is attached to an activity. * @hide */ public void attachHostActivity(Activity activity) { mHostActivity = activity; } /** Loading libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java +2 −12 Original line number Diff line number Diff line Loading @@ -69,9 +69,6 @@ public class StartingSurfaceDrawer { private final ShellExecutor mSplashScreenExecutor; private final SplashscreenContentDrawer mSplashscreenContentDrawer; // TODO(b/131727939) remove this when clearing ActivityRecord private static final int REMOVE_WHEN_TIMEOUT = 2000; public StartingSurfaceDrawer(Context context, ShellExecutor splashScreenExecutor, TransactionPool pool) { mContext = context; Loading Loading @@ -295,12 +292,8 @@ public class StartingSurfaceDrawer { TaskSnapshot snapshot) { final int taskId = startingWindowInfo.taskInfo.taskId; final TaskSnapshotWindow surface = TaskSnapshotWindow.create(startingWindowInfo, appToken, snapshot, mSplashScreenExecutor, () -> removeWindowNoAnimate(taskId)); mSplashScreenExecutor.executeDelayed(() -> removeWindowNoAnimate(taskId), REMOVE_WHEN_TIMEOUT); final StartingWindowRecord tView = new StartingWindowRecord(null/* decorView */, surface); snapshot, mSplashScreenExecutor, () -> removeWindowNoAnimate(taskId)); final StartingWindowRecord tView = new StartingWindowRecord(null/* decorView */, surface); mStartingWindowRecords.put(taskId, tView); } Loading Loading @@ -354,8 +347,6 @@ public class StartingSurfaceDrawer { } if (shouldSaveView) { removeWindowNoAnimate(taskId); mSplashScreenExecutor.executeDelayed( () -> removeWindowNoAnimate(taskId), REMOVE_WHEN_TIMEOUT); saveSplashScreenRecord(taskId, view); } return shouldSaveView; Loading Loading @@ -392,7 +383,6 @@ public class StartingSurfaceDrawer { if (leash != null || playRevealAnimation) { mSplashscreenContentDrawer.applyExitAnimation(record.mContentView, leash, frame, record.isEarlyExit(), exitFinish); mSplashScreenExecutor.executeDelayed(exitFinish, REMOVE_WHEN_TIMEOUT); } else { // the SplashScreenView has been copied to client, skip default exit // animation Loading Loading
core/java/android/app/Activity.java +12 −0 Original line number Diff line number Diff line Loading @@ -1627,6 +1627,18 @@ public class Activity extends ContextThemeWrapper } } /** * Clear the splash screen view if exist. * @hide */ public void detachSplashScreenView() { synchronized (this) { if (mSplashScreenView != null) { mSplashScreenView = null; } } } /** * Same as {@link #onCreate(android.os.Bundle)} but called for those activities created with * the attribute {@link android.R.attr#persistableMode} set to Loading
core/java/android/app/ActivityThread.java +1 −20 Original line number Diff line number Diff line Loading @@ -292,7 +292,6 @@ public final class ActivityThread extends ClientTransactionHandler /** Use background GC policy and default JIT threshold. */ private static final int VM_PROCESS_STATE_JANK_IMPERCEPTIBLE = 1; private static final int REMOVE_SPLASH_SCREEN_VIEW_TIMEOUT = 5000; /** * Denotes an invalid sequence number corresponding to a process state change. */ Loading Loading @@ -1956,8 +1955,6 @@ public final class ActivityThread extends ClientTransactionHandler public static final int INSTRUMENT_WITHOUT_RESTART = 170; public static final int FINISH_INSTRUMENTATION_WITHOUT_RESTART = 171; public static final int REMOVE_SPLASH_SCREEN_VIEW = 172; String codeToString(int code) { if (DEBUG_MESSAGES) { switch (code) { Loading Loading @@ -2006,8 +2003,6 @@ public final class ActivityThread extends ClientTransactionHandler case INSTRUMENT_WITHOUT_RESTART: return "INSTRUMENT_WITHOUT_RESTART"; case FINISH_INSTRUMENTATION_WITHOUT_RESTART: return "FINISH_INSTRUMENTATION_WITHOUT_RESTART"; case REMOVE_SPLASH_SCREEN_VIEW: return "REMOVE_SPLASH_SCREEN_VIEW"; } } return Integer.toString(code); Loading Loading @@ -2204,9 +2199,6 @@ public final class ActivityThread extends ClientTransactionHandler case FINISH_INSTRUMENTATION_WITHOUT_RESTART: handleFinishInstrumentationWithoutRestart(); break; case REMOVE_SPLASH_SCREEN_VIEW: handleRemoveSplashScreenView((ActivityClientRecord) msg.obj); break; } Object obj = msg.obj; if (obj instanceof SomeArgs) { Loading Loading @@ -4020,6 +4012,7 @@ public final class ActivityThread extends ClientTransactionHandler view.cacheRootWindow(r.window); view.makeSystemUIColorsTransparent(); r.activity.mSplashScreenView = view; view.attachHostActivity(r.activity); view.requestLayout(); // Ensure splash screen view is shown before remove the splash screen window. final ViewRootImpl impl = decorView.getViewRootImpl(); Loading Loading @@ -4062,8 +4055,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override public void handOverSplashScreenView(@NonNull ActivityClientRecord r) { if (r.activity.mSplashScreenView != null) { Message msg = mH.obtainMessage(H.REMOVE_SPLASH_SCREEN_VIEW, r); mH.sendMessageDelayed(msg, REMOVE_SPLASH_SCREEN_VIEW_TIMEOUT); synchronized (this) { if (mSplashScreenGlobal != null) { mSplashScreenGlobal.dispatchOnExitAnimation(r.token, Loading @@ -4073,16 +4064,6 @@ public final class ActivityThread extends ClientTransactionHandler } } /** * Force remove splash screen view. */ private void handleRemoveSplashScreenView(@NonNull ActivityClientRecord r) { if (r.activity.mSplashScreenView != null) { r.activity.mSplashScreenView.remove(); r.activity.mSplashScreenView = null; } } /** * Cycle activity through onPause and onUserLeaveHint so that PIP is entered if supported, then * return to its previous state. This allows activities that rely on onUserLeaveHint instead of Loading
core/java/android/window/SplashScreenView.java +14 −4 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.annotation.ColorInt; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.TestApi; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; Loading @@ -46,8 +47,6 @@ import android.widget.FrameLayout; import com.android.internal.R; import com.android.internal.policy.DecorView; import java.util.function.Consumer; /** * <p>The view which allows an activity to customize its splash screen exit animation.</p> * Loading Loading @@ -79,8 +78,8 @@ public final class SplashScreenView extends FrameLayout { private Animatable mAnimatableIcon; private ValueAnimator mAnimator; private Runnable mAnimationFinishListener; private Consumer<Canvas> mOnDrawCallback; // The host activity when transfer view to it. private Activity mHostActivity; // cache original window and status private Window mWindow; private boolean mDrawBarBackground; Loading Loading @@ -334,6 +333,17 @@ public final class SplashScreenView extends FrameLayout { restoreSystemUIColors(); mWindow = null; } if (mHostActivity != null) { mHostActivity.detachSplashScreenView(); } } /** * Called when this view is attached to an activity. * @hide */ public void attachHostActivity(Activity activity) { mHostActivity = activity; } /** Loading
libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java +2 −12 Original line number Diff line number Diff line Loading @@ -69,9 +69,6 @@ public class StartingSurfaceDrawer { private final ShellExecutor mSplashScreenExecutor; private final SplashscreenContentDrawer mSplashscreenContentDrawer; // TODO(b/131727939) remove this when clearing ActivityRecord private static final int REMOVE_WHEN_TIMEOUT = 2000; public StartingSurfaceDrawer(Context context, ShellExecutor splashScreenExecutor, TransactionPool pool) { mContext = context; Loading Loading @@ -295,12 +292,8 @@ public class StartingSurfaceDrawer { TaskSnapshot snapshot) { final int taskId = startingWindowInfo.taskInfo.taskId; final TaskSnapshotWindow surface = TaskSnapshotWindow.create(startingWindowInfo, appToken, snapshot, mSplashScreenExecutor, () -> removeWindowNoAnimate(taskId)); mSplashScreenExecutor.executeDelayed(() -> removeWindowNoAnimate(taskId), REMOVE_WHEN_TIMEOUT); final StartingWindowRecord tView = new StartingWindowRecord(null/* decorView */, surface); snapshot, mSplashScreenExecutor, () -> removeWindowNoAnimate(taskId)); final StartingWindowRecord tView = new StartingWindowRecord(null/* decorView */, surface); mStartingWindowRecords.put(taskId, tView); } Loading Loading @@ -354,8 +347,6 @@ public class StartingSurfaceDrawer { } if (shouldSaveView) { removeWindowNoAnimate(taskId); mSplashScreenExecutor.executeDelayed( () -> removeWindowNoAnimate(taskId), REMOVE_WHEN_TIMEOUT); saveSplashScreenRecord(taskId, view); } return shouldSaveView; Loading Loading @@ -392,7 +383,6 @@ public class StartingSurfaceDrawer { if (leash != null || playRevealAnimation) { mSplashscreenContentDrawer.applyExitAnimation(record.mContentView, leash, frame, record.isEarlyExit(), exitFinish); mSplashScreenExecutor.executeDelayed(exitFinish, REMOVE_WHEN_TIMEOUT); } else { // the SplashScreenView has been copied to client, skip default exit // animation Loading