[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:
@@ -93,41 +93,6 @@
|
|||||||
android:id="@+id/screenrecord_audio_switch"
|
android:id="@+id/screenrecord_audio_switch"
|
||||||
style="@style/ScreenRecord.Switch"/>
|
style="@style/ScreenRecord.Switch"/>
|
||||||
</LinearLayout>
|
</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>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import android.os.Bundle;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
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_RESULT_CODE = "extra_resultCode";
|
||||||
private static final String EXTRA_PATH = "extra_path";
|
private static final String EXTRA_PATH = "extra_path";
|
||||||
private static final String EXTRA_AUDIO_SOURCE = "extra_useAudio";
|
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_START = "com.android.systemui.screenrecord.START";
|
||||||
private static final String ACTION_STOP = "com.android.systemui.screenrecord.STOP";
|
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 RecordingController mController;
|
||||||
private final KeyguardDismissUtil mKeyguardDismissUtil;
|
private final KeyguardDismissUtil mKeyguardDismissUtil;
|
||||||
private ScreenRecordingAudioSource mAudioSource;
|
private ScreenRecordingAudioSource mAudioSource;
|
||||||
private boolean mShowTaps;
|
|
||||||
private boolean mOriginalShowTaps;
|
|
||||||
private ScreenMediaRecorder mRecorder;
|
private ScreenMediaRecorder mRecorder;
|
||||||
private final Executor mLongExecutor;
|
private final Executor mLongExecutor;
|
||||||
private final UiEventLogger mUiEventLogger;
|
private final UiEventLogger mUiEventLogger;
|
||||||
@@ -102,15 +98,12 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis
|
|||||||
* android.content.Intent)}
|
* android.content.Intent)}
|
||||||
* @param audioSource The ordinal value of the audio source
|
* @param audioSource The ordinal value of the audio source
|
||||||
* {@link com.android.systemui.screenrecord.ScreenRecordingAudioSource}
|
* {@link com.android.systemui.screenrecord.ScreenRecordingAudioSource}
|
||||||
* @param showTaps True to make touches visible while recording
|
|
||||||
*/
|
*/
|
||||||
public static Intent getStartIntent(Context context, int resultCode,
|
public static Intent getStartIntent(Context context, int resultCode, int audioSource) {
|
||||||
int audioSource, boolean showTaps) {
|
|
||||||
return new Intent(context, RecordingService.class)
|
return new Intent(context, RecordingService.class)
|
||||||
.setAction(ACTION_START)
|
.setAction(ACTION_START)
|
||||||
.putExtra(EXTRA_RESULT_CODE, resultCode)
|
.putExtra(EXTRA_RESULT_CODE, resultCode)
|
||||||
.putExtra(EXTRA_AUDIO_SOURCE, audioSource)
|
.putExtra(EXTRA_AUDIO_SOURCE, audioSource);
|
||||||
.putExtra(EXTRA_SHOW_TAPS, showTaps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -128,13 +121,6 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis
|
|||||||
mAudioSource = ScreenRecordingAudioSource
|
mAudioSource = ScreenRecordingAudioSource
|
||||||
.values()[intent.getIntExtra(EXTRA_AUDIO_SOURCE, 0)];
|
.values()[intent.getIntExtra(EXTRA_AUDIO_SOURCE, 0)];
|
||||||
Log.d(TAG, "recording with audio source" + mAudioSource);
|
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(
|
mRecorder = new ScreenMediaRecorder(
|
||||||
mUserContextTracker.getUserContext(),
|
mUserContextTracker.getUserContext(),
|
||||||
@@ -379,7 +365,6 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void stopRecording(int userId) {
|
private void stopRecording(int userId) {
|
||||||
setTapsVisible(mOriginalShowTaps);
|
|
||||||
if (getRecorder() != null) {
|
if (getRecorder() != null) {
|
||||||
getRecorder().end();
|
getRecorder().end();
|
||||||
saveRecording(userId);
|
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.
|
* Get an intent to stop the recording service.
|
||||||
* @param context Context from the requesting activity
|
* @param context Context from the requesting activity
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ public class ScreenRecordDialog extends SystemUIDialog {
|
|||||||
private final UserContextProvider mUserContextProvider;
|
private final UserContextProvider mUserContextProvider;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final Runnable mOnStartRecordingClicked;
|
private final Runnable mOnStartRecordingClicked;
|
||||||
private Switch mTapsSwitch;
|
|
||||||
private Switch mAudioSwitch;
|
private Switch mAudioSwitch;
|
||||||
private Spinner mOptions;
|
private Spinner mOptions;
|
||||||
|
|
||||||
@@ -96,7 +95,6 @@ public class ScreenRecordDialog extends SystemUIDialog {
|
|||||||
});
|
});
|
||||||
|
|
||||||
mAudioSwitch = findViewById(R.id.screenrecord_audio_switch);
|
mAudioSwitch = findViewById(R.id.screenrecord_audio_switch);
|
||||||
mTapsSwitch = findViewById(R.id.screenrecord_taps_switch);
|
|
||||||
mOptions = findViewById(R.id.screen_recording_options);
|
mOptions = findViewById(R.id.screen_recording_options);
|
||||||
ArrayAdapter a = new ScreenRecordingAdapter(getContext().getApplicationContext(),
|
ArrayAdapter a = new ScreenRecordingAdapter(getContext().getApplicationContext(),
|
||||||
android.R.layout.simple_spinner_dropdown_item,
|
android.R.layout.simple_spinner_dropdown_item,
|
||||||
@@ -110,7 +108,6 @@ public class ScreenRecordDialog extends SystemUIDialog {
|
|||||||
|
|
||||||
private void requestScreenCapture() {
|
private void requestScreenCapture() {
|
||||||
Context userContext = mUserContextProvider.getUserContext();
|
Context userContext = mUserContextProvider.getUserContext();
|
||||||
boolean showTaps = mTapsSwitch.isChecked();
|
|
||||||
ScreenRecordingAudioSource audioMode = mAudioSwitch.isChecked()
|
ScreenRecordingAudioSource audioMode = mAudioSwitch.isChecked()
|
||||||
? (ScreenRecordingAudioSource) mOptions.getSelectedItem()
|
? (ScreenRecordingAudioSource) mOptions.getSelectedItem()
|
||||||
: NONE;
|
: NONE;
|
||||||
@@ -118,7 +115,7 @@ public class ScreenRecordDialog extends SystemUIDialog {
|
|||||||
RecordingService.REQUEST_CODE,
|
RecordingService.REQUEST_CODE,
|
||||||
RecordingService.getStartIntent(
|
RecordingService.getStartIntent(
|
||||||
userContext, Activity.RESULT_OK,
|
userContext, Activity.RESULT_OK,
|
||||||
audioMode.ordinal(), showTaps),
|
audioMode.ordinal()),
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
|
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
|
||||||
PendingIntent stopIntent = PendingIntent.getService(userContext,
|
PendingIntent stopIntent = PendingIntent.getService(userContext,
|
||||||
RecordingService.REQUEST_CODE,
|
RecordingService.REQUEST_CODE,
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class RecordingServiceTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLogStartRecording() {
|
public void testLogStartRecording() {
|
||||||
Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false);
|
Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0);
|
||||||
mRecordingService.onStartCommand(startIntent, 0, 0);
|
mRecordingService.onStartCommand(startIntent, 0, 0);
|
||||||
|
|
||||||
verify(mUiEventLogger, times(1)).log(Events.ScreenRecordEvent.SCREEN_RECORD_START);
|
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
|
// When the screen recording does not start properly
|
||||||
doThrow(new RuntimeException("fail")).when(mScreenMediaRecorder).start();
|
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);
|
mRecordingService.onStartCommand(startIntent, 0, 0);
|
||||||
|
|
||||||
// Then the state is set to not recording
|
// Then the state is set to not recording
|
||||||
|
|||||||
Reference in New Issue
Block a user