Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Added restriction MediaRecorder.setOutputFile
Browse files Browse the repository at this point in the history
Refs #1874
  • Loading branch information
M66B committed Aug 13, 2014
1 parent 8a1bec1 commit 96d17b1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Changelog

**Next release**

* Added restriction *MediaRecorder.setOutputFile* ([issue](/../../issues/1874))

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

<a name="xprivacy3"></a>
Expand Down
1 change: 1 addition & 0 deletions res/values/functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
<string name="media_Audio_startRecording" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/media/AudioRecord.html#startRecording()">Google documentation</a>]]></string>
<string name="media_Camera_startPreview" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/hardware/Camera.html#startPreview()">Google documentation</a>]]></string>
<string name="media_Camera_takePicture" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/hardware/Camera.html#takePicture(android.hardware.Camera.ShutterCallback,%20android.hardware.Camera.PictureCallback,%20android.hardware.Camera.PictureCallback)">Google documentation</a>]]></string>
<string name="media_MediaRecorder_setOutputFile" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/media/MediaRecorder.html#setOutputFile(java.io.FileDescriptor)">Google documentation</a>]]></string>
<string name="media_MediaRecorder_start" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/media/MediaRecorder.html#start()">Google documentation</a>]]></string>
<string name="media_android_media_action_IMAGE_CAPTURE" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/provider/MediaStore.html#ACTION_IMAGE_CAPTURE">Google documentation</a>]]></string>
<string name="media_android_media_action_IMAGE_CAPTURE_SECURE" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/provider/MediaStore.html#ACTION_IMAGE_CAPTURE_SECURE">Google documentation</a>]]></string>
Expand Down
1 change: 1 addition & 0 deletions src/biz/bokhorst/xprivacy/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ public static List<Hook> get() {
mListHook.add(new Hook("media", "Camera.startPreview", "CAMERA", 1, "2.2.3", "setPreviewCallback").unsafe().doNotify());
mListHook.add(new Hook("media", "Camera.takePicture", "CAMERA", 1, "2.2.3", "takePicture").unsafe().doNotify());
mListHook.add(new Hook("media", "MediaRecorder.start", "RECORD_AUDIO,RECORD_VIDEO", 1, "2.2.3", "setOutputFile").unsafe().doNotify());
mListHook.add(new Hook("media", "MediaRecorder.setOutputFile", "RECORD_AUDIO,RECORD_VIDEO", 1, "2.99.19", "setOutputFile").unsafe().doNotify());
mListHook.add(new Hook("media", "Camera.permission", "CAMERA", 1, "2.2.3", null).dangerous().doNotify());
mListHook.add(new Hook("media", "Record.Audio.permission", "RECORD_AUDIO", 3, "2.2.3", null).dangerous().doNotify());
mListHook.add(new Hook("media", "Record.Video.permission", "RECORD_VIDEO", 3, "2.2.3", null).dangerous().doNotify());
Expand Down
14 changes: 7 additions & 7 deletions src/biz/bokhorst/xprivacy/XMediaRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import java.util.ArrayList;
import java.util.List;

import android.util.Log;

public class XMediaRecorder extends XHook {
private Methods mMethod;

Expand All @@ -22,23 +20,25 @@ public String getClassName() {
// http://developer.android.com/reference/android/media/MediaRecorder.html

private enum Methods {
start
setOutputFile, start
};

public static List<XHook> getInstances() {
List<XHook> listHook = new ArrayList<XHook>();
listHook.add(new XMediaRecorder(Methods.setOutputFile, PrivacyManager.cMedia));
listHook.add(new XMediaRecorder(Methods.start, PrivacyManager.cMedia));
return listHook;
}

@Override
protected void before(XParam param) throws Throwable {
if (mMethod == Methods.start) {
switch (mMethod) {
case setOutputFile:
case start:
if (isRestricted(param))
param.setResult(null);

} else
Util.log(this, Log.WARN, "Unknown method=" + param.method.getName());
break;
}
}

@Override
Expand Down

0 comments on commit 96d17b1

Please sign in to comment.