Merge "Revert "Override process config for cold start on secondary screens"" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0fea6e25c5
@@ -1085,22 +1085,6 @@ final class ActivityRecord extends ConfigurationContainer {
|
|||||||
if (root == this) {
|
if (root == this) {
|
||||||
task.setRootProcess(proc);
|
task.setRootProcess(proc);
|
||||||
}
|
}
|
||||||
// Override the process configuration to match the display where the first activity in
|
|
||||||
// the process was launched. This can help with compat issues on secondary displays when
|
|
||||||
// apps use Application to obtain configuration or metrics instead of Activity.
|
|
||||||
final ActivityDisplay display = getDisplay();
|
|
||||||
if (display == null || display.mDisplayId == INVALID_DISPLAY) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!proc.hasActivities() && display.mDisplayId != DEFAULT_DISPLAY) {
|
|
||||||
proc.registerDisplayConfigurationListenerLocked(display);
|
|
||||||
} else if (display.mDisplayId == DEFAULT_DISPLAY) {
|
|
||||||
// Once an activity is launched on default display - stop listening for other displays
|
|
||||||
// configurations to maintain compatibility with previous platform releases. E.g. when
|
|
||||||
// an activity is launched in a Bubble and then moved to default screen, we should match
|
|
||||||
// the global device config.
|
|
||||||
proc.unregisterDisplayConfigurationListenerLocked();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasProcess() {
|
boolean hasProcess() {
|
||||||
@@ -3249,7 +3233,7 @@ final class ActivityRecord extends ConfigurationContainer {
|
|||||||
// Update last reported values.
|
// Update last reported values.
|
||||||
final Configuration newMergedOverrideConfig = getMergedOverrideConfiguration();
|
final Configuration newMergedOverrideConfig = getMergedOverrideConfiguration();
|
||||||
|
|
||||||
setLastReportedConfiguration(getProcessGlobalConfiguration(), newMergedOverrideConfig);
|
setLastReportedConfiguration(mAtmService.getGlobalConfiguration(), newMergedOverrideConfig);
|
||||||
|
|
||||||
if (mState == INITIALIZING) {
|
if (mState == INITIALIZING) {
|
||||||
// No need to relaunch or schedule new config for activity that hasn't been launched
|
// No need to relaunch or schedule new config for activity that hasn't been launched
|
||||||
@@ -3358,14 +3342,6 @@ final class ActivityRecord extends ConfigurationContainer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get process configuration, or global config if the process is not set. */
|
|
||||||
private Configuration getProcessGlobalConfiguration() {
|
|
||||||
if (app != null) {
|
|
||||||
return app.getConfiguration();
|
|
||||||
}
|
|
||||||
return mAtmService.getGlobalConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When assessing a configuration change, decide if the changes flags and the new configurations
|
* When assessing a configuration change, decide if the changes flags and the new configurations
|
||||||
* should cause the Activity to relaunch.
|
* should cause the Activity to relaunch.
|
||||||
@@ -3473,7 +3449,7 @@ final class ActivityRecord extends ConfigurationContainer {
|
|||||||
mStackSupervisor.activityRelaunchingLocked(this);
|
mStackSupervisor.activityRelaunchingLocked(this);
|
||||||
final ClientTransactionItem callbackItem = ActivityRelaunchItem.obtain(pendingResults,
|
final ClientTransactionItem callbackItem = ActivityRelaunchItem.obtain(pendingResults,
|
||||||
pendingNewIntents, configChangeFlags,
|
pendingNewIntents, configChangeFlags,
|
||||||
new MergedConfiguration(getProcessGlobalConfiguration(),
|
new MergedConfiguration(mAtmService.getGlobalConfiguration(),
|
||||||
getMergedOverrideConfiguration()),
|
getMergedOverrideConfiguration()),
|
||||||
preserveWindow);
|
preserveWindow);
|
||||||
final ActivityLifecycleItem lifecycleItem;
|
final ActivityLifecycleItem lifecycleItem;
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.server.wm;
|
package com.android.server.wm;
|
||||||
|
|
||||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
|
|
||||||
import static android.view.Display.DEFAULT_DISPLAY;
|
import static android.view.Display.DEFAULT_DISPLAY;
|
||||||
import static android.view.Surface.ROTATION_0;
|
import static android.view.Surface.ROTATION_0;
|
||||||
import static android.view.Surface.ROTATION_90;
|
import static android.view.Surface.ROTATION_90;
|
||||||
@@ -40,7 +38,6 @@ import static com.android.server.wm.ActivityStack.REMOVE_TASK_MODE_MOVING;
|
|||||||
import static com.android.server.wm.ActivityStack.STACK_VISIBILITY_INVISIBLE;
|
import static com.android.server.wm.ActivityStack.STACK_VISIBILITY_INVISIBLE;
|
||||||
import static com.android.server.wm.ActivityStack.STACK_VISIBILITY_VISIBLE;
|
import static com.android.server.wm.ActivityStack.STACK_VISIBILITY_VISIBLE;
|
||||||
import static com.android.server.wm.ActivityStack.STACK_VISIBILITY_VISIBLE_BEHIND_TRANSLUCENT;
|
import static com.android.server.wm.ActivityStack.STACK_VISIBILITY_VISIBLE_BEHIND_TRANSLUCENT;
|
||||||
import static com.android.server.wm.WindowContainer.POSITION_TOP;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
@@ -59,10 +56,10 @@ import android.app.servertransaction.PauseActivityItem;
|
|||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
|
import android.os.RemoteException;
|
||||||
import android.platform.test.annotations.Presubmit;
|
import android.platform.test.annotations.Presubmit;
|
||||||
import android.util.MergedConfiguration;
|
import android.util.MergedConfiguration;
|
||||||
import android.util.MutableBoolean;
|
import android.util.MutableBoolean;
|
||||||
import android.view.DisplayInfo;
|
|
||||||
import android.view.IRemoteAnimationFinishedCallback;
|
import android.view.IRemoteAnimationFinishedCallback;
|
||||||
import android.view.IRemoteAnimationRunner.Stub;
|
import android.view.IRemoteAnimationRunner.Stub;
|
||||||
import android.view.RemoteAnimationAdapter;
|
import android.view.RemoteAnimationAdapter;
|
||||||
@@ -601,67 +598,6 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
|||||||
assertNull(mActivity.pendingOptions);
|
assertNull(mActivity.pendingOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSetProcessOverridesConfig() {
|
|
||||||
final ActivityRecord defaultDisplayActivity =
|
|
||||||
createActivityOnDisplay(true /* defaultDisplay */, null /* process */);
|
|
||||||
assertFalse(defaultDisplayActivity.app.registeredForDisplayConfigChanges());
|
|
||||||
|
|
||||||
final ActivityRecord secondaryDisplayActivity =
|
|
||||||
createActivityOnDisplay(false /* defaultDisplay */, null /* process */);
|
|
||||||
assertTrue(secondaryDisplayActivity.app.registeredForDisplayConfigChanges());
|
|
||||||
assertEquals(secondaryDisplayActivity.getDisplay().getResolvedOverrideConfiguration(),
|
|
||||||
secondaryDisplayActivity.app.getRequestedOverrideConfiguration());
|
|
||||||
|
|
||||||
assertNotEquals(defaultDisplayActivity.getConfiguration(),
|
|
||||||
secondaryDisplayActivity.getConfiguration());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSetProcessDoesntOverrideConfigIfAnotherActivityPresent() {
|
|
||||||
final ActivityRecord defaultDisplayActivity =
|
|
||||||
createActivityOnDisplay(true /* defaultDisplay */, null /* process */);
|
|
||||||
assertFalse(defaultDisplayActivity.app.registeredForDisplayConfigChanges());
|
|
||||||
|
|
||||||
final ActivityRecord secondaryDisplayActivity =
|
|
||||||
createActivityOnDisplay(false /* defaultDisplay */, defaultDisplayActivity.app);
|
|
||||||
assertFalse(secondaryDisplayActivity.app.registeredForDisplayConfigChanges());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testActivityOnDefaultDisplayClearsProcessOverride() {
|
|
||||||
final ActivityRecord secondaryDisplayActivity =
|
|
||||||
createActivityOnDisplay(false /* defaultDisplay */, null /* process */);
|
|
||||||
assertTrue(secondaryDisplayActivity.app.registeredForDisplayConfigChanges());
|
|
||||||
|
|
||||||
final ActivityRecord defaultDisplayActivity =
|
|
||||||
createActivityOnDisplay(true /* defaultDisplay */,
|
|
||||||
secondaryDisplayActivity.app);
|
|
||||||
assertFalse(defaultDisplayActivity.app.registeredForDisplayConfigChanges());
|
|
||||||
assertFalse(secondaryDisplayActivity.app.registeredForDisplayConfigChanges());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an activity on display. For non-default display request it will also create a new
|
|
||||||
* display with custom DisplayInfo.
|
|
||||||
*/
|
|
||||||
private ActivityRecord createActivityOnDisplay(boolean defaultDisplay,
|
|
||||||
WindowProcessController process) {
|
|
||||||
final ActivityDisplay display;
|
|
||||||
if (defaultDisplay) {
|
|
||||||
display = mRootActivityContainer.getDefaultDisplay();
|
|
||||||
} else {
|
|
||||||
final DisplayInfo info = new DisplayInfo();
|
|
||||||
info.logicalWidth = 100;
|
|
||||||
info.logicalHeight = 100;
|
|
||||||
display = addNewActivityDisplayAt(info, POSITION_TOP);
|
|
||||||
}
|
|
||||||
final TestActivityStack stack = display.createStack(WINDOWING_MODE_UNDEFINED,
|
|
||||||
ACTIVITY_TYPE_STANDARD, true /* onTop */);
|
|
||||||
final TaskRecord task = new TaskBuilder(mSupervisor).setStack(stack).build();
|
|
||||||
return new ActivityBuilder(mService).setTask(task).setUseProcess(process).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Setup {@link #mActivity} as a size-compat-mode-able activity without fixed orientation. */
|
/** Setup {@link #mActivity} as a size-compat-mode-able activity without fixed orientation. */
|
||||||
private void prepareFixedAspectRatioUnresizableActivity() {
|
private void prepareFixedAspectRatioUnresizableActivity() {
|
||||||
setupDisplayContentForCompatDisplayInsets();
|
setupDisplayContentForCompatDisplayInsets();
|
||||||
|
|||||||
@@ -195,7 +195,6 @@ class ActivityTestsBase {
|
|||||||
private ActivityStack mStack;
|
private ActivityStack mStack;
|
||||||
private int mActivityFlags;
|
private int mActivityFlags;
|
||||||
private int mLaunchMode;
|
private int mLaunchMode;
|
||||||
private WindowProcessController mWpc;
|
|
||||||
|
|
||||||
ActivityBuilder(ActivityTaskManagerService service) {
|
ActivityBuilder(ActivityTaskManagerService service) {
|
||||||
mService = service;
|
mService = service;
|
||||||
@@ -246,11 +245,6 @@ class ActivityTestsBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivityBuilder setUseProcess(WindowProcessController wpc) {
|
|
||||||
mWpc = wpc;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityRecord build() {
|
ActivityRecord build() {
|
||||||
if (mComponent == null) {
|
if (mComponent == null) {
|
||||||
final int id = sCurrentActivityId++;
|
final int id = sCurrentActivityId++;
|
||||||
@@ -296,18 +290,12 @@ class ActivityTestsBase {
|
|||||||
mTaskRecord.addActivityToTop(activity);
|
mTaskRecord.addActivityToTop(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
final WindowProcessController wpc;
|
final WindowProcessController wpc = new WindowProcessController(mService,
|
||||||
if (mWpc != null) {
|
mService.mContext.getApplicationInfo(), "name", 12345,
|
||||||
wpc = mWpc;
|
UserHandle.getUserId(12345), mock(Object.class),
|
||||||
} else {
|
mock(WindowProcessListener.class));
|
||||||
wpc = new WindowProcessController(mService,
|
wpc.setThread(mock(IApplicationThread.class));
|
||||||
mService.mContext.getApplicationInfo(), "name", 12345,
|
|
||||||
UserHandle.getUserId(12345), mock(Object.class),
|
|
||||||
mock(WindowProcessListener.class));
|
|
||||||
wpc.setThread(mock(IApplicationThread.class));
|
|
||||||
}
|
|
||||||
activity.setProcess(wpc);
|
activity.setProcess(wpc);
|
||||||
wpc.addActivityIfNeeded(activity);
|
|
||||||
return activity;
|
return activity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ public class AppWindowTokenTests extends WindowTestsBase {
|
|||||||
@FlakyTest(bugId = 131005232)
|
@FlakyTest(bugId = 131005232)
|
||||||
public void testLandscapeSeascapeRotationByApp() {
|
public void testLandscapeSeascapeRotationByApp() {
|
||||||
// Some plumbing to get the service ready for rotation updates.
|
// Some plumbing to get the service ready for rotation updates.
|
||||||
|
mWm.mDisplayReady = true;
|
||||||
mWm.mDisplayEnabled = true;
|
mWm.mDisplayEnabled = true;
|
||||||
|
|
||||||
final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(
|
final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(
|
||||||
@@ -185,6 +186,7 @@ public class AppWindowTokenTests extends WindowTestsBase {
|
|||||||
@Test
|
@Test
|
||||||
public void testLandscapeSeascapeRotationByPolicy() {
|
public void testLandscapeSeascapeRotationByPolicy() {
|
||||||
// Some plumbing to get the service ready for rotation updates.
|
// Some plumbing to get the service ready for rotation updates.
|
||||||
|
mWm.mDisplayReady = true;
|
||||||
mWm.mDisplayEnabled = true;
|
mWm.mDisplayEnabled = true;
|
||||||
|
|
||||||
final DisplayRotation spiedRotation = spy(mDisplayContent.getDisplayRotation());
|
final DisplayRotation spiedRotation = spy(mDisplayContent.getDisplayRotation());
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import android.content.BroadcastReceiver;
|
|||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.hardware.display.DisplayManagerInternal;
|
import android.hardware.display.DisplayManagerInternal;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -176,12 +175,6 @@ public class SystemServicesTestRule implements TestRule {
|
|||||||
// Display creation is driven by the ActivityManagerService via
|
// Display creation is driven by the ActivityManagerService via
|
||||||
// ActivityStackSupervisor. We emulate those steps here.
|
// ActivityStackSupervisor. We emulate those steps here.
|
||||||
mWindowManagerService.mRoot.createDisplayContent(display, mock(ActivityDisplay.class));
|
mWindowManagerService.mRoot.createDisplayContent(display, mock(ActivityDisplay.class));
|
||||||
mWindowManagerService.displayReady();
|
|
||||||
|
|
||||||
final Configuration defaultDisplayConfig =
|
|
||||||
mWindowManagerService.computeNewConfiguration(DEFAULT_DISPLAY);
|
|
||||||
doReturn(defaultDisplayConfig).when(atms).getGlobalConfiguration();
|
|
||||||
doReturn(defaultDisplayConfig).when(atms).getGlobalConfigurationForPid(anyInt());
|
|
||||||
|
|
||||||
mMockTracker.stopTracking();
|
mMockTracker.stopTracking();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ class WindowTestsBase {
|
|||||||
context.getDisplay().getDisplayInfo(mDisplayInfo);
|
context.getDisplay().getDisplayInfo(mDisplayInfo);
|
||||||
mDisplayContent = createNewDisplay();
|
mDisplayContent = createNewDisplay();
|
||||||
mWm.mDisplayEnabled = true;
|
mWm.mDisplayEnabled = true;
|
||||||
|
mWm.mDisplayReady = true;
|
||||||
|
|
||||||
// Set-up some common windows.
|
// Set-up some common windows.
|
||||||
mCommonWindows = new HashSet<>();
|
mCommonWindows = new HashSet<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user