From 96d17b15f4862819906cc4697c6e36b597eb24ac Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 13 Aug 2014 21:00:16 +0200 Subject: [PATCH] Added restriction MediaRecorder.setOutputFile Refs #1874 --- CHANGELOG.md | 2 ++ res/values/functions.xml | 1 + src/biz/bokhorst/xprivacy/Meta.java | 1 + src/biz/bokhorst/xprivacy/XMediaRecorder.java | 14 +++++++------- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 726973abc..bf79cadac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ Changelog **Next release** +* Added restriction *MediaRecorder.setOutputFile* ([issue](/../../issues/1874)) + [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) diff --git a/res/values/functions.xml b/res/values/functions.xml index 4c816d923..5aceaa2dc 100644 --- a/res/values/functions.xml +++ b/res/values/functions.xml @@ -176,6 +176,7 @@ Google documentation]]> Google documentation]]> Google documentation]]> + Google documentation]]> Google documentation]]> Google documentation]]> Google documentation]]> diff --git a/src/biz/bokhorst/xprivacy/Meta.java b/src/biz/bokhorst/xprivacy/Meta.java index 5888a3ead..f3aba66a6 100644 --- a/src/biz/bokhorst/xprivacy/Meta.java +++ b/src/biz/bokhorst/xprivacy/Meta.java @@ -240,6 +240,7 @@ public static List 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()); diff --git a/src/biz/bokhorst/xprivacy/XMediaRecorder.java b/src/biz/bokhorst/xprivacy/XMediaRecorder.java index a1bddfe45..239062b88 100644 --- a/src/biz/bokhorst/xprivacy/XMediaRecorder.java +++ b/src/biz/bokhorst/xprivacy/XMediaRecorder.java @@ -3,8 +3,6 @@ import java.util.ArrayList; import java.util.List; -import android.util.Log; - public class XMediaRecorder extends XHook { private Methods mMethod; @@ -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 getInstances() { List listHook = new ArrayList(); + 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