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"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.linphone" 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"/> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23"/>
<!-- Permissions for Push Notification --> <!-- Permissions for Push Notification -->
<permission android:name="org.linphone.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <!-- Change package ! --> <permission android:name="org.linphone.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <!-- Change package ! -->
<uses-permission android:name="org.linphone.permission.C2D_MESSAGE" /> <!-- 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.PROCESS_OUTGOING_CALLS"/>
<uses-permission android:name="android.permission.CALL_PHONE"/> <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 --> <!-- 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.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
@ -48,8 +48,8 @@
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <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"/> <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" <activity android:name="org.linphone.LinphoneLauncherActivity"
android:label="@string/app_name" android:label="@string/app_name"
@ -60,7 +60,7 @@
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.CALL" /> <action android:name="android.intent.action.CALL" />
<action android:name="android.intent.action.CALL_PRIVILEGED" /> <action android:name="android.intent.action.CALL_PRIVILEGED" />
@ -76,7 +76,7 @@
<data android:scheme="imto" /> <data android:scheme="imto" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<data android:mimeType="@string/sync_mimetype" /> <!-- Change package in res/values/non_localizable_custom.xml ! --> <data android:mimeType="@string/sync_mimetype" /> <!-- Change package in res/values/non_localizable_custom.xml ! -->
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
@ -119,10 +119,10 @@
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
<!--<intent-filter> <!--<intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<data android:mimeType="audio/*" /> <data android:mimeType="audio/*" />
<data android:mimeType="video/*" /> <data android:mimeType="video/*" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter>--> </intent-filter>-->
@ -135,7 +135,7 @@
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="org.linphone.purchase.InAppPurchaseActivity" <activity android:name="org.linphone.purchase.InAppPurchaseActivity"
android:theme="@style/NoTitle" android:theme="@style/NoTitle"
android:screenOrientation="nosensor"> android:screenOrientation="nosensor">
@ -143,7 +143,7 @@
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="org.linphone.assistant.RemoteProvisioningLoginActivity" <activity android:name="org.linphone.assistant.RemoteProvisioningLoginActivity"
android:theme="@style/NoTitle" android:theme="@style/NoTitle"
android:screenOrientation="nosensor"> android:screenOrientation="nosensor">
@ -151,14 +151,14 @@
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="org.linphone.assistant.RemoteProvisioningActivity" <activity android:name="org.linphone.assistant.RemoteProvisioningActivity"
android:theme="@style/NoTitle" android:theme="@style/NoTitle"
android:screenOrientation="nosensor"> android:screenOrientation="nosensor">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<data android:scheme="linphone-config" /> <!-- Change if needed --> <data android:scheme="linphone-config" /> <!-- Change if needed -->
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
@ -194,22 +194,22 @@
<receiver android:name="org.linphone.NetworkManager"> <receiver android:name="org.linphone.NetworkManager">
<intent-filter><action android:name="android.net.conn.CONNECTIVITY_CHANGE"></action></intent-filter> <intent-filter><action android:name="android.net.conn.CONNECTIVITY_CHANGE"></action></intent-filter>
</receiver> </receiver>
<receiver android:name="org.linphone.BluetoothManager" android:enabled="false"> <receiver android:name="org.linphone.BluetoothManager" android:enabled="false">
</receiver> </receiver>
<receiver android:name="org.linphone.BootReceiver"> <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.BOOT_COMPLETED"></action></intent-filter>
<intent-filter><action android:name="android.intent.action.ACTION_SHUTDOWN"></action></intent-filter> <intent-filter><action android:name="android.intent.action.ACTION_SHUTDOWN"></action></intent-filter>
</receiver> </receiver>
<receiver android:name="org.linphone.PhoneStateChangedReceiver"> <receiver android:name="org.linphone.PhoneStateChangedReceiver">
<intent-filter><action android:name="android.intent.action.PHONE_STATE" /></intent-filter> <intent-filter><action android:name="android.intent.action.PHONE_STATE" /></intent-filter>
</receiver> </receiver>
<!-- This one needs to be registered from application --> <!-- This one needs to be registered from application -->
<receiver android:name="KeepAliveReceiver"/> <receiver android:name="KeepAliveReceiver"/>
<!-- Needed for push notification --> <!-- Needed for push notification -->
<receiver android:name="org.linphone.gcm.GCMReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <receiver android:name="org.linphone.gcm.GCMReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter> <intent-filter>
@ -218,7 +218,7 @@
<category android:name="org.linphone" /> <!-- Change package ! --> <category android:name="org.linphone" /> <!-- Change package ! -->
</intent-filter> </intent-filter>
</receiver> </receiver>
<service android:name="org.linphone.gcm.GCMService" /> <service android:name="org.linphone.gcm.GCMService" />
<activity android:name="org.linphone.tutorials.TutorialLauncherActivity" <activity android:name="org.linphone.tutorials.TutorialLauncherActivity"
@ -227,28 +227,28 @@
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="org.linphone.tutorials.TutorialBuddyStatusActivity" <activity android:name="org.linphone.tutorials.TutorialBuddyStatusActivity"
android:theme="@style/NoTitle"> android:theme="@style/NoTitle">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="org.linphone.tutorials.TutorialChatRoomActivity" <activity android:name="org.linphone.tutorials.TutorialChatRoomActivity"
android:theme="@style/NoTitle"> android:theme="@style/NoTitle">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="org.linphone.tutorials.TutorialHelloWorldActivity" <activity android:name="org.linphone.tutorials.TutorialHelloWorldActivity"
android:theme="@style/NoTitle"> android:theme="@style/NoTitle">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="org.linphone.tutorials.TutorialRegistrationActivity" <activity android:name="org.linphone.tutorials.TutorialRegistrationActivity"
android:theme="@style/NoTitle"> android:theme="@style/NoTitle">
<intent-filter> <intent-filter>
@ -262,7 +262,7 @@
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>
</application> </application>
</manifest> </manifest>

View file

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

View file

@ -1250,14 +1250,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
ContactsManager.getInstance().initializeContactManager(getApplicationContext(), getContentResolver()); ContactsManager.getInstance().initializeContactManager(getApplicationContext(), getContentResolver());
} }
break; 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: case PERMISSIONS_RECORD_AUDIO_ECHO_CANCELLER:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
((SettingsFragment) fragment).startEchoCancellerCalibration(); ((SettingsFragment) fragment).startEchoCancellerCalibration();
@ -1266,6 +1258,16 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} }
break; break;
case PERMISSIONS_READ_EXTERNAL_STORAGE_DEVICE_RINGTONE: 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) if (permissions[0].compareTo(Manifest.permission.READ_EXTERNAL_STORAGE) != 0)
break; break;
boolean enableRingtone = (grantResults[0] == PackageManager.PERMISSION_GRANTED); boolean enableRingtone = (grantResults[0] == PackageManager.PERMISSION_GRANTED);