Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
9ca30446
Commit
9ca30446
authored
Feb 16, 2018
by
Sylvain Berfini
🐮
Browse files
Improved AndroidPlatformHelper
parent
a237baff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
wrappers/java/classes/tools/AndroidPlatformHelper.java
wrappers/java/classes/tools/AndroidPlatformHelper.java
+19
-10
No files found.
wrappers/java/classes/tools/AndroidPlatformHelper.java
View file @
9ca30446
...
...
@@ -171,19 +171,28 @@ public class AndroidPlatformHelper {
mWakeLock
.
acquire
();
}
public
void
releaseCpuLock
(){
public
void
releaseCpuLock
()
{
Log
.
i
(
"releaseCpuLock()"
);
mWakeLock
.
release
();
}
private
int
getResourceIdentifierFromName
(
String
name
)
{
int
resId
=
mResources
.
getIdentifier
(
name
,
"raw"
,
mContext
.
getPackageName
());
if
(
resId
==
0
)
{
Log
.
d
(
"App doesn't seem to embed resource "
+
name
+
"in it's res/raw/ directory, use linphone's instead"
);
resId
=
mResources
.
getIdentifier
(
name
,
"raw"
,
"org.linphone"
);
}
return
resId
;
}
private
void
copyAssetsFromPackage
()
throws
IOException
{
copyIfNotExist
(
m
Resource
s
.
get
Identifier
(
"org.linphone:raw/
notes_of_the_optimistic"
,
null
,
null
),
mRingSoundFile
);
copyIfNotExist
(
m
Resource
s
.
get
Identifier
(
"org.linphone:raw/ringback"
,
null
,
null
),
mRingbackSoundFile
);
copyIfNotExist
(
m
Resource
s
.
get
Identifier
(
"org.linphone:raw/hold"
,
null
,
null
),
mPauseSoundFile
);
copyIfNotExist
(
m
Resource
s
.
get
Identifier
(
"org.linphone:raw/
incoming_chat"
,
null
,
null
),
mErrorToneFile
);
copyIfNotExist
(
m
Resource
s
.
get
Identifier
(
"org.linphone:raw/
cpim_grammar"
,
null
,
null
),
mGrammarCpimFile
);
copyIfNotExist
(
m
Resource
s
.
get
Identifier
(
"org.linphone:raw/
vcard_grammar"
,
null
,
null
),
mGrammarVcardFile
);
copyIfNotExist
(
m
Resource
s
.
get
Identifier
(
"org.linphone:raw/rootca"
,
null
,
null
),
mLinphoneRootCaFile
);
copyIfNotExist
(
get
ResourceIdentifier
FromName
(
"
notes_of_the_optimistic"
),
mRingSoundFile
);
copyIfNotExist
(
get
ResourceIdentifier
FromName
(
"ringback"
),
mRingbackSoundFile
);
copyIfNotExist
(
get
ResourceIdentifier
FromName
(
"hold"
),
mPauseSoundFile
);
copyIfNotExist
(
get
ResourceIdentifier
FromName
(
"
incoming_chat"
),
mErrorToneFile
);
copyIfNotExist
(
get
ResourceIdentifier
FromName
(
"
cpim_grammar"
),
mGrammarCpimFile
);
copyIfNotExist
(
get
ResourceIdentifier
FromName
(
"
vcard_grammar"
),
mGrammarVcardFile
);
copyIfNotExist
(
get
ResourceIdentifier
FromName
(
"rootca"
),
mLinphoneRootCaFile
);
}
public
void
copyIfNotExist
(
int
ressourceId
,
String
target
)
throws
IOException
{
...
...
@@ -193,9 +202,9 @@ public class AndroidPlatformHelper {
}
}
public
void
copyFromPackage
(
int
ressourceId
,
String
target
)
throws
IOException
{
FileOutputStream
lOutputStream
=
mContext
.
openFileOutput
(
target
,
0
);
public
void
copyFromPackage
(
int
ressourceId
,
String
target
)
throws
IOException
{
InputStream
lInputStream
=
mResources
.
openRawResource
(
ressourceId
);
FileOutputStream
lOutputStream
=
mContext
.
openFileOutput
(
target
,
0
);
int
readByte
;
byte
[]
buff
=
new
byte
[
8048
];
while
((
readByte
=
lInputStream
.
read
(
buff
))
!=
-
1
)
{
...
...
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