Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
533
Issue boards
Milestones
Wiki
Code
Merge requests
11
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
8ee4529d
Commit
8ee4529d
authored
7 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Check read permission with StartActivity context
On Samsung Galaxy devices, app context seems to not be always ready
parent
eae98504
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vlc-android/src/org/videolan/vlc/StartActivity.java
+4
-16
4 additions, 16 deletions
vlc-android/src/org/videolan/vlc/StartActivity.java
vlc-android/src/org/videolan/vlc/util/Permissions.java
+7
-2
7 additions, 2 deletions
vlc-android/src/org/videolan/vlc/util/Permissions.java
with
11 additions
and
18 deletions
vlc-android/src/org/videolan/vlc/StartActivity.java
+
4
−
16
View file @
8ee4529d
...
...
@@ -24,11 +24,9 @@
package
org.videolan.vlc
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.preference.PreferenceManager
;
import
android.provider.MediaStore
;
...
...
@@ -96,20 +94,10 @@ public class StartActivity extends Activity {
}
private
void
startMedialibrary
(
final
boolean
firstRun
,
final
boolean
upgrade
)
{
final
Runnable
runnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
if
(!
VLCApplication
.
getMLInstance
().
isInitiated
()
&&
Permissions
.
canReadStorage
())
startService
(
new
Intent
(
MediaParsingService
.
ACTION_INIT
,
null
,
StartActivity
.
this
,
MediaParsingService
.
class
)
.
putExtra
(
EXTRA_FIRST_RUN
,
firstRun
)
.
putExtra
(
EXTRA_UPGRADE
,
upgrade
));
}
};
final
Context
ctx
=
VLCApplication
.
getAppContext
();
if
(
ctx
!=
null
)
runnable
.
run
();
else
new
Handler
().
postDelayed
(
runnable
,
500
);
if
(!
VLCApplication
.
getMLInstance
().
isInitiated
()
&&
Permissions
.
canReadStorage
(
StartActivity
.
this
))
startService
(
new
Intent
(
MediaParsingService
.
ACTION_INIT
,
null
,
StartActivity
.
this
,
MediaParsingService
.
class
)
.
putExtra
(
EXTRA_FIRST_RUN
,
firstRun
)
.
putExtra
(
EXTRA_UPGRADE
,
upgrade
));
}
private
boolean
showTvUi
()
{
...
...
This diff is collapsed.
Click to expand it.
vlc-android/src/org/videolan/vlc/util/Permissions.java
+
7
−
2
View file @
8ee4529d
...
...
@@ -73,9 +73,14 @@ public class Permissions {
@TargetApi
(
Build
.
VERSION_CODES
.
JELLY_BEAN
)
public
static
boolean
canReadStorage
()
{
return
canReadStorage
(
VLCApplication
.
getAppContext
());
}
@TargetApi
(
Build
.
VERSION_CODES
.
JELLY_BEAN
)
public
static
boolean
canReadStorage
(
Context
context
)
{
if
(!
AndroidUtil
.
isICSOrLater
)
return
VLCApplication
.
getAppC
ontext
()
.
getExternalFilesDir
(
null
)
!=
null
;
return
!
AndroidUtil
.
isMarshMallowOrLater
||
ContextCompat
.
checkSelfPermission
(
VLCApplication
.
getAppC
ontext
()
,
return
c
ontext
.
getExternalFilesDir
(
null
)
!=
null
;
return
!
AndroidUtil
.
isMarshMallowOrLater
||
ContextCompat
.
checkSelfPermission
(
c
ontext
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
==
PackageManager
.
PERMISSION_GRANTED
;
}
...
...
This diff is collapsed.
Click to expand it.
Jean-Baptiste Kempf
@jbk
mentioned in issue
#386 (closed)
·
7 years ago
mentioned in issue
#386 (closed)
mentioned in issue #386
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment