Allow background activity launch by drag notification
Drag notification to launch activity is aborted since the app is not visible. This CL adds the background activity allowed flag to make activity launches successful. Bug: 237985674 Test: Drag the notification to home. Check the activity is launched. Change-Id: I6513e7d5d7b17c4a41c32316fd7504fe1bf2e793
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
package com.android.wm.shell.draganddrop;
|
||||
|
||||
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
|
||||
import static android.app.ComponentOptions.KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED;
|
||||
import static android.app.ComponentOptions.KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
|
||||
@@ -263,6 +265,9 @@ public class DragAndDropPolicy {
|
||||
mStarter.startShortcut(packageName, id, position, opts, user);
|
||||
} else {
|
||||
final PendingIntent launchIntent = intent.getParcelableExtra(EXTRA_PENDING_INTENT);
|
||||
// Put BAL flags to avoid activity start aborted.
|
||||
opts.putBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED, true);
|
||||
opts.putBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION, true);
|
||||
mStarter.startIntent(launchIntent, null /* fillIntent */, position, opts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@ package com.android.wm.shell.splitscreen;
|
||||
|
||||
import static android.app.ActivityOptions.KEY_LAUNCH_ROOT_TASK_TOKEN;
|
||||
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
|
||||
import static android.app.ComponentOptions.KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED;
|
||||
import static android.app.ComponentOptions.KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
|
||||
@@ -1104,9 +1102,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
|
||||
private void addActivityOptions(Bundle opts, StageTaskListener stage) {
|
||||
opts.putParcelable(KEY_LAUNCH_ROOT_TASK_TOKEN, stage.mRootTaskInfo.token);
|
||||
// Put BAL flags to avoid activity start aborted.
|
||||
opts.putBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED, true);
|
||||
opts.putBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION, true);
|
||||
}
|
||||
|
||||
void updateActivityOptions(Bundle opts, @SplitPosition int position) {
|
||||
|
||||
Reference in New Issue
Block a user