Add SysUiProxy method to start transition on desktop task launch.
This forces the task to correctly start the TRANSIT_OPEN transiiton in Desktop mode when launching an intent from the taskbar and prevent it from opening in full screen. Fixes: 361366053 Test: manual test Flag: EXEMPT bugfix Change-Id: I6d59705aa55745c3425266dacbb012dd4e2b1b03
This commit is contained in:
@@ -228,6 +228,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
private DeviceProfile mPersistentTaskbarDeviceProfile;
|
||||
|
||||
private final LauncherPrefs mLauncherPrefs;
|
||||
private final SystemUiProxy mSysUiProxy;
|
||||
|
||||
private TaskbarFeatureEvaluator mTaskbarFeatureEvaluator;
|
||||
|
||||
@@ -237,10 +238,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
@Nullable Context navigationBarPanelContext, DeviceProfile launcherDp,
|
||||
TaskbarNavButtonController buttonController,
|
||||
ScopedUnfoldTransitionProgressProvider unfoldTransitionProgressProvider,
|
||||
boolean isPrimaryDisplay) {
|
||||
boolean isPrimaryDisplay, SystemUiProxy sysUiProxy) {
|
||||
super(windowContext);
|
||||
mIsPrimaryDisplay = isPrimaryDisplay;
|
||||
mNavigationBarPanelContext = navigationBarPanelContext;
|
||||
mSysUiProxy = sysUiProxy;
|
||||
applyDeviceProfile(launcherDp);
|
||||
final Resources resources = getResources();
|
||||
mTaskbarFeatureEvaluator = TaskbarFeatureEvaluator.getInstance(this);
|
||||
@@ -1630,12 +1632,12 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
intent.getComponent(), info.user, intent.getSourceBounds(), null);
|
||||
return;
|
||||
}
|
||||
int displayId = getDisplay() == null ? DEFAULT_DISPLAY : getDisplay().getDisplayId();
|
||||
// TODO(b/216683257): Use startActivityForResult for search results that require it.
|
||||
if (taskInRecents != null) {
|
||||
// Re launch instance from recents
|
||||
ActivityOptionsWrapper opts = getActivityLaunchOptions(null, info);
|
||||
opts.options.setLaunchDisplayId(
|
||||
getDisplay() == null ? DEFAULT_DISPLAY : getDisplay().getDisplayId());
|
||||
opts.options.setLaunchDisplayId(displayId);
|
||||
if (ActivityManagerWrapper.getInstance()
|
||||
.startActivityFromRecents(taskInRecents.key, opts.options)) {
|
||||
mControllers.uiController.getRecentsView()
|
||||
@@ -1643,12 +1645,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return;
|
||||
}
|
||||
}
|
||||
ActivityOptionsWrapper opts = null;
|
||||
if (areDesktopTasksVisible()) {
|
||||
opts = getActivityLaunchDesktopOptions(info);
|
||||
ActivityOptionsWrapper opts = getActivityLaunchDesktopOptions(info);
|
||||
Bundle optionsBundle = opts == null ? null : opts.options.toBundle();
|
||||
mSysUiProxy.startLaunchIntentTransition(intent, optionsBundle, displayId);
|
||||
} else {
|
||||
startActivity(intent, null);
|
||||
}
|
||||
Bundle optionsBundle = opts == null ? null : opts.options.toBundle();
|
||||
startActivity(intent, optionsBundle);
|
||||
} catch (NullPointerException | ActivityNotFoundException | SecurityException e) {
|
||||
Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
|
||||
@@ -795,7 +795,8 @@ public class TaskbarManager {
|
||||
private TaskbarActivityContext createTaskbarActivityContext(DeviceProfile dp, int displayId) {
|
||||
TaskbarActivityContext newTaskbar = new TaskbarActivityContext(mWindowContext,
|
||||
mNavigationBarPanelContext, dp, mDefaultNavButtonController,
|
||||
mUnfoldProgressProvider, isDefaultDisplay(displayId));
|
||||
mUnfoldProgressProvider, isDefaultDisplay(displayId),
|
||||
SystemUiProxy.INSTANCE.get(mWindowContext));
|
||||
|
||||
addTaskbarToMap(displayId, newTaskbar);
|
||||
return newTaskbar;
|
||||
|
||||
@@ -836,6 +836,15 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context:
|
||||
splitScreen?.startIntent(intent, userId, fillInIntent, position, options, instanceId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the desktop mode interface to start a TRANSIT_OPEN transition when launching an intent
|
||||
* from the taskbar so that it can be handled in desktop mode.
|
||||
*/
|
||||
fun startLaunchIntentTransition(intent: Intent, options: Bundle, displayId: Int) =
|
||||
executeWithErrorLog({ "Failed call startLaunchIntentTransition" }) {
|
||||
desktopMode?.startLaunchIntentTransition(intent, options, displayId)
|
||||
}
|
||||
|
||||
//
|
||||
// One handed
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user