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
40ae364d
Commit
40ae364d
authored
Oct 19, 2017
by
Sylvain Berfini
🐮
Browse files
Added getDataPath, getConfigPath and getCachePath to AndroidPlatformHelper
parent
df7f5059
Changes
1
Hide whitespace changes
Inline
Side-by-side
wrappers/java/classes/tools/AndroidPlatformHelper.java
View file @
40ae364d
...
...
@@ -40,18 +40,19 @@ import android.os.Build;
* This class is instanciated directly by the linphone library in order to access specific features only accessible in java.
**/
public
class
AndroidPlatformHelper
{
public
class
AndroidPlatformHelper
{
private
Context
mContext
;
private
WifiManager
.
WifiLock
mWifiLock
;
private
WifiManager
.
MulticastLock
mMcastLock
;
private
ConnectivityManager
mConnectivityManager
;
private
PowerManager
mPowerManager
;
private
WakeLock
mWakeLock
;
public
AndroidPlatformHelper
(
Object
ctx_obj
){
Context
ctx
=
(
Context
)
ctx_obj
;
WifiManager
wifiMgr
=
ctx
.
getSystemService
(
WifiManager
.
class
);
mPowerManager
=
(
PowerManager
)
ctx
.
getSystemService
(
Context
.
POWER_SERVICE
);
mConnectivityManager
=
(
ConnectivityManager
)
ctx
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
public
AndroidPlatformHelper
(
Object
ctx_obj
)
{
m
Context
=
(
Context
)
ctx_obj
;
WifiManager
wifiMgr
=
mContext
.
getSystemService
(
WifiManager
.
class
);
mPowerManager
=
(
PowerManager
)
mContext
.
getSystemService
(
Context
.
POWER_SERVICE
);
mConnectivityManager
=
(
ConnectivityManager
)
mContext
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
mWakeLock
=
mPowerManager
.
newWakeLock
(
PowerManager
.
PARTIAL_WAKE_LOCK
,
"AndroidPlatformHelper"
);
mWakeLock
.
setReferenceCounted
(
true
);
...
...
@@ -61,7 +62,7 @@ public class AndroidPlatformHelper{
mWifiLock
.
setReferenceCounted
(
true
);
}
public
Object
getPowerManager
(){
public
Object
getPowerManager
()
{
return
mPowerManager
;
}
...
...
@@ -85,26 +86,44 @@ public class AndroidPlatformHelper{
Log
.
i
(
"getDnsServers() returning"
);
return
servers
;
}
public
void
acquireWifiLock
(){
public
String
getDataPath
()
{
return
mContext
.
getFilesDir
().
getAbsolutePath
();
}
public
String
getConfigPath
()
{
return
mContext
.
getFilesDir
().
getAbsolutePath
();
}
public
String
getCachePath
()
{
return
mContext
.
getCacheDir
().
getAbsolutePath
();
}
public
void
acquireWifiLock
()
{
Log
.
i
(
"acquireWifiLock()"
);
mWifiLock
.
acquire
();
}
public
void
releaseWifiLock
(){
public
void
releaseWifiLock
()
{
Log
.
i
(
"releaseWifiLock()"
);
mWifiLock
.
release
();
}
public
void
acquireMcastLock
(){
public
void
acquireMcastLock
()
{
Log
.
i
(
"acquireMcastLock()"
);
mMcastLock
.
acquire
();
}
public
void
releaseMcastLock
(){
public
void
releaseMcastLock
()
{
Log
.
i
(
"releaseMcastLock()"
);
mMcastLock
.
release
();
}
public
void
acquireCpuLock
(){
public
void
acquireCpuLock
()
{
Log
.
i
(
"acquireCpuLock()"
);
mWakeLock
.
acquire
();
}
public
void
releaseCpuLock
(){
Log
.
i
(
"releaseCpuLock()"
);
mWakeLock
.
release
();
...
...
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