[Android] Deactivate DebugLogService in debug builds

Geoffrey Métais git at videolan.org
Wed Nov 14 15:26:57 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Nov 14 11:26:26 2018 +0100| [eb1ac62811356fb69841370ee9376d522ad531a9] | committer: Geoffrey Métais

Deactivate DebugLogService in debug builds

This service runs in another process, it prevented the use of Instant
Run during development.

> https://code.videolan.org/videolan/vlc-android/commit/eb1ac62811356fb69841370ee9376d522ad531a9
---

 vlc-android/AndroidManifest.xml                           |  5 -----
 vlc-android/flavors/release/AndroidManifest.xml           |  7 +++++++
 .../videolan/vlc/gui/preferences/PreferencesAdvanced.java | 15 ++++++++++++---
 .../vlc/gui/tv/preferences/PreferencesAdvanced.java       | 13 +++++++++++--
 4 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/vlc-android/AndroidManifest.xml b/vlc-android/AndroidManifest.xml
index 053f625d9..a933816d4 100644
--- a/vlc-android/AndroidManifest.xml
+++ b/vlc-android/AndroidManifest.xml
@@ -477,11 +477,6 @@
         <activity android:name=".gui.CompatErrorActivity" />
         <activity android:name=".gui.preferences.PreferencesActivity"
             android:theme="@style/Theme.VLC" />
-
-        <activity android:name=".gui.DebugLogActivity"
-            android:launchMode="singleTop" />
-        <service android:name=".DebugLogService"
-            android:process=":logger" />
         <activity
             android:name=".gui.video.VideoPlayerActivity"
             android:resizeableActivity="true"
diff --git a/vlc-android/flavors/release/AndroidManifest.xml b/vlc-android/flavors/release/AndroidManifest.xml
index 8bfca5f82..1d03bce05 100644
--- a/vlc-android/flavors/release/AndroidManifest.xml
+++ b/vlc-android/flavors/release/AndroidManifest.xml
@@ -18,4 +18,11 @@
     <uses-permission android:name="org.videolan.vlc.permission.READ_EXTENSION_DATA" />
     <uses-permission android:name="org.videolan.vlc.permission.BIND_DATA_CONSUMER" />
 
+    <application>
+        <activity android:name=".gui.DebugLogActivity"
+            android:launchMode="singleTop" />
+        <service android:name=".DebugLogService"
+            android:process=":logger" />
+    </application>
+
 </manifest>
diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java
index bffc1982f..e3531dcd8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java
@@ -28,12 +28,11 @@ import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.net.Uri;
-import androidx.appcompat.app.AlertDialog;
-import androidx.preference.EditTextPreference;
-import androidx.preference.Preference;
+import android.os.Bundle;
 import android.widget.Toast;
 
 import org.videolan.medialibrary.Medialibrary;
+import org.videolan.vlc.BuildConfig;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.DebugLogActivity;
@@ -46,6 +45,10 @@ import org.videolan.vlc.util.WorkersKt;
 
 import java.io.File;
 
+import androidx.appcompat.app.AlertDialog;
+import androidx.preference.EditTextPreference;
+import androidx.preference.Preference;
+
 public class PreferencesAdvanced extends BasePreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
     @Override
     protected int getXml() {
@@ -58,6 +61,12 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
         return R.string.advanced_prefs_category;
     }
 
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        if (BuildConfig.DEBUG) findPreference("debug_logs").setVisible(false);
+    }
+
     @Override
     public void onStart() {
         super.onStart();
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java
index 15811fb84..574caa645 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java
@@ -31,15 +31,18 @@ import android.content.Intent;
 import android.content.SharedPreferences;
 import android.net.Uri;
 import android.os.Build;
-import androidx.preference.EditTextPreference;
-import androidx.preference.Preference;
+import android.os.Bundle;
 import android.widget.Toast;
 
+import org.videolan.vlc.BuildConfig;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.DebugLogActivity;
 import org.videolan.vlc.util.VLCInstance;
 
+import androidx.preference.EditTextPreference;
+import androidx.preference.Preference;
+
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
 public class PreferencesAdvanced extends BasePreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
     @Override
@@ -53,6 +56,12 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
         return R.string.advanced_prefs_category;
     }
 
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        if (BuildConfig.DEBUG) findPreference("debug_logs").setVisible(false);
+    }
+
     @Override
     public void onStart() {
         super.onStart();



More information about the Android mailing list