[DO NOT MERGE] Remove taps option from screen record dialog

Removing option because the touch points currently cannot be recorded
due to changes in how the cursor is drawn

Bug: 205709231
Test: manual
Test: atest RecordingServiceTest
Change-Id: If544d534be16f2a2a21129f1f014c5c98aa55885
This commit is contained in:
Beth Thibodeau
2021-11-04 12:34:10 -04:00
parent 481929130e
commit 19c76901bb
4 changed files with 5 additions and 63 deletions

View File

@@ -93,41 +93,6 @@
android:id="@+id/screenrecord_audio_switch"
style="@style/ScreenRecord.Switch"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="@dimen/screenrecord_option_padding">
<ImageView
android:layout_width="@dimen/screenrecord_option_icon_size"
android:layout_height="@dimen/screenrecord_option_icon_size"
android:layout_weight="0"
android:src="@drawable/ic_touch"
android:tint="?android:attr/textColorSecondary"
android:layout_gravity="center"
android:layout_marginRight="@dimen/screenrecord_option_padding"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:layout_weight="1"
android:layout_gravity="fill_vertical"
android:gravity="center_vertical"
android:text="@string/screenrecord_taps_label"
android:textAppearance="?android:attr/textAppearanceMedium"
android:fontFamily="@*android:string/config_headlineFontFamily"
android:textColor="?android:attr/textColorPrimary"
android:importantForAccessibility="no"/>
<Switch
android:layout_width="wrap_content"
android:minWidth="48dp"
android:layout_height="48dp"
android:layout_weight="0"
android:id="@+id/screenrecord_taps_switch"
android:contentDescription="@string/screenrecord_taps_label"
style="@style/ScreenRecord.Switch"/>
</LinearLayout>
</LinearLayout>
<!-- Buttons -->

View File

@@ -32,7 +32,6 @@ import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;
import android.widget.Toast;
@@ -62,7 +61,6 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis
private static final String EXTRA_RESULT_CODE = "extra_resultCode";
private static final String EXTRA_PATH = "extra_path";
private static final String EXTRA_AUDIO_SOURCE = "extra_useAudio";
private static final String EXTRA_SHOW_TAPS = "extra_showTaps";
private static final String ACTION_START = "com.android.systemui.screenrecord.START";
private static final String ACTION_STOP = "com.android.systemui.screenrecord.STOP";
@@ -74,8 +72,6 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis
private final RecordingController mController;
private final KeyguardDismissUtil mKeyguardDismissUtil;
private ScreenRecordingAudioSource mAudioSource;
private boolean mShowTaps;
private boolean mOriginalShowTaps;
private ScreenMediaRecorder mRecorder;
private final Executor mLongExecutor;
private final UiEventLogger mUiEventLogger;
@@ -102,15 +98,12 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis
* android.content.Intent)}
* @param audioSource The ordinal value of the audio source
* {@link com.android.systemui.screenrecord.ScreenRecordingAudioSource}
* @param showTaps True to make touches visible while recording
*/
public static Intent getStartIntent(Context context, int resultCode,
int audioSource, boolean showTaps) {
public static Intent getStartIntent(Context context, int resultCode, int audioSource) {
return new Intent(context, RecordingService.class)
.setAction(ACTION_START)
.putExtra(EXTRA_RESULT_CODE, resultCode)
.putExtra(EXTRA_AUDIO_SOURCE, audioSource)
.putExtra(EXTRA_SHOW_TAPS, showTaps);
.putExtra(EXTRA_AUDIO_SOURCE, audioSource);
}
@Override
@@ -128,13 +121,6 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis
mAudioSource = ScreenRecordingAudioSource
.values()[intent.getIntExtra(EXTRA_AUDIO_SOURCE, 0)];
Log.d(TAG, "recording with audio source" + mAudioSource);
mShowTaps = intent.getBooleanExtra(EXTRA_SHOW_TAPS, false);
mOriginalShowTaps = Settings.System.getInt(
getApplicationContext().getContentResolver(),
Settings.System.SHOW_TOUCHES, 0) != 0;
setTapsVisible(mShowTaps);
mRecorder = new ScreenMediaRecorder(
mUserContextTracker.getUserContext(),
@@ -379,7 +365,6 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis
}
private void stopRecording(int userId) {
setTapsVisible(mOriginalShowTaps);
if (getRecorder() != null) {
getRecorder().end();
saveRecording(userId);
@@ -411,11 +396,6 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis
});
}
private void setTapsVisible(boolean turnOn) {
int value = turnOn ? 1 : 0;
Settings.System.putInt(getContentResolver(), Settings.System.SHOW_TOUCHES, value);
}
/**
* Get an intent to stop the recording service.
* @param context Context from the requesting activity

View File

@@ -55,7 +55,6 @@ public class ScreenRecordDialog extends SystemUIDialog {
private final UserContextProvider mUserContextProvider;
@Nullable
private final Runnable mOnStartRecordingClicked;
private Switch mTapsSwitch;
private Switch mAudioSwitch;
private Spinner mOptions;
@@ -96,7 +95,6 @@ public class ScreenRecordDialog extends SystemUIDialog {
});
mAudioSwitch = findViewById(R.id.screenrecord_audio_switch);
mTapsSwitch = findViewById(R.id.screenrecord_taps_switch);
mOptions = findViewById(R.id.screen_recording_options);
ArrayAdapter a = new ScreenRecordingAdapter(getContext().getApplicationContext(),
android.R.layout.simple_spinner_dropdown_item,
@@ -110,7 +108,6 @@ public class ScreenRecordDialog extends SystemUIDialog {
private void requestScreenCapture() {
Context userContext = mUserContextProvider.getUserContext();
boolean showTaps = mTapsSwitch.isChecked();
ScreenRecordingAudioSource audioMode = mAudioSwitch.isChecked()
? (ScreenRecordingAudioSource) mOptions.getSelectedItem()
: NONE;
@@ -118,7 +115,7 @@ public class ScreenRecordDialog extends SystemUIDialog {
RecordingService.REQUEST_CODE,
RecordingService.getStartIntent(
userContext, Activity.RESULT_OK,
audioMode.ordinal(), showTaps),
audioMode.ordinal()),
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
PendingIntent stopIntent = PendingIntent.getService(userContext,
RecordingService.REQUEST_CODE,

View File

@@ -104,7 +104,7 @@ public class RecordingServiceTest extends SysuiTestCase {
@Test
public void testLogStartRecording() {
Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false);
Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0);
mRecordingService.onStartCommand(startIntent, 0, 0);
verify(mUiEventLogger, times(1)).log(Events.ScreenRecordEvent.SCREEN_RECORD_START);
@@ -137,7 +137,7 @@ public class RecordingServiceTest extends SysuiTestCase {
// When the screen recording does not start properly
doThrow(new RuntimeException("fail")).when(mScreenMediaRecorder).start();
Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false);
Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0);
mRecordingService.onStartCommand(startIntent, 0, 0);
// Then the state is set to not recording