[Android] Remove logging feature from release

Geoffrey Métais git at videolan.org
Mon Oct 26 16:37:10 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Oct 26 15:55:48 2015 +0100| [9de284d2f311ed75b01e02fcd42ddfbfe0028251] | committer: Geoffrey Métais

Remove logging feature from release

Removed permission too

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=9de284d2f311ed75b01e02fcd42ddfbfe0028251
---

 vlc-android/release/AndroidManifest.xml                   |    2 ++
 .../src/org/videolan/vlc/gui/preferences/Developer.java   |   13 +++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/vlc-android/release/AndroidManifest.xml b/vlc-android/release/AndroidManifest.xml
index 20da9c3..ab78e77 100644
--- a/vlc-android/release/AndroidManifest.xml
+++ b/vlc-android/release/AndroidManifest.xml
@@ -7,4 +7,6 @@
     <!-- Because manifest merger will add it otherwise... -->
     <uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
 
+    <uses-permission android:name="android.permission.READ_LOGS" tools:node="remove" />
+
 </manifest>
diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/Developer.java b/vlc-android/src/org/videolan/vlc/gui/preferences/Developer.java
index 1dec620..73a1001 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/Developer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/Developer.java
@@ -23,10 +23,16 @@
 
 package org.videolan.vlc.gui.preferences;
 
+import android.Manifest;
+import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
 import android.support.v7.preference.Preference;
 
+import org.videolan.libvlc.util.AndroidUtil;
+import org.videolan.vlc.BuildConfig;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.DebugLogActivity;
@@ -44,6 +50,13 @@ public class Developer extends BasePreferenceFragment implements SharedPreferenc
     }
 
     @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        findPreference("debug_logs").setVisible(BuildConfig.DEBUG && (AndroidUtil.isJellyBeanMR1OrLater() ||
+                getActivity().checkCallingOrSelfPermission(Manifest.permission.READ_LOGS) == PackageManager.PERMISSION_GRANTED));
+    }
+
+    @Override
     public void onStart() {
         super.onStart();
         getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);



More information about the Android mailing list