Fix showing strange Launcher on pressing Home.

Bug: 118441555
Test: manual, race condition repro, TaplTests
Change-Id: I8b09895558f8baa72eb3a794724170417fadfda6
This commit is contained in:
Vadim Tryshev 2018-11-12 16:11:55 -08:00
parent 7b3c12f90e
commit e45e60140e
1 changed files with 5 additions and 0 deletions

View File

@ -36,6 +36,7 @@ import java.lang.ref.WeakReference;
public abstract class InternalStateHandler extends Binder {
public static final String EXTRA_STATE_HANDLER = "launcher.state_handler";
public static final String EXTRA_FROM_HOME_KEY = "android.intent.extra.FROM_HOME_KEY";
private static final Scheduler sScheduler = new Scheduler();
@ -76,6 +77,10 @@ public abstract class InternalStateHandler extends Binder {
Launcher launcher, Intent intent, boolean alreadyOnHome, boolean explicitIntent) {
boolean result = false;
if (intent != null && intent.getExtras() != null) {
// If we know that this the intent comes from pressing Home, defer to the default
// processing.
if (intent.hasExtra(EXTRA_FROM_HOME_KEY)) return false;
IBinder stateBinder = intent.getExtras().getBinder(EXTRA_STATE_HANDLER);
if (stateBinder instanceof InternalStateHandler) {
InternalStateHandler handler = (InternalStateHandler) stateBinder;