update to 9.4.9

This commit is contained in:
xaxtix 2023-02-28 23:33:54 +04:00
parent 8bb3438f62
commit 1ac56c671e
16 changed files with 108 additions and 101 deletions

View file

@ -719,6 +719,7 @@ JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_makeNati
},
.platformContext = platformContext,
};
descriptor.version = v;
for (int i = 0, size = env->GetArrayLength(endpoints); i < size; i++) {
JavaObject endpointObject(env, env->GetObjectArrayElement(endpoints, i));

View file

@ -1893,9 +1893,6 @@ public class AndroidUtilities {
result = new ArrayList<>();
}
File file = new File(path.substring(0, idx));
if (!file.canWrite()) {
continue;
}
for (int i = 0; i < result.size(); i++) {
if (result.get(i).getPath().equals(file.getPath())) {
continue;
@ -1930,7 +1927,7 @@ public class AndroidUtilities {
file = dirs[0];
if (!TextUtils.isEmpty(SharedConfig.storageCacheDir)) {
for (int a = 0; a < dirs.length; a++) {
if (dirs[a] != null && dirs[a].getAbsolutePath().startsWith(SharedConfig.storageCacheDir) && dirs[a].canWrite()) {
if (dirs[a] != null && dirs[a].getAbsolutePath().startsWith(SharedConfig.storageCacheDir)) {
file = dirs[a];
break;
}

View file

@ -24,8 +24,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
public static int BUILD_VERSION = 3161;
public static String BUILD_VERSION_STRING = "9.4.8";
public static int BUILD_VERSION = 3164;
public static String BUILD_VERSION_STRING = "9.4.9";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -2216,7 +2216,7 @@ public class ImageLoader {
if (dirs != null) {
for (int a = 0, N = dirs.size(); a < N; a++) {
File dir = dirs.get(a);
if (dir.getAbsolutePath().startsWith(SharedConfig.storageCacheDir) && dir.canWrite()) {
if (dir.getAbsolutePath().startsWith(SharedConfig.storageCacheDir)) {
path = dir;
break;
}
@ -2250,7 +2250,7 @@ public class ImageLoader {
ArrayList<File> dirs = AndroidUtilities.getDataDirs();
for (int a = 0, N = dirs.size(); a < N; a++) {
File dir = dirs.get(a);
if (dir != null && !TextUtils.isEmpty(SharedConfig.storageCacheDir) && dir.getAbsolutePath().startsWith(SharedConfig.storageCacheDir) && dir.canWrite()) {
if (dir != null && !TextUtils.isEmpty(SharedConfig.storageCacheDir) && dir.getAbsolutePath().startsWith(SharedConfig.storageCacheDir)) {
path = dir;
telegramPath = new File(path, "Telegram");
telegramPath.mkdirs();

View file

@ -40,7 +40,7 @@ public class LanguageDetector {
if (onFail != null) {
onFail.run(e);
}
FileLog.e(e);
FileLog.e(e, false);
}
} catch (Exception e) {
if (onFail != null) {
@ -51,7 +51,7 @@ public class LanguageDetector {
if (onFail != null) {
onFail.run(null);
}
FileLog.e(t);
FileLog.e(t, false);
}
}
}

View file

@ -2001,6 +2001,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
public boolean seekToProgress(MessageObject messageObject, float progress) {
final MessageObject playingMessageObject = this.playingMessageObject;
if (audioPlayer == null && videoPlayer == null || messageObject == null || playingMessageObject == null || !isSamePlayingMessage(messageObject)) {
return false;
}

View file

@ -8385,7 +8385,10 @@ public class MessagesStorage extends BaseController {
public void getMessages(long dialogId, long mergeDialogId, boolean loadInfo, int count, int max_id, int offset_date, int minDate, int classGuid, int load_type, boolean scheduled, int replyMessageId, int loadIndex, boolean processMessages, boolean isTopic) {
storageQueue.postRunnable(() -> {
getMessagesInternal(dialogId, mergeDialogId, count, max_id, offset_date, minDate, classGuid, load_type, scheduled, replyMessageId, loadIndex, processMessages, isTopic).run();
Runnable processMessagesRunnable = getMessagesInternal(dialogId, mergeDialogId, count, max_id, offset_date, minDate, classGuid, load_type, scheduled, replyMessageId, loadIndex, processMessages, isTopic);
Utilities.stageQueue.postRunnable(() -> {
processMessagesRunnable.run();
});
});
}

View file

@ -3791,7 +3791,7 @@ public class NotificationsController extends BaseController {
}
}
intent.putExtra("currentAccount", currentAccount);
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_ONE_SHOT);
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_ONE_SHOT);
mBuilder.setContentTitle(name)
.setSmallIcon(R.drawable.notification)
@ -3812,10 +3812,14 @@ public class NotificationsController extends BaseController {
mBuilder.addPerson("tel:+" + user.phone);
}
Intent dismissIntent = new Intent(ApplicationLoader.applicationContext, NotificationDismissReceiver.class);
dismissIntent.putExtra("messageDate", lastMessageObject.messageOwner.date);
dismissIntent.putExtra("currentAccount", currentAccount);
mBuilder.setDeleteIntent(PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 1, dismissIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
try {
Intent dismissIntent = new Intent(ApplicationLoader.applicationContext, NotificationDismissReceiver.class);
dismissIntent.putExtra("messageDate", lastMessageObject.messageOwner.date);
dismissIntent.putExtra("currentAccount", currentAccount);
mBuilder.setDeleteIntent(PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 1, dismissIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
} catch (Throwable e) {
FileLog.e(e);
}
if (photoPath != null) {
BitmapDrawable img = ImageLoader.getInstance().getImageFromMemory(photoPath, null, "50_50");
@ -3959,10 +3963,7 @@ public class NotificationsController extends BaseController {
showExtraNotifications(mBuilder, detailText, dialog_id, topicId, chatName, vibrationPattern, ledColor, sound, configImportance, isDefault, isInApp, notifyDisabled, chatType);
scheduleNotificationRepeat();
} catch (Exception e) {
// ignore xiaomi issues
// Remote stack trace
// To many PendingIntent's
FileLog.e(e, !(e instanceof SecurityException));
FileLog.e(e);
}
}
@ -4544,7 +4545,7 @@ public class NotificationsController extends BaseController {
intent.putExtra("topicId", topicId);
}
intent.putExtra("currentAccount", currentAccount);
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_ONE_SHOT);
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender();
if (wearReplyAction != null) {
@ -4601,11 +4602,15 @@ public class NotificationsController extends BaseController {
.setSortKey(String.valueOf(Long.MAX_VALUE - date))
.setCategory(NotificationCompat.CATEGORY_MESSAGE);
Intent dismissIntent = new Intent(ApplicationLoader.applicationContext, NotificationDismissReceiver.class);
dismissIntent.putExtra("messageDate", maxDate);
dismissIntent.putExtra("dialogId", dialogId);
dismissIntent.putExtra("currentAccount", currentAccount);
builder.setDeleteIntent(PendingIntent.getBroadcast(ApplicationLoader.applicationContext, internalId, dismissIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
try {
Intent dismissIntent = new Intent(ApplicationLoader.applicationContext, NotificationDismissReceiver.class);
dismissIntent.putExtra("messageDate", maxDate);
dismissIntent.putExtra("dialogId", dialogId);
dismissIntent.putExtra("currentAccount", currentAccount);
builder.setDeleteIntent(PendingIntent.getBroadcast(ApplicationLoader.applicationContext, internalId, dismissIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
} catch (Exception e) {
FileLog.e(e);
}
if (useSummaryNotification) {
builder.setGroup(notificationGroup);

View file

@ -1501,4 +1501,8 @@ public class SharedConfig {
public static boolean deviceIsHigh() {
return getDevicePerformanceClass() >= PERFORMANCE_CLASS_HIGH;
}
public static boolean deviceIsAverage() {
return getDevicePerformanceClass() <= PERFORMANCE_CLASS_AVERAGE;
}
}

View file

@ -14,6 +14,7 @@ import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.VideoEditedInfo;
@ -994,8 +995,12 @@ public class MediaCodecVideoConvertor {
final int dstHeight, boolean external) {
final float kernelSize = Utilities.clamp((float) (Math.max(srcWidth, srcHeight) / (float) Math.max(dstHeight, dstWidth)) * 0.8f, 2f, 1f);
final int kernelRadius = (int) kernelSize;
int kernelRadius = (int) kernelSize;
if (kernelRadius > 1 && SharedConfig.deviceIsAverage()) {
kernelRadius = 1;
}
FileLog.d("source size " + srcWidth + "x" + srcHeight + " dest size " + dstWidth + dstHeight + " kernelRadius " + kernelRadius);
if (external) {
return "#extension GL_OES_EGL_image_external : require\n" +
"precision mediump float;\n" +

View file

@ -7046,7 +7046,7 @@ public class Theme {
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putString("theme", themeInfo.getKey());
editor.apply();
editor.commit();
}
String[] wallpaperLink = new String[1];
if (themeInfo.assetName != null) {
@ -7131,7 +7131,7 @@ public class Theme {
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.remove("theme");
editor.apply();
editor.commit();
}
currentColorsNoAccent.clear();
themedWallpaperFileOffset = 0;

View file

@ -365,7 +365,7 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
if (!TextUtils.isEmpty(SharedConfig.storageCacheDir)) {
for (int a = 0, N = storageDirs.size(); a < N; a++) {
File file = storageDirs.get(a);
if (file.getAbsolutePath().startsWith(SharedConfig.storageCacheDir) && file.canWrite()) {
if (file.getAbsolutePath().startsWith(SharedConfig.storageCacheDir)) {
path = file;
break;
}

View file

@ -24,24 +24,19 @@ import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.analytics.AnalyticsListener;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.audio.AudioCapabilities;
import com.google.android.exoplayer2.audio.AudioProcessor;
import com.google.android.exoplayer2.audio.AudioRendererEventListener;
import com.google.android.exoplayer2.audio.AudioSink;
import com.google.android.exoplayer2.audio.DefaultAudioSink;
import com.google.android.exoplayer2.audio.TeeAudioProcessor;
import com.google.android.exoplayer2.mediacodec.MediaCodecRenderer;
import com.google.android.exoplayer2.mediacodec.MediaCodecSelector;
import com.google.android.exoplayer2.source.LoopingMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
@ -52,7 +47,6 @@ import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.MappingTrackSelector;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultAllocator;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.video.SurfaceNotValidException;
import com.google.android.exoplayer2.video.VideoListener;
import com.google.android.exoplayer2.video.VideoSize;
@ -64,7 +58,6 @@ import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.secretmedia.ExtendedDefaultDataSourceFactory;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@SuppressLint("NewApi")
public class VideoPlayer implements Player.Listener, VideoListener, AnalyticsListener, NotificationCenter.NotificationCenterDelegate {
@ -499,7 +492,7 @@ public class VideoPlayer implements Player.Listener, VideoListener, AnalyticsLis
return player != null && lastReportedPlaybackState == ExoPlayer.STATE_BUFFERING;
}
public void setStreamType(int type) {
public void setStreamType(int type) {
if (player != null) {
player.setAudioAttributes(new AudioAttributes.Builder()
.setUsage(type == AudioManager.STREAM_VOICE_CALL ? C.USAGE_VOICE_COMMUNICATION : C.USAGE_MEDIA)

View file

@ -206,66 +206,64 @@ public class DefaultThemesPreviewCell extends LinearLayout {
pos[0] += dayNightCell.getImageView().getMeasuredWidth() / 2;
pos[1] += dayNightCell.getImageView().getMeasuredHeight() / 2 + AndroidUtilities.dp(3);
Runnable then = () -> AndroidUtilities.runOnUIThread(() -> {
updateDayNightMode();
updateSelectedPosition();
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, themeInfo, false, pos, -1, toDark, dayNightCell.getImageView(), dayNightCell);
updateDayNightMode();
updateSelectedPosition();
int iconNewColor = Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4);
darkThemeDrawable.setColorFilter(new PorterDuffColorFilter(iconNewColor, PorterDuff.Mode.SRC_IN));
ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1f);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
int iconColor = ColorUtils.blendARGB(iconOldColor, iconNewColor, (float) valueAnimator.getAnimatedValue());
darkThemeDrawable.setColorFilter(new PorterDuffColorFilter(iconColor, PorterDuff.Mode.SRC_IN));
}
});
valueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
darkThemeDrawable.setColorFilter(new PorterDuffColorFilter(iconNewColor, PorterDuff.Mode.SRC_IN));
super.onAnimationEnd(animation);
}
});
valueAnimator.setDuration(350);
valueAnimator.start();
int navBarNewColor = Theme.getColor(Theme.key_windowBackgroundGray);
final Window window = context instanceof Activity ? ((Activity) context).getWindow() : null;
if (window != null) {
if (navBarAnimator != null && navBarAnimator.isRunning()) {
navBarAnimator.cancel();
}
final int navBarFromColor = navBarAnimator != null && navBarAnimator.isRunning() ? navBarColor : navBarOldColor;
navBarAnimator = ValueAnimator.ofFloat(0, 1);
final float startDelay = toDark ? 50 : 200, duration = 150, fullDuration = 350;
navBarAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float t = Math.max(0, Math.min(1, ((float) valueAnimator.getAnimatedValue() * fullDuration - startDelay) / duration));
navBarColor = ColorUtils.blendARGB(navBarFromColor, navBarNewColor, t);
AndroidUtilities.setNavigationBarColor(window, navBarColor, false);
AndroidUtilities.setLightNavigationBar(window, AndroidUtilities.computePerceivedBrightness(navBarColor) >= 0.721f);
}
});
navBarAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
AndroidUtilities.setNavigationBarColor(window, navBarNewColor, false);
AndroidUtilities.setLightNavigationBar(window, AndroidUtilities.computePerceivedBrightness(navBarNewColor) >= 0.721f);
}
});
navBarAnimator.setDuration((long) fullDuration);
navBarAnimator.start();
}
if (Theme.isCurrentThemeDay()) {
dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToNightMode", R.string.SettingsSwitchToNightMode), darkThemeDrawable, true);
} else {
dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToDayMode", R.string.SettingsSwitchToDayMode), darkThemeDrawable, true);
int iconNewColor = Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4);
darkThemeDrawable.setColorFilter(new PorterDuffColorFilter(iconNewColor, PorterDuff.Mode.SRC_IN));
ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1f);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
int iconColor = ColorUtils.blendARGB(iconOldColor, iconNewColor, (float) valueAnimator.getAnimatedValue());
darkThemeDrawable.setColorFilter(new PorterDuffColorFilter(iconColor, PorterDuff.Mode.SRC_IN));
}
});
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, themeInfo, false, pos, -1, toDark, dayNightCell.getImageView(), dayNightCell, then);
valueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
darkThemeDrawable.setColorFilter(new PorterDuffColorFilter(iconNewColor, PorterDuff.Mode.SRC_IN));
super.onAnimationEnd(animation);
}
});
valueAnimator.setDuration(350);
valueAnimator.start();
int navBarNewColor = Theme.getColor(Theme.key_windowBackgroundGray);
final Window window = context instanceof Activity ? ((Activity) context).getWindow() : null;
if (window != null) {
if (navBarAnimator != null && navBarAnimator.isRunning()) {
navBarAnimator.cancel();
}
final int navBarFromColor = navBarAnimator != null && navBarAnimator.isRunning() ? navBarColor : navBarOldColor;
navBarAnimator = ValueAnimator.ofFloat(0, 1);
final float startDelay = toDark ? 50 : 200, duration = 150, fullDuration = 350;
navBarAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float t = Math.max(0, Math.min(1, ((float) valueAnimator.getAnimatedValue() * fullDuration - startDelay) / duration));
navBarColor = ColorUtils.blendARGB(navBarFromColor, navBarNewColor, t);
AndroidUtilities.setNavigationBarColor(window, navBarColor, false);
AndroidUtilities.setLightNavigationBar(window, AndroidUtilities.computePerceivedBrightness(navBarColor) >= 0.721f);
}
});
navBarAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
AndroidUtilities.setNavigationBarColor(window, navBarNewColor, false);
AndroidUtilities.setLightNavigationBar(window, AndroidUtilities.computePerceivedBrightness(navBarNewColor) >= 0.721f);
}
});
navBarAnimator.setDuration((long) fullDuration);
navBarAnimator.start();
}
if (Theme.isCurrentThemeDay()) {
dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToNightMode", R.string.SettingsSwitchToNightMode), darkThemeDrawable, true);
} else {
dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToDayMode", R.string.SettingsSwitchToDayMode), darkThemeDrawable, true);
}
}
});

View file

@ -980,7 +980,7 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
rebuildFragments(REBUILD_FLAG_REBUILD_LAST);
}
fragment.setParentLayout(this);
if (position == -1 || position >= fragmentStack.size()) {
if (position < 0 || position >= fragmentStack.size()) {
BaseFragment lastFragment = getLastFragment();
if (lastFragment != null) {
lastFragment.setPaused(true);

View file

@ -13,12 +13,12 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Sat Mar 12 05:53:50 MSK 2016
APP_VERSION_NAME=9.4.8
APP_VERSION_CODE=3161
APP_VERSION_NAME=9.4.9
APP_VERSION_CODE=3164
APP_PACKAGE=org.telegram.messenger
RELEASE_KEY_PASSWORD=android
RELEASE_KEY_ALIAS=androidkey
RELEASE_STORE_PASSWORD=android
RELEASE_KEY_PASSWORD=TelegramAndroidPswd
RELEASE_KEY_ALIAS=tmessages
RELEASE_STORE_PASSWORD=TelegramAndroidPswd
org.gradle.jvmargs=-Xmx4096M -XX:MaxPermSize=4096m
org.gradle.daemon=true
org.gradle.parallel=true