Merge "Update override config to include some changes from global config" into nyc-dev

am: 88be465ce5

* commit '88be465ce572f84649e01744a7ec96b6346b3686':
  Update override config to include some changes from global config

Change-Id: I2b15d9856f87e66ae9eb1ab6c9b84f7ac3add2ce
This commit is contained in:
Andrii Kulian
2016-06-01 01:20:50 +00:00
committed by android-build-merger
3 changed files with 22 additions and 2 deletions

View File

@@ -207,7 +207,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
public static final int SCREENLAYOUT_COMPAT_NEEDED = 0x10000000;
/**
* Bit mask of overall layout of the screen. Currently there are two
* Bit mask of overall layout of the screen. Currently there are four
* fields:
* <p>The {@link #SCREENLAYOUT_SIZE_MASK} bits define the overall size
* of the screen. They may be one of

View File

@@ -73,7 +73,6 @@ 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_SHOWN;
import static com.android.server.am.ActivityStackSupervisor.FindTaskResult;
import static com.android.server.am.ActivityStackSupervisor.MOVING;
import static com.android.server.am.ActivityStackSupervisor.ON_TOP;
import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS;
import static com.android.server.wm.AppTransition.TRANSIT_ACTIVITY_CLOSE;
@@ -4464,6 +4463,7 @@ final class ActivityStack {
// Short circuit: if the two configurations are equal (the common case), then there is
// nothing to do.
final Configuration newConfig = mService.mConfiguration;
r.task.sanitizeOverrideConfiguration(newConfig);
final Configuration taskConfig = r.task.mOverrideConfig;
if (r.configuration.equals(newConfig)
&& r.taskConfigOverride.equals(taskConfig)

View File

@@ -73,6 +73,8 @@ import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_NEVER;
import static android.content.pm.ActivityInfo.RESIZE_MODE_CROP_WINDOWS;
import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZEABLE;
import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_PRIVILEGED;
import static android.content.res.Configuration.SCREENLAYOUT_LONG_MASK;
import static android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK;
import static android.provider.Settings.Secure.USER_SETUP_COMPLETE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ADD_REMOVE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_LOCKTASK;
@@ -1574,6 +1576,24 @@ final class TaskRecord {
return bounds;
}
/**
* Update fields that are not overridden for task from global configuration.
*
* @param globalConfig global configuration to update from.
*/
void sanitizeOverrideConfiguration(Configuration globalConfig) {
// screenLayout field is set in #calculateOverrideConfig but only part of it is really
// overridden - aspect ratio and size. Other flags (like layout direction) can be updated
// separately in global config and they also must be updated in override config.
int overrideScreenLayout = mOverrideConfig.screenLayout;
int newScreenLayout = globalConfig.screenLayout;
newScreenLayout = (newScreenLayout & ~SCREENLAYOUT_LONG_MASK)
| (overrideScreenLayout & SCREENLAYOUT_LONG_MASK);
newScreenLayout = (newScreenLayout & ~SCREENLAYOUT_SIZE_MASK)
| (overrideScreenLayout & SCREENLAYOUT_SIZE_MASK);
mOverrideConfig.screenLayout = newScreenLayout;
}
static Rect validateBounds(Rect bounds) {
if (bounds != null && bounds.isEmpty()) {
Slog.wtf(TAG, "Received strange task bounds: " + bounds, new Throwable());