Merge "Fix issue with quickstep recents button not unlocking before entering PIP." into pi-dev

This commit is contained in:
TreeHugger Robot
2018-04-05 23:34:35 +00:00
committed by Android (Google) Code Review
2 changed files with 30 additions and 5 deletions

View File

@@ -71,6 +71,9 @@ public class ActivityManagerWrapper {
private static final ActivityManagerWrapper sInstance = new ActivityManagerWrapper(); private static final ActivityManagerWrapper sInstance = new ActivityManagerWrapper();
// Should match the values in PhoneWindowManager
public static final String CLOSE_SYSTEM_WINDOWS_REASON_RECENTS = "recentapps";
private final PackageManager mPackageManager; private final PackageManager mPackageManager;
private final BackgroundExecutor mBackgroundExecutor; private final BackgroundExecutor mBackgroundExecutor;
private final TaskStackChangeListeners mTaskStackChangeListeners; private final TaskStackChangeListeners mTaskStackChangeListeners;

View File

@@ -22,6 +22,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static com.android.systemui.statusbar.phone.StatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS; import static com.android.systemui.statusbar.phone.StatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.trust.TrustManager;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
@@ -51,6 +52,7 @@ import com.android.systemui.EventLogTags;
import com.android.systemui.OverviewProxyService; import com.android.systemui.OverviewProxyService;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.RecentsComponent; import com.android.systemui.RecentsComponent;
import com.android.systemui.SystemUIApplication;
import com.android.systemui.shared.recents.IOverviewProxy; import com.android.systemui.shared.recents.IOverviewProxy;
import com.android.systemui.SystemUI; import com.android.systemui.SystemUI;
import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.EventBus;
@@ -70,6 +72,7 @@ import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.stackdivider.Divider; import com.android.systemui.stackdivider.Divider;
import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.phone.StatusBar;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
@@ -107,6 +110,7 @@ public class Recents extends SystemUI
private Handler mHandler; private Handler mHandler;
private RecentsImpl mImpl; private RecentsImpl mImpl;
private TrustManager mTrustManager;
private int mDraggingInRecentsCurrentUser; private int mDraggingInRecentsCurrentUser;
// Only For system user, this is the callbacks instance we return to each secondary user // Only For system user, this is the callbacks instance we return to each secondary user
@@ -235,6 +239,8 @@ public class Recents extends SystemUI
registerWithSystemUser(); registerWithSystemUser();
} }
putComponent(Recents.class, this); putComponent(Recents.class, this);
mTrustManager = (TrustManager) mContext.getSystemService(Context.TRUST_SERVICE);
} }
@Override @Override
@@ -342,12 +348,28 @@ public class Recents extends SystemUI
// If connected to launcher service, let it handle the toggle logic // If connected to launcher service, let it handle the toggle logic
IOverviewProxy overviewProxy = mOverviewProxyService.getProxy(); IOverviewProxy overviewProxy = mOverviewProxyService.getProxy();
if (overviewProxy != null) { if (overviewProxy != null) {
try { final Runnable toggleRecents = () -> {
overviewProxy.onOverviewToggle(); try {
return; if (mOverviewProxyService.getProxy() != null) {
} catch (RemoteException e) { mOverviewProxyService.getProxy().onOverviewToggle();
Log.e(TAG, "Cannot send toggle recents through proxy service.", e); }
} catch (RemoteException e) {
Log.e(TAG, "Cannot send toggle recents through proxy service.", e);
}
};
// Preload only if device for current user is unlocked
final StatusBar statusBar = getComponent(StatusBar.class);
if (statusBar != null && statusBar.isKeyguardShowing()) {
statusBar.executeRunnableDismissingKeyguard(() -> {
// Flush trustmanager before checking device locked per user
mTrustManager.reportKeyguardShowingChanged();
mHandler.post(toggleRecents);
}, null, true /* dismissShade */, false /* afterKeyguardGone */,
true /* deferred */);
} else {
toggleRecents.run();
} }
return;
} }
int growTarget = getComponent(Divider.class).getView().growsRecents(); int growTarget = getComponent(Divider.class).getView().growsRecents();