mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-18 03:48:08 +00:00
Using SDK 4.5.2 feature to vibrate during an incoming call
This commit is contained in:
parent
0a18b28417
commit
3dd1605ea6
7 changed files with 17 additions and 35 deletions
|
|
@ -10,7 +10,7 @@ static def firebaseEnabled() {
|
|||
}
|
||||
|
||||
task getGitVersion() {
|
||||
def gitVersion = "4.4.1"
|
||||
def gitVersion = "4.4.2"
|
||||
def gitVersionStream = new ByteArrayOutputStream()
|
||||
def gitCommitsCount = new ByteArrayOutputStream()
|
||||
def gitCommitHash = new ByteArrayOutputStream()
|
||||
|
|
@ -100,7 +100,7 @@ android {
|
|||
defaultConfig {
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
versionCode 4401
|
||||
versionCode 4402
|
||||
versionName "${project.version}"
|
||||
applicationId getPackageName()
|
||||
multiDexEnabled true
|
||||
|
|
|
|||
|
|
@ -215,6 +215,12 @@
|
|||
android:name=".service.LinphoneService"
|
||||
android:label="@string/service_name" />
|
||||
|
||||
<service
|
||||
android:name="org.linphone.core.tools.service.CoreService"
|
||||
android:foregroundServiceType="phoneCall"
|
||||
android:stopWithTask="false"
|
||||
android:label="@string/app_name" />
|
||||
|
||||
<service
|
||||
android:name=".sync.SyncService"
|
||||
android:exported="true">
|
||||
|
|
|
|||
|
|
@ -371,6 +371,12 @@ public class LinphoneManager implements SensorEventListener {
|
|||
|
||||
mCore.migrateLogsFromRcToDb();
|
||||
|
||||
// Migration code
|
||||
if (mCore.getConfig().getBool("app", "incoming_call_vibration", true)) {
|
||||
mCore.setVibrationOnIncomingCallEnabled(true);
|
||||
mCore.getConfig().setBool("app", "incoming_call_vibration", false);
|
||||
}
|
||||
|
||||
// Migrate existing linphone accounts to have conference factory uri and LIME X3Dh url set
|
||||
String uri = getString(R.string.default_conference_factory_uri);
|
||||
for (ProxyConfig lpc : mCore.getProxyConfigList()) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import android.app.PendingIntent;
|
|||
import android.content.ContentProviderClient;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Vibrator;
|
||||
import android.view.WindowManager;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import org.linphone.R;
|
||||
|
|
@ -243,9 +242,4 @@ class ApiTwentyOnePlus {
|
|||
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
|
||||
}
|
||||
}
|
||||
|
||||
public static void vibrate(Vibrator vibrator) {
|
||||
long[] pattern = {0, 1000, 1000};
|
||||
vibrator.vibrate(pattern, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,10 +33,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.AudioAttributes;
|
||||
import android.os.Build;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
import android.provider.Settings;
|
||||
import android.widget.RemoteViews;
|
||||
import org.linphone.R;
|
||||
|
|
@ -334,15 +331,4 @@ class ApiTwentySixPlus {
|
|||
activity.enterPictureInPictureMode();
|
||||
}
|
||||
}
|
||||
|
||||
public static void vibrate(Vibrator vibrator) {
|
||||
long[] timings = {0, 1000, 1000};
|
||||
int[] amplitudes = {0, VibrationEffect.DEFAULT_AMPLITUDE, 0};
|
||||
VibrationEffect effect = VibrationEffect.createWaveform(timings, amplitudes, 1);
|
||||
AudioAttributes audioAttrs =
|
||||
new AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE)
|
||||
.build();
|
||||
vibrator.vibrate(effect, audioAttrs);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.os.Vibrator;
|
||||
import android.provider.Settings;
|
||||
import android.service.notification.StatusBarNotification;
|
||||
import org.linphone.core.Address;
|
||||
|
|
@ -327,12 +326,4 @@ public class Compatibility {
|
|||
|
||||
return new StatusBarNotification[0];
|
||||
}
|
||||
|
||||
public static void vibrate(Vibrator vibrator) {
|
||||
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
|
||||
ApiTwentySixPlus.vibrate(vibrator);
|
||||
} else {
|
||||
ApiTwentyOnePlus.vibrate(vibrator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1152,13 +1152,12 @@ public class LinphonePreferences {
|
|||
}
|
||||
|
||||
public boolean isIncomingCallVibrationEnabled() {
|
||||
if (getConfig() == null) return true;
|
||||
return getConfig().getBool("app", "incoming_call_vibration", true);
|
||||
if (getLc() == null) return false;
|
||||
return getLc().isVibrationOnIncomingCallEnabled();
|
||||
}
|
||||
|
||||
public void enableIncomingCallVibration(boolean enable) {
|
||||
if (getConfig() == null) return;
|
||||
getConfig().setBool("app", "incoming_call_vibration", enable);
|
||||
getLc().setVibrationOnIncomingCallEnabled(enable);
|
||||
}
|
||||
|
||||
public boolean isBisFeatureEnabled() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue