Avoid media indexing on Android
Summary: Record Android screen captures into a separate directory with a `.nomedia` file to avoid it from getting indexed before it gets removed after being pulled. Reviewed By: danielbuechele Differential Revision: D13465448 fbshipit-source-id: 4449ff3a927cc8621b015b018d2b743cedc4ce8c
This commit is contained in:
committed by
Facebook Github Bot
parent
d7ecd3af5a
commit
4cb82c1f1d
@@ -155,13 +155,27 @@ class ScreenCaptureButtons extends Component<Props, State> {
|
||||
const videoPath = path.join(CAPTURE_LOCATION, getFileName('mp4'));
|
||||
this.videoPath = videoPath;
|
||||
if (selectedDevice instanceof AndroidDevice) {
|
||||
const devicePath = '/sdcard/flipper_recorder';
|
||||
|
||||
this.setState({
|
||||
recording: true,
|
||||
});
|
||||
|
||||
this.executeShell(
|
||||
selectedDevice,
|
||||
`screenrecord --bugreport /sdcard/video.mp4`,
|
||||
`mkdir -p "${devicePath}" && touch "${devicePath}/.nomedia"`,
|
||||
)
|
||||
.then(output => {
|
||||
if (output) {
|
||||
throw output;
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
this.executeShell(
|
||||
selectedDevice,
|
||||
`screenrecord --bugreport "${devicePath}/video.mp4"`,
|
||||
),
|
||||
)
|
||||
.then(output => {
|
||||
if (output) {
|
||||
throw output;
|
||||
@@ -174,17 +188,19 @@ class ScreenCaptureButtons extends Component<Props, State> {
|
||||
});
|
||||
})
|
||||
.then(
|
||||
(): Promise<string> => {
|
||||
return this.pullFromDevice(
|
||||
(): Promise<string> =>
|
||||
this.pullFromDevice(
|
||||
selectedDevice,
|
||||
`/sdcard/video.mp4`,
|
||||
`${devicePath}/video.mp4`,
|
||||
videoPath,
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
.then(openFile)
|
||||
.then(() => {
|
||||
this.executeShell(selectedDevice, `rm /sdcard/video.mp4`);
|
||||
.then(() => this.executeShell(selectedDevice, `rm -rf "${devicePath}"`))
|
||||
.then(output => {
|
||||
if (output) {
|
||||
throw output;
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
this.setState({
|
||||
|
||||
Reference in New Issue
Block a user