* Avoid description repetition screenshots

* dexOptions is no longer used in agp7
* stop agp7 complaining about missing proguard rules
* PIP aspect ratio should match video aspect ratio
* Revert "Always show Quote as last action"
* use androidx ExifInterface to parse rotation
* default "auto accept files" to Never for wifi and mobile data connection
This commit is contained in:
Arne 2021-09-19 04:14:57 +02:00
parent bad9155ced
commit b9578c21be
17 changed files with 171 additions and 41 deletions

View file

@ -3,10 +3,10 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.android.tools.build:gradle:7.0.2'
}
}
@ -33,11 +33,11 @@ repositories {
configurations {
playstoreImplementation
gitImplementation
compile.exclude group: 'org.jetbrains' , module:'annotations'
implementation.exclude group: 'org.jetbrains' , module:'annotations'
}
dependencies {
implementation 'org.webrtc:google-webrtc:1.0.32006'
implementation 'org.webrtc:google-webrtc:1.+'
implementation project(':libs:android-transcoder')
playstoreImplementation('com.google.firebase:firebase-messaging:22.0.0') { ///higher versions are causing crashes due to missing project IDs
exclude group: 'com.google.firebase', module: 'firebase-core'
@ -63,7 +63,7 @@ dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.exifinterface:exifinterface:1.3.2'
implementation 'androidx.exifinterface:exifinterface:1.3.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.emoji:emoji:1.1.0'
gitImplementation 'androidx.emoji:emoji-appcompat:1.1.0'
@ -112,8 +112,8 @@ android {
targetSdkVersion 29
//bversionNameSuffix " beta_(2021-06-28)" // " beta_(XXXX-XX-XX)" // activate for beta versions
versionCode 104
versionName "1.3.1"
versionCode 105
versionName "1.3.2"
//resConfigs "en"
archivesBaseName += "-$versionName"
@ -145,13 +145,6 @@ android {
//exclude "lib/armeabi/**"
}
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild
javaMaxHeapSize "4g"
jumboMode true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View file

@ -0,0 +1,8 @@
* Vermeiden von Wiederholung in der Beschreibung zu Screenshots
* dexOptionen wird nicht mehr in agp7 verwendet
* stoppe agp7 Beschwerde über fehlende Proguard-Regeln
* PIP-Aspektverhältnis soll mit Video-Aspektverhältnis übereinstimmen
* Kehre "Always show Quote as last action" um
* Verwende androidx ExifInterface zur Parse Rotation
* standardmäßig "auto akzeptieren von Dateien" zu "Niemals" für Wi-Fi und mobile Datenverbindung

View file

@ -0,0 +1,7 @@
* Avoid description repetition screenshots
* dexOptions is no longer used in agp7
* stop agp7 complaining about missing proguard rules
* PIP aspect ratio should match video aspect ratio
* Revert "Always show Quote as last action"
* use androidx ExifInterface to parse rotation
* default "auto accept files" to Never for wifi and mobile data connection

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -1,5 +1,6 @@
#Sun Sep 19 02:58:45 CEST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

10
proguard-rules.pro vendored
View file

@ -29,6 +29,16 @@
-dontwarn java.lang.**
-dontwarn javax.lang.**
-dontwarn com.android.org.conscrypt.SSLParametersImpl
-dontwarn org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
-dontwarn org.bouncycastle.jsse.BCSSLParameters
-dontwarn org.bouncycastle.jsse.BCSSLSocket
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE
-keepclassmembers class eu.siacs.conversations.http.services.** {
!transient <fields>;
}

View file

@ -5,6 +5,8 @@ import android.database.Cursor;
import android.os.SystemClock;
import android.util.Log;
import com.google.common.base.Strings;
import org.json.JSONException;
import org.json.JSONObject;
@ -248,7 +250,7 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
}
public String getHostname() {
return this.hostname == null ? "" : this.hostname;
return Strings.nullToEmpty(this.hostname);
}
public void setHostname(String hostname) {

View file

@ -35,6 +35,8 @@ import android.util.DisplayMetrics;
import android.util.Log;
import android.util.LruCache;
import androidx.exifinterface.media.ExifInterface;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.StringRes;
@ -76,7 +78,6 @@ import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.util.Attachment;
import eu.siacs.conversations.utils.Compatibility;
import eu.siacs.conversations.utils.CryptoHelper;
import eu.siacs.conversations.utils.ExifHelper;
import eu.siacs.conversations.utils.FileUtils;
import eu.siacs.conversations.utils.FileWriterException;
import eu.siacs.conversations.utils.MimeUtils;
@ -805,19 +806,34 @@ public class FileBackend {
}
}
private int getRotation(File file) {
return getRotation(Uri.parse("file://" + file.getAbsolutePath()));
private int getRotation(final File file) {
try (final InputStream inputStream = new FileInputStream(file)) {
return getRotation(inputStream);
} catch (Exception e) {
return 0;
}
}
private int getRotation(Uri image) {
InputStream is = null;
try {
is = mXmppConnectionService.getContentResolver().openInputStream(image);
return ExifHelper.getOrientation(is);
} catch (FileNotFoundException e) {
private int getRotation(final Uri image) {
try (final InputStream is = mXmppConnectionService.getContentResolver().openInputStream(image)) {
return is == null ? 0 : getRotation(is);
} catch (final Exception e) {
return 0;
} finally {
close(is);
}
}
private static int getRotation(final InputStream inputStream) throws IOException {
final ExifInterface exif = new ExifInterface(inputStream);
final int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_180:
return 180;
case ExifInterface.ORIENTATION_ROTATE_90:
return 90;
case ExifInterface.ORIENTATION_ROTATE_270:
return 270;
default:
return 0;
}
}
@ -1773,7 +1789,8 @@ public class FileBackend {
this.resId = resId;
}
public @StringRes int getResId() {
public @StringRes
int getResId() {
return resId;
}
}

View file

@ -1,5 +1,9 @@
package eu.siacs.conversations.ui;
import static java.util.Arrays.asList;
import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied;
import eu.siacs.conversations.ui.util.Rationals;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.PictureInPictureParams;
@ -63,10 +67,8 @@ import eu.siacs.conversations.xmpp.jingle.Media;
import eu.siacs.conversations.xmpp.jingle.RtpEndUserState;
import me.drakeet.support.toast.ToastCompat;
import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied;
import static java.util.Arrays.asList;
public class RtpSessionActivity extends XmppActivity implements XmppConnectionService.OnJingleRtpConnectionUpdate {
public class RtpSessionActivity extends XmppActivity implements XmppConnectionService.OnJingleRtpConnectionUpdate, eu.siacs.conversations.ui.widget.SurfaceViewRenderer.OnAspectRatioChanged {
public static final String EXTRA_WITH = "with";
public static final String EXTRA_SESSION_ID = "session_id";
@ -446,12 +448,14 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
public void onStart() {
super.onStart();
mHandler.postDelayed(mTickExecutor, CALL_DURATION_UPDATE_INTERVAL);
this.binding.remoteVideo.setOnAspectRatioChanged(this);
}
@Override
public void onStop() {
mHandler.removeCallbacks(mTickExecutor);
binding.remoteVideo.release();
binding.remoteVideo.setOnAspectRatioChanged(null);
binding.localVideo.release();
final WeakReference<JingleRtpConnection> weakReference = this.rtpConnectionReference;
final JingleRtpConnection jingleRtpConnection = weakReference == null ? null : weakReference.get();
@ -516,9 +520,12 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
@RequiresApi(api = Build.VERSION_CODES.O)
private void startPictureInPicture() {
try {
final Rational rational = this.binding.remoteVideo.getAspectRatio();
final Rational clippedRational = Rationals.clip(rational);
Log.d(Config.LOGTAG, "suggested rational " + rational + ". clipped to " + clippedRational);
enterPictureInPictureMode(
new PictureInPictureParams.Builder()
.setAspectRatio(new Rational(10, 16))
.setAspectRatio(clippedRational)
.build()
);
} catch (final IllegalStateException e) {
@ -526,6 +533,16 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
Log.w(Config.LOGTAG, "unable to enter picture in picture mode", e);
}
}
@Override
public void onAspectRatioChanged(final Rational rational) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && isPictureInPicture()) {
final Rational clippedRational = Rationals.clip(rational);
Log.d(Config.LOGTAG, "suggested rational after aspect ratio change " + rational + ". clipped to " + clippedRational);
setPictureInPictureParams(new PictureInPictureParams.Builder()
.setAspectRatio(clippedRational)
.build());
}
}
private boolean deviceSupportsPictureInPicture() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {

View file

@ -0,0 +1,26 @@
package eu.siacs.conversations.ui.util;
import android.util.Rational;
public final class Rationals {
//between 2.39:1 and 1:2.39 (inclusive).
private static final Rational MIN = new Rational(100,239);
private static final Rational MAX = new Rational(239,100);
private Rationals() {
}
public static Rational clip(final Rational input) {
if (input.compareTo(MIN) < 0) {
return MIN;
}
if (input.compareTo(MAX) > 0) {
return MAX;
}
return input;
}
}

View file

@ -0,0 +1,48 @@
package eu.siacs.conversations.ui.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Rational;
import eu.siacs.conversations.Config;
public class SurfaceViewRenderer extends org.webrtc.SurfaceViewRenderer {
private Rational aspectRatio = new Rational(1,1);
private OnAspectRatioChanged onAspectRatioChanged;
public SurfaceViewRenderer(Context context) {
super(context);
}
public SurfaceViewRenderer(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void onFrameResolutionChanged(int videoWidth, int videoHeight, int rotation) {
super.onFrameResolutionChanged(videoWidth, videoHeight, rotation);
final int rotatedWidth = rotation != 0 && rotation != 180 ? videoHeight : videoWidth;
final int rotatedHeight = rotation != 0 && rotation != 180 ? videoWidth : videoHeight;
final Rational currentRational = this.aspectRatio;
this.aspectRatio = new Rational(rotatedWidth, rotatedHeight);
Log.d(Config.LOGTAG,"onFrameResolutionChanged("+rotatedWidth+","+rotatedHeight+","+aspectRatio+")");
if (currentRational.equals(this.aspectRatio) || onAspectRatioChanged == null) {
return;
}
onAspectRatioChanged.onAspectRatioChanged(this.aspectRatio);
}
public void setOnAspectRatioChanged(final OnAspectRatioChanged onAspectRatioChanged) {
this.onAspectRatioChanged = onAspectRatioChanged;
}
public Rational getAspectRatio() {
return this.aspectRatio;
}
public interface OnAspectRatioChanged {
void onAspectRatioChanged(final Rational rational);
}
}

View file

@ -98,7 +98,7 @@
</RelativeLayout>
<org.webrtc.SurfaceViewRenderer
<eu.siacs.conversations.ui.widget.SurfaceViewRenderer
android:id="@+id/local_video"
android:layout_width="@dimen/local_video_preview_width"
android:layout_height="@dimen/local_video_preview_height"
@ -111,7 +111,7 @@
android:visibility="gone"
app:elevation="4dp" />
<org.webrtc.SurfaceViewRenderer
<eu.siacs.conversations.ui.widget.SurfaceViewRenderer
android:id="@+id/remote_video"
android:layout_width="match_parent"
android:layout_height="match_parent"

View file

@ -17,6 +17,10 @@
android:id="@+id/copy_link"
android:title="@string/copy_link"
android:visible="false" />
<item
android:id="@+id/quote_message"
android:title="@string/quote"
android:visible="false" />
<item
android:id="@+id/retry_decryption"
android:title="@string/retry_decryption"
@ -25,10 +29,6 @@
android:id="@+id/correct_message"
android:title="@string/correct_message"
android:visible="false" />
<item
android:id="@+id/quote_message"
android:title="@string/quote"
android:visible="false" />
<item
android:id="@+id/delete_message"
android:title="@string/delete_message"

View file

@ -60,8 +60,8 @@
<bool name="use_internal_updater">true</bool>
<bool name="show_own_accounts">true</bool>
<bool name="vibrate_in_chat">true</bool>
<integer name="auto_accept_filesize_wifi">10485760</integer>
<integer name="auto_accept_filesize_mobile">524288</integer>
<integer name="auto_accept_filesize_wifi">0</integer>
<integer name="auto_accept_filesize_mobile">0</integer>
<integer name="auto_accept_filesize_roaming">0</integer>
<integer name="automatic_message_deletion">0</integer>
<integer name="automatic_attachment_deletion">0</integer>

View file

@ -1144,6 +1144,7 @@
<string name="error_security_exception">The app you used to share this file did not provide enough permissions.</string>
<string name="unable_to_enable_video">Unable to enable video.</string>
<string name="delete_recording_dialog_message">Do you really want to cancel and delete your recording?</string>
<string name="pref_prevent_screenshots_summary">Hide app contents in the app switcher and block screenshots</string>
<string name="pref_pause_voice_on_move_from_ear">Pause voice message automatically</string>
<string name="pref_pause_voice_on_move_from_ear_summary">Pause the current voice message when you move your device away from your ear.</string>
<string name="plain_text_document">Plain text document</string>