diff options
14 files changed, 198 insertions, 68 deletions
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 836bff598ede..fce23cf6819a 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -3670,7 +3670,7 @@ public abstract class Context { * <li>caller has {@code android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}</li> * <li>caller has {@code android.Manifest.permission.INTERACT_ACROSS_USERS} and is the same * package as the {@code service} (determined by its component's package) and the Android - * version is at least {@link android.os.Build.VERSION_CODES#S}</li> + * version is at least {@link android.os.Build.VERSION_CODES#TIRAMISU}</li> * <li>caller has {@code android.Manifest.permission.INTERACT_ACROSS_USERS} and is in same * profile group as the given {@code user}</li> * <li>caller has {@code android.Manifest.permission.INTERACT_ACROSS_PROFILES} and is in same diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp index 5850a81b8295..95599bd41e8d 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -730,6 +730,7 @@ status_t JMediaCodec::getOutputFrame( switch (c2Buffer->data().type()) { case C2BufferData::LINEAR: { std::unique_ptr<JMediaCodecLinearBlock> context{new JMediaCodecLinearBlock}; + context->mCodecNames.push_back(mNameAtCreation.c_str()); context->mBuffer = c2Buffer; ScopedLocalRef<jobject> linearBlock{env, env->NewObject( gLinearBlockInfo.clazz, gLinearBlockInfo.ctorId)}; @@ -769,6 +770,7 @@ status_t JMediaCodec::getOutputFrame( } else { if (!mGraphicOutput) { std::unique_ptr<JMediaCodecLinearBlock> context{new JMediaCodecLinearBlock}; + context->mCodecNames.push_back(mNameAtCreation.c_str()); context->mLegacyBuffer = buffer; ScopedLocalRef<jobject> linearBlock{env, env->NewObject( gLinearBlockInfo.clazz, gLinearBlockInfo.ctorId)}; @@ -812,7 +814,6 @@ status_t JMediaCodec::getOutputFrame( return OK; } - status_t JMediaCodec::getName(JNIEnv *env, jstring *nameStr) const { AString name; @@ -2286,6 +2287,108 @@ static status_t ConvertKeyValueListsToAMessage( return OK; } +static bool obtain( + JMediaCodecLinearBlock *context, + int capacity, + const std::vector<std::string> &names, + bool secure) { + if (secure) { + // Start at 1MB, which is an arbitrary starting point that can + // increase when needed. + constexpr size_t kInitialDealerCapacity = 1048576; + thread_local sp<MemoryDealer> sDealer = new MemoryDealer( + kInitialDealerCapacity, "JNI(1MB)"); + context->mMemory = sDealer->allocate(capacity); + if (context->mMemory == nullptr) { + size_t newDealerCapacity = sDealer->getMemoryHeap()->getSize() * 2; + while (capacity * 2 > newDealerCapacity) { + newDealerCapacity *= 2; + } + ALOGI("LinearBlock.native_obtain: " + "Dealer capacity increasing from %zuMB to %zuMB", + sDealer->getMemoryHeap()->getSize() / 1048576, + newDealerCapacity / 1048576); + sDealer = new MemoryDealer( + newDealerCapacity, + AStringPrintf("JNI(%zuMB)", newDealerCapacity).c_str()); + context->mMemory = sDealer->allocate(capacity); + } + context->mHidlMemory = hardware::fromHeap(context->mMemory->getMemory( + &context->mHidlMemoryOffset, &context->mHidlMemorySize)); + } else { + context->mBlock = MediaCodec::FetchLinearBlock(capacity, names); + if (!context->mBlock) { + return false; + } + } + context->mCodecNames = names; + return true; +} + +static void extractMemoryFromContext( + JMediaCodecLinearBlock *context, + jint offset, + jint size, + sp<hardware::HidlMemory> *memory) { + *memory = context->toHidlMemory(); + if (*memory == nullptr) { + if (!context->mBlock) { + ALOGW("extractMemoryFromContext: the buffer is missing both IMemory and C2Block"); + return; + } + ALOGD("extractMemoryFromContext: realloc & copying from C2Block to IMemory (cap=%zu)", + context->capacity()); + if (!obtain(context, context->capacity(), + context->mCodecNames, true /* secure */)) { + ALOGW("extractMemoryFromContext: failed to obtain secure block"); + return; + } + C2WriteView view = context->mBlock->map().get(); + if (view.error() != C2_OK) { + ALOGW("extractMemoryFromContext: failed to map C2Block (%d)", view.error()); + return; + } + uint8_t *memoryPtr = static_cast<uint8_t *>(context->mMemory->unsecurePointer()); + memcpy(memoryPtr + offset, view.base() + offset, size); + context->mBlock.reset(); + context->mReadWriteMapping.reset(); + *memory = context->toHidlMemory(); + } +} + +static void extractBufferFromContext( + JMediaCodecLinearBlock *context, + jint offset, + jint size, + std::shared_ptr<C2Buffer> *buffer) { + *buffer = context->toC2Buffer(offset, size); + if (*buffer == nullptr) { + if (!context->mMemory) { + ALOGW("extractBufferFromContext: the buffer is missing both IMemory and C2Block"); + return; + } + ALOGD("extractBufferFromContext: realloc & copying from IMemory to C2Block (cap=%zu)", + context->capacity()); + if (obtain(context, context->capacity(), + context->mCodecNames, false /* secure */)) { + ALOGW("extractBufferFromContext: failed to obtain non-secure block"); + return; + } + C2WriteView view = context->mBlock->map().get(); + if (view.error() != C2_OK) { + ALOGW("extractBufferFromContext: failed to map C2Block (%d)", view.error()); + return; + } + uint8_t *memoryPtr = static_cast<uint8_t *>(context->mMemory->unsecurePointer()); + memcpy(view.base() + offset, memoryPtr + offset, size); + context->mMemory.clear(); + context->mHidlMemory.clear(); + context->mHidlMemorySize = 0; + context->mHidlMemoryOffset = 0; + *buffer = context->toC2Buffer(offset, size); + } +} + static void android_media_MediaCodec_native_queueLinearBlock( JNIEnv *env, jobject thiz, jint index, jobject bufferObj, jint offset, jint size, jobject cryptoInfoObj, @@ -2314,12 +2417,10 @@ static void android_media_MediaCodec_native_queueLinearBlock( JMediaCodecLinearBlock *context = (JMediaCodecLinearBlock *)env->GetLongField(bufferObj, gLinearBlockInfo.contextId); if (codec->hasCryptoOrDescrambler()) { - memory = context->toHidlMemory(); - // TODO: copy if memory is null + extractMemoryFromContext(context, offset, size, &memory); offset += context->mHidlMemoryOffset; } else { - buffer = context->toC2Buffer(offset, size); - // TODO: copy if buffer is null + extractBufferFromContext(context, offset, size, &buffer); } } env->MonitorExit(lock.get()); @@ -2354,6 +2455,7 @@ static void android_media_MediaCodec_native_queueLinearBlock( flags, tunings, &errorDetailMsg); + ALOGI_IF(err != OK, "queueEncryptedLinearBlock returned err = %d", err); } else { if (!buffer) { ALOGI("queueLinearBlock: no C2Buffer found"); @@ -3300,33 +3402,9 @@ static void android_media_MediaCodec_LinearBlock_native_obtain( hasNonSecure = true; } } - if (hasSecure && !hasNonSecure) { - constexpr size_t kInitialDealerCapacity = 1048576; // 1MB - thread_local sp<MemoryDealer> sDealer = new MemoryDealer( - kInitialDealerCapacity, "JNI(1MB)"); - context->mMemory = sDealer->allocate(capacity); - if (context->mMemory == nullptr) { - size_t newDealerCapacity = sDealer->getMemoryHeap()->getSize() * 2; - while (capacity * 2 > newDealerCapacity) { - newDealerCapacity *= 2; - } - ALOGI("LinearBlock.native_obtain: " - "Dealer capacity increasing from %zuMB to %zuMB", - sDealer->getMemoryHeap()->getSize() / 1048576, - newDealerCapacity / 1048576); - sDealer = new MemoryDealer( - newDealerCapacity, - AStringPrintf("JNI(%zuMB)", newDealerCapacity).c_str()); - context->mMemory = sDealer->allocate(capacity); - } - context->mHidlMemory = hardware::fromHeap(context->mMemory->getMemory( - &context->mHidlMemoryOffset, &context->mHidlMemorySize)); - } else { - context->mBlock = MediaCodec::FetchLinearBlock(capacity, names); - if (!context->mBlock) { - jniThrowException(env, "java/io/IOException", nullptr); - return; - } + if (!obtain(context.get(), capacity, names, (hasSecure && !hasNonSecure) /* secure */)) { + jniThrowException(env, "java/io/IOException", nullptr); + return; } env->CallVoidMethod( thiz, diff --git a/media/jni/android_media_MediaCodecLinearBlock.h b/media/jni/android_media_MediaCodecLinearBlock.h index ae2d3a264abc..c7530207d1fa 100644 --- a/media/jni/android_media_MediaCodecLinearBlock.h +++ b/media/jni/android_media_MediaCodecLinearBlock.h @@ -25,6 +25,8 @@ namespace android { struct JMediaCodecLinearBlock { + std::vector<std::string> mCodecNames; + std::shared_ptr<C2Buffer> mBuffer; std::shared_ptr<C2ReadView> mReadonlyMapping; @@ -40,7 +42,7 @@ struct JMediaCodecLinearBlock { std::once_flag mCopyWarningFlag; - std::shared_ptr<C2Buffer> toC2Buffer(size_t offset, size_t size) { + std::shared_ptr<C2Buffer> toC2Buffer(size_t offset, size_t size) const { if (mBuffer) { if (mBuffer->data().type() != C2BufferData::LINEAR) { return nullptr; @@ -64,12 +66,22 @@ struct JMediaCodecLinearBlock { return nullptr; } - sp<hardware::HidlMemory> toHidlMemory() { + sp<hardware::HidlMemory> toHidlMemory() const { if (mHidlMemory) { return mHidlMemory; } return nullptr; } + + size_t capacity() const { + if (mBlock) { + return mBlock->capacity(); + } + if (mMemory) { + return mMemory->size(); + } + return 0; + } }; } // namespace android diff --git a/packages/SystemUI/res/layout/media_output_list_item.xml b/packages/SystemUI/res/layout/media_output_list_item.xml index f79e534670d8..7785a098a0eb 100644 --- a/packages/SystemUI/res/layout/media_output_list_item.xml +++ b/packages/SystemUI/res/layout/media_output_list_item.xml @@ -40,6 +40,7 @@ android:paddingStart="0dp" android:paddingEnd="0dp" android:background="@null" + android:contentDescription="@string/media_output_dialog_accessibility_seekbar" android:progressDrawable="@drawable/media_output_dialog_seekbar_background" android:thumb="@null" android:layout_width="match_parent" diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 0fe744dcb03d..c1e485be0af2 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -2281,6 +2281,8 @@ <string name="media_output_dialog_button_stop_casting">Stop casting</string> <!-- Accessibility text describing purpose of media output dialog. [CHAR LIMIT=NONE] --> <string name="media_output_dialog_accessibility_title">Available devices for audio output.</string> + <!-- Accessibility text describing purpose of seekbar in media output dialog. [CHAR LIMIT=NONE] --> + <string name="media_output_dialog_accessibility_seekbar">Volume</string> <!-- Media Output Broadcast Dialog --> <!-- Title for Broadcast First Notify Dialog [CHAR LIMIT=60] --> diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaControllerFactory.java b/packages/SystemUI/src/com/android/systemui/media/MediaControllerFactory.java index 71bc7c20c026..ed3e10939b6a 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaControllerFactory.java +++ b/packages/SystemUI/src/com/android/systemui/media/MediaControllerFactory.java @@ -16,6 +16,7 @@ package com.android.systemui.media; +import android.annotation.NonNull; import android.content.Context; import android.media.session.MediaController; import android.media.session.MediaSession; @@ -39,7 +40,7 @@ public class MediaControllerFactory { * * @param token The token for the session. This value must never be null. */ - public MediaController create(MediaSession.Token token) { + public MediaController create(@NonNull MediaSession.Token token) { return new MediaController(mContext, token); } } diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt b/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt index 8bf2c6e92105..6a69d427929e 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt @@ -509,6 +509,11 @@ class MediaDataManager( */ private fun updateState(key: String, state: PlaybackState) { mediaEntries.get(key)?.let { + val token = it.token + if (token == null) { + if (DEBUG) Log.d(TAG, "State updated, but token was null") + return + } val actions = createActionsFromState(it.packageName, mediaControllerFactory.create(it.token), UserHandle(it.userId)) val data = it.copy( diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaTimeoutListener.kt b/packages/SystemUI/src/com/android/systemui/media/MediaTimeoutListener.kt index d4c4f2165339..93a29ef03393 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaTimeoutListener.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaTimeoutListener.kt @@ -161,8 +161,9 @@ class MediaTimeoutListener @Inject constructor( destroyed = false mediaController?.unregisterCallback(this) field = value - mediaController = if (field.token != null) { - mediaControllerFactory.create(field.token) + val token = field.token + mediaController = if (token != null) { + mediaControllerFactory.create(token) } else { null } diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java index ec472c655b43..5430ee67e6ef 100644 --- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java @@ -28,7 +28,6 @@ import android.widget.CheckBox; import androidx.annotation.NonNull; import androidx.core.widget.CompoundButtonCompat; -import com.android.settingslib.Utils; import com.android.settingslib.media.LocalMediaManager.MediaDeviceState; import com.android.settingslib.media.MediaDevice; import com.android.systemui.R; @@ -257,9 +256,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { setSingleLineLayout(mContext.getText(R.string.media_output_dialog_pairing_new), false /* bFocused */); final Drawable d = mContext.getDrawable(R.drawable.ic_add); - d.setColorFilter(new PorterDuffColorFilter( - Utils.getColorAccentDefaultColor(mContext), PorterDuff.Mode.SRC_IN)); mTitleIcon.setImageDrawable(d); + mTitleIcon.setColorFilter(mController.getColorItemContent()); mContainerLayout.setOnClickListener(mController::launchBluetoothPairing); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt index 9a7b129f7597..e6df1066c00c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt @@ -978,6 +978,26 @@ class MediaDataManagerTest : SysuiTestCase() { anyBoolean()) } + @Test + fun testPlaybackStateChange_keyHasNullToken_doesNothing() { + // When we get an update that sets the data's token to null + whenever(controller.metadata).thenReturn(metadataBuilder.build()) + addNotificationAndLoad() + val data = mediaDataCaptor.value + assertThat(data.resumption).isFalse() + mediaDataManager.onMediaDataLoaded(KEY, null, data.copy(token = null)) + + // And then get a state update + val state = PlaybackState.Builder().build() + val callbackCaptor = argumentCaptor<(String, PlaybackState) -> Unit>() + verify(mediaTimeoutListener).stateCallback = capture(callbackCaptor) + + // Then no changes are made + callbackCaptor.value.invoke(KEY, state) + verify(listener, never()).onMediaDataLoaded(eq(KEY), any(), any(), anyBoolean(), anyInt(), + anyBoolean()) + } + /** * Helper function to add a media notification and capture the resulting MediaData */ diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index 7a52af61a196..0807fbaf7cc3 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -2355,9 +2355,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { return; } - if (VDBG) { - log("notifyActiveDataSubIdChanged: activeDataSubId=" + activeDataSubId); - } + log("notifyActiveDataSubIdChanged: activeDataSubId=" + activeDataSubId); + mLocalLog.log("notifyActiveDataSubIdChanged: activeDataSubId=" + activeDataSubId); mActiveDataSubId = activeDataSubId; synchronized (mRecords) { diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index f0fe2ddd0395..02648c4da76f 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -9171,7 +9171,7 @@ public class AudioService extends IAudioService.Stub throw new IllegalArgumentException("Invalid timeOutMs/usagesToMute"); } Log.i(TAG, "muteAwaitConnection dev:" + device + " timeOutMs:" + timeOutMs - + " usages:" + usages); + + " usages:" + Arrays.toString(usages)); if (mDeviceBroker.isDeviceConnected(device)) { // not throwing an exception as there could be a race between a connection (server-side, @@ -9223,7 +9223,7 @@ public class AudioService extends IAudioService.Stub mutedUsages = mMutedUsagesAwaitingConnection; mMutingExpectedDevice = null; mMutedUsagesAwaitingConnection = null; - mPlaybackMonitor.cancelMuteAwaitConnection(); + mPlaybackMonitor.cancelMuteAwaitConnection("cancelMuteAwaitConnection dev:" + device); } dispatchMuteAwaitConnection(cb -> { try { cb.dispatchOnUnmutedEvent( AudioManager.MuteAwaitConnectionCallback.EVENT_CANCEL, device, mutedUsages); @@ -9259,8 +9259,8 @@ public class AudioService extends IAudioService.Stub } mMutingExpectedDevice = null; mMutedUsagesAwaitingConnection = null; - Log.i(TAG, "muteAwaitConnection device " + device + " connected, unmuting"); - mPlaybackMonitor.cancelMuteAwaitConnection(); + mPlaybackMonitor.cancelMuteAwaitConnection( + "checkMuteAwaitConnection device " + device + " connected, unmuting"); } dispatchMuteAwaitConnection(cb -> { try { cb.dispatchOnUnmutedEvent( AudioManager.MuteAwaitConnectionCallback.EVENT_CONNECTION, device, mutedUsages); diff --git a/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java b/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java index a4468a3e1eec..b3e7e31d37fc 100644 --- a/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java +++ b/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java @@ -1170,8 +1170,8 @@ public final class PlaybackActivityMonitor } } - void cancelMuteAwaitConnection() { - sEventLogger.loglogi("cancelMuteAwaitConnection()", TAG); + void cancelMuteAwaitConnection(String source) { + sEventLogger.loglogi("cancelMuteAwaitConnection() from:" + source, TAG); synchronized (mPlayerLock) { // cancel scheduled timeout, ignore device, only one expected device at a time mEventHandler.removeMessages(MSG_L_TIMEOUT_MUTE_AWAIT_CONNECTION); @@ -1223,7 +1223,7 @@ public final class PlaybackActivityMonitor + " uid:" + apc.getClientUid())).printLog(TAG)); apc.getPlayerProxy().applyVolumeShaper( MUTE_AWAIT_CONNECTION_VSHAPE, - PLAY_CREATE_IF_NEEDED); + PLAY_SKIP_RAMP); mMutedPlayersAwaitingConnection.add(apc.getPlayerInterfaceId()); } catch (Exception e) { Log.e(TAG, "awaiting connection: error muting player " 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 35d8129eb385..891b33baf2f1 100644 --- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java @@ -108,6 +108,13 @@ import org.junit.runner.RunWith; @Presubmit @RunWith(WindowTestRunner.class) public class SizeCompatTests extends WindowTestsBase { + private static final String CONFIG_NEVER_CONSTRAIN_DISPLAY_APIS = + "never_constrain_display_apis"; + private static final String CONFIG_ALWAYS_CONSTRAIN_DISPLAY_APIS = + "always_constrain_display_apis"; + private static final String CONFIG_NEVER_CONSTRAIN_DISPLAY_APIS_ALL_PACKAGES = + "never_constrain_display_apis_all_packages"; + @Rule public TestRule compatChangeRule = new PlatformCompatChangeRule(); @@ -123,8 +130,10 @@ public class SizeCompatTests extends WindowTestsBase { doReturn(mActivityMetricsLogger).when(mAtm.mTaskSupervisor).getActivityMetricsLogger(); mInitialConstrainDisplayApisFlags = DeviceConfig.getProperties( NAMESPACE_CONSTRAIN_DISPLAY_APIS); - DeviceConfig.setProperties( - new Properties.Builder(NAMESPACE_CONSTRAIN_DISPLAY_APIS).build()); + // Provide empty default values for the configs. + setNeverConstrainDisplayApisFlag("", true); + setNeverConstrainDisplayApisAllPackagesFlag(false, true); + setAlwaysConstrainDisplayApisFlag("", true); } @After @@ -805,9 +814,9 @@ public class SizeCompatTests extends WindowTestsBase { public void testNeverConstrainDisplayApisDeviceConfig_allPackagesFlagTrue_sandboxNotApplied() { setUpDisplaySizeWithApp(1000, 1200); - setNeverConstrainDisplayApisAllPackagesFlag("true"); + setNeverConstrainDisplayApisAllPackagesFlag(true, false); // Setting 'never_constrain_display_apis' as well to make sure it is ignored. - setNeverConstrainDisplayApisFlag("com.android.other::,com.android.other2::"); + setNeverConstrainDisplayApisFlag("com.android.other::,com.android.other2::", false); // Make the task root resizable. mActivity.info.resizeMode = RESIZE_MODE_RESIZEABLE; @@ -830,7 +839,7 @@ public class SizeCompatTests extends WindowTestsBase { setNeverConstrainDisplayApisFlag( "com.android.frameworks.wmtests:20:,com.android.other::," - + "com.android.frameworks.wmtests:0:10"); + + "com.android.frameworks.wmtests:0:10", false); // Make the task root resizable. mActivity.info.resizeMode = RESIZE_MODE_RESIZEABLE; @@ -851,7 +860,8 @@ public class SizeCompatTests extends WindowTestsBase { public void testNeverConstrainDisplayApisDeviceConfig_packageOutsideRange_sandboxingApplied() { setUpDisplaySizeWithApp(1000, 1200); - setNeverConstrainDisplayApisFlag("com.android.other::,com.android.frameworks.wmtests:1:5"); + setNeverConstrainDisplayApisFlag("com.android.other::,com.android.frameworks.wmtests:1:5", + false); // Make the task root resizable. mActivity.info.resizeMode = RESIZE_MODE_RESIZEABLE; @@ -870,7 +880,7 @@ public class SizeCompatTests extends WindowTestsBase { public void testNeverConstrainDisplayApisDeviceConfig_packageNotInFlag_sandboxingApplied() { setUpDisplaySizeWithApp(1000, 1200); - setNeverConstrainDisplayApisFlag("com.android.other::,com.android.other2::"); + setNeverConstrainDisplayApisFlag("com.android.other::,com.android.other2::", false); // Make the task root resizable. mActivity.info.resizeMode = RESIZE_MODE_RESIZEABLE; @@ -952,7 +962,7 @@ public class SizeCompatTests extends WindowTestsBase { setAlwaysConstrainDisplayApisFlag( "com.android.frameworks.wmtests:20:,com.android.other::," - + "com.android.frameworks.wmtests:0:10"); + + "com.android.frameworks.wmtests:0:10", false); // Make the task root resizable. mActivity.info.resizeMode = RESIZE_MODE_RESIZEABLE; @@ -2562,19 +2572,22 @@ public class SizeCompatTests extends WindowTestsBase { displayContent.onRequestedOverrideConfigurationChanged(c); } - private static void setNeverConstrainDisplayApisFlag(@Nullable String value) { - DeviceConfig.setProperty(NAMESPACE_CONSTRAIN_DISPLAY_APIS, "never_constrain_display_apis", - value, /* makeDefault= */ false); + private static void setNeverConstrainDisplayApisFlag(@Nullable String value, + boolean makeDefault) { + DeviceConfig.setProperty(NAMESPACE_CONSTRAIN_DISPLAY_APIS, + CONFIG_NEVER_CONSTRAIN_DISPLAY_APIS, value, makeDefault); } - private static void setNeverConstrainDisplayApisAllPackagesFlag(@Nullable String value) { + private static void setNeverConstrainDisplayApisAllPackagesFlag(boolean value, + boolean makeDefault) { DeviceConfig.setProperty(NAMESPACE_CONSTRAIN_DISPLAY_APIS, - "never_constrain_display_apis_all_packages", - value, /* makeDefault= */ false); + CONFIG_NEVER_CONSTRAIN_DISPLAY_APIS_ALL_PACKAGES, String.valueOf(value), + makeDefault); } - private static void setAlwaysConstrainDisplayApisFlag(@Nullable String value) { - DeviceConfig.setProperty(NAMESPACE_CONSTRAIN_DISPLAY_APIS, "always_constrain_display_apis", - value, /* makeDefault= */ false); + private static void setAlwaysConstrainDisplayApisFlag(@Nullable String value, + boolean makeDefault) { + DeviceConfig.setProperty(NAMESPACE_CONSTRAIN_DISPLAY_APIS, + CONFIG_ALWAYS_CONSTRAIN_DISPLAY_APIS, value, makeDefault); } } |