mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-21 04:58:14 +00:00
Added getDataPath, getConfigPath and getCachePath to AndroidPlatformHelper
This commit is contained in:
parent
df7f5059c2
commit
40ae364d21
1 changed files with 31 additions and 12 deletions
|
|
@ -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) {
|
||||
mContext = (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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue