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'));
|
const videoPath = path.join(CAPTURE_LOCATION, getFileName('mp4'));
|
||||||
this.videoPath = videoPath;
|
this.videoPath = videoPath;
|
||||||
if (selectedDevice instanceof AndroidDevice) {
|
if (selectedDevice instanceof AndroidDevice) {
|
||||||
|
const devicePath = '/sdcard/flipper_recorder';
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
recording: true,
|
recording: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.executeShell(
|
this.executeShell(
|
||||||
selectedDevice,
|
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 => {
|
.then(output => {
|
||||||
if (output) {
|
if (output) {
|
||||||
throw output;
|
throw output;
|
||||||
@@ -174,17 +188,19 @@ class ScreenCaptureButtons extends Component<Props, State> {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
(): Promise<string> => {
|
(): Promise<string> =>
|
||||||
return this.pullFromDevice(
|
this.pullFromDevice(
|
||||||
selectedDevice,
|
selectedDevice,
|
||||||
`/sdcard/video.mp4`,
|
`${devicePath}/video.mp4`,
|
||||||
videoPath,
|
videoPath,
|
||||||
);
|
),
|
||||||
},
|
|
||||||
)
|
)
|
||||||
.then(openFile)
|
.then(openFile)
|
||||||
.then(() => {
|
.then(() => this.executeShell(selectedDevice, `rm -rf "${devicePath}"`))
|
||||||
this.executeShell(selectedDevice, `rm /sdcard/video.mp4`);
|
.then(output => {
|
||||||
|
if (output) {
|
||||||
|
throw output;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|||||||
Reference in New Issue
Block a user