diff --git a/src/com/android/messaging/BugleApplication.java b/src/com/android/messaging/BugleApplication.java index d034e8c..b0b4720 100644 --- a/src/com/android/messaging/BugleApplication.java +++ b/src/com/android/messaging/BugleApplication.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project - * Copyright (C) 2024 The LineageOS Project + * Copyright (C) 2024-2025 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. @@ -24,7 +24,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; import android.os.Handler; -import android.os.Looper; import android.support.v7.mms.CarrierConfigValuesLoader; import android.support.v7.mms.MmsManager; import android.telephony.CarrierConfigManager; @@ -39,12 +38,10 @@ import com.android.messaging.sms.BugleUserAgentInfoLoader; import com.android.messaging.sms.MmsConfig; import com.android.messaging.ui.ConversationDrawables; import com.android.messaging.util.BuglePrefsKeys; -import com.android.messaging.util.DebugUtils; import com.android.messaging.util.LogUtil; import com.android.messaging.util.PhoneUtils; import com.android.messaging.util.Trace; -import java.io.File; import java.lang.Thread.UncaughtExceptionHandler; /** @@ -84,8 +81,6 @@ public class BugleApplication extends Application implements UncaughtExceptionHa final CarrierConfigValuesLoader carrierConfigValuesLoader = factory.getCarrierConfigValuesLoader(); - maybeStartProfiling(); - BugleApplication.updateAppConfig(context); // Initialize MMS lib @@ -155,27 +150,6 @@ public class BugleApplication extends Application implements UncaughtExceptionHa } } - private void maybeStartProfiling() { - // App startup profiling support. To use it: - // adb shell setprop log.tag.BugleProfile DEBUG - // # Start the app, wait for a 30s, download trace file: - // adb pull /data/data/com.android.messaging/cache/startup.trace /tmp - // # Open trace file (using adt/tools/traceview) - if (android.util.Log.isLoggable(LogUtil.PROFILE_TAG, android.util.Log.DEBUG)) { - // Start method tracing with a big enough buffer and let it run for 30s. - // Note we use a logging tag as we don't want to wait for gservices to start up. - final File file = DebugUtils.getDebugFile("startup.trace", true); - android.os.Debug.startMethodTracing(file.getAbsolutePath(), 160 * 1024 * 1024); - new Handler(Looper.getMainLooper()).postDelayed(() -> { - android.os.Debug.stopMethodTracing(); - // Allow world to see trace file - DebugUtils.ensureReadable(file); - LogUtil.d(LogUtil.PROFILE_TAG, "Tracing complete - " - + file.getAbsolutePath()); - }, 30000); - } - } - private void maybeHandleSharedPrefsUpgrade(final Factory factory) { final int existingVersion = factory.getApplicationPrefs().getInt( BuglePrefsKeys.SHARED_PREFERENCES_VERSION, diff --git a/src/com/android/messaging/Factory.java b/src/com/android/messaging/Factory.java index 2c854d4..dca2e6d 100644 --- a/src/com/android/messaging/Factory.java +++ b/src/com/android/messaging/Factory.java @@ -66,6 +66,4 @@ public abstract class Factory { public abstract BugleCarrierConfigValuesLoader getCarrierConfigValuesLoader(); // Note this needs to run from any thread public abstract void reclaimMemory(); - - public abstract void onActivityResume(); } diff --git a/src/com/android/messaging/FactoryImpl.java b/src/com/android/messaging/FactoryImpl.java index 091c439..bf34de8 100644 --- a/src/com/android/messaging/FactoryImpl.java +++ b/src/com/android/messaging/FactoryImpl.java @@ -199,10 +199,6 @@ class FactoryImpl extends Factory { mMemoryCacheManager.reclaimMemory(); } - @Override - public void onActivityResume() { - } - @Override public MediaUtil getMediaUtil() { return mMediaUtil; diff --git a/src/com/android/messaging/datamodel/MessageNotificationState.java b/src/com/android/messaging/datamodel/MessageNotificationState.java index 18bcea2..cece072 100644 --- a/src/com/android/messaging/datamodel/MessageNotificationState.java +++ b/src/com/android/messaging/datamodel/MessageNotificationState.java @@ -234,14 +234,6 @@ public abstract class MessageNotificationState extends NotificationState { mParticipantCount = participantCount; } - public int getLatestMessageNotificationType() { - final MessageLineInfo messageLineInfo = getLatestMessageLineInfo(); - if (messageLineInfo == null) { - return BugleNotifications.LOCAL_SMS_NOTIFICATION; - } - return messageLineInfo.mNotificationType; - } - public String getLatestMessageId() { final MessageLineInfo messageLineInfo = getLatestMessageLineInfo(); if (messageLineInfo == null) { @@ -362,7 +354,6 @@ public abstract class MessageNotificationState extends NotificationState { if (!(convInfo.mLineInfos.get(0) instanceof MessageLineInfo)) { continue; } - setPeopleForConversation(convInfo.mConversationId); final ConversationInfoList list = new ConversationInfoList( convInfo.mTotalMessageCount, Lists.newArrayList(convInfo)); mChildren.add(new BundledMessageNotificationState(list, i)); @@ -452,8 +443,6 @@ public abstract class MessageNotificationState extends NotificationState { super(convList); // This conversation has been accepted. final ConversationLineInfo convInfo = convList.mConvInfos.get(0); - setAvatarUrlsForConversation(convInfo.mConversationId); - setPeopleForConversation(convInfo.mConversationId); final Context context = Factory.get().getApplicationContext(); MessageLineInfo messageInfo = (MessageLineInfo) convInfo.mLineInfos.get(0); @@ -476,7 +465,7 @@ public abstract class MessageNotificationState extends NotificationState { final String attachment = context.getString(message); final SpannableStringBuilder spanBuilder = new SpannableStringBuilder(); if (!TextUtils.isEmpty(mContent)) { - spanBuilder.append(mContent).append(System.getProperty("line.separator")); + spanBuilder.append(mContent).append(System.lineSeparator()); } final int start = spanBuilder.length(); spanBuilder.append(attachment); @@ -917,7 +906,7 @@ public abstract class MessageNotificationState extends NotificationState { Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); if (!TextUtils.isEmpty(text)) { // Now add the actual message text below the subject header. - spanBuilder.append(System.getProperty("line.separator") + text); + spanBuilder.append(System.lineSeparator() + text); } text = spanBuilder; } @@ -1059,18 +1048,6 @@ public abstract class MessageNotificationState extends NotificationState { return mTitle; } - @Override - public int getLatestMessageNotificationType() { - // This function is called to determine whether the most recent notification applies - // to an sms conversation or a hangout conversation. We have different ringtone/vibrate - // settings for both types of conversations. - if (mConvList.mConvInfos.size() > 0) { - final ConversationLineInfo convInfo = mConvList.mConvInfos.get(0); - return convInfo.getLatestMessageNotificationType(); - } - return BugleNotifications.LOCAL_SMS_NOTIFICATION; - } - protected CharSequence getTicker() { return BugleNotifications.buildColonSeparatedMessage( mTickerSender != null ? mTickerSender : mTitle, diff --git a/src/com/android/messaging/datamodel/NotificationState.java b/src/com/android/messaging/datamodel/NotificationState.java index b52ffaa..50a2b37 100644 --- a/src/com/android/messaging/datamodel/NotificationState.java +++ b/src/com/android/messaging/datamodel/NotificationState.java @@ -94,12 +94,6 @@ public abstract class NotificationState { */ protected abstract NotificationCompat.Style build(NotificationCompat.Builder builder); - protected void setAvatarUrlsForConversation(final String conversationId) { - } - - protected void setPeopleForConversation(final String conversationId) { - } - /** * Reserves request codes for this notification type. By default 2 codes are reserved, one for * the main intent and another for the cancel intent. Override this function to reserve more. @@ -108,10 +102,6 @@ public abstract class NotificationState { return NUM_REQUEST_CODES_NEEDED; } - public int getContentIntentRequestCode() { - return mBaseRequestCode + CONTENT_INTENT_REQUEST_CODE_OFFSET; - } - public int getClearIntentRequestCode() { return mBaseRequestCode + CLEAR_INTENT_REQUEST_CODE_OFFSET; } @@ -121,14 +111,6 @@ public abstract class NotificationState { */ public abstract int getIcon(); - /** - * @return the type of notification that should be used from {@link RealTimeChatNotifications} - * so that the proper ringtone and vibrate settings can be used. - */ - public int getLatestMessageNotificationType() { - return BugleNotifications.LOCAL_SMS_NOTIFICATION; - } - /** * @return the notification priority level for this notification. */ diff --git a/src/com/android/messaging/datamodel/action/ActionServiceImpl.java b/src/com/android/messaging/datamodel/action/ActionServiceImpl.java index 1dced72..b5e841c 100644 --- a/src/com/android/messaging/datamodel/action/ActionServiceImpl.java +++ b/src/com/android/messaging/datamodel/action/ActionServiceImpl.java @@ -203,17 +203,11 @@ public class ActionServiceImpl extends JobIntentService { mBackgroundWorker = DataModel.get().getBackgroundWorkerForActionService(); } - @Override - public void onDestroy() { - super.onDestroy(); - } - /** * Queue intent to the ActionService. */ private static void startServiceWithIntent(final Intent intent) { final Context context = Factory.get().getApplicationContext(); - final int opcode = intent.getIntExtra(EXTRA_OP_CODE, 0); intent.setClass(context, ActionServiceImpl.class); enqueueWork(context, intent); } diff --git a/src/com/android/messaging/datamodel/data/MessageData.java b/src/com/android/messaging/datamodel/data/MessageData.java index 92be4b2..191d468 100644 --- a/src/com/android/messaging/datamodel/data/MessageData.java +++ b/src/com/android/messaging/datamodel/data/MessageData.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project - * Copyright (C) 2024 The LineageOS Project + * Copyright (C) 2024-2025 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. @@ -660,7 +660,7 @@ public class MessageData implements Parcelable { } public final String getMessageText() { - final String separator = System.getProperty("line.separator"); + final String separator = System.lineSeparator(); final StringBuilder text = new StringBuilder(); for (final MessagePartData part : mParts) { if (!part.isAttachment() && !TextUtils.isEmpty(part.getText())) { @@ -678,7 +678,7 @@ public class MessageData implements Parcelable { * appends a text part */ public final void consolidateText() { - final String separator = System.getProperty("line.separator"); + final String separator = System.lineSeparator(); final StringBuilder captionText = new StringBuilder(); MessagePartData firstTextPart = null; int firstTextPartIndex = -1; diff --git a/src/com/android/messaging/datamodel/media/CustomVCardEntryConstructor.java b/src/com/android/messaging/datamodel/media/CustomVCardEntryConstructor.java index db71514..6a389b3 100644 --- a/src/com/android/messaging/datamodel/media/CustomVCardEntryConstructor.java +++ b/src/com/android/messaging/datamodel/media/CustomVCardEntryConstructor.java @@ -27,11 +27,6 @@ import java.util.List; public class CustomVCardEntryConstructor implements VCardInterpreter { public interface EntryHandler { - /** - * Called when the parsing started. - */ - void onStart(); - /** * The method called when one vCard entry is created. Children come before their parent in * nested vCard files. @@ -86,9 +81,6 @@ public class CustomVCardEntryConstructor implements VCardInterpreter { @Override public void onVCardStarted() { - for (EntryHandler entryHandler : mEntryHandlers) { - entryHandler.onStart(); - } } @Override diff --git a/src/com/android/messaging/datamodel/media/VCardRequest.java b/src/com/android/messaging/datamodel/media/VCardRequest.java index 2d57012..5b1f7c1 100644 --- a/src/com/android/messaging/datamodel/media/VCardRequest.java +++ b/src/com/android/messaging/datamodel/media/VCardRequest.java @@ -248,10 +248,6 @@ public class VCardRequest implements MediaRequest { mSignal = signal; } - @Override - public void onStart() { - } - @Override @DoesNotRunOnMainThread public void onEntryCreated(final CustomVCardEntry entry) { diff --git a/src/com/android/messaging/sms/MmsUtils.java b/src/com/android/messaging/sms/MmsUtils.java index 5702a7c..309cd77 100644 --- a/src/com/android/messaging/sms/MmsUtils.java +++ b/src/com/android/messaging/sms/MmsUtils.java @@ -52,19 +52,16 @@ import android.text.TextUtils; import com.android.messaging.Factory; import com.android.messaging.R; -import com.android.messaging.datamodel.MediaScratchFileProvider; import com.android.messaging.datamodel.action.DownloadMmsAction; import com.android.messaging.datamodel.action.SendMessageAction; import com.android.messaging.datamodel.data.MessageData; import com.android.messaging.datamodel.data.MessagePartData; import com.android.messaging.mmslib.SqliteWrapper; -import com.android.messaging.mmslib.pdu.PduComposer; import com.android.messaging.mmslib.pdu.PduPersister; import com.android.messaging.sms.SmsSender.SendResult; import com.android.messaging.util.Assert; import com.android.messaging.util.BugleGservicesKeys; import com.android.messaging.util.BuglePrefs; -import com.android.messaging.util.DebugUtils; import com.android.messaging.util.EmailAddress; import com.android.messaging.util.ImageUtils; import com.android.messaging.util.ImageUtils.ImageResizer; @@ -73,10 +70,7 @@ import com.android.messaging.util.MediaMetadataRetrieverWrapper; import com.android.messaging.util.PhoneUtils; import com.google.common.base.Joiner; -import java.io.BufferedOutputStream; -import java.io.File; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; @@ -87,7 +81,6 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; -import java.util.UUID; /** * Utils for sending sms/mms messages. @@ -277,10 +270,6 @@ public class MmsUtils { private static final String sSmilNonVisualAttachmentsWithText = sSmilTextOnly; - public static final String MMS_DUMP_PREFIX = "mmsdump-"; - public static final String SMS_DUMP_PREFIX = "smsdump-"; - - public static final int MIN_VIDEO_BYTES_PER_SECOND = 4 * 1024; public static final int MIN_IMAGE_BYTE_SIZE = 16 * 1024; public static final int MAX_VIDEO_ATTACHMENT_COUNT = 1; @@ -1396,43 +1385,6 @@ public class MmsUtils { return sHasSmsDateSentColumn; } - private static final String[] TEST_CARRIERS_PROJECTION = - new String[] { Telephony.Carriers.MMSC }; - private static Boolean sUseSystemApn = null; - /** - * Check if we can access the APN data in the Telephony provider. Access was restricted in - * JB MR1 (and some JB MR2) devices. If we can't access the APN, we have to fall back and use - * a private table in our own app. - * - * @return Whether we can access the system APN table - */ - public static boolean useSystemApnTable() { - if (sUseSystemApn == null) { - Cursor cursor = null; - try { - final Context context = Factory.get().getApplicationContext(); - final ContentResolver resolver = context.getContentResolver(); - cursor = SqliteWrapper.query( - context, - resolver, - Telephony.Carriers.CONTENT_URI, - TEST_CARRIERS_PROJECTION, - null/*selection*/, - null/*selectionArgs*/, - null); - sUseSystemApn = true; - } catch (final SecurityException e) { - LogUtil.w(TAG, "Can't access system APN, using internal table", e); - sUseSystemApn = false; - } finally { - if (cursor != null) { - cursor.close(); - } - } - } - return sUseSystemApn; - } - public static final Uri MMS_PART_CONTENT_URI = Uri.parse("content://mms/part"); /** @@ -1818,15 +1770,6 @@ public class MmsUtils { return pdu; } - private static RetrieveConf receiveFromDumpFile(final byte[] data) throws MmsFailureException { - final GenericPdu pdu = parsePduForAnyCarrier(data); - if (pdu == null || !(pdu instanceof RetrieveConf)) { - LogUtil.e(TAG, "receiveFromDumpFile: Parsing retrieved PDU failure"); - throw new MmsFailureException(MMS_REQUEST_MANUAL_RETRY, "Failed reading dump file"); - } - return (RetrieveConf) pdu; - } - public static StatusPlusUri sendMmsMessage(final Context context, final int subId, final Uri messageUri, final Bundle extras) { int status = MMS_REQUEST_MANUAL_RETRY; @@ -2241,40 +2184,6 @@ public class MmsUtils { return resolver.delete(messageUri, null /* selection */, null /* selectionArgs */); } - public static byte[] createDebugNotificationInd(final String fileName) { - byte[] pduData = null; - try { - final Context context = Factory.get().getApplicationContext(); - // Load the message file - final byte[] data = DebugUtils.receiveFromDumpFile(fileName); - final RetrieveConf retrieveConf = receiveFromDumpFile(data); - // Create the notification - final NotificationInd notification = new NotificationInd(); - final long expiry = System.currentTimeMillis() / 1000 + 600; - notification.setTransactionId(fileName.getBytes()); - notification.setMmsVersion(retrieveConf.getMmsVersion()); - notification.setFrom(retrieveConf.getFrom()); - notification.setSubject(retrieveConf.getSubject()); - notification.setExpiry(expiry); - notification.setMessageSize(data.length); - notification.setMessageClass(retrieveConf.getMessageClass()); - - final Uri.Builder builder = MediaScratchFileProvider.getUriBuilder(); - builder.appendPath(fileName); - final Uri contentLocation = builder.build(); - notification.setContentLocation(contentLocation.toString().getBytes()); - - // Serialize - pduData = new PduComposer(context, notification).make(); - if (pduData == null || pduData.length < 1) { - throw new IllegalArgumentException("Empty or zero length PDU data"); - } - } catch (final MmsFailureException | InvalidHeaderValueException e) { - // Nothing to do - } - return pduData; - } - public static int mapRawStatusToErrorResourceId(final int bugleStatus, final int rawStatus) { int stringResId = R.string.message_status_send_failed; switch (rawStatus) { @@ -2304,53 +2213,4 @@ public class MmsUtils { } return stringResId; } - - /** - * Dump the raw MMS data into a file - * - * @param rawPdu The raw pdu data - * @param pdu The parsed pdu, used to construct a dump file name - */ - public static void dumpPdu(final byte[] rawPdu, final GenericPdu pdu) { - if (rawPdu == null || rawPdu.length < 1) { - return; - } - final String dumpFileName = MmsUtils.MMS_DUMP_PREFIX + getDumpFileId(pdu); - final File dumpFile = DebugUtils.getDebugFile(dumpFileName, true); - try { - final FileOutputStream fos = new FileOutputStream(dumpFile); - try (BufferedOutputStream bos = new BufferedOutputStream(fos)) { - bos.write(rawPdu); - bos.flush(); - } - DebugUtils.ensureReadable(dumpFile); - } catch (final IOException e) { - LogUtil.e(TAG, "dumpPdu: " + e, e); - } - } - - /** - * Get the dump file id based on the parsed PDU - * 1. Use message id if not empty - * 2. Use transaction id if message id is empty - * 3. If all above is empty, use random UUID - * - * @param pdu the parsed PDU - * @return the id of the dump file - */ - private static String getDumpFileId(final GenericPdu pdu) { - String fileId = null; - if (pdu != null && pdu instanceof RetrieveConf) { - final RetrieveConf retrieveConf = (RetrieveConf) pdu; - if (retrieveConf.getMessageId() != null) { - fileId = new String(retrieveConf.getMessageId()); - } else if (retrieveConf.getTransactionId() != null) { - fileId = new String(retrieveConf.getTransactionId()); - } - } - if (TextUtils.isEmpty(fileId)) { - fileId = UUID.randomUUID().toString(); - } - return fileId; - } } diff --git a/src/com/android/messaging/sms/SystemProperties.java b/src/com/android/messaging/sms/SystemProperties.java deleted file mode 100644 index 098c894..0000000 --- a/src/com/android/messaging/sms/SystemProperties.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.messaging.sms; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * Hacky way to call the hidden SystemProperties class API - */ -class SystemProperties { - private static Method sSystemPropertiesGetMethod = null; - - public static String get(final String name) { - if (sSystemPropertiesGetMethod == null) { - try { - final Class systemPropertiesClass = Class.forName("android.os.SystemProperties"); - if (systemPropertiesClass != null) { - sSystemPropertiesGetMethod = - systemPropertiesClass.getMethod("get", String.class); - } - } catch (final ClassNotFoundException | NoSuchMethodException e) { - // Nothing to do - } - } - if (sSystemPropertiesGetMethod != null) { - try { - return (String) sSystemPropertiesGetMethod.invoke(null, name); - } catch (final IllegalArgumentException | InvocationTargetException | - IllegalAccessException e) { - // Nothing to do - } - } - return null; - } -} diff --git a/src/com/android/messaging/ui/CompositeAdapter.java b/src/com/android/messaging/ui/CompositeAdapter.java index 7f21313..fa1760e 100644 --- a/src/com/android/messaging/ui/CompositeAdapter.java +++ b/src/com/android/messaging/ui/CompositeAdapter.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project - * Copyright (C) 2024 The LineageOS Project + * Copyright (C) 2024-2025 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. @@ -68,10 +68,6 @@ public class CompositeAdapter extends BaseAdapter { public View getHeaderView(final View convertView, final ViewGroup parentView) { return null; } - - public void close() { - // do nothing in base class. - } } private class Observer extends DataSetObserver { @@ -116,56 +112,6 @@ public class CompositeAdapter extends BaseAdapter { notifyDataSetChanged(); } - public void removePartition(final int index) { - final Partition partition = mPartitions[index]; - partition.close(); - System.arraycopy(mPartitions, index + 1, mPartitions, index, - mSize - index - 1); - mSize--; - partition.getAdapter().unregisterDataSetObserver(mObserver); - invalidate(); - notifyDataSetChanged(); - } - - public void clearPartitions() { - for (int i = 0; i < mSize; i++) { - final Partition partition = mPartitions[i]; - partition.close(); - partition.getAdapter().unregisterDataSetObserver(mObserver); - } - invalidate(); - notifyDataSetChanged(); - } - - public Partition getPartition(final int index) { - return mPartitions[index]; - } - - public int getPartitionAtPosition(final int position) { - ensureCacheValid(); - int start = 0; - for (int i = 0; i < mSize; i++) { - final int end = start + mPartitions[i].getCount(); - if (position >= start && position < end) { - int offset = position - start; - if (mPartitions[i].hasHeader() && - (mPartitions[i].getCount() > 0 || mPartitions[i].showIfEmpty())) { - offset--; - } - if (offset == -1) { - return -1; - } - return i; - } - start = end; - } - return mSize - 1; - } - - public int getPartitionCount() { - return mSize; - } - public void invalidate() { mCacheValid = false; } diff --git a/src/com/android/messaging/ui/conversation/ConversationActivity.java b/src/com/android/messaging/ui/conversation/ConversationActivity.java index 8f4cdd0..3bf75ad 100644 --- a/src/com/android/messaging/ui/conversation/ConversationActivity.java +++ b/src/com/android/messaging/ui/conversation/ConversationActivity.java @@ -278,14 +278,6 @@ public class ConversationActivity extends BugleActionBarActivity invalidateActionBar(); } - @Override // From ConversationFragmentHost - public void onConversationMessagesUpdated(final int numberOfMessages) { - } - - @Override // From ConversationFragmentHost - public void onConversationParticipantDataLoaded(final int numberOfParticipants) { - } - @Override // From ConversationFragmentHost public boolean isActiveAndFocused() { return !mIsPaused && hasWindowFocus(); diff --git a/src/com/android/messaging/ui/conversation/ConversationFragment.java b/src/com/android/messaging/ui/conversation/ConversationFragment.java index 52075d3..b8a6b07 100644 --- a/src/com/android/messaging/ui/conversation/ConversationFragment.java +++ b/src/com/android/messaging/ui/conversation/ConversationFragment.java @@ -131,14 +131,11 @@ public class ConversationFragment extends Fragment implements ConversationDataLi ActionMode startActionMode(ActionMode.Callback callback); void dismissActionMode(); ActionMode getActionMode(); - void onConversationMessagesUpdated(int numberOfMessages); - void onConversationParticipantDataLoaded(int numberOfParticipants); boolean isActiveAndFocused(); } public static final String FRAGMENT_TAG = "conversation"; - static final int REQUEST_CHOOSE_ATTACHMENTS = 2; private static final int JUMP_SCROLL_THRESHOLD = 15; // We animate the message from draft to message list, if we the message doesn't show up in the // list within this time limit, then we just do a fade in animation instead @@ -896,8 +893,6 @@ public class ConversationFragment extends Fragment implements ConversationDataLi } if (cursor != null) { - mHost.onConversationMessagesUpdated(cursor.getCount()); - // Are we coming from a widget click where we're told to scroll to a particular item? final int scrollToPos = getScrollToMessagePosition(); if (scrollToPos >= 0) { @@ -1164,8 +1159,6 @@ public class ConversationFragment extends Fragment implements ConversationDataLi mHost.invalidateActionBar(); mRecyclerView.setVisibility(View.VISIBLE); - mHost.onConversationParticipantDataLoaded - (mBinding.getData().getNumberOfParticipantsExcludingSelf()); } } @@ -1542,11 +1535,6 @@ public class ConversationFragment extends Fragment implements ConversationDataLi return false; } - @Override - public void showHideSimSelector(final boolean show) { - // no-op for now - } - @Override public int getSimSelectorItemLayoutId() { return R.layout.sim_selector_item_view; diff --git a/src/com/android/messaging/ui/conversation/ConversationInputManager.java b/src/com/android/messaging/ui/conversation/ConversationInputManager.java index 03038ab..0a5f328 100644 --- a/src/com/android/messaging/ui/conversation/ConversationInputManager.java +++ b/src/com/android/messaging/ui/conversation/ConversationInputManager.java @@ -62,7 +62,6 @@ public class ConversationInputManager implements ConversationInput.ConversationI void onStartComposeMessage(); SimSelectorView getSimSelectorView(); MediaPicker createMediaPicker(); - void showHideSimSelector(boolean show); int getSimSelectorItemLayoutId(); } @@ -493,15 +492,12 @@ public class ConversationInputManager implements ConversationInput.ConversationI @Override public boolean show(boolean animate) { final boolean result = super.show(animate); - mHost.showHideSimSelector(true /*show*/); return result; } @Override public boolean hide(boolean animate) { - final boolean result = super.hide(animate); - mHost.showHideSimSelector(false /*show*/); - return result; + return super.hide(animate); } } diff --git a/src/com/android/messaging/ui/mediapicker/CameraMediaChooser.java b/src/com/android/messaging/ui/mediapicker/CameraMediaChooser.java index cbe79ad..a941adc 100644 --- a/src/com/android/messaging/ui/mediapicker/CameraMediaChooser.java +++ b/src/com/android/messaging/ui/mediapicker/CameraMediaChooser.java @@ -104,11 +104,6 @@ class CameraMediaChooser extends MediaChooser { } } - @Override - public View destroyView() { - return super.destroyView(); - } - @Override protected View createView(final ViewGroup container) { final LayoutInflater inflater = getLayoutInflater(); diff --git a/src/com/android/messaging/ui/mediapicker/MediaChooser.java b/src/com/android/messaging/ui/mediapicker/MediaChooser.java index 7f4476d..eb66cc2 100644 --- a/src/com/android/messaging/ui/mediapicker/MediaChooser.java +++ b/src/com/android/messaging/ui/mediapicker/MediaChooser.java @@ -107,9 +107,6 @@ abstract class MediaChooser extends BasePagerViewHolder return LayoutInflater.from(getContext()); } - /** Allows the chooser to handle full screen change */ - void onFullScreenChanged(final boolean fullScreen) {} - /** Allows the chooser to handle the chooser being opened or closed */ void onOpenedChanged(final boolean open) { mOpen = open; @@ -176,9 +173,6 @@ abstract class MediaChooser extends BasePagerViewHolder return false; } - public void onCreateOptionsMenu(final MenuInflater inflater, final Menu menu) { - } - public boolean onOptionsItemSelected(final MenuItem item) { return false; } @@ -204,5 +198,4 @@ abstract class MediaChooser extends BasePagerViewHolder /** Optional activity life-cycle methods to be overridden by subclasses */ public void onPause() { } - public void onResume() { } } diff --git a/src/com/android/messaging/ui/mediapicker/MediaPicker.java b/src/com/android/messaging/ui/mediapicker/MediaPicker.java index 1baa4da..c362398 100644 --- a/src/com/android/messaging/ui/mediapicker/MediaPicker.java +++ b/src/com/android/messaging/ui/mediapicker/MediaPicker.java @@ -279,15 +279,6 @@ public class MediaPicker extends Fragment implements DraftMessageSubscriptionDat } } - @Override - public void onResume() { - super.onResume(); - - for (final MediaChooser chooser : mEnabledChoosers) { - chooser.onResume(); - } - } - @Override public void onDestroy() { super.onDestroy(); @@ -545,7 +536,6 @@ public class MediaPicker extends Fragment implements DraftMessageSubscriptionDat mListenerHandler.post(() -> mListener.onOpened()); } if (mSelectedChooser != null) { - mSelectedChooser.onFullScreenChanged(false); mSelectedChooser.onOpenedChanged(true); } } @@ -566,9 +556,6 @@ public class MediaPicker extends Fragment implements DraftMessageSubscriptionDat if (mListener != null) { mListenerHandler.post(() -> mListener.onFullScreenChanged(fullScreen)); } - if (mSelectedChooser != null) { - mSelectedChooser.onFullScreenChanged(fullScreen); - } } void dispatchItemsSelected(final MessagePartData item, final boolean dismissMediaPicker) { @@ -641,9 +628,6 @@ public class MediaPicker extends Fragment implements DraftMessageSubscriptionDat @Override public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) { - if (mSelectedChooser != null) { - mSelectedChooser.onCreateOptionsMenu(inflater, menu); - } } @Override diff --git a/src/com/android/messaging/util/BugleActivityUtil.java b/src/com/android/messaging/util/BugleActivityUtil.java index 79ce329..ec6f90d 100644 --- a/src/com/android/messaging/util/BugleActivityUtil.java +++ b/src/com/android/messaging/util/BugleActivityUtil.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project - * Copyright (C) 2024 The LineageOS Project + * Copyright (C) 2024-2025 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. @@ -22,7 +22,6 @@ import android.app.AlertDialog; import android.content.Context; import android.os.UserManager; -import com.android.messaging.Factory; import com.android.messaging.R; import com.android.messaging.datamodel.DataModel; @@ -41,7 +40,6 @@ public class BugleActivityUtil { */ public static boolean onActivityResume(Context context, Activity activity) { DataModel.get().onActivityResume(); - Factory.get().onActivityResume(); // Validate all requirements to run are met return checkHasSmsPermissionsForUser(context, activity); diff --git a/src/com/android/messaging/util/DebugUtils.java b/src/com/android/messaging/util/DebugUtils.java index d054556..17b3b8e 100644 --- a/src/com/android/messaging/util/DebugUtils.java +++ b/src/com/android/messaging/util/DebugUtils.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project - * Copyright (C) 2024 The LineageOS Project + * Copyright (C) 2024-2025 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. @@ -17,83 +17,7 @@ package com.android.messaging.util; -import android.os.Environment; - -import com.google.common.io.ByteStreams; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; - public class DebugUtils { - private static final String TAG = "bugle.util.DebugUtils"; - - public static File getDebugFile(final String fileName, final boolean create) { - final File dir = getDebugFilesDir(); - final File file = new File(dir, fileName); - if (create && file.exists()) { - file.delete(); - } - return file; - } - - public static File getDebugFilesDir() { - final File dir = Environment.getExternalStorageDirectory(); - return dir; - } - - /** - * Load MMS/SMS from the dump file - */ - public static byte[] receiveFromDumpFile(final String dumpFileName) { - byte[] data = null; - try { - final File inputFile = getDebugFile(dumpFileName, false); - final FileInputStream fis = new FileInputStream(inputFile); - try (BufferedInputStream bis = new BufferedInputStream(fis)) { - // dump file - data = ByteStreams.toByteArray(bis); - if (data == null || data.length < 1) { - LogUtil.e(LogUtil.BUGLE_TAG, "receiveFromDumpFile: empty data"); - } - } - } catch (final IOException e) { - LogUtil.e(LogUtil.BUGLE_TAG, "receiveFromDumpFile: " + e, e); - } - return data; - } - - public static void ensureReadable(final File file) { - if (file.exists()){ - file.setReadable(true, false); - } - } - - /** - * Logs the name of the method that is currently executing, e.g. "MyActivity.onCreate". This is - * useful for surgically adding logs for tracing execution while debugging. - *

- * NOTE: This method retrieves the current thread's stack trace, which adds runtime overhead. - * However, this method is only executed on eng builds if DEBUG logs are loggable. - */ - public static void logCurrentMethod(String tag) { - if (!LogUtil.isLoggable(tag, LogUtil.DEBUG)) { - return; - } - StackTraceElement caller = getCaller(1); - if (caller == null) { - return; - } - String className = caller.getClassName(); - // Strip off the package name - int lastDot = className.lastIndexOf('.'); - if (lastDot > -1) { - className = className.substring(lastDot + 1); - } - LogUtil.d(tag, className + "." + caller.getMethodName()); - } - /** * Returns info about the calling method. The {@code depth} parameter controls how far back to * go. For example, if foo() calls bar(), and bar() calls getCaller(0), it returns info about