Merge "Read only versions of read only flag (ag/28012390.) so the user serial number can be read before flags are initialized." into main
diff --git a/core/java/android/service/dreams/IDreamManager.aidl b/core/java/android/service/dreams/IDreamManager.aidl
index 620eef6..76f6363 100644
--- a/core/java/android/service/dreams/IDreamManager.aidl
+++ b/core/java/android/service/dreams/IDreamManager.aidl
@@ -39,7 +39,9 @@
@UnsupportedAppUsage
boolean isDreamingOrInPreview();
boolean canStartDreaming(boolean isScreenOn);
+ /** @deprecated Please use finishSelfOneway instead. */
void finishSelf(in IBinder token, boolean immediate);
+ /** @deprecated Please use startDozingOneway instead. */
void startDozing(in IBinder token, int screenState, int reason, int screenBrightness);
void stopDozing(in IBinder token);
void forceAmbientDisplayEnabled(boolean enabled);
diff --git a/mms/java/android/telephony/MmsManager.java b/mms/java/android/telephony/MmsManager.java
index b893b45..ac29277 100644
--- a/mms/java/android/telephony/MmsManager.java
+++ b/mms/java/android/telephony/MmsManager.java
@@ -26,6 +26,7 @@
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.UserHandle;
import com.android.internal.telephony.IMms;
@@ -69,9 +70,9 @@
return;
}
- iMms.sendMessage(subId, ActivityThread.currentPackageName(), contentUri,
- locationUrl, configOverrides, sentIntent, messageId,
- mContext.getAttributionTag());
+ iMms.sendMessage(subId, /* placeholder callingUser= */ UserHandle.USER_NULL,
+ ActivityThread.currentPackageName(), contentUri, locationUrl,
+ configOverrides, sentIntent, messageId, mContext.getAttributionTag());
} catch (RemoteException e) {
// Ignore it
}
@@ -101,9 +102,9 @@
if (iMms == null) {
return;
}
- iMms.downloadMessage(subId, ActivityThread.currentPackageName(),
- locationUrl, contentUri, configOverrides, downloadedIntent,
- messageId, mContext.getAttributionTag());
+ iMms.downloadMessage(subId, /* placeholder callingUser= */ UserHandle.USER_NULL,
+ ActivityThread.currentPackageName(), locationUrl, contentUri,
+ configOverrides, downloadedIntent, messageId, mContext.getAttributionTag());
} catch (RemoteException e) {
// Ignore it
}
diff --git a/mms/java/com/android/internal/telephony/IMms.aidl b/mms/java/com/android/internal/telephony/IMms.aidl
index 3cdde10..1c75951 100644
--- a/mms/java/com/android/internal/telephony/IMms.aidl
+++ b/mms/java/com/android/internal/telephony/IMms.aidl
@@ -29,6 +29,7 @@
* Send an MMS message with attribution tag.
*
* @param subId the SIM id
+ * @param callingUser user id of the calling app
* @param callingPkg the package name of the calling app
* @param contentUri the content uri from which to read MMS message encoded in standard MMS
* PDU format
@@ -40,7 +41,7 @@
* @param messageId An id that uniquely identifies the message requested to be sent.
* @param attributionTag a tag that attributes the call to a client App.
*/
- void sendMessage(int subId, String callingPkg, in Uri contentUri,
+ void sendMessage(int subId, in int callingUser, String callingPkg, in Uri contentUri,
String locationUrl, in Bundle configOverrides, in PendingIntent sentIntent,
in long messageId, String attributionTag);
@@ -48,6 +49,7 @@
* Download an MMS message using known location and transaction id
*
* @param subId the SIM id
+ * @param callingUser user id of the calling app
* @param callingPkg the package name of the calling app
* @param locationUrl the location URL of the MMS message to be downloaded, usually obtained
* from the MMS WAP push notification
@@ -60,7 +62,7 @@
* @param messageId An id that uniquely identifies the message requested to be downloaded.
* @param attributionTag a tag that attributes the call to a client App.
*/
- void downloadMessage(int subId, String callingPkg, String locationUrl,
+ void downloadMessage(int subId, in int callingUser, String callingPkg, String locationUrl,
in Uri contentUri, in Bundle configOverrides,
in PendingIntent downloadedIntent, in long messageId, String attributionTag);
@@ -82,6 +84,7 @@
/**
* Import a multimedia message into system's MMS store
*
+ * @param callingUser user id of the calling app
* @param callingPkg the package name of the calling app
* @param contentUri the content uri from which to read PDU of the message to import
* @param messageId the optional message id
@@ -90,7 +93,7 @@
* @param read if the message is read
* @return the message URI, null if failed
*/
- Uri importMultimediaMessage(String callingPkg, in Uri contentUri, String messageId,
+ Uri importMultimediaMessage(in int callingUser, String callingPkg, in Uri contentUri, String messageId,
long timestampSecs, boolean seen, boolean read);
/**
@@ -146,11 +149,12 @@
/**
* Add a multimedia message draft to system MMS store
*
+ * @param callingUser user id of the calling app
* @param callingPkg the package name of the calling app
* @param contentUri the content Uri from which to read PDU data of the draft MMS
* @return the URI of the stored draft message
*/
- Uri addMultimediaMessageDraft(String callingPkg, in Uri contentUri);
+ Uri addMultimediaMessageDraft(in int callingUser, String callingPkg, in Uri contentUri);
/**
* Send a system stored MMS message
diff --git a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt
index be64ff6..af755d3 100644
--- a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt
@@ -384,16 +384,7 @@
if (index > 0) {
HorizontalDivider()
}
- ShortcutSinglePane(searchQuery, shortcut)
- }
-}
-
-@Composable
-private fun ShortcutSinglePane(searchQuery: String, shortcut: Shortcut) {
- Column(Modifier.padding(vertical = 24.dp)) {
- ShortcutDescriptionText(searchQuery = searchQuery, shortcut = shortcut)
- Spacer(modifier = Modifier.height(12.dp))
- ShortcutKeyCombinations(shortcut = shortcut)
+ ShortcutView(Modifier.padding(vertical = 24.dp), searchQuery, shortcut)
}
}
@@ -421,7 +412,7 @@
onCategoryClicked = { onCategorySelected(it.type) }
)
Spacer(modifier = Modifier.width(24.dp))
- EndSidePanel(searchQuery, Modifier.fillMaxSize(), selectedCategory)
+ EndSidePanel(searchQuery, Modifier.fillMaxSize().padding(top = 8.dp), selectedCategory)
}
}
}
@@ -447,14 +438,14 @@
shape = RoundedCornerShape(28.dp),
color = MaterialTheme.colorScheme.surfaceBright
) {
- Column(Modifier.padding(horizontal = 32.dp, vertical = 24.dp)) {
+ Column(Modifier.padding(24.dp)) {
SubCategoryTitle(subCategory.label)
- Spacer(Modifier.height(24.dp))
+ Spacer(Modifier.height(8.dp))
subCategory.shortcuts.fastForEachIndexed { index, shortcut ->
if (index > 0) {
HorizontalDivider()
}
- ShortcutViewDualPane(searchQuery, shortcut)
+ ShortcutView(Modifier.padding(vertical = 16.dp), searchQuery, shortcut)
}
}
}
@@ -470,17 +461,17 @@
}
@Composable
-private fun ShortcutViewDualPane(searchQuery: String, shortcut: Shortcut) {
- Row(Modifier.padding(vertical = 16.dp)) {
+private fun ShortcutView(modifier: Modifier, searchQuery: String, shortcut: Shortcut) {
+ Row(modifier) {
Row(
- modifier = Modifier.width(160.dp).align(Alignment.CenterVertically),
+ modifier = Modifier.width(128.dp).align(Alignment.CenterVertically),
horizontalArrangement = Arrangement.spacedBy(16.dp),
verticalAlignment = Alignment.CenterVertically,
) {
if (shortcut.icon != null) {
ShortcutIcon(
shortcut.icon,
- modifier = Modifier.size(36.dp),
+ modifier = Modifier.size(24.dp),
)
}
ShortcutDescriptionText(
@@ -520,7 +511,11 @@
modifier: Modifier = Modifier,
shortcut: Shortcut,
) {
- FlowRow(modifier = modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {
+ FlowRow(
+ modifier = modifier,
+ verticalArrangement = Arrangement.spacedBy(8.dp),
+ horizontalArrangement = Arrangement.End
+ ) {
shortcut.commands.forEachIndexed { index, command ->
if (index > 0) {
ShortcutOrSeparator(spacing = 16.dp)
@@ -641,7 +636,7 @@
) {
Column(modifier) {
ShortcutsSearchBar(onSearchQueryChanged)
- Spacer(modifier = Modifier.heightIn(16.dp))
+ Spacer(modifier = Modifier.heightIn(8.dp))
CategoriesPanelTwoPane(categories, selectedCategory, onCategoryClicked)
Spacer(modifier = Modifier.weight(1f))
KeyboardSettings(onKeyboardSettingsClicked)
@@ -678,7 +673,7 @@
Surface(
selected = selected,
onClick = onClick,
- modifier = Modifier.semantics { role = Role.Tab }.heightIn(min = 72.dp).fillMaxWidth(),
+ modifier = Modifier.semantics { role = Role.Tab }.heightIn(min = 64.dp).fillMaxWidth(),
shape = RoundedCornerShape(28.dp),
color = colors.containerColor(selected).value,
) {
diff --git a/services/core/java/com/android/server/MmsServiceBroker.java b/services/core/java/com/android/server/MmsServiceBroker.java
index ced7773..11de258 100644
--- a/services/core/java/com/android/server/MmsServiceBroker.java
+++ b/services/core/java/com/android/server/MmsServiceBroker.java
@@ -130,17 +130,18 @@
}
@Override
- public void sendMessage(int subId, String callingPkg, Uri contentUri, String locationUrl,
- Bundle configOverrides, PendingIntent sentIntent, long messageId,
+ public void sendMessage(int subId, int callingUser, String callingPkg,
+ Uri contentUri, String locationUrl, Bundle configOverrides,
+ PendingIntent sentIntent, long messageId,
String attributionTag) throws RemoteException {
returnPendingIntentWithError(sentIntent);
}
@Override
- public void downloadMessage(int subId, String callingPkg, String locationUrl,
- Uri contentUri, Bundle configOverrides, PendingIntent downloadedIntent,
- long messageId, String attributionTag)
- throws RemoteException {
+ public void downloadMessage(int subId, int callingUser, String callingPkg,
+ String locationUrl, Uri contentUri, Bundle configOverrides,
+ PendingIntent downloadedIntent,
+ long messageId, String attributionTag) throws RemoteException {
returnPendingIntentWithError(downloadedIntent);
}
@@ -151,8 +152,9 @@
}
@Override
- public Uri importMultimediaMessage(String callingPkg, Uri contentUri, String messageId,
- long timestampSecs, boolean seen, boolean read) throws RemoteException {
+ public Uri importMultimediaMessage(int callingUser, String callingPkg,
+ Uri contentUri, String messageId, long timestampSecs,
+ boolean seen, boolean read) throws RemoteException {
return null;
}
@@ -187,8 +189,8 @@
}
@Override
- public Uri addMultimediaMessageDraft(String callingPkg, Uri contentUri)
- throws RemoteException {
+ public Uri addMultimediaMessageDraft(int callingUser, String callingPkg,
+ Uri contentUri) throws RemoteException {
return null;
}
@@ -333,9 +335,9 @@
private static final String PHONE_PACKAGE_NAME = "com.android.phone";
@Override
- public void sendMessage(int subId, String callingPkg, Uri contentUri,
- String locationUrl, Bundle configOverrides, PendingIntent sentIntent,
- long messageId, String attributionTag)
+ public void sendMessage(int subId, int callingUser, String callingPkg,
+ Uri contentUri, String locationUrl, Bundle configOverrides,
+ PendingIntent sentIntent, long messageId, String attributionTag)
throws RemoteException {
Slog.d(TAG, "sendMessage() by " + callingPkg);
mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, "Send MMS message");
@@ -360,14 +362,15 @@
CarrierMessagingService.SERVICE_INTERFACE,
Intent.FLAG_GRANT_READ_URI_PERMISSION,
subId);
- getServiceGuarded().sendMessage(subId, callingPkg, contentUri, locationUrl,
- configOverrides, sentIntent, messageId, attributionTag);
+ getServiceGuarded().sendMessage(subId, getCallingUserId(), callingPkg, contentUri,
+ locationUrl, configOverrides, sentIntent, messageId, attributionTag);
}
@Override
- public void downloadMessage(int subId, String callingPkg, String locationUrl,
- Uri contentUri, Bundle configOverrides, PendingIntent downloadedIntent,
- long messageId, String attributionTag) throws RemoteException {
+ public void downloadMessage(int subId, int callingUser, String callingPkg,
+ String locationUrl, Uri contentUri, Bundle configOverrides,
+ PendingIntent downloadedIntent, long messageId, String attributionTag)
+ throws RemoteException {
Slog.d(TAG, "downloadMessage() by " + callingPkg);
mContext.enforceCallingPermission(Manifest.permission.RECEIVE_MMS,
"Download MMS message");
@@ -381,8 +384,8 @@
Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION,
subId);
- getServiceGuarded().downloadMessage(subId, callingPkg, locationUrl, contentUri,
- configOverrides, downloadedIntent, messageId, attributionTag);
+ getServiceGuarded().downloadMessage(subId, getCallingUserId(), callingPkg, locationUrl,
+ contentUri, configOverrides, downloadedIntent, messageId, attributionTag);
}
@Override
@@ -399,8 +402,8 @@
}
@Override
- public Uri importMultimediaMessage(String callingPkg, Uri contentUri,
- String messageId, long timestampSecs, boolean seen, boolean read)
+ public Uri importMultimediaMessage(int callingUser, String callingPkg,
+ Uri contentUri, String messageId, long timestampSecs, boolean seen, boolean read)
throws RemoteException {
if (getAppOpsManager().noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(),
callingPkg, null, null) != AppOpsManager.MODE_ALLOWED) {
@@ -408,8 +411,8 @@
// while writing the TelephonyProvider
return FAKE_MMS_SENT_URI;
}
- return getServiceGuarded().importMultimediaMessage(
- callingPkg, contentUri, messageId, timestampSecs, seen, read);
+ return getServiceGuarded().importMultimediaMessage(getCallingUserId(), callingPkg,
+ contentUri, messageId, timestampSecs, seen, read);
}
@Override
@@ -467,15 +470,16 @@
}
@Override
- public Uri addMultimediaMessageDraft(String callingPkg, Uri contentUri)
- throws RemoteException {
+ public Uri addMultimediaMessageDraft(int callingUser, String callingPkg,
+ Uri contentUri) throws RemoteException {
if (getAppOpsManager().noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(),
callingPkg, null, null) != AppOpsManager.MODE_ALLOWED) {
// Silently fail AppOps failure due to not being the default SMS app
// while writing the TelephonyProvider
return FAKE_MMS_DRAFT_URI;
}
- return getServiceGuarded().addMultimediaMessageDraft(callingPkg, contentUri);
+ return getServiceGuarded().addMultimediaMessageDraft(getCallingUserId(), callingPkg,
+ contentUri);
}
@Override
@@ -572,4 +576,13 @@
if (info == null) return INVALID_SIM_SLOT_INDEX;
return info.getSimSlotIndex();
}
+
+ /**
+ * Retrieves the calling user id.
+ * @return The id of the calling user.
+ */
+ private int getCallingUserId() {
+ return Binder.getCallingUserHandle().getIdentifier();
+ }
+
}
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 2dbf5bbf..bea16dc 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -4294,7 +4294,8 @@
}
void finishRelaunching() {
- mLetterboxUiController.setRelaunchingAfterRequestedOrientationChanged(false);
+ mAppCompatController.getAppCompatOrientationOverrides()
+ .setRelaunchingAfterRequestedOrientationChanged(false);
mTaskSupervisor.getActivityMetricsLogger().notifyActivityRelaunched(this);
if (mPendingRelaunchCount > 0) {
@@ -8185,7 +8186,8 @@
mLastReportedConfiguration.getMergedConfiguration())) {
ensureActivityConfiguration(false /* ignoreVisibility */);
if (mPendingRelaunchCount > originalRelaunchingCount) {
- mLetterboxUiController.setRelaunchingAfterRequestedOrientationChanged(true);
+ mAppCompatController.getAppCompatOrientationOverrides()
+ .setRelaunchingAfterRequestedOrientationChanged(true);
}
if (mTransitionController.inPlayingTransition(this)) {
mTransitionController.mValidateActivityCompat.add(this);
diff --git a/services/core/java/com/android/server/wm/AppCompatAspectRatioOverrides.java b/services/core/java/com/android/server/wm/AppCompatAspectRatioOverrides.java
index 05d4c82..25cb134 100644
--- a/services/core/java/com/android/server/wm/AppCompatAspectRatioOverrides.java
+++ b/services/core/java/com/android/server/wm/AppCompatAspectRatioOverrides.java
@@ -36,6 +36,7 @@
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.AppCompatConfiguration.LETTERBOX_POSITION_MULTIPLIER_CENTER;
import static com.android.server.wm.AppCompatConfiguration.MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO;
+import static com.android.server.wm.AppCompatUtils.isChangeEnabled;
import android.annotation.NonNull;
import android.content.pm.PackageManager;
@@ -115,7 +116,7 @@
*/
boolean shouldOverrideMinAspectRatio() {
return mAllowMinAspectRatioOverrideOptProp.shouldEnableWithOptInOverrideAndOptOutProperty(
- isCompatChangeEnabled(OVERRIDE_MIN_ASPECT_RATIO));
+ isChangeEnabled(mActivityRecord, OVERRIDE_MIN_ASPECT_RATIO));
}
/**
@@ -154,7 +155,7 @@
}
boolean isSystemOverrideToFullscreenEnabled() {
- return isCompatChangeEnabled(OVERRIDE_ANY_ORIENTATION_TO_USER)
+ return isChangeEnabled(mActivityRecord, OVERRIDE_ANY_ORIENTATION_TO_USER)
&& !mAllowOrientationOverrideOptProp.isFalse()
&& (mUserAspectRatioState.mUserAspectRatio == USER_MIN_ASPECT_RATIO_UNSET
|| mUserAspectRatioState.mUserAspectRatio == USER_MIN_ASPECT_RATIO_FULLSCREEN);
@@ -302,10 +303,6 @@
private int mUserAspectRatio = USER_MIN_ASPECT_RATIO_UNSET;
}
- private boolean isCompatChangeEnabled(long overrideChangeId) {
- return mActivityRecord.info.isChangeEnabled(overrideChangeId);
- }
-
private Resources getResources() {
return mActivityRecord.mWmService.mContext.getResources();
}
diff --git a/services/core/java/com/android/server/wm/AppCompatCameraOverrides.java b/services/core/java/com/android/server/wm/AppCompatCameraOverrides.java
index 93a8663..aeaaffd 100644
--- a/services/core/java/com/android/server/wm/AppCompatCameraOverrides.java
+++ b/services/core/java/com/android/server/wm/AppCompatCameraOverrides.java
@@ -30,6 +30,7 @@
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME;
+import static com.android.server.wm.AppCompatUtils.isChangeEnabled;
import android.annotation.NonNull;
import android.app.CameraCompatTaskInfo.FreeformCameraCompatMode;
@@ -99,7 +100,8 @@
boolean shouldOverrideMinAspectRatioForCamera() {
return isCameraActive() && mAllowMinAspectRatioOverrideOptProp
.shouldEnableWithOptInOverrideAndOptOutProperty(
- isCompatChangeEnabled(OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA));
+ isChangeEnabled(mActivityRecord,
+ OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA));
}
/**
@@ -115,7 +117,7 @@
*/
boolean shouldRefreshActivityForCameraCompat() {
return mCameraCompatAllowRefreshOptProp.shouldEnableWithOptOutOverrideAndProperty(
- isCompatChangeEnabled(OVERRIDE_CAMERA_COMPAT_DISABLE_REFRESH));
+ isChangeEnabled(mActivityRecord, OVERRIDE_CAMERA_COMPAT_DISABLE_REFRESH));
}
/**
@@ -134,7 +136,7 @@
*/
boolean shouldRefreshActivityViaPauseForCameraCompat() {
return mCameraCompatEnableRefreshViaPauseOptProp.shouldEnableWithOverrideAndProperty(
- isCompatChangeEnabled(OVERRIDE_CAMERA_COMPAT_ENABLE_REFRESH_VIA_PAUSE));
+ isChangeEnabled(mActivityRecord, OVERRIDE_CAMERA_COMPAT_ENABLE_REFRESH_VIA_PAUSE));
}
/**
@@ -150,7 +152,7 @@
*/
boolean shouldForceRotateForCameraCompat() {
return mCameraCompatAllowForceRotationOptProp.shouldEnableWithOptOutOverrideAndProperty(
- isCompatChangeEnabled(OVERRIDE_CAMERA_COMPAT_DISABLE_FORCE_ROTATION));
+ isChangeEnabled(mActivityRecord, OVERRIDE_CAMERA_COMPAT_DISABLE_FORCE_ROTATION));
}
/**
@@ -168,7 +170,7 @@
* </ul>
*/
boolean shouldApplyFreeformTreatmentForCameraCompat() {
- return Flags.cameraCompatForFreeform() && !isCompatChangeEnabled(
+ return Flags.cameraCompatForFreeform() && !isChangeEnabled(mActivityRecord,
OVERRIDE_CAMERA_COMPAT_DISABLE_FREEFORM_WINDOWING_TREATMENT);
}
@@ -191,7 +193,7 @@
}
boolean isOverrideOrientationOnlyForCameraEnabled() {
- return isCompatChangeEnabled(OVERRIDE_ORIENTATION_ONLY_FOR_CAMERA);
+ return isChangeEnabled(mActivityRecord, OVERRIDE_ORIENTATION_ONLY_FOR_CAMERA);
}
/**
@@ -227,10 +229,6 @@
mAppCompatCameraOverridesState.mFreeformCameraCompatMode = freeformCameraCompatMode;
}
- private boolean isCompatChangeEnabled(long overrideChangeId) {
- return mActivityRecord.info.isChangeEnabled(overrideChangeId);
- }
-
static class AppCompatCameraOverridesState {
// Whether activity "refresh" was requested but not finished in
// ActivityRecord#activityResumedLocked following the camera compat force rotation in
diff --git a/services/core/java/com/android/server/wm/AppCompatOrientationOverrides.java b/services/core/java/com/android/server/wm/AppCompatOrientationOverrides.java
index 0adf825..bd01351 100644
--- a/services/core/java/com/android/server/wm/AppCompatOrientationOverrides.java
+++ b/services/core/java/com/android/server/wm/AppCompatOrientationOverrides.java
@@ -20,14 +20,20 @@
import static android.content.pm.ActivityInfo.OVERRIDE_ENABLE_COMPAT_IGNORE_ORIENTATION_REQUEST_WHEN_LOOP_DETECTED;
import static android.content.pm.ActivityInfo.OVERRIDE_ENABLE_COMPAT_IGNORE_REQUESTED_ORIENTATION;
import static android.content.pm.ActivityInfo.OVERRIDE_LANDSCAPE_ORIENTATION_TO_REVERSE_LANDSCAPE;
+import static android.content.pm.ActivityInfo.OVERRIDE_RESPECT_REQUESTED_ORIENTATION;
import static android.content.pm.ActivityInfo.OVERRIDE_UNDEFINED_ORIENTATION_TO_NOSENSOR;
import static android.content.pm.ActivityInfo.OVERRIDE_UNDEFINED_ORIENTATION_TO_PORTRAIT;
+import static android.content.pm.ActivityInfo.OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION;
+import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
+import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_DISPLAY_ORIENTATION_OVERRIDE;
import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_IGNORING_ORIENTATION_REQUEST_WHEN_LOOP_DETECTED;
+import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_ORIENTATION_OVERRIDE;
import static android.view.WindowManager.PROPERTY_COMPAT_IGNORE_REQUESTED_ORIENTATION;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.AppCompatUtils.asLazy;
+import static com.android.server.wm.AppCompatUtils.isChangeEnabled;
import android.annotation.NonNull;
@@ -54,6 +60,10 @@
private final OptPropFactory.OptProp mIgnoreRequestedOrientationOptProp;
@NonNull
private final OptPropFactory.OptProp mAllowIgnoringOrientationRequestWhenLoopDetectedOptProp;
+ @NonNull
+ private final OptPropFactory.OptProp mAllowOrientationOverrideOptProp;
+ @NonNull
+ private final OptPropFactory.OptProp mAllowDisplayOrientationOverrideOptProp;
@NonNull
final OrientationOverridesState mOrientationOverridesState;
@@ -74,6 +84,17 @@
mAllowIgnoringOrientationRequestWhenLoopDetectedOptProp = optPropBuilder.create(
PROPERTY_COMPAT_ALLOW_IGNORING_ORIENTATION_REQUEST_WHEN_LOOP_DETECTED,
isPolicyForIgnoringRequestedOrientationEnabled);
+ mAllowOrientationOverrideOptProp = optPropBuilder.create(
+ PROPERTY_COMPAT_ALLOW_ORIENTATION_OVERRIDE);
+ mAllowDisplayOrientationOverrideOptProp = optPropBuilder.create(
+ PROPERTY_COMPAT_ALLOW_DISPLAY_ORIENTATION_OVERRIDE,
+ () -> mActivityRecord.mDisplayContent != null
+ && mActivityRecord.getTask() != null
+ && mActivityRecord.mDisplayContent.getIgnoreOrientationRequest()
+ && !mActivityRecord.getTask().inMultiWindowMode()
+ && mActivityRecord.mDisplayContent.getNaturalOrientation()
+ == ORIENTATION_LANDSCAPE
+ );
}
boolean shouldEnableIgnoreOrientationRequest() {
@@ -81,6 +102,10 @@
isCompatChangeEnabled(OVERRIDE_ENABLE_COMPAT_IGNORE_REQUESTED_ORIENTATION));
}
+ boolean isOverrideRespectRequestedOrientationEnabled() {
+ return isChangeEnabled(mActivityRecord, OVERRIDE_RESPECT_REQUESTED_ORIENTATION);
+ }
+
/**
* Whether an app is calling {@link android.app.Activity#setRequestedOrientation}
* in a loop and orientation request should be ignored.
@@ -113,6 +138,26 @@
}
/**
+ * Whether should fix display orientation to landscape natural orientation when a task is
+ * fullscreen and the display is ignoring orientation requests.
+ *
+ * <p>This treatment is enabled when the following conditions are met:
+ * <ul>
+ * <li>Opt-out component property isn't enabled
+ * <li>Opt-in per-app override is enabled
+ * <li>Task is in fullscreen.
+ * <li>{@link DisplayContent#getIgnoreOrientationRequest} is enabled
+ * <li>Natural orientation of the display is landscape.
+ * </ul>
+ */
+ boolean shouldUseDisplayLandscapeNaturalOrientation() {
+ return mAllowDisplayOrientationOverrideOptProp
+ .shouldEnableWithOptInOverrideAndOptOutProperty(
+ isChangeEnabled(mActivityRecord,
+ OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION));
+ }
+
+ /**
* Sets whether an activity is relaunching after the app has called {@link
* android.app.Activity#setRequestedOrientation}.
*/
@@ -125,6 +170,10 @@
return mOrientationOverridesState.mIsRelaunchingAfterRequestedOrientationChanged;
}
+ boolean isAllowOrientationOverrideOptOut() {
+ return mAllowOrientationOverrideOptProp.isFalse();
+ }
+
@VisibleForTesting
int getSetOrientationRequestCounter() {
return mOrientationOverridesState.mSetOrientationRequestCounter;
diff --git a/services/core/java/com/android/server/wm/AppCompatOrientationPolicy.java b/services/core/java/com/android/server/wm/AppCompatOrientationPolicy.java
index 17f0d97..c5506de 100644
--- a/services/core/java/com/android/server/wm/AppCompatOrientationPolicy.java
+++ b/services/core/java/com/android/server/wm/AppCompatOrientationPolicy.java
@@ -86,7 +86,8 @@
return SCREEN_ORIENTATION_PORTRAIT;
}
- if (mAppCompatOverrides.isAllowOrientationOverrideOptOut()) {
+ if (mAppCompatOverrides.getAppCompatOrientationOverrides()
+ .isAllowOrientationOverrideOptOut()) {
return candidate;
}
diff --git a/services/core/java/com/android/server/wm/AppCompatOverrides.java b/services/core/java/com/android/server/wm/AppCompatOverrides.java
index cde48d6..f1ee23b 100644
--- a/services/core/java/com/android/server/wm/AppCompatOverrides.java
+++ b/services/core/java/com/android/server/wm/AppCompatOverrides.java
@@ -18,13 +18,10 @@
import static android.content.pm.ActivityInfo.FORCE_NON_RESIZE_APP;
import static android.content.pm.ActivityInfo.FORCE_RESIZE_APP;
-import static android.content.pm.ActivityInfo.OVERRIDE_RESPECT_REQUESTED_ORIENTATION;
-import static android.content.pm.ActivityInfo.OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION;
-import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
-import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_DISPLAY_ORIENTATION_OVERRIDE;
-import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_ORIENTATION_OVERRIDE;
import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES;
+import static com.android.server.wm.AppCompatUtils.isChangeEnabled;
+
import android.annotation.NonNull;
import com.android.server.wm.utils.OptPropFactory;
@@ -36,11 +33,6 @@
@NonNull
private final ActivityRecord mActivityRecord;
-
- @NonNull
- private final OptPropFactory.OptProp mAllowOrientationOverrideOptProp;
- @NonNull
- private final OptPropFactory.OptProp mAllowDisplayOrientationOverrideOptProp;
@NonNull
private final OptPropFactory.OptProp mAllowForceResizeOverrideOptProp;
@NonNull
@@ -69,19 +61,6 @@
mAppCompatFocusOverrides = new AppCompatFocusOverrides(mActivityRecord,
appCompatConfiguration, optPropBuilder);
- mAllowOrientationOverrideOptProp = optPropBuilder.create(
- PROPERTY_COMPAT_ALLOW_ORIENTATION_OVERRIDE);
-
- mAllowDisplayOrientationOverrideOptProp = optPropBuilder.create(
- PROPERTY_COMPAT_ALLOW_DISPLAY_ORIENTATION_OVERRIDE,
- () -> mActivityRecord.mDisplayContent != null
- && mActivityRecord.getTask() != null
- && mActivityRecord.mDisplayContent.getIgnoreOrientationRequest()
- && !mActivityRecord.getTask().inMultiWindowMode()
- && mActivityRecord.mDisplayContent.getNaturalOrientation()
- == ORIENTATION_LANDSCAPE
- );
-
mAllowForceResizeOverrideOptProp = optPropBuilder.create(
PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES);
}
@@ -106,33 +85,6 @@
return mAppCompatFocusOverrides;
}
- boolean isAllowOrientationOverrideOptOut() {
- return mAllowOrientationOverrideOptProp.isFalse();
- }
-
- boolean isOverrideRespectRequestedOrientationEnabled() {
- return isCompatChangeEnabled(OVERRIDE_RESPECT_REQUESTED_ORIENTATION);
- }
-
- /**
- * Whether should fix display orientation to landscape natural orientation when a task is
- * fullscreen and the display is ignoring orientation requests.
- *
- * <p>This treatment is enabled when the following conditions are met:
- * <ul>
- * <li>Opt-out component property isn't enabled
- * <li>Opt-in per-app override is enabled
- * <li>Task is in fullscreen.
- * <li>{@link DisplayContent#getIgnoreOrientationRequest} is enabled
- * <li>Natural orientation of the display is landscape.
- * </ul>
- */
- boolean shouldUseDisplayLandscapeNaturalOrientation() {
- return mAllowDisplayOrientationOverrideOptProp
- .shouldEnableWithOptInOverrideAndOptOutProperty(
- isCompatChangeEnabled(OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION));
- }
-
/**
* Whether we should apply the force resize per-app override. When this override is applied it
* forces the packages it is applied to to be resizable. It won't change whether the app can be
@@ -147,7 +99,7 @@
*/
boolean shouldOverrideForceResizeApp() {
return mAllowForceResizeOverrideOptProp.shouldEnableWithOptInOverrideAndOptOutProperty(
- isCompatChangeEnabled(FORCE_RESIZE_APP));
+ isChangeEnabled(mActivityRecord, FORCE_RESIZE_APP));
}
/**
@@ -162,10 +114,6 @@
*/
boolean shouldOverrideForceNonResizeApp() {
return mAllowForceResizeOverrideOptProp.shouldEnableWithOptInOverrideAndOptOutProperty(
- isCompatChangeEnabled(FORCE_NON_RESIZE_APP));
- }
-
- private boolean isCompatChangeEnabled(long overrideChangeId) {
- return mActivityRecord.info.isChangeEnabled(overrideChangeId);
+ isChangeEnabled(mActivityRecord, FORCE_NON_RESIZE_APP));
}
}
diff --git a/services/core/java/com/android/server/wm/DisplayArea.java b/services/core/java/com/android/server/wm/DisplayArea.java
index 75724eb..86f69cd 100644
--- a/services/core/java/com/android/server/wm/DisplayArea.java
+++ b/services/core/java/com/android/server/wm/DisplayArea.java
@@ -267,7 +267,8 @@
// between fullscreen and PiP would work well. Checking TaskFragment rather than
// Task to ensure that Activity Embedding is excluded.
&& activity.getTaskFragment().getWindowingMode() == WINDOWING_MODE_FULLSCREEN
- && activity.mLetterboxUiController.isOverrideRespectRequestedOrientationEnabled();
+ && activity.mAppCompatController.getAppCompatOrientationOverrides()
+ .isOverrideRespectRequestedOrientationEnabled();
}
boolean getIgnoreOrientationRequest() {
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 475b473..403c307 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -2939,8 +2939,9 @@
if (!handlesOrientationChangeFromDescendant(orientation)) {
ActivityRecord topActivity = topRunningActivity(/* considerKeyguardState= */ true);
- if (topActivity != null && topActivity.mLetterboxUiController
- .shouldUseDisplayLandscapeNaturalOrientation()) {
+ if (topActivity != null && topActivity.mAppCompatController
+ .getAppCompatOrientationOverrides()
+ .shouldUseDisplayLandscapeNaturalOrientation()) {
ProtoLog.v(WM_DEBUG_ORIENTATION,
"Display id=%d is ignoring orientation request for %d, return %d"
+ " following a per-app override for %s",
diff --git a/services/core/java/com/android/server/wm/LetterboxUiController.java b/services/core/java/com/android/server/wm/LetterboxUiController.java
index 73f3655..5d4198f 100644
--- a/services/core/java/com/android/server/wm/LetterboxUiController.java
+++ b/services/core/java/com/android/server/wm/LetterboxUiController.java
@@ -147,20 +147,6 @@
}
/**
- * Sets whether an activity is relaunching after the app has called {@link
- * android.app.Activity#setRequestedOrientation}.
- */
- void setRelaunchingAfterRequestedOrientationChanged(boolean isRelaunching) {
- getAppCompatOverrides().getAppCompatOrientationOverrides()
- .setRelaunchingAfterRequestedOrientationChanged(isRelaunching);
- }
-
-
- boolean isOverrideRespectRequestedOrientationEnabled() {
- return getAppCompatOverrides().isOverrideRespectRequestedOrientationEnabled();
- }
-
- /**
* Whether should fix display orientation to landscape natural orientation when a task is
* fullscreen and the display is ignoring orientation requests.
*
@@ -174,7 +160,8 @@
* </ul>
*/
boolean shouldUseDisplayLandscapeNaturalOrientation() {
- return getAppCompatOverrides().shouldUseDisplayLandscapeNaturalOrientation();
+ return getAppCompatOverrides().getAppCompatOrientationOverrides()
+ .shouldUseDisplayLandscapeNaturalOrientation();
}
boolean hasWallpaperBackgroundForLetterbox() {
@@ -800,11 +787,6 @@
return null;
}
- boolean getIsRelaunchingAfterRequestedOrientationChanged() {
- return getAppCompatOverrides().getAppCompatOrientationOverrides()
- .getIsRelaunchingAfterRequestedOrientationChanged();
- }
-
private void adjustBoundsForTaskbar(final WindowState mainWindow, final Rect bounds) {
// Rounded corners should be displayed above the taskbar. When taskbar is hidden,
// an insets frame is equal to a navigation bar which shouldn't affect position of
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 164994c..1cc5a8b 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -5373,7 +5373,7 @@
// change then delay the position update until it has redrawn to avoid any flickers.
final boolean isLetterboxedAndRelaunching = activityRecord != null
&& activityRecord.areBoundsLetterboxed()
- && activityRecord.mLetterboxUiController
+ && activityRecord.mAppCompatController.getAppCompatOrientationOverrides()
.getIsRelaunchingAfterRequestedOrientationChanged();
if (surfaceResizedWithoutMoveAnimation || isLetterboxedAndRelaunching) {
applyWithNextDraw(mSetSurfacePositionConsumer);
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppCompatActivityRobot.java b/services/tests/wmtests/src/com/android/server/wm/AppCompatActivityRobot.java
index 11f7560..f5c2e19 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppCompatActivityRobot.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppCompatActivityRobot.java
@@ -126,6 +126,10 @@
.isCameraActive(any(ActivityRecord.class), anyBoolean());
}
+ void setDisplayNaturalOrientation(@Configuration.Orientation int naturalOrientation) {
+ doReturn(naturalOrientation).when(mDisplayContent).getNaturalOrientation();
+ }
+
@NonNull
ActivityRecord top() {
return mActivityStack.top();
@@ -189,6 +193,11 @@
mDisplayContent.setIgnoreOrientationRequest(enabled);
}
+ void setTopTaskInMultiWindowMode(boolean inMultiWindowMode) {
+ doReturn(inMultiWindowMode).when(mTaskStack.top())
+ .inMultiWindowMode();
+ }
+
void setTopActivityAsEmbedded(boolean embedded) {
doReturn(embedded).when(mActivityStack.top()).isEmbedded();
}
@@ -225,20 +234,21 @@
void createNewDisplay() {
mDisplayContent = new TestDisplayContent.Builder(mAtm, mDisplayWidth, mDisplayHeight)
.build();
+ spyOn(mDisplayContent);
spyOnAppCompatCameraPolicy();
}
void createNewTask() {
final Task newTask = new WindowTestsBase.TaskBuilder(mSupervisor)
.setDisplay(mDisplayContent).build();
- mTaskStack.push(newTask);
+ pushTask(newTask);
}
void createNewTaskWithBaseActivity() {
final Task newTask = new WindowTestsBase.TaskBuilder(mSupervisor)
.setCreateActivity(true)
.setDisplay(mDisplayContent).build();
- mTaskStack.push(newTask);
+ pushTask(newTask);
pushActivity(newTask.getTopNonFinishingActivity());
}
@@ -433,6 +443,11 @@
spyOn(activity.mLetterboxUiController);
}
+ private void pushTask(@NonNull Task task) {
+ spyOn(task);
+ mTaskStack.push(task);
+ }
+
private void spyOnAppCompatCameraPolicy() {
spyOn(mDisplayContent.mAppCompatCameraPolicy);
if (mDisplayContent.mAppCompatCameraPolicy.hasDisplayRotationCompatPolicy()) {
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppCompatOrientationOverridesTest.java b/services/tests/wmtests/src/com/android/server/wm/AppCompatOrientationOverridesTest.java
index 634453f..6c0d8c4 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppCompatOrientationOverridesTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppCompatOrientationOverridesTest.java
@@ -16,6 +16,10 @@
package com.android.server.wm;
import static android.content.pm.ActivityInfo.OVERRIDE_ENABLE_COMPAT_IGNORE_ORIENTATION_REQUEST_WHEN_LOOP_DETECTED;
+import static android.content.pm.ActivityInfo.OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION;
+import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
+import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
+import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_DISPLAY_ORIENTATION_OVERRIDE;
import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_IGNORING_ORIENTATION_REQUEST_WHEN_LOOP_DETECTED;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
@@ -158,6 +162,72 @@
});
}
+ @Test
+ @EnableCompatChanges({OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION})
+ public void testShouldUseDisplayLandscapeNaturalOrientation_override_returnsTrue() {
+ runTestScenario((robot) -> {
+ robot.applyOnActivity((a) -> {
+ a.setDisplayNaturalOrientation(ORIENTATION_LANDSCAPE);
+ a.setIgnoreOrientationRequest(true);
+ a.createActivityWithComponent();
+ });
+ robot.checkShouldUseDisplayLandscapeNaturalOrientation(/* expected */ true);
+ });
+ }
+
+ @Test
+ @EnableCompatChanges({OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION})
+ public void testShouldUseDisplayLandscapeNaturalOrientation_falseProperty_returnsFalse() {
+ runTestScenario((robot) -> {
+ robot.prop().disable(PROPERTY_COMPAT_ALLOW_DISPLAY_ORIENTATION_OVERRIDE);
+ robot.applyOnActivity((a) -> {
+ a.setDisplayNaturalOrientation(ORIENTATION_LANDSCAPE);
+ a.setIgnoreOrientationRequest(true);
+ a.createActivityWithComponent();
+ });
+ robot.checkShouldUseDisplayLandscapeNaturalOrientation(/* expected */ false);
+ });
+ }
+
+ @Test
+ @EnableCompatChanges({OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION})
+ public void testShouldUseDisplayLandscapeNaturalOrientation_portrait_isFalse() {
+ runTestScenario((robot) -> {
+ robot.applyOnActivity((a) -> {
+ a.setDisplayNaturalOrientation(ORIENTATION_PORTRAIT);
+ a.setIgnoreOrientationRequest(true);
+ a.createActivityWithComponent();
+ });
+ robot.checkShouldUseDisplayLandscapeNaturalOrientation(/* expected */ false);
+ });
+ }
+ @Test
+ @EnableCompatChanges({OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION})
+ public void testShouldUseDisplayLandscapeNaturalOrientation_noIgnoreRequest_isFalse() {
+ runTestScenario((robot) -> {
+ robot.applyOnActivity((a) -> {
+ a.setDisplayNaturalOrientation(ORIENTATION_LANDSCAPE);
+ a.setIgnoreOrientationRequest(false);
+ a.createActivityWithComponent();
+ });
+ robot.checkShouldUseDisplayLandscapeNaturalOrientation(/* expected */ false);
+ });
+ }
+
+ @Test
+ @EnableCompatChanges({OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION})
+ public void testShouldUseDisplayLandscapeNaturalOrientation_inMultiWindowMode_returnsFalse() {
+ runTestScenario((robot) -> {
+ robot.applyOnActivity((a) -> {
+ a.setDisplayNaturalOrientation(ORIENTATION_LANDSCAPE);
+ a.setIgnoreOrientationRequest(true);
+ a.createActivityWithComponent();
+ a.setTopTaskInMultiWindowMode(/* inMultiWindowMode */ true);
+ });
+ robot.checkShouldUseDisplayLandscapeNaturalOrientation(/* expected */ false);
+ });
+ }
+
/**
* Runs a test scenario providing a Robot.
*/
@@ -215,6 +285,11 @@
}
}
+ void checkShouldUseDisplayLandscapeNaturalOrientation(boolean expected) {
+ assertEquals(expected,
+ getTopOrientationOverrides().shouldUseDisplayLandscapeNaturalOrientation());
+ }
+
private AppCompatOrientationOverrides getTopOrientationOverrides() {
return activity().top().mAppCompatController.getAppCompatOverrides()
.getAppCompatOrientationOverrides();
diff --git a/services/tests/wmtests/src/com/android/server/wm/LetterboxUiControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/LetterboxUiControllerTest.java
index a0a2904..26a4411 100644
--- a/services/tests/wmtests/src/com/android/server/wm/LetterboxUiControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/LetterboxUiControllerTest.java
@@ -18,11 +18,7 @@
import static android.content.pm.ActivityInfo.FORCE_NON_RESIZE_APP;
import static android.content.pm.ActivityInfo.FORCE_RESIZE_APP;
-import static android.content.pm.ActivityInfo.OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION;
-import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
-import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
import static android.view.InsetsSource.FLAG_INSETS_ROUNDED_CORNER;
-import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_DISPLAY_ORIENTATION_OVERRIDE;
import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
@@ -309,56 +305,6 @@
return mainWindow;
}
- // shouldUseDisplayLandscapeNaturalOrientation
-
- @Test
- @EnableCompatChanges({OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION})
- public void testShouldUseDisplayLandscapeNaturalOrientation_override_returnsTrue() {
- prepareActivityThatShouldUseDisplayLandscapeNaturalOrientation();
- assertTrue(mController.shouldUseDisplayLandscapeNaturalOrientation());
- }
-
- @Test
- @EnableCompatChanges({OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION})
- public void testShouldUseDisplayLandscapeNaturalOrientation_overrideAndFalseProperty_returnsFalse()
- throws Exception {
- mockThatProperty(PROPERTY_COMPAT_ALLOW_DISPLAY_ORIENTATION_OVERRIDE, /* value */ false);
-
- mController = new LetterboxUiController(mWm, mActivity);
-
- prepareActivityThatShouldUseDisplayLandscapeNaturalOrientation();
- assertFalse(mController.shouldUseDisplayLandscapeNaturalOrientation());
- }
-
- @Test
- @EnableCompatChanges({OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION})
- public void testShouldUseDisplayLandscapeNaturalOrientation_portraitNaturalOrientation_returnsFalse() {
- prepareActivityThatShouldUseDisplayLandscapeNaturalOrientation();
- doReturn(ORIENTATION_PORTRAIT).when(mDisplayContent).getNaturalOrientation();
-
- assertFalse(mController.shouldUseDisplayLandscapeNaturalOrientation());
- }
-
- @Test
- @EnableCompatChanges({OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION})
- public void testShouldUseDisplayLandscapeNaturalOrientation_disabledIgnoreOrientationRequest_returnsFalse() {
- prepareActivityThatShouldUseDisplayLandscapeNaturalOrientation();
- mDisplayContent.setIgnoreOrientationRequest(false);
-
- assertFalse(mController.shouldUseDisplayLandscapeNaturalOrientation());
- }
-
- @Test
- @EnableCompatChanges({OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION})
- public void testShouldUseDisplayLandscapeNaturalOrientation_inMultiWindowMode_returnsFalse() {
- prepareActivityThatShouldUseDisplayLandscapeNaturalOrientation();
-
- spyOn(mTask);
- doReturn(true).when(mTask).inMultiWindowMode();
-
- assertFalse(mController.shouldUseDisplayLandscapeNaturalOrientation());
- }
-
@Test
@EnableCompatChanges({FORCE_RESIZE_APP})
public void testshouldOverrideForceResizeApp_overrideEnabled_returnsTrue() {
@@ -612,12 +558,6 @@
doReturn(property).when(pm).getProperty(eq(propertyName), anyString());
}
- private void prepareActivityThatShouldUseDisplayLandscapeNaturalOrientation() {
- spyOn(mDisplayContent);
- doReturn(ORIENTATION_LANDSCAPE).when(mDisplayContent).getNaturalOrientation();
- mDisplayContent.setIgnoreOrientationRequest(true);
- }
-
private ActivityRecord setUpActivityWithComponent() {
mDisplayContent = new TestDisplayContent
.Builder(mAtm, /* dw */ 1000, /* dh */ 2000).build();
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 72747c9..ed93a8c 100644
--- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
@@ -788,7 +788,7 @@
// Change the fixed orientation.
mActivity.setRequestedOrientation(SCREEN_ORIENTATION_LANDSCAPE);
assertTrue(mActivity.isRelaunching());
- assertTrue(mActivity.mLetterboxUiController
+ assertTrue(mActivity.mAppCompatController.getAppCompatOrientationOverrides()
.getIsRelaunchingAfterRequestedOrientationChanged());
assertFitted();