Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2c7e23b authored by Beth Thibodeau's avatar Beth Thibodeau Committed by Automerger Merge Worker
Browse files

[DO NOT MERGE] Remove taps option from screen record dialog am: 19c76901

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16191877

Change-Id: I17876b0c9571b3942cfbb7be70134e31672c92ad
parents 6b58c0f9 19c76901
Loading
Loading
Loading
Loading
+0 −35
Original line number Diff line number Diff line
@@ -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 -->
+2 −22
Original line number Diff line number Diff line
@@ -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
+1 −4
Original line number Diff line number Diff line
@@ -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,
+2 −2
Original line number Diff line number Diff line
@@ -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