Merge "Don't take app screenshot in minimize docked stack." into nyc-mr1-dev

This commit is contained in:
TreeHugger Robot
2016-09-22 22:09:24 +00:00
committed by Android (Google) Code Review

View File

@@ -29,6 +29,7 @@ import static android.content.pm.ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE;
import static android.content.pm.ActivityInfo.FLAG_RESUME_WHILE_PAUSING; import static android.content.pm.ActivityInfo.FLAG_RESUME_WHILE_PAUSING;
import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS; import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS;
import static android.content.res.Configuration.SCREENLAYOUT_UNDEFINED; import static android.content.res.Configuration.SCREENLAYOUT_UNDEFINED;
import static android.view.Display.DEFAULT_DISPLAY;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ADD_REMOVE; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ADD_REMOVE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ALL; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ALL;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_APP; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_APP;
@@ -68,6 +69,7 @@ import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_VISIBILIT
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.am.ActivityManagerService.LOCK_SCREEN_SHOWN; import static com.android.server.am.ActivityManagerService.LOCK_SCREEN_SHOWN;
import static com.android.server.am.ActivityManagerService.TAKE_FULLSCREEN_SCREENSHOTS;
import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE; import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE; import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.STARTING_WINDOW_REMOVED; import static com.android.server.am.ActivityRecord.STARTING_WINDOW_REMOVED;
@@ -669,7 +671,7 @@ final class ActivityStack {
final boolean isOnHomeDisplay() { final boolean isOnHomeDisplay() {
return isAttached() && return isAttached() &&
mActivityContainer.mActivityDisplay.mDisplayId == Display.DEFAULT_DISPLAY; mActivityContainer.mActivityDisplay.mDisplayId == DEFAULT_DISPLAY;
} }
void moveToFront(String reason) { void moveToFront(String reason) {
@@ -1041,22 +1043,32 @@ final class ActivityStack {
int w = mService.mThumbnailWidth; int w = mService.mThumbnailWidth;
int h = mService.mThumbnailHeight; int h = mService.mThumbnailHeight;
float scale = 1f;
if (w > 0) {
if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "\tTaking screenshot");
// When this flag is set, we currently take the fullscreen screenshot of the activity if (w <= 0) {
// but scaled to half the size. This gives us a "good-enough" fullscreen thumbnail to Slog.e(TAG, "\tInvalid thumbnail dimensions: " + w + "x" + h);
// use within SystemUI while keeping memory usage low. return null;
if (ActivityManagerService.TAKE_FULLSCREEN_SCREENSHOTS) {
w = h = -1;
scale = mService.mFullscreenThumbnailScale;
}
return mWindowManager.screenshotApplications(who.appToken, Display.DEFAULT_DISPLAY,
w, h, scale);
} }
Slog.e(TAG, "Invalid thumbnail dimensions: " + w + "x" + h);
return null; if (mStackId == DOCKED_STACK_ID && mStackSupervisor.mIsDockMinimized) {
// When the docked stack is minimized its app windows are cropped significantly so any
// screenshot taken will not display the apps contain. So, we avoid taking a screenshot
// in that case.
if (DEBUG_SCREENSHOTS) Slog.e(TAG, "\tIn minimized docked stack");
return null;
}
float scale = 1f;
if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "\tTaking screenshot");
// When this flag is set, we currently take the fullscreen screenshot of the activity but
// scaled to half the size. This gives us a "good-enough" fullscreen thumbnail to use within
// SystemUI while keeping memory usage low.
if (TAKE_FULLSCREEN_SCREENSHOTS) {
w = h = -1;
scale = mService.mFullscreenThumbnailScale;
}
return mWindowManager.screenshotApplications(who.appToken, DEFAULT_DISPLAY, w, h, scale);
} }
/** /**