Fix read contacts

This commit is contained in:
Erwan Croze 2016-10-18 10:28:52 +02:00
parent f1d3a1bfac
commit 5271e395de
3 changed files with 38 additions and 36 deletions

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.linphone"
android:versionCode="3120" android:installLocation="auto">
android:versionCode="3200" android:versionName="3.2.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23"/>
<!-- Permissions for Push Notification -->
<permission android:name="org.linphone.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <!-- Change package ! -->
<uses-permission android:name="org.linphone.permission.C2D_MESSAGE" /> <!-- Change package ! -->
@ -19,7 +19,7 @@
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<!-- Needed to allow Linphone to install on tablets, since android.permission.CALL_PHONE implies android.hardware.telephony is required -->
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.CAMERA" />
@ -48,8 +48,8 @@
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true"/>
<application android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:largeHeap="true" android:allowBackup="true">
<application android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:largeHeap="true" android:allowBackup="true" android:debuggable="true">
<activity android:name="org.linphone.LinphoneLauncherActivity"
android:label="@string/app_name"
@ -60,7 +60,7 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL" />
<action android:name="android.intent.action.CALL_PRIVILEGED" />
@ -76,7 +76,7 @@
<data android:scheme="imto" />
</intent-filter>
<intent-filter>
<data android:mimeType="@string/sync_mimetype" /> <!-- Change package in res/values/non_localizable_custom.xml ! -->
<action android:name="android.intent.action.VIEW" />
@ -119,10 +119,10 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<!--<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:mimeType="audio/*" />
<data android:mimeType="audio/*" />
<data android:mimeType="video/*" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>-->
@ -135,7 +135,7 @@
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.purchase.InAppPurchaseActivity"
android:theme="@style/NoTitle"
android:screenOrientation="nosensor">
@ -143,7 +143,7 @@
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.assistant.RemoteProvisioningLoginActivity"
android:theme="@style/NoTitle"
android:screenOrientation="nosensor">
@ -151,14 +151,14 @@
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.assistant.RemoteProvisioningActivity"
android:theme="@style/NoTitle"
android:screenOrientation="nosensor">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<intent-filter>
<data android:scheme="linphone-config" /> <!-- Change if needed -->
<action android:name="android.intent.action.VIEW" />
@ -194,22 +194,22 @@
<receiver android:name="org.linphone.NetworkManager">
<intent-filter><action android:name="android.net.conn.CONNECTIVITY_CHANGE"></action></intent-filter>
</receiver>
<receiver android:name="org.linphone.BluetoothManager" android:enabled="false">
</receiver>
<receiver android:name="org.linphone.BootReceiver">
<intent-filter><action android:name="android.intent.action.BOOT_COMPLETED"></action></intent-filter>
<intent-filter><action android:name="android.intent.action.ACTION_SHUTDOWN"></action></intent-filter>
</receiver>
<receiver android:name="org.linphone.PhoneStateChangedReceiver">
<intent-filter><action android:name="android.intent.action.PHONE_STATE" /></intent-filter>
</receiver>
<!-- This one needs to be registered from application -->
<receiver android:name="KeepAliveReceiver"/>
<!-- Needed for push notification -->
<receiver android:name="org.linphone.gcm.GCMReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
@ -218,7 +218,7 @@
<category android:name="org.linphone" /> <!-- Change package ! -->
</intent-filter>
</receiver>
<service android:name="org.linphone.gcm.GCMService" />
<activity android:name="org.linphone.tutorials.TutorialLauncherActivity"
@ -227,28 +227,28 @@
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.tutorials.TutorialBuddyStatusActivity"
android:theme="@style/NoTitle">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.tutorials.TutorialChatRoomActivity"
android:theme="@style/NoTitle">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.tutorials.TutorialHelloWorldActivity"
android:theme="@style/NoTitle">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.tutorials.TutorialRegistrationActivity"
android:theme="@style/NoTitle">
<intent-filter>
@ -262,7 +262,7 @@
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
</manifest>
</manifest>

View file

@ -70,7 +70,7 @@
android:id="@+id/footer"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true">
@ -96,7 +96,7 @@
android:textCursorDrawable="@null"
android:inputType="textShortMessage|textMultiLine"
android:contentDescription="@string/content_description_message"
android:maxLines="50"
android:maxLines="6"
android:padding="5dp"
android:layout_margin="5dp"
android:layout_weight="1"

View file

@ -1250,14 +1250,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
ContactsManager.getInstance().initializeContactManager(getApplicationContext(), getContentResolver());
}
break;
case PERMISSIONS_REQUEST_CONTACTS:
if (readContactsI >= 0 && grantResults[readContactsI] == PackageManager.PERMISSION_GRANTED) {
ContactsManager.getInstance().enableContactsAccess();
}
checkAndRequestReadPhoneStatePermission();
ContactsManager.getInstance().fetchContactsAsync();
fetchedContactsOnce = true;
break;
case PERMISSIONS_RECORD_AUDIO_ECHO_CANCELLER:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
((SettingsFragment) fragment).startEchoCancellerCalibration();
@ -1266,6 +1258,16 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
break;
case PERMISSIONS_READ_EXTERNAL_STORAGE_DEVICE_RINGTONE:
if (readContactsI >= 0 && grantResults[readContactsI] == PackageManager.PERMISSION_GRANTED) {
ContactsManager.getInstance().enableContactsAccess();
}
ContactsManager.getInstance().fetchContactsAsync();
ContactsManager.getInstance().enableContactsAccess();
if (!fetchedContactsOnce) {
ContactsManager.getInstance().enableContactsAccess();
ContactsManager.getInstance().fetchContactsAsync();
fetchedContactsOnce = true;
}
if (permissions[0].compareTo(Manifest.permission.READ_EXTERNAL_STORAGE) != 0)
break;
boolean enableRingtone = (grantResults[0] == PackageManager.PERMISSION_GRANTED);