Messaging: Fix a few android related things

* NotificationBuilder.addPerson(String) -> .addPerson(Person)
* Wearableextenter.addPage deprecated without replacement
* Html.fromHtml(String) -> .fromHtml(String, int)
* Handlers need Loopers
* Resource-IDs are not final by default (if-else instead of switch-case)
* call super.onFinishInflate() in override of onFinishInflate()
* Configuration.locale -> configuration.getLocales().get(0)
* SimpleDateFormat needs localization as well
* AudioAttributes instead of setAudioStreamType()
* isDataEnabled() is a public method, no need for reflection anymore

Change-Id: Icd830768b86edca3e0b44f1edc6c57facc9f731a
This commit is contained in:
Michael W
2024-12-22 23:18:10 +01:00
parent e128bff457
commit d940ab74ad
33 changed files with 313 additions and 388 deletions

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +22,6 @@ import android.content.Context;
import android.net.Uri;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.text.TextUtils;
import com.android.messaging.Factory;
import com.android.messaging.R;
@@ -39,7 +39,8 @@ public class FileUtil {
private static synchronized File getNewFile(File directory, String extension,
String fileNameFormat) throws IOException {
final Date date = new Date(System.currentTimeMillis());
final SimpleDateFormat dateFormat = new SimpleDateFormat(fileNameFormat);
final SimpleDateFormat dateFormat = new SimpleDateFormat(fileNameFormat,
Locale.getDefault(Locale.Category.FORMAT));
final String numberedFileNameFormat = dateFormat.format(date) + "_%02d" + "." + extension;
for (int i = 1; i <= 99; i++) { // Only save 99 of the same file name.
final String newName = String.format(Locale.US, numberedFileNameFormat, i);