Merge "Fix unable to drag notification to enter split screen" into sc-v2-dev
This commit is contained in:
@@ -25,6 +25,8 @@ import android.content.ClipDescription;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.view.DragEvent;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.internal.logging.InstanceId;
|
||||
import com.android.internal.logging.InstanceIdSequence;
|
||||
import com.android.internal.logging.UiEvent;
|
||||
@@ -61,9 +63,7 @@ public class DragAndDropEventLogger {
|
||||
mInstanceId = mIdSequence.newInstanceId();
|
||||
}
|
||||
mActivityInfo = item.getActivityInfo();
|
||||
mUiEventLogger.logWithInstanceId(getStartEnum(description),
|
||||
mActivityInfo.applicationInfo.uid,
|
||||
mActivityInfo.applicationInfo.packageName, mInstanceId);
|
||||
log(getStartEnum(description), mActivityInfo);
|
||||
return mInstanceId;
|
||||
}
|
||||
|
||||
@@ -71,18 +71,21 @@ public class DragAndDropEventLogger {
|
||||
* Logs a successful drop.
|
||||
*/
|
||||
public void logDrop() {
|
||||
mUiEventLogger.logWithInstanceId(DragAndDropUiEventEnum.GLOBAL_APP_DRAG_DROPPED,
|
||||
mActivityInfo.applicationInfo.uid,
|
||||
mActivityInfo.applicationInfo.packageName, mInstanceId);
|
||||
log(DragAndDropUiEventEnum.GLOBAL_APP_DRAG_DROPPED, mActivityInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the end of a drag.
|
||||
*/
|
||||
public void logEnd() {
|
||||
mUiEventLogger.logWithInstanceId(DragAndDropUiEventEnum.GLOBAL_APP_DRAG_END,
|
||||
mActivityInfo.applicationInfo.uid,
|
||||
mActivityInfo.applicationInfo.packageName, mInstanceId);
|
||||
log(DragAndDropUiEventEnum.GLOBAL_APP_DRAG_END, mActivityInfo);
|
||||
}
|
||||
|
||||
private void log(UiEventLogger.UiEventEnum event, @Nullable ActivityInfo activityInfo) {
|
||||
mUiEventLogger.logWithInstanceId(event,
|
||||
activityInfo == null ? 0 : activityInfo.applicationInfo.uid,
|
||||
activityInfo == null ? null : activityInfo.applicationInfo.packageName,
|
||||
mInstanceId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1760,7 +1760,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
||||
* Called when a notification is dropped on proper target window.
|
||||
*/
|
||||
public void dragAndDropSuccess() {
|
||||
mOnDragSuccessListener.onDragSuccess(getEntry());
|
||||
if (mOnDragSuccessListener != null) {
|
||||
mOnDragSuccessListener.onDragSuccess(getEntry());
|
||||
}
|
||||
}
|
||||
|
||||
private void doLongClickCallback() {
|
||||
|
||||
@@ -148,7 +148,8 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
|
||||
/**
|
||||
* A launch root task for activity launching with {@link FLAG_ACTIVITY_LAUNCH_ADJACENT} flag.
|
||||
*/
|
||||
private Task mLaunchAdjacentFlagRootTask;
|
||||
@VisibleForTesting
|
||||
Task mLaunchAdjacentFlagRootTask;
|
||||
|
||||
/**
|
||||
* A focusable root task that is purposely to be positioned at the top. Although the root
|
||||
|
||||
@@ -566,17 +566,17 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
||||
case HIERARCHY_OP_TYPE_SET_LAUNCH_ADJACENT_FLAG_ROOT: {
|
||||
final WindowContainer wc = WindowContainer.fromBinder(hop.getContainer());
|
||||
final Task task = wc != null ? wc.asTask() : null;
|
||||
final boolean clearRoot = hop.getToTop();
|
||||
if (task == null) {
|
||||
throw new IllegalArgumentException("Cannot set non-task as launch root: " + wc);
|
||||
} else if (!task.mCreatedByOrganizer) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Cannot set non-organized task as adjacent flag root: " + wc);
|
||||
} else if (task.getAdjacentTaskFragment() == null) {
|
||||
} else if (task.getAdjacentTaskFragment() == null && !clearRoot) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Cannot set non-adjacent task as adjacent flag root: " + wc);
|
||||
}
|
||||
|
||||
final boolean clearRoot = hop.getToTop();
|
||||
task.getDisplayArea().setLaunchAdjacentFlagRootTask(clearRoot ? null : task);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -542,6 +542,36 @@ public class WindowOrganizerTests extends WindowTestsBase {
|
||||
assertEquals(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY, infos.get(0).getWindowingMode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetAdjacentLaunchRoot() {
|
||||
DisplayContent dc = mWm.mRoot.getDisplayContent(Display.DEFAULT_DISPLAY);
|
||||
|
||||
final Task task1 = mWm.mAtmService.mTaskOrganizerController.createRootTask(
|
||||
dc, WINDOWING_MODE_MULTI_WINDOW, null);
|
||||
final RunningTaskInfo info1 = task1.getTaskInfo();
|
||||
final Task task2 = mWm.mAtmService.mTaskOrganizerController.createRootTask(
|
||||
dc, WINDOWING_MODE_MULTI_WINDOW, null);
|
||||
final RunningTaskInfo info2 = task2.getTaskInfo();
|
||||
|
||||
WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||
wct.setAdjacentRoots(info1.token, info2.token);
|
||||
mWm.mAtmService.mWindowOrganizerController.applyTransaction(wct);
|
||||
assertEquals(task1.getAdjacentTaskFragment(), task2);
|
||||
assertEquals(task2.getAdjacentTaskFragment(), task1);
|
||||
|
||||
wct = new WindowContainerTransaction();
|
||||
wct.setLaunchAdjacentFlagRoot(info1.token);
|
||||
mWm.mAtmService.mWindowOrganizerController.applyTransaction(wct);
|
||||
assertEquals(dc.getDefaultTaskDisplayArea().mLaunchAdjacentFlagRootTask, task1);
|
||||
|
||||
task1.setAdjacentTaskFragment(null);
|
||||
task2.setAdjacentTaskFragment(null);
|
||||
wct = new WindowContainerTransaction();
|
||||
wct.clearLaunchAdjacentFlagRoot(info1.token);
|
||||
mWm.mAtmService.mWindowOrganizerController.applyTransaction(wct);
|
||||
assertEquals(dc.getDefaultTaskDisplayArea().mLaunchAdjacentFlagRootTask, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTileAddRemoveChild() {
|
||||
final StubOrganizer listener = new StubOrganizer();
|
||||
|
||||
Reference in New Issue
Block a user