Merge "Move AudioService recv off of main thread" into 24D1-dev
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 8852705..9142aea 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -1529,6 +1529,26 @@
public static final long INSETS_DECOUPLED_CONFIGURATION_ENFORCED = 151861875L;
/**
+ * When enabled, the activity will receive configuration decoupled from system bar insets.
+ *
+ * <p>This will only apply if the activity is targeting SDK level 34 or earlier versions.
+ *
+ * <p>This will only in effect if the device is trying to provide a different value by default
+ * other than the legacy value, i.e., the
+ * {@code Flags.allowsScreenSizeDecoupledFromStatusBarAndCutout()} is set to true.
+ *
+ * <p>If the {@code Flags.insetsDecoupledConfiguration()} is also set to true, all apps
+ * targeting SDK level 35 or later, and apps with this override flag will receive the insets
+ * decoupled configuration.
+ *
+ * @hide
+ */
+ @ChangeId
+ @Disabled
+ @Overridable
+ public static final long OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION = 327313645L;
+
+ /**
* Optional set of a certificates identifying apps that are allowed to embed this activity. From
* the "knownActivityEmbeddingCerts" attribute.
*/
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 6fcf506..c1221a6 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -76,6 +76,7 @@
import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS;
import static android.content.pm.ActivityInfo.FLAG_STATE_NOT_NEEDED;
import static android.content.pm.ActivityInfo.FLAG_TURN_SCREEN_ON;
+import static android.content.pm.ActivityInfo.OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION;
import static android.content.pm.ActivityInfo.INSETS_DECOUPLED_CONFIGURATION_ENFORCED;
import static android.content.pm.ActivityInfo.LAUNCH_MULTIPLE;
import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_INSTANCE;
@@ -2119,9 +2120,19 @@
mCameraCompatControlEnabled = mWmService.mContext.getResources()
.getBoolean(R.bool.config_isCameraCompatControlForStretchedIssuesEnabled);
mResolveConfigHint = new TaskFragment.ConfigOverrideHint();
- mResolveConfigHint.mUseLegacyInsetsForStableBounds =
- mWmService.mFlags.mInsetsDecoupledConfiguration
- && !info.isChangeEnabled(INSETS_DECOUPLED_CONFIGURATION_ENFORCED);
+ if (mWmService.mFlags.mInsetsDecoupledConfiguration) {
+ // When the stable configuration is the default behavior, override for the legacy apps
+ // without forward override flag.
+ mResolveConfigHint.mUseOverrideInsetsForStableBounds =
+ !info.isChangeEnabled(INSETS_DECOUPLED_CONFIGURATION_ENFORCED)
+ && !info.isChangeEnabled(
+ OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION);
+ } else {
+ // When the stable configuration is not the default behavior, forward overriding the
+ // listed apps.
+ mResolveConfigHint.mUseOverrideInsetsForStableBounds =
+ info.isChangeEnabled(OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION);
+ }
mTargetSdk = info.applicationInfo.targetSdkVersion;
@@ -8425,7 +8436,7 @@
mCompatDisplayInsets =
new CompatDisplayInsets(
mDisplayContent, this, letterboxedContainerBounds,
- mResolveConfigHint.mUseLegacyInsetsForStableBounds);
+ mResolveConfigHint.mUseOverrideInsetsForStableBounds);
}
private void clearSizeCompatModeAttributes() {
@@ -8628,7 +8639,7 @@
if (rotation == ROTATION_UNDEFINED && !isFixedRotationTransforming()) {
rotation = mDisplayContent.getRotation();
}
- if (!mResolveConfigHint.mUseLegacyInsetsForStableBounds
+ if (!mResolveConfigHint.mUseOverrideInsetsForStableBounds
|| getCompatDisplayInsets() != null
|| isFloating(parentWindowingMode) || parentAppBounds == null
|| parentAppBounds.isEmpty() || rotation == ROTATION_UNDEFINED) {
@@ -8945,7 +8956,7 @@
if (mDisplayContent == null) {
return true;
}
- if (!mResolveConfigHint.mUseLegacyInsetsForStableBounds) {
+ if (!mResolveConfigHint.mUseOverrideInsetsForStableBounds) {
// No insets should be considered any more.
return true;
}
@@ -8964,7 +8975,7 @@
final Task task = getTask();
task.calculateInsetFrames(outNonDecorBounds /* outNonDecorBounds */,
outStableBounds /* outStableBounds */, parentBounds /* bounds */, di,
- mResolveConfigHint.mUseLegacyInsetsForStableBounds);
+ mResolveConfigHint.mUseOverrideInsetsForStableBounds);
final int orientationWithInsets = outStableBounds.height() >= outStableBounds.width()
? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE;
// If orientation does not match the orientation with insets applied, then a
@@ -9021,7 +9032,7 @@
getResolvedOverrideConfiguration().windowConfiguration.getBounds();
final int stableBoundsOrientation = stableBounds.width() > stableBounds.height()
? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT;
- final int parentOrientation = mResolveConfigHint.mUseLegacyInsetsForStableBounds
+ final int parentOrientation = mResolveConfigHint.mUseOverrideInsetsForStableBounds
? stableBoundsOrientation : newParentConfig.orientation;
// If the activity requires a different orientation (either by override or activityInfo),
@@ -9046,7 +9057,7 @@
return;
}
- final Rect parentAppBounds = mResolveConfigHint.mUseLegacyInsetsForStableBounds
+ final Rect parentAppBounds = mResolveConfigHint.mUseOverrideInsetsForStableBounds
? outNonDecorBounds : newParentConfig.windowConfiguration.getAppBounds();
// TODO(b/182268157): Explore using only one type of parentBoundsWithInsets, either app
// bounds or stable bounds to unify aspect ratio logic.
diff --git a/services/core/java/com/android/server/wm/LetterboxUiController.java b/services/core/java/com/android/server/wm/LetterboxUiController.java
index 224be157..a961e9a 100644
--- a/services/core/java/com/android/server/wm/LetterboxUiController.java
+++ b/services/core/java/com/android/server/wm/LetterboxUiController.java
@@ -885,13 +885,11 @@
// Note that we check the task rather than the parent as with ActivityEmbedding the parent might
// be a TaskFragment, and its windowing mode is always MULTI_WINDOW, even if the task is
// actually fullscreen.
- private boolean isDisplayFullScreenAndInPosture(DeviceStateController.DeviceState state,
- boolean isTabletop) {
+ private boolean isDisplayFullScreenAndInPosture(boolean isTabletop) {
Task task = mActivityRecord.getTask();
- return mActivityRecord.mDisplayContent != null
- && mActivityRecord.mDisplayContent.getDisplayRotation().isDeviceInPosture(state,
- isTabletop)
- && task != null
+ return mActivityRecord.mDisplayContent != null && task != null
+ && mActivityRecord.mDisplayContent.getDisplayRotation().isDeviceInPosture(
+ DeviceStateController.DeviceState.HALF_FOLDED, isTabletop)
&& task.getWindowingMode() == WINDOWING_MODE_FULLSCREEN;
}
@@ -919,16 +917,14 @@
}
private boolean isFullScreenAndBookModeEnabled() {
- return isDisplayFullScreenAndInPosture(
- DeviceStateController.DeviceState.HALF_FOLDED, false /* isTabletop */)
+ return isDisplayFullScreenAndInPosture(/* isTabletop */ false)
&& mLetterboxConfiguration.getIsAutomaticReachabilityInBookModeEnabled();
}
float getVerticalPositionMultiplier(Configuration parentConfiguration) {
// Don't check resolved configuration because it may not be updated yet during
// configuration change.
- boolean tabletopMode = isDisplayFullScreenAndInPosture(
- DeviceStateController.DeviceState.HALF_FOLDED, true /* isTabletop */);
+ boolean tabletopMode = isDisplayFullScreenAndInPosture(/* isTabletop */ true);
return isVerticalReachabilityEnabled(parentConfiguration)
// Using the last global dynamic position to avoid "jumps" when moving
// between apps or activities.
@@ -961,16 +957,15 @@
}
private boolean shouldUseSplitScreenAspectRatio(@NonNull Configuration parentConfiguration) {
- final boolean isBookMode = isDisplayFullScreenAndInPosture(
- DeviceStateController.DeviceState.HALF_FOLDED,
- /* isTabletop */ false);
+ final boolean isBookMode = isDisplayFullScreenAndInPosture(/* isTabletop */ false);
final boolean isNotCenteredHorizontally = getHorizontalPositionMultiplier(
parentConfiguration) != LETTERBOX_POSITION_MULTIPLIER_CENTER;
- final boolean isTabletopMode = isDisplayFullScreenAndInPosture(
- DeviceStateController.DeviceState.HALF_FOLDED,
- /* isTabletop */ true);
+ final boolean isTabletopMode = isDisplayFullScreenAndInPosture(/* isTabletop */ true);
+ final boolean isLandscape = isFixedOrientationLandscape(
+ mActivityRecord.getOverrideOrientation());
+
// Don't resize to split screen size when in book mode if letterbox position is centered
- return ((isBookMode && isNotCenteredHorizontally) || isTabletopMode)
+ return (isBookMode && isNotCenteredHorizontally || isTabletopMode && isLandscape)
|| isCameraCompatSplitScreenAspectRatioAllowed()
&& isCameraCompatTreatmentActive();
}
@@ -1632,17 +1627,13 @@
if (isHorizontalReachabilityEnabled()) {
int letterboxPositionForHorizontalReachability = getLetterboxConfiguration()
.getLetterboxPositionForHorizontalReachability(
- isDisplayFullScreenAndInPosture(
- DeviceStateController.DeviceState.HALF_FOLDED,
- false /* isTabletop */));
+ isDisplayFullScreenAndInPosture(/* isTabletop */ false));
positionToLog = letterboxHorizontalReachabilityPositionToLetterboxPosition(
letterboxPositionForHorizontalReachability);
} else if (isVerticalReachabilityEnabled()) {
int letterboxPositionForVerticalReachability = getLetterboxConfiguration()
.getLetterboxPositionForVerticalReachability(
- isDisplayFullScreenAndInPosture(
- DeviceStateController.DeviceState.HALF_FOLDED,
- true /* isTabletop */));
+ isDisplayFullScreenAndInPosture(/* isTabletop */ true));
positionToLog = letterboxVerticalReachabilityPositionToLetterboxPosition(
letterboxPositionForVerticalReachability);
}
diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java
index da79a22..271e807 100644
--- a/services/core/java/com/android/server/wm/TaskFragment.java
+++ b/services/core/java/com/android/server/wm/TaskFragment.java
@@ -2213,7 +2213,7 @@
static class ConfigOverrideHint {
@Nullable DisplayInfo mTmpOverrideDisplayInfo;
@Nullable ActivityRecord.CompatDisplayInsets mTmpCompatInsets;
- boolean mUseLegacyInsetsForStableBounds;
+ boolean mUseOverrideInsetsForStableBounds;
}
void computeConfigResourceOverrides(@NonNull Configuration inOutConfig,
@@ -2246,11 +2246,11 @@
@NonNull Configuration parentConfig, @Nullable ConfigOverrideHint overrideHint) {
DisplayInfo overrideDisplayInfo = null;
ActivityRecord.CompatDisplayInsets compatInsets = null;
- boolean useLegacyInsetsForStableBounds = false;
+ boolean useOverrideInsetsForStableBounds = false;
if (overrideHint != null) {
overrideDisplayInfo = overrideHint.mTmpOverrideDisplayInfo;
compatInsets = overrideHint.mTmpCompatInsets;
- useLegacyInsetsForStableBounds = overrideHint.mUseLegacyInsetsForStableBounds;
+ useOverrideInsetsForStableBounds = overrideHint.mUseOverrideInsetsForStableBounds;
if (overrideDisplayInfo != null) {
// Make sure the screen related configs can be computed by the provided
// display info.
@@ -2330,7 +2330,7 @@
// The non decor inset are areas that could never be removed in Honeycomb. See
// {@link WindowManagerPolicy#getNonDecorInsetsLw}.
calculateInsetFrames(mTmpNonDecorBounds, mTmpStableBounds, mTmpFullBounds, di,
- useLegacyInsetsForStableBounds);
+ useOverrideInsetsForStableBounds);
} else {
// Apply the given non-decor and stable insets to calculate the corresponding bounds
// for screen size of configuration.
diff --git a/services/foldables/devicestateprovider/src/com/android/server/policy/BookStyleStateTransitions.java b/services/foldables/devicestateprovider/src/com/android/server/policy/BookStyleStateTransitions.java
index 16daacb..aa7532a 100644
--- a/services/foldables/devicestateprovider/src/com/android/server/policy/BookStyleStateTransitions.java
+++ b/services/foldables/devicestateprovider/src/com/android/server/policy/BookStyleStateTransitions.java
@@ -412,7 +412,7 @@
/* stickyKeepInnerUntil45Degrees */ true,
PreferredScreen.INNER,
/* setStickyKeepOuterUntil90Degrees */ null,
- /* setStickyKeepInnerUntil45Degrees */ false
+ /* setStickyKeepInnerUntil45Degrees */ null
));
DEFAULT_STATE_TRANSITIONS.add(new StateTransition(
HingeAngle.ANGLE_45_TO_90,
@@ -492,7 +492,7 @@
/* stickyKeepInnerUntil45Degrees */ true,
PreferredScreen.INNER,
/* setStickyKeepOuterUntil90Degrees */ null,
- /* setStickyKeepInnerUntil45Degrees */ false
+ /* setStickyKeepInnerUntil45Degrees */ null
));
DEFAULT_STATE_TRANSITIONS.add(new StateTransition(
HingeAngle.ANGLE_45_TO_90,
diff --git a/services/foldables/devicestateprovider/tests/src/com/android/server/policy/BookStyleDeviceStatePolicyTest.java b/services/foldables/devicestateprovider/tests/src/com/android/server/policy/BookStyleDeviceStatePolicyTest.java
index 9f07aa8..2d725d1 100644
--- a/services/foldables/devicestateprovider/tests/src/com/android/server/policy/BookStyleDeviceStatePolicyTest.java
+++ b/services/foldables/devicestateprovider/tests/src/com/android/server/policy/BookStyleDeviceStatePolicyTest.java
@@ -511,7 +511,7 @@
}
@Test
- public void test_unfoldTo60Degrees_andFoldTo10_switchesToClosedState() {
+ public void test_unfoldTo60Degrees_andFoldTo10_doesNotSwitchToClosedState() {
sendHingeAngle(0f);
sendRightSideFlatSensorEvent(false);
mProvider.setListener(mListener);
@@ -522,6 +522,36 @@
sendHingeAngle(10f);
+ verify(mListener, never()).onStateChanged(anyInt());
+ }
+
+ @Test
+ public void test_unfoldTo100Degrees_andFoldTo10_switchesToClosedState() {
+ sendHingeAngle(0f);
+ sendRightSideFlatSensorEvent(false);
+ mProvider.setListener(mListener);
+ assertLatestReportedState(DEVICE_STATE_CLOSED);
+ sendHingeAngle(100f);
+ assertLatestReportedState(DEVICE_STATE_HALF_OPENED);
+ clearInvocations(mListener);
+
+ sendHingeAngle(10f);
+
+ verify(mListener).onStateChanged(DEVICE_STATE_CLOSED);
+ }
+
+ @Test
+ public void test_unfoldTo10Degrees_andFoldTo0_switchesToClosedState() {
+ sendHingeAngle(0f);
+ sendRightSideFlatSensorEvent(false);
+ mProvider.setListener(mListener);
+ assertLatestReportedState(DEVICE_STATE_CLOSED);
+ sendHingeAngle(10f);
+ assertLatestReportedState(DEVICE_STATE_HALF_OPENED);
+ clearInvocations(mListener);
+
+ sendHingeAngle(0f);
+
verify(mListener).onStateChanged(DEVICE_STATE_CLOSED);
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
index 8641267..21c16eb 100644
--- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
@@ -4425,6 +4425,21 @@
}
@Test
+ public void testPortraitAppInTabletop_notSplitScreen() {
+ final int dw = 2400;
+ setUpDisplaySizeWithApp(dw, 2000);
+ prepareUnresizable(mActivity, SCREEN_ORIENTATION_PORTRAIT);
+
+ final int initialWidth = mActivity.getBounds().width();
+
+ setFoldablePosture(true /* isHalfFolded */, true /* isTabletop */);
+
+ final int finalWidth = mActivity.getBounds().width();
+ assertEquals(initialWidth, finalWidth);
+ assertNotEquals(finalWidth, getExpectedSplitSize(dw));
+ }
+
+ @Test
public void testUpdateResolvedBoundsHorizontalPosition_bookModeEnabled() {
// Set up a display in landscape with a fixed-orientation PORTRAIT app
setUpDisplaySizeWithApp(2800, 1400);
diff --git a/telephony/java/android/telephony/satellite/SatelliteManager.java b/telephony/java/android/telephony/satellite/SatelliteManager.java
index 87bb0f0..b005715 100644
--- a/telephony/java/android/telephony/satellite/SatelliteManager.java
+++ b/telephony/java/android/telephony/satellite/SatelliteManager.java
@@ -954,6 +954,11 @@
@FlaggedApi(Flags.FLAG_OEM_ENABLED_SATELLITE_FLAG)
public static final int SATELLITE_MODEM_STATE_CONNECTED = 7;
/**
+ * The satellite modem is being powered on.
+ * @hide
+ */
+ public static final int SATELLITE_MODEM_STATE_ENABLING_SATELLITE = 8;
+ /**
* Satellite modem state is unknown. This generic modem state should be used only when the
* modem state cannot be mapped to other specific modem states.
*/
@@ -970,6 +975,7 @@
SATELLITE_MODEM_STATE_UNAVAILABLE,
SATELLITE_MODEM_STATE_NOT_CONNECTED,
SATELLITE_MODEM_STATE_CONNECTED,
+ SATELLITE_MODEM_STATE_ENABLING_SATELLITE,
SATELLITE_MODEM_STATE_UNKNOWN
})
@Retention(RetentionPolicy.SOURCE)