Skip to content
Snippets Groups Projects
Commit 0322c454 authored by dakinola's avatar dakinola Committed by Daniel Akinola
Browse files

Remove record_task_content feature flag check in ContentRecorder

Feature flag check is no longer needed and leads to scenarios where partial screen sharing fails despite the device being capable of it, so its better to remove this extra point of failure.

Bug: 301273469
Test: manually built & smoke test
Test: atest WmTests:ContentRecorderTests
Change-Id: Iad8926c377a2cae7c1b08f874926d09cc46274a4
parent 69758018
No related branches found
No related tags found
No related merge requests found
......@@ -3973,12 +3973,6 @@
"group": "WM_ERROR",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
"1563836923": {
"message": "Content Recording: Unable to record task since feature is disabled %d",
"level": "VERBOSE",
"group": "WM_DEBUG_CONTENT_RECORDING",
"at": "com\/android\/server\/wm\/ContentRecorder.java"
},
"1577579529": {
"message": "win=%s destroySurfaces: appStopped=%b win.mWindowRemovalAllowed=%b win.mRemoveOnExit=%b",
"level": "ERROR",
......
......@@ -33,7 +33,6 @@ import android.media.projection.IMediaProjectionManager;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.DeviceConfig;
import android.view.ContentRecordingSession;
import android.view.ContentRecordingSession.RecordContent;
import android.view.Display;
......@@ -47,11 +46,6 @@ import com.android.internal.protolog.common.ProtoLog;
*/
final class ContentRecorder implements WindowContainerListener {
/**
* The key for accessing the device config that controls if task recording is supported.
*/
@VisibleForTesting static final String KEY_RECORD_TASK_FEATURE = "record_task_content";
/**
* The display content this class is handling recording for.
*/
......@@ -411,14 +405,6 @@ final class ContentRecorder implements WindowContainerListener {
// TODO(206461622) Migrate to using the RootDisplayArea
return dc;
case RECORD_CONTENT_TASK:
if (!DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_WINDOW_MANAGER,
KEY_RECORD_TASK_FEATURE, false)) {
handleStartRecordingFailed();
ProtoLog.v(WM_DEBUG_CONTENT_RECORDING,
"Content Recording: Unable to record task since feature is disabled %d",
mDisplayContent.getDisplayId());
return null;
}
// Given the WindowToken of the region to record, retrieve the associated
// SurfaceControl.
if (tokenToRecord == null) {
......
......@@ -31,7 +31,6 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
import static com.android.server.wm.ContentRecorder.KEY_RECORD_TASK_FEATURE;
import static com.google.common.truth.Truth.assertThat;
......@@ -51,25 +50,21 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.os.IBinder;
import android.platform.test.annotations.Presubmit;
import android.provider.DeviceConfig;
import android.view.ContentRecordingSession;
import android.view.DisplayInfo;
import android.view.Gravity;
import android.view.SurfaceControl;
import androidx.annotation.NonNull;
import androidx.test.filters.SmallTest;
import com.android.server.wm.ContentRecorder.MediaProjectionManagerWrapper;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.util.concurrent.CountDownLatch;
/**
* Tests for the {@link ContentRecorder} class.
......@@ -93,9 +88,6 @@ public class ContentRecorderTests extends WindowTestsBase {
private ContentRecorder mContentRecorder;
@Mock private MediaProjectionManagerWrapper mMediaProjectionManagerWrapper;
private SurfaceControl mRecordedSurface;
// Handle feature flag.
private ConfigListener mConfigListener;
private CountDownLatch mLatch;
@Before public void setUp() {
MockitoAnnotations.initMocks(this);
......@@ -133,23 +125,11 @@ public class ContentRecorderTests extends WindowTestsBase {
mWaitingDisplaySession.setVirtualDisplayId(displayId);
mWaitingDisplaySession.setWaitingForConsent(true);
mConfigListener = new ConfigListener();
DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_WINDOW_MANAGER,
mContext.getMainExecutor(), mConfigListener);
mLatch = new CountDownLatch(1);
DeviceConfig.setProperty(DeviceConfig.NAMESPACE_WINDOW_MANAGER, KEY_RECORD_TASK_FEATURE,
"true", true);
// Skip unnecessary operations of relayout.
spyOn(mWm.mWindowPlacerLocked);
doNothing().when(mWm.mWindowPlacerLocked).performSurfacePlacement(anyBoolean());
}
@After
public void teardown() {
DeviceConfig.removeOnPropertiesChangedListener(mConfigListener);
}
@Test
public void testIsCurrentlyRecording() {
assertThat(mContentRecorder.isCurrentlyRecording()).isFalse();
......@@ -183,24 +163,6 @@ public class ContentRecorderTests extends WindowTestsBase {
assertThat(mContentRecorder.isCurrentlyRecording()).isFalse();
}
@Test
public void testUpdateRecording_task_featureDisabled() {
mLatch = new CountDownLatch(1);
DeviceConfig.setProperty(DeviceConfig.NAMESPACE_WINDOW_MANAGER, KEY_RECORD_TASK_FEATURE,
"false", false);
mContentRecorder.setContentRecordingSession(mTaskSession);
mContentRecorder.updateRecording();
assertThat(mContentRecorder.isCurrentlyRecording()).isFalse();
}
@Test
public void testUpdateRecording_task_featureEnabled() {
// Feature already enabled; don't need to again.
mContentRecorder.setContentRecordingSession(mTaskSession);
mContentRecorder.updateRecording();
assertThat(mContentRecorder.isCurrentlyRecording()).isTrue();
}
@Test
public void testUpdateRecording_task_nullToken() {
ContentRecordingSession session = mTaskSession;
......@@ -703,13 +665,4 @@ public class ContentRecorderTests extends WindowTestsBase {
anyInt());
return mirroredSurface;
}
private class ConfigListener implements DeviceConfig.OnPropertiesChangedListener {
@Override
public void onPropertiesChanged(@NonNull DeviceConfig.Properties properties) {
if (mLatch != null && properties.getKeyset().contains(KEY_RECORD_TASK_FEATURE)) {
mLatch.countDown();
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment