Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
aa3bf82b
Commit
aa3bf82b
authored
Sep 12, 2023
by
Evan W. Patton
Committed by
Susan Rati Lane
Sep 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow loading media from private directory without file: scheme
Change-Id: I49edca7a3026328b6fb88f21d21ff5fe729738e3
parent
a699e8cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
appinventor/components/src/com/google/appinventor/components/runtime/util/MediaUtil.java
...google/appinventor/components/runtime/util/MediaUtil.java
+16
-3
No files found.
appinventor/components/src/com/google/appinventor/components/runtime/util/MediaUtil.java
View file @
aa3bf82b
// -*- mode: java; c-basic-offset: 2; -*-
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-202
0
MIT, All rights reserved
// Copyright 2011-202
3
MIT, All rights reserved
// Released under the Apache License, Version 2.0
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
...
@@ -28,7 +28,6 @@ import android.view.Display;
...
@@ -28,7 +28,6 @@ import android.view.Display;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.widget.VideoView
;
import
android.widget.VideoView
;
import
com.google.appinventor.components.common.FileScope
;
import
com.google.appinventor.components.runtime.Form
;
import
com.google.appinventor.components.runtime.Form
;
import
com.google.appinventor.components.runtime.ReplForm
;
import
com.google.appinventor.components.runtime.ReplForm
;
import
com.google.appinventor.components.runtime.errors.PermissionException
;
import
com.google.appinventor.components.runtime.errors.PermissionException
;
...
@@ -56,7 +55,16 @@ import java.util.concurrent.ConcurrentHashMap;
...
@@ -56,7 +55,16 @@ import java.util.concurrent.ConcurrentHashMap;
*/
*/
public
class
MediaUtil
{
public
class
MediaUtil
{
private
enum
MediaSource
{
ASSET
,
REPL_ASSET
,
SDCARD
,
FILE_URL
,
URL
,
CONTENT_URI
,
CONTACT_URI
}
private
enum
MediaSource
{
ASSET
,
REPL_ASSET
,
SDCARD
,
FILE_URL
,
URL
,
CONTENT_URI
,
CONTACT_URI
,
PRIVATE_DATA
}
private
static
final
String
LOG_TAG
=
"MediaUtil"
;
private
static
final
String
LOG_TAG
=
"MediaUtil"
;
...
@@ -107,6 +115,8 @@ public class MediaUtil {
...
@@ -107,6 +115,8 @@ public class MediaUtil {
}
else
if
(
mediaPath
.
startsWith
(
"content://"
))
{
}
else
if
(
mediaPath
.
startsWith
(
"content://"
))
{
return
MediaSource
.
CONTENT_URI
;
return
MediaSource
.
CONTENT_URI
;
}
else
if
(
mediaPath
.
startsWith
(
"/data/"
))
{
return
MediaSource
.
PRIVATE_DATA
;
}
}
try
{
try
{
...
@@ -274,6 +284,9 @@ public class MediaUtil {
...
@@ -274,6 +284,9 @@ public class MediaUtil {
}
}
return
getAssetsIgnoreCaseInputStream
(
form
,
mediaPath
);
return
getAssetsIgnoreCaseInputStream
(
form
,
mediaPath
);
case
PRIVATE_DATA:
return
new
FileInputStream
(
mediaPath
);
case
REPL_ASSET:
case
REPL_ASSET:
if
(
RUtil
.
needsFilePermission
(
form
,
mediaPath
,
null
))
{
if
(
RUtil
.
needsFilePermission
(
form
,
mediaPath
,
null
))
{
// App specific storage does not need read permission
// App specific storage does not need read permission
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment