Loading packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/RecordingServiceTest.java +7 −4 Original line number Diff line number Diff line Loading @@ -148,7 +148,8 @@ public class RecordingServiceTest extends SysuiTestCase { @Test public void testLogStartFullScreenRecording() { Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false, null, false); Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false, null, false, false); mRecordingService.onStartCommand(startIntent, 0, 0); verify(mUiEventLogger, times(1)).log(Events.ScreenRecordEvent.SCREEN_RECORD_START); Loading @@ -158,7 +159,8 @@ public class RecordingServiceTest extends SysuiTestCase { public void testLogStartPartialRecording() { MediaProjectionCaptureTarget target = new MediaProjectionCaptureTarget(new LaunchCookie(), 12345); Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false, target, false); Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false, target, false, false); mRecordingService.onStartCommand(startIntent, 0, 0); verify(mUiEventLogger, times(1)).log(Events.ScreenRecordEvent.SCREEN_RECORD_START); Loading Loading @@ -191,7 +193,8 @@ 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, null, false); Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false, null, false, false); mRecordingService.onStartCommand(startIntent, 0, 0); assertUpdateState(false); Loading Loading @@ -316,7 +319,7 @@ public class RecordingServiceTest extends SysuiTestCase { @Test public void testSecondaryDisplayRecording() throws IOException { Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false, 200, null, false); RecordingService.getStartIntent(mContext, 0, 0, false, 200, null, false, false); assertEquals(startIntent.getIntExtra("extra_displayId", -1), 200); } Loading packages/SystemUI/res/drawable/ic_storage.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?attr/colorControlNormal"> <path android:fillColor="#FF000000" android:pathData="M2,20h20v-4L2,16v4zM4,17h2v2L4,19v-2zM2,4v4h20L22,4L2,4zM6,7L4,7L4,5h2v2zM2,14h20v-4L2,10v4zM4,11h2v2L4,13v-2z"/> </vector> packages/SystemUI/res/layout/screen_record_options.xml +47 −0 Original line number Diff line number Diff line Loading @@ -132,4 +132,51 @@ style="@style/ScreenRecord.Switch" android:importantForAccessibility="yes" /> </LinearLayout> <LinearLayout android:id="@+id/show_longer_timeout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical" 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:src="@drawable/ic_storage" android:tint="?android:attr/textColorSecondary" android:layout_marginRight="@dimen/screenrecord_option_padding" android:importantForAccessibility="no"/> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:minHeight="48dp" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:fontFamily="@*android:string/config_bodyFontFamily" android:text="@string/screenrecord_longer_timeout_switch_label" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="?android:attr/textColorPrimary" android:contentDescription="@string/screenrecord_longer_timeout_switch_label"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:importantForAccessibility="no" android:fontFamily="@*android:string/config_bodyFontFamily" android:text="@string/screenrecord_longer_timeout_switch_summary" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="?android:textColorSecondary"/> </LinearLayout> <Switch android:layout_width="wrap_content" android:minWidth="48dp" android:layout_height="48dp" android:id="@+id/screenrecord_longer_timeout_switch" android:contentDescription="@string/screenrecord_longer_timeout_switch_label" style="@style/ScreenRecord.Switch" android:importantForAccessibility="yes" /> </LinearLayout> </LinearLayout> No newline at end of file packages/SystemUI/res/values/cm_strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -120,4 +120,6 @@ <!-- Screen record --> <string name="screenrecord_lowquality_label">Lower quality</string> <string name="screenrecord_lowquality_summary">For smaller file size</string> <string name="screenrecord_longer_timeout_switch_label">Larger file size limit</string> <string name="screenrecord_longer_timeout_switch_summary">Limit recording size to 15 GB</string> </resources> packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java +15 −4 Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ public class RecordingService extends Service implements ScreenMediaRecorderList private static final String EXTRA_DISPLAY_ID = "extra_displayId"; private static final String EXTRA_STOP_REASON = "extra_stopReason"; private static final String EXTRA_LOW_QUALITY = "extra_lowQuality"; private static final String EXTRA_LONGER_DURATION = "extra_longerDuration"; protected static final String ACTION_START = "com.android.systemui.screenrecord.START"; protected static final String ACTION_SHOW_START_NOTIF = Loading Loading @@ -112,6 +113,7 @@ public class RecordingService extends Service implements ScreenMediaRecorderList private RecordingServiceStrings mStrings; private boolean mLowQuality; private boolean mLongerDuration; @Inject public RecordingService(ScreenRecordUxController controller, @LongRunning Executor executor, Loading Loading @@ -144,14 +146,15 @@ public class RecordingService extends Service implements ScreenMediaRecorderList public static Intent getStartIntent(Context context, int resultCode, int audioSource, boolean showTaps, @Nullable MediaProjectionCaptureTarget captureTarget, boolean lowQuality) { boolean lowQuality, boolean longerDuration) { 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_CAPTURE_TARGET, captureTarget) .putExtra(EXTRA_LOW_QUALITY, lowQuality); .putExtra(EXTRA_LOW_QUALITY, lowQuality) .putExtra(EXTRA_LONGER_DURATION, longerDuration); } /** Loading @@ -174,9 +177,9 @@ public class RecordingService extends Service implements ScreenMediaRecorderList boolean showTaps, int displayId, @Nullable MediaProjectionCaptureTarget captureTarget, boolean lowQuality) { boolean lowQuality, boolean longerDuration) { return getStartIntent(context, resultCode, audioSource, showTaps, captureTarget, lowQuality) lowQuality, longerDuration) .putExtra(EXTRA_DISPLAY_ID, displayId); } Loading Loading @@ -207,6 +210,7 @@ public class RecordingService extends Service implements ScreenMediaRecorderList Log.d(getTag(), "recording with audio source " + mAudioSource); mShowTaps = intent.getBooleanExtra(EXTRA_SHOW_TAPS, false); mLowQuality = intent.getBooleanExtra(EXTRA_LOW_QUALITY, false); mLongerDuration = intent.getBooleanExtra(EXTRA_LONGER_DURATION, false); MediaProjectionCaptureTarget captureTarget = intent.getParcelableExtra(EXTRA_CAPTURE_TARGET, Loading @@ -229,6 +233,7 @@ public class RecordingService extends Service implements ScreenMediaRecorderList this ); setLowQuality(mLowQuality); setLongerDuration(mLongerDuration); if (startRecording()) { updateState(true); Loading Loading @@ -599,6 +604,12 @@ public class RecordingService extends Service implements ScreenMediaRecorderList } } private void setLongerDuration(boolean longer) { if (getRecorder() != null) { getRecorder().setLongerDuration(longer); } } /** * Get an intent to stop the recording service. * @param context Context from the requesting activity Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/screenrecord/RecordingServiceTest.java +7 −4 Original line number Diff line number Diff line Loading @@ -148,7 +148,8 @@ public class RecordingServiceTest extends SysuiTestCase { @Test public void testLogStartFullScreenRecording() { Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false, null, false); Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false, null, false, false); mRecordingService.onStartCommand(startIntent, 0, 0); verify(mUiEventLogger, times(1)).log(Events.ScreenRecordEvent.SCREEN_RECORD_START); Loading @@ -158,7 +159,8 @@ public class RecordingServiceTest extends SysuiTestCase { public void testLogStartPartialRecording() { MediaProjectionCaptureTarget target = new MediaProjectionCaptureTarget(new LaunchCookie(), 12345); Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false, target, false); Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false, target, false, false); mRecordingService.onStartCommand(startIntent, 0, 0); verify(mUiEventLogger, times(1)).log(Events.ScreenRecordEvent.SCREEN_RECORD_START); Loading Loading @@ -191,7 +193,8 @@ 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, null, false); Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false, null, false, false); mRecordingService.onStartCommand(startIntent, 0, 0); assertUpdateState(false); Loading Loading @@ -316,7 +319,7 @@ public class RecordingServiceTest extends SysuiTestCase { @Test public void testSecondaryDisplayRecording() throws IOException { Intent startIntent = RecordingService.getStartIntent(mContext, 0, 0, false, 200, null, false); RecordingService.getStartIntent(mContext, 0, 0, false, 200, null, false, false); assertEquals(startIntent.getIntExtra("extra_displayId", -1), 200); } Loading
packages/SystemUI/res/drawable/ic_storage.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?attr/colorControlNormal"> <path android:fillColor="#FF000000" android:pathData="M2,20h20v-4L2,16v4zM4,17h2v2L4,19v-2zM2,4v4h20L22,4L2,4zM6,7L4,7L4,5h2v2zM2,14h20v-4L2,10v4zM4,11h2v2L4,13v-2z"/> </vector>
packages/SystemUI/res/layout/screen_record_options.xml +47 −0 Original line number Diff line number Diff line Loading @@ -132,4 +132,51 @@ style="@style/ScreenRecord.Switch" android:importantForAccessibility="yes" /> </LinearLayout> <LinearLayout android:id="@+id/show_longer_timeout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical" 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:src="@drawable/ic_storage" android:tint="?android:attr/textColorSecondary" android:layout_marginRight="@dimen/screenrecord_option_padding" android:importantForAccessibility="no"/> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:minHeight="48dp" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:fontFamily="@*android:string/config_bodyFontFamily" android:text="@string/screenrecord_longer_timeout_switch_label" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="?android:attr/textColorPrimary" android:contentDescription="@string/screenrecord_longer_timeout_switch_label"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:importantForAccessibility="no" android:fontFamily="@*android:string/config_bodyFontFamily" android:text="@string/screenrecord_longer_timeout_switch_summary" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="?android:textColorSecondary"/> </LinearLayout> <Switch android:layout_width="wrap_content" android:minWidth="48dp" android:layout_height="48dp" android:id="@+id/screenrecord_longer_timeout_switch" android:contentDescription="@string/screenrecord_longer_timeout_switch_label" style="@style/ScreenRecord.Switch" android:importantForAccessibility="yes" /> </LinearLayout> </LinearLayout> No newline at end of file
packages/SystemUI/res/values/cm_strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -120,4 +120,6 @@ <!-- Screen record --> <string name="screenrecord_lowquality_label">Lower quality</string> <string name="screenrecord_lowquality_summary">For smaller file size</string> <string name="screenrecord_longer_timeout_switch_label">Larger file size limit</string> <string name="screenrecord_longer_timeout_switch_summary">Limit recording size to 15 GB</string> </resources>
packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java +15 −4 Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ public class RecordingService extends Service implements ScreenMediaRecorderList private static final String EXTRA_DISPLAY_ID = "extra_displayId"; private static final String EXTRA_STOP_REASON = "extra_stopReason"; private static final String EXTRA_LOW_QUALITY = "extra_lowQuality"; private static final String EXTRA_LONGER_DURATION = "extra_longerDuration"; protected static final String ACTION_START = "com.android.systemui.screenrecord.START"; protected static final String ACTION_SHOW_START_NOTIF = Loading Loading @@ -112,6 +113,7 @@ public class RecordingService extends Service implements ScreenMediaRecorderList private RecordingServiceStrings mStrings; private boolean mLowQuality; private boolean mLongerDuration; @Inject public RecordingService(ScreenRecordUxController controller, @LongRunning Executor executor, Loading Loading @@ -144,14 +146,15 @@ public class RecordingService extends Service implements ScreenMediaRecorderList public static Intent getStartIntent(Context context, int resultCode, int audioSource, boolean showTaps, @Nullable MediaProjectionCaptureTarget captureTarget, boolean lowQuality) { boolean lowQuality, boolean longerDuration) { 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_CAPTURE_TARGET, captureTarget) .putExtra(EXTRA_LOW_QUALITY, lowQuality); .putExtra(EXTRA_LOW_QUALITY, lowQuality) .putExtra(EXTRA_LONGER_DURATION, longerDuration); } /** Loading @@ -174,9 +177,9 @@ public class RecordingService extends Service implements ScreenMediaRecorderList boolean showTaps, int displayId, @Nullable MediaProjectionCaptureTarget captureTarget, boolean lowQuality) { boolean lowQuality, boolean longerDuration) { return getStartIntent(context, resultCode, audioSource, showTaps, captureTarget, lowQuality) lowQuality, longerDuration) .putExtra(EXTRA_DISPLAY_ID, displayId); } Loading Loading @@ -207,6 +210,7 @@ public class RecordingService extends Service implements ScreenMediaRecorderList Log.d(getTag(), "recording with audio source " + mAudioSource); mShowTaps = intent.getBooleanExtra(EXTRA_SHOW_TAPS, false); mLowQuality = intent.getBooleanExtra(EXTRA_LOW_QUALITY, false); mLongerDuration = intent.getBooleanExtra(EXTRA_LONGER_DURATION, false); MediaProjectionCaptureTarget captureTarget = intent.getParcelableExtra(EXTRA_CAPTURE_TARGET, Loading @@ -229,6 +233,7 @@ public class RecordingService extends Service implements ScreenMediaRecorderList this ); setLowQuality(mLowQuality); setLongerDuration(mLongerDuration); if (startRecording()) { updateState(true); Loading Loading @@ -599,6 +604,12 @@ public class RecordingService extends Service implements ScreenMediaRecorderList } } private void setLongerDuration(boolean longer) { if (getRecorder() != null) { getRecorder().setLongerDuration(longer); } } /** * Get an intent to stop the recording service. * @param context Context from the requesting activity Loading