Show forced resizable based on top activity

Also don't show it for noDisplay activities.

Bug: 28223489
Change-Id: Idb555b019b5cebdcf16a0cfaa19d64263874735f
This commit is contained in:
Jorim Jaggi
2016-04-27 15:40:20 -07:00
parent c875ae74ba
commit cd13d33ee5
2 changed files with 10 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.content.pm.ActivityInfo.RESIZE_MODE_CROP_WINDOWS;
import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_CONFIGURATION;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_SWITCH;
@@ -822,6 +823,11 @@ final class ActivityRecord {
return !isHomeActivity() && (isResizeable() || service.mForceResizableActivities);
}
boolean isNonResizableOrForced() {
return !isHomeActivity() && info.resizeMode != RESIZE_MODE_RESIZEABLE
&& info.resizeMode != RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
}
boolean supportsPictureInPicture() {
return !isHomeActivity() && info.resizeMode == RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
}

View File

@@ -3508,6 +3508,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
return;
}
final ActivityRecord topActivity = task.getTopActivity();
if (!task.canGoInDockedStack() || forceNonResizable) {
// Display a warning toast that we tried to put a non-dockable task in the docked stack.
mService.mHandler.sendEmptyMessage(NOTIFY_ACTIVITY_DISMISSING_DOCKED_STACK_MSG);
@@ -3515,9 +3516,9 @@ public final class ActivityStackSupervisor implements DisplayListener {
// Dismiss docked stack. If task appeared to be in docked stack but is not resizable -
// we need to move it to top of fullscreen stack, otherwise it will be covered.
moveTasksToFullscreenStackLocked(DOCKED_STACK_ID, actualStackId == DOCKED_STACK_ID);
} else if (task.mResizeMode == RESIZE_MODE_FORCE_RESIZEABLE) {
String packageName = task.getTopActivity() != null
? task.getTopActivity().appInfo.packageName : null;
} else if (topActivity != null && topActivity.isNonResizableOrForced()
&& !topActivity.noDisplay) {
String packageName = topActivity.appInfo.packageName;
mService.mHandler.obtainMessage(NOTIFY_FORCED_RESIZABLE_MSG, task.taskId, 0,
packageName).sendToTarget();
}