[Android] Pass firstrun and upgrade booleans to ML service

Geoffrey Métais git at videolan.org
Tue Mar 14 18:34:03 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 14 17:58:24 2017 +0100| [e59817ebc09510c2501844e8a4a6bd2e76c39f97] | committer: Geoffrey Métais

Pass firstrun and upgrade booleans to ML service

Correctly send firstRun and upgrade state to MediaParsingService with
runtime permissions

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

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java      | 8 +++++++-
 vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java | 5 ++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index b81f4bd..01428c7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -121,6 +121,7 @@ public class MainActivity extends AudioPlayerContainerActivity implements Filter
 
     private Menu mMenu;
     private SearchView mSearchView;
+    private boolean mFirstRun, mUpgrade;
 
     // Extensions management
     private ServiceConnection mExtensionServiceConnection;
@@ -185,6 +186,8 @@ public class MainActivity extends AudioPlayerContainerActivity implements Filter
         mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
 
         if (getIntent().getBooleanExtra(StartActivity.EXTRA_UPGRADE, false)) {
+            mUpgrade = true;
+            mFirstRun = getIntent().getBooleanExtra(StartActivity.EXTRA_FIRST_RUN, false);
             /*
              * The sliding menu is automatically opened when the user closes
              * the info dialog. If (for any reason) the dialog is not shown,
@@ -224,7 +227,10 @@ public class MainActivity extends AudioPlayerContainerActivity implements Filter
                 // If request is cancelled, the result arrays are empty.
                 if (grantResults.length > 0
                         && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
-                    startService(new Intent(MediaParsingService.ACTION_INIT, null, this, MediaParsingService.class));
+                    Intent serviceIntent = new Intent(MediaParsingService.ACTION_INIT, null, this, MediaParsingService.class);
+                    serviceIntent.putExtra(StartActivity.EXTRA_FIRST_RUN, mFirstRun);
+                    serviceIntent.putExtra(StartActivity.EXTRA_UPGRADE, mUpgrade);
+                    startService(serviceIntent);
                 } else
                     Permissions.showStoragePermissionDialog(this, false);
                 break;
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index a361007..2ba33f5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -235,7 +235,10 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
                 // If request is cancelled, the result arrays are empty.
                 if (grantResults.length > 0
                         && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
-                    startService(new Intent(MediaParsingService.ACTION_INIT, null, this, MediaParsingService.class));
+                    Intent serviceIntent = new Intent(MediaParsingService.ACTION_INIT, null, this, MediaParsingService.class);
+                    serviceIntent.putExtra(StartActivity.EXTRA_FIRST_RUN, getIntent().getBooleanExtra(StartActivity.EXTRA_FIRST_RUN, false));
+                    serviceIntent.putExtra(StartActivity.EXTRA_UPGRADE, getIntent().getBooleanExtra(StartActivity.EXTRA_UPGRADE, false));
+                    startService(serviceIntent);
                 } else {
                     Permissions.showStoragePermissionDialog(this, false);
                 }



More information about the Android mailing list