Messaging: Remove unused or not required classes and methods
Change-Id: I28ebaecc503ee58c74fc8081162777f861dd4516
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.IntentFilter;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
|
||||||
import android.support.v7.mms.CarrierConfigValuesLoader;
|
import android.support.v7.mms.CarrierConfigValuesLoader;
|
||||||
import android.support.v7.mms.MmsManager;
|
import android.support.v7.mms.MmsManager;
|
||||||
import android.telephony.CarrierConfigManager;
|
import android.telephony.CarrierConfigManager;
|
||||||
@@ -39,12 +38,10 @@ import com.android.messaging.sms.BugleUserAgentInfoLoader;
|
|||||||
import com.android.messaging.sms.MmsConfig;
|
import com.android.messaging.sms.MmsConfig;
|
||||||
import com.android.messaging.ui.ConversationDrawables;
|
import com.android.messaging.ui.ConversationDrawables;
|
||||||
import com.android.messaging.util.BuglePrefsKeys;
|
import com.android.messaging.util.BuglePrefsKeys;
|
||||||
import com.android.messaging.util.DebugUtils;
|
|
||||||
import com.android.messaging.util.LogUtil;
|
import com.android.messaging.util.LogUtil;
|
||||||
import com.android.messaging.util.PhoneUtils;
|
import com.android.messaging.util.PhoneUtils;
|
||||||
import com.android.messaging.util.Trace;
|
import com.android.messaging.util.Trace;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.Thread.UncaughtExceptionHandler;
|
import java.lang.Thread.UncaughtExceptionHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,8 +81,6 @@ public class BugleApplication extends Application implements UncaughtExceptionHa
|
|||||||
final CarrierConfigValuesLoader carrierConfigValuesLoader =
|
final CarrierConfigValuesLoader carrierConfigValuesLoader =
|
||||||
factory.getCarrierConfigValuesLoader();
|
factory.getCarrierConfigValuesLoader();
|
||||||
|
|
||||||
maybeStartProfiling();
|
|
||||||
|
|
||||||
BugleApplication.updateAppConfig(context);
|
BugleApplication.updateAppConfig(context);
|
||||||
|
|
||||||
// Initialize MMS lib
|
// 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) {
|
private void maybeHandleSharedPrefsUpgrade(final Factory factory) {
|
||||||
final int existingVersion = factory.getApplicationPrefs().getInt(
|
final int existingVersion = factory.getApplicationPrefs().getInt(
|
||||||
BuglePrefsKeys.SHARED_PREFERENCES_VERSION,
|
BuglePrefsKeys.SHARED_PREFERENCES_VERSION,
|
||||||
|
|||||||
@@ -66,6 +66,4 @@ public abstract class Factory {
|
|||||||
public abstract BugleCarrierConfigValuesLoader getCarrierConfigValuesLoader();
|
public abstract BugleCarrierConfigValuesLoader getCarrierConfigValuesLoader();
|
||||||
// Note this needs to run from any thread
|
// Note this needs to run from any thread
|
||||||
public abstract void reclaimMemory();
|
public abstract void reclaimMemory();
|
||||||
|
|
||||||
public abstract void onActivityResume();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,10 +199,6 @@ class FactoryImpl extends Factory {
|
|||||||
mMemoryCacheManager.reclaimMemory();
|
mMemoryCacheManager.reclaimMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivityResume() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MediaUtil getMediaUtil() {
|
public MediaUtil getMediaUtil() {
|
||||||
return mMediaUtil;
|
return mMediaUtil;
|
||||||
|
|||||||
@@ -234,14 +234,6 @@ public abstract class MessageNotificationState extends NotificationState {
|
|||||||
mParticipantCount = participantCount;
|
mParticipantCount = participantCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLatestMessageNotificationType() {
|
|
||||||
final MessageLineInfo messageLineInfo = getLatestMessageLineInfo();
|
|
||||||
if (messageLineInfo == null) {
|
|
||||||
return BugleNotifications.LOCAL_SMS_NOTIFICATION;
|
|
||||||
}
|
|
||||||
return messageLineInfo.mNotificationType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLatestMessageId() {
|
public String getLatestMessageId() {
|
||||||
final MessageLineInfo messageLineInfo = getLatestMessageLineInfo();
|
final MessageLineInfo messageLineInfo = getLatestMessageLineInfo();
|
||||||
if (messageLineInfo == null) {
|
if (messageLineInfo == null) {
|
||||||
@@ -362,7 +354,6 @@ public abstract class MessageNotificationState extends NotificationState {
|
|||||||
if (!(convInfo.mLineInfos.get(0) instanceof MessageLineInfo)) {
|
if (!(convInfo.mLineInfos.get(0) instanceof MessageLineInfo)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
setPeopleForConversation(convInfo.mConversationId);
|
|
||||||
final ConversationInfoList list = new ConversationInfoList(
|
final ConversationInfoList list = new ConversationInfoList(
|
||||||
convInfo.mTotalMessageCount, Lists.newArrayList(convInfo));
|
convInfo.mTotalMessageCount, Lists.newArrayList(convInfo));
|
||||||
mChildren.add(new BundledMessageNotificationState(list, i));
|
mChildren.add(new BundledMessageNotificationState(list, i));
|
||||||
@@ -452,8 +443,6 @@ public abstract class MessageNotificationState extends NotificationState {
|
|||||||
super(convList);
|
super(convList);
|
||||||
// This conversation has been accepted.
|
// This conversation has been accepted.
|
||||||
final ConversationLineInfo convInfo = convList.mConvInfos.get(0);
|
final ConversationLineInfo convInfo = convList.mConvInfos.get(0);
|
||||||
setAvatarUrlsForConversation(convInfo.mConversationId);
|
|
||||||
setPeopleForConversation(convInfo.mConversationId);
|
|
||||||
|
|
||||||
final Context context = Factory.get().getApplicationContext();
|
final Context context = Factory.get().getApplicationContext();
|
||||||
MessageLineInfo messageInfo = (MessageLineInfo) convInfo.mLineInfos.get(0);
|
MessageLineInfo messageInfo = (MessageLineInfo) convInfo.mLineInfos.get(0);
|
||||||
@@ -476,7 +465,7 @@ public abstract class MessageNotificationState extends NotificationState {
|
|||||||
final String attachment = context.getString(message);
|
final String attachment = context.getString(message);
|
||||||
final SpannableStringBuilder spanBuilder = new SpannableStringBuilder();
|
final SpannableStringBuilder spanBuilder = new SpannableStringBuilder();
|
||||||
if (!TextUtils.isEmpty(mContent)) {
|
if (!TextUtils.isEmpty(mContent)) {
|
||||||
spanBuilder.append(mContent).append(System.getProperty("line.separator"));
|
spanBuilder.append(mContent).append(System.lineSeparator());
|
||||||
}
|
}
|
||||||
final int start = spanBuilder.length();
|
final int start = spanBuilder.length();
|
||||||
spanBuilder.append(attachment);
|
spanBuilder.append(attachment);
|
||||||
@@ -917,7 +906,7 @@ public abstract class MessageNotificationState extends NotificationState {
|
|||||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
if (!TextUtils.isEmpty(text)) {
|
if (!TextUtils.isEmpty(text)) {
|
||||||
// Now add the actual message text below the subject header.
|
// Now add the actual message text below the subject header.
|
||||||
spanBuilder.append(System.getProperty("line.separator") + text);
|
spanBuilder.append(System.lineSeparator() + text);
|
||||||
}
|
}
|
||||||
text = spanBuilder;
|
text = spanBuilder;
|
||||||
}
|
}
|
||||||
@@ -1059,18 +1048,6 @@ public abstract class MessageNotificationState extends NotificationState {
|
|||||||
return mTitle;
|
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() {
|
protected CharSequence getTicker() {
|
||||||
return BugleNotifications.buildColonSeparatedMessage(
|
return BugleNotifications.buildColonSeparatedMessage(
|
||||||
mTickerSender != null ? mTickerSender : mTitle,
|
mTickerSender != null ? mTickerSender : mTitle,
|
||||||
|
|||||||
@@ -94,12 +94,6 @@ public abstract class NotificationState {
|
|||||||
*/
|
*/
|
||||||
protected abstract NotificationCompat.Style build(NotificationCompat.Builder builder);
|
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
|
* 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.
|
* 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;
|
return NUM_REQUEST_CODES_NEEDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getContentIntentRequestCode() {
|
|
||||||
return mBaseRequestCode + CONTENT_INTENT_REQUEST_CODE_OFFSET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getClearIntentRequestCode() {
|
public int getClearIntentRequestCode() {
|
||||||
return mBaseRequestCode + CLEAR_INTENT_REQUEST_CODE_OFFSET;
|
return mBaseRequestCode + CLEAR_INTENT_REQUEST_CODE_OFFSET;
|
||||||
}
|
}
|
||||||
@@ -121,14 +111,6 @@ public abstract class NotificationState {
|
|||||||
*/
|
*/
|
||||||
public abstract int getIcon();
|
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.
|
* @return the notification priority level for this notification.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -203,17 +203,11 @@ public class ActionServiceImpl extends JobIntentService {
|
|||||||
mBackgroundWorker = DataModel.get().getBackgroundWorkerForActionService();
|
mBackgroundWorker = DataModel.get().getBackgroundWorkerForActionService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queue intent to the ActionService.
|
* Queue intent to the ActionService.
|
||||||
*/
|
*/
|
||||||
private static void startServiceWithIntent(final Intent intent) {
|
private static void startServiceWithIntent(final Intent intent) {
|
||||||
final Context context = Factory.get().getApplicationContext();
|
final Context context = Factory.get().getApplicationContext();
|
||||||
final int opcode = intent.getIntExtra(EXTRA_OP_CODE, 0);
|
|
||||||
intent.setClass(context, ActionServiceImpl.class);
|
intent.setClass(context, ActionServiceImpl.class);
|
||||||
enqueueWork(context, intent);
|
enqueueWork(context, intent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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() {
|
public final String getMessageText() {
|
||||||
final String separator = System.getProperty("line.separator");
|
final String separator = System.lineSeparator();
|
||||||
final StringBuilder text = new StringBuilder();
|
final StringBuilder text = new StringBuilder();
|
||||||
for (final MessagePartData part : mParts) {
|
for (final MessagePartData part : mParts) {
|
||||||
if (!part.isAttachment() && !TextUtils.isEmpty(part.getText())) {
|
if (!part.isAttachment() && !TextUtils.isEmpty(part.getText())) {
|
||||||
@@ -678,7 +678,7 @@ public class MessageData implements Parcelable {
|
|||||||
* appends a text part
|
* appends a text part
|
||||||
*/
|
*/
|
||||||
public final void consolidateText() {
|
public final void consolidateText() {
|
||||||
final String separator = System.getProperty("line.separator");
|
final String separator = System.lineSeparator();
|
||||||
final StringBuilder captionText = new StringBuilder();
|
final StringBuilder captionText = new StringBuilder();
|
||||||
MessagePartData firstTextPart = null;
|
MessagePartData firstTextPart = null;
|
||||||
int firstTextPartIndex = -1;
|
int firstTextPartIndex = -1;
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ import java.util.List;
|
|||||||
public class CustomVCardEntryConstructor implements VCardInterpreter {
|
public class CustomVCardEntryConstructor implements VCardInterpreter {
|
||||||
|
|
||||||
public interface EntryHandler {
|
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
|
* The method called when one vCard entry is created. Children come before their parent in
|
||||||
* nested vCard files.
|
* nested vCard files.
|
||||||
@@ -86,9 +81,6 @@ public class CustomVCardEntryConstructor implements VCardInterpreter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onVCardStarted() {
|
public void onVCardStarted() {
|
||||||
for (EntryHandler entryHandler : mEntryHandlers) {
|
|
||||||
entryHandler.onStart();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -248,10 +248,6 @@ public class VCardRequest implements MediaRequest<VCardResource> {
|
|||||||
mSignal = signal;
|
mSignal = signal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DoesNotRunOnMainThread
|
@DoesNotRunOnMainThread
|
||||||
public void onEntryCreated(final CustomVCardEntry entry) {
|
public void onEntryCreated(final CustomVCardEntry entry) {
|
||||||
|
|||||||
@@ -52,19 +52,16 @@ import android.text.TextUtils;
|
|||||||
|
|
||||||
import com.android.messaging.Factory;
|
import com.android.messaging.Factory;
|
||||||
import com.android.messaging.R;
|
import com.android.messaging.R;
|
||||||
import com.android.messaging.datamodel.MediaScratchFileProvider;
|
|
||||||
import com.android.messaging.datamodel.action.DownloadMmsAction;
|
import com.android.messaging.datamodel.action.DownloadMmsAction;
|
||||||
import com.android.messaging.datamodel.action.SendMessageAction;
|
import com.android.messaging.datamodel.action.SendMessageAction;
|
||||||
import com.android.messaging.datamodel.data.MessageData;
|
import com.android.messaging.datamodel.data.MessageData;
|
||||||
import com.android.messaging.datamodel.data.MessagePartData;
|
import com.android.messaging.datamodel.data.MessagePartData;
|
||||||
import com.android.messaging.mmslib.SqliteWrapper;
|
import com.android.messaging.mmslib.SqliteWrapper;
|
||||||
import com.android.messaging.mmslib.pdu.PduComposer;
|
|
||||||
import com.android.messaging.mmslib.pdu.PduPersister;
|
import com.android.messaging.mmslib.pdu.PduPersister;
|
||||||
import com.android.messaging.sms.SmsSender.SendResult;
|
import com.android.messaging.sms.SmsSender.SendResult;
|
||||||
import com.android.messaging.util.Assert;
|
import com.android.messaging.util.Assert;
|
||||||
import com.android.messaging.util.BugleGservicesKeys;
|
import com.android.messaging.util.BugleGservicesKeys;
|
||||||
import com.android.messaging.util.BuglePrefs;
|
import com.android.messaging.util.BuglePrefs;
|
||||||
import com.android.messaging.util.DebugUtils;
|
|
||||||
import com.android.messaging.util.EmailAddress;
|
import com.android.messaging.util.EmailAddress;
|
||||||
import com.android.messaging.util.ImageUtils;
|
import com.android.messaging.util.ImageUtils;
|
||||||
import com.android.messaging.util.ImageUtils.ImageResizer;
|
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.android.messaging.util.PhoneUtils;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
@@ -87,7 +81,6 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utils for sending sms/mms messages.
|
* Utils for sending sms/mms messages.
|
||||||
@@ -277,10 +270,6 @@ public class MmsUtils {
|
|||||||
|
|
||||||
private static final String sSmilNonVisualAttachmentsWithText = sSmilTextOnly;
|
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 MIN_IMAGE_BYTE_SIZE = 16 * 1024;
|
||||||
public static final int MAX_VIDEO_ATTACHMENT_COUNT = 1;
|
public static final int MAX_VIDEO_ATTACHMENT_COUNT = 1;
|
||||||
|
|
||||||
@@ -1396,43 +1385,6 @@ public class MmsUtils {
|
|||||||
return sHasSmsDateSentColumn;
|
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");
|
public static final Uri MMS_PART_CONTENT_URI = Uri.parse("content://mms/part");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1818,15 +1770,6 @@ public class MmsUtils {
|
|||||||
return pdu;
|
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,
|
public static StatusPlusUri sendMmsMessage(final Context context, final int subId,
|
||||||
final Uri messageUri, final Bundle extras) {
|
final Uri messageUri, final Bundle extras) {
|
||||||
int status = MMS_REQUEST_MANUAL_RETRY;
|
int status = MMS_REQUEST_MANUAL_RETRY;
|
||||||
@@ -2241,40 +2184,6 @@ public class MmsUtils {
|
|||||||
return resolver.delete(messageUri, null /* selection */, null /* selectionArgs */);
|
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) {
|
public static int mapRawStatusToErrorResourceId(final int bugleStatus, final int rawStatus) {
|
||||||
int stringResId = R.string.message_status_send_failed;
|
int stringResId = R.string.message_status_send_failed;
|
||||||
switch (rawStatus) {
|
switch (rawStatus) {
|
||||||
@@ -2304,53 +2213,4 @@ public class MmsUtils {
|
|||||||
}
|
}
|
||||||
return stringResId;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
public View getHeaderView(final View convertView, final ViewGroup parentView) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
|
||||||
// do nothing in base class.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Observer extends DataSetObserver {
|
private class Observer extends DataSetObserver {
|
||||||
@@ -116,56 +112,6 @@ public class CompositeAdapter extends BaseAdapter {
|
|||||||
notifyDataSetChanged();
|
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() {
|
public void invalidate() {
|
||||||
mCacheValid = false;
|
mCacheValid = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,14 +278,6 @@ public class ConversationActivity extends BugleActionBarActivity
|
|||||||
invalidateActionBar();
|
invalidateActionBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // From ConversationFragmentHost
|
|
||||||
public void onConversationMessagesUpdated(final int numberOfMessages) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // From ConversationFragmentHost
|
|
||||||
public void onConversationParticipantDataLoaded(final int numberOfParticipants) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // From ConversationFragmentHost
|
@Override // From ConversationFragmentHost
|
||||||
public boolean isActiveAndFocused() {
|
public boolean isActiveAndFocused() {
|
||||||
return !mIsPaused && hasWindowFocus();
|
return !mIsPaused && hasWindowFocus();
|
||||||
|
|||||||
@@ -131,14 +131,11 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
|||||||
ActionMode startActionMode(ActionMode.Callback callback);
|
ActionMode startActionMode(ActionMode.Callback callback);
|
||||||
void dismissActionMode();
|
void dismissActionMode();
|
||||||
ActionMode getActionMode();
|
ActionMode getActionMode();
|
||||||
void onConversationMessagesUpdated(int numberOfMessages);
|
|
||||||
void onConversationParticipantDataLoaded(int numberOfParticipants);
|
|
||||||
boolean isActiveAndFocused();
|
boolean isActiveAndFocused();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String FRAGMENT_TAG = "conversation";
|
public static final String FRAGMENT_TAG = "conversation";
|
||||||
|
|
||||||
static final int REQUEST_CHOOSE_ATTACHMENTS = 2;
|
|
||||||
private static final int JUMP_SCROLL_THRESHOLD = 15;
|
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
|
// 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
|
// 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) {
|
if (cursor != null) {
|
||||||
mHost.onConversationMessagesUpdated(cursor.getCount());
|
|
||||||
|
|
||||||
// Are we coming from a widget click where we're told to scroll to a particular item?
|
// Are we coming from a widget click where we're told to scroll to a particular item?
|
||||||
final int scrollToPos = getScrollToMessagePosition();
|
final int scrollToPos = getScrollToMessagePosition();
|
||||||
if (scrollToPos >= 0) {
|
if (scrollToPos >= 0) {
|
||||||
@@ -1164,8 +1159,6 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
|||||||
mHost.invalidateActionBar();
|
mHost.invalidateActionBar();
|
||||||
|
|
||||||
mRecyclerView.setVisibility(View.VISIBLE);
|
mRecyclerView.setVisibility(View.VISIBLE);
|
||||||
mHost.onConversationParticipantDataLoaded
|
|
||||||
(mBinding.getData().getNumberOfParticipantsExcludingSelf());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1542,11 +1535,6 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showHideSimSelector(final boolean show) {
|
|
||||||
// no-op for now
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSimSelectorItemLayoutId() {
|
public int getSimSelectorItemLayoutId() {
|
||||||
return R.layout.sim_selector_item_view;
|
return R.layout.sim_selector_item_view;
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ public class ConversationInputManager implements ConversationInput.ConversationI
|
|||||||
void onStartComposeMessage();
|
void onStartComposeMessage();
|
||||||
SimSelectorView getSimSelectorView();
|
SimSelectorView getSimSelectorView();
|
||||||
MediaPicker createMediaPicker();
|
MediaPicker createMediaPicker();
|
||||||
void showHideSimSelector(boolean show);
|
|
||||||
int getSimSelectorItemLayoutId();
|
int getSimSelectorItemLayoutId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,15 +492,12 @@ public class ConversationInputManager implements ConversationInput.ConversationI
|
|||||||
@Override
|
@Override
|
||||||
public boolean show(boolean animate) {
|
public boolean show(boolean animate) {
|
||||||
final boolean result = super.show(animate);
|
final boolean result = super.show(animate);
|
||||||
mHost.showHideSimSelector(true /*show*/);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hide(boolean animate) {
|
public boolean hide(boolean animate) {
|
||||||
final boolean result = super.hide(animate);
|
return super.hide(animate);
|
||||||
mHost.showHideSimSelector(false /*show*/);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,11 +104,6 @@ class CameraMediaChooser extends MediaChooser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public View destroyView() {
|
|
||||||
return super.destroyView();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected View createView(final ViewGroup container) {
|
protected View createView(final ViewGroup container) {
|
||||||
final LayoutInflater inflater = getLayoutInflater();
|
final LayoutInflater inflater = getLayoutInflater();
|
||||||
|
|||||||
@@ -107,9 +107,6 @@ abstract class MediaChooser extends BasePagerViewHolder
|
|||||||
return LayoutInflater.from(getContext());
|
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 */
|
/** Allows the chooser to handle the chooser being opened or closed */
|
||||||
void onOpenedChanged(final boolean open) {
|
void onOpenedChanged(final boolean open) {
|
||||||
mOpen = open;
|
mOpen = open;
|
||||||
@@ -176,9 +173,6 @@ abstract class MediaChooser extends BasePagerViewHolder
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCreateOptionsMenu(final MenuInflater inflater, final Menu menu) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -204,5 +198,4 @@ abstract class MediaChooser extends BasePagerViewHolder
|
|||||||
|
|
||||||
/** Optional activity life-cycle methods to be overridden by subclasses */
|
/** Optional activity life-cycle methods to be overridden by subclasses */
|
||||||
public void onPause() { }
|
public void onPause() { }
|
||||||
public void onResume() { }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@@ -545,7 +536,6 @@ public class MediaPicker extends Fragment implements DraftMessageSubscriptionDat
|
|||||||
mListenerHandler.post(() -> mListener.onOpened());
|
mListenerHandler.post(() -> mListener.onOpened());
|
||||||
}
|
}
|
||||||
if (mSelectedChooser != null) {
|
if (mSelectedChooser != null) {
|
||||||
mSelectedChooser.onFullScreenChanged(false);
|
|
||||||
mSelectedChooser.onOpenedChanged(true);
|
mSelectedChooser.onOpenedChanged(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -566,9 +556,6 @@ public class MediaPicker extends Fragment implements DraftMessageSubscriptionDat
|
|||||||
if (mListener != null) {
|
if (mListener != null) {
|
||||||
mListenerHandler.post(() -> mListener.onFullScreenChanged(fullScreen));
|
mListenerHandler.post(() -> mListener.onFullScreenChanged(fullScreen));
|
||||||
}
|
}
|
||||||
if (mSelectedChooser != null) {
|
|
||||||
mSelectedChooser.onFullScreenChanged(fullScreen);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatchItemsSelected(final MessagePartData item, final boolean dismissMediaPicker) {
|
void dispatchItemsSelected(final MessagePartData item, final boolean dismissMediaPicker) {
|
||||||
@@ -641,9 +628,6 @@ public class MediaPicker extends Fragment implements DraftMessageSubscriptionDat
|
|||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(@NonNull final Menu menu,
|
public void onCreateOptionsMenu(@NonNull final Menu menu,
|
||||||
@NonNull final MenuInflater inflater) {
|
@NonNull final MenuInflater inflater) {
|
||||||
if (mSelectedChooser != null) {
|
|
||||||
mSelectedChooser.onCreateOptionsMenu(inflater, menu);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.content.Context;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
|
||||||
import com.android.messaging.Factory;
|
|
||||||
import com.android.messaging.R;
|
import com.android.messaging.R;
|
||||||
import com.android.messaging.datamodel.DataModel;
|
import com.android.messaging.datamodel.DataModel;
|
||||||
|
|
||||||
@@ -41,7 +40,6 @@ public class BugleActivityUtil {
|
|||||||
*/
|
*/
|
||||||
public static boolean onActivityResume(Context context, Activity activity) {
|
public static boolean onActivityResume(Context context, Activity activity) {
|
||||||
DataModel.get().onActivityResume();
|
DataModel.get().onActivityResume();
|
||||||
Factory.get().onActivityResume();
|
|
||||||
|
|
||||||
// Validate all requirements to run are met
|
// Validate all requirements to run are met
|
||||||
return checkHasSmsPermissionsForUser(context, activity);
|
return checkHasSmsPermissionsForUser(context, activity);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -17,83 +17,7 @@
|
|||||||
|
|
||||||
package com.android.messaging.util;
|
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 {
|
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.
|
|
||||||
* <p>
|
|
||||||
* 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
|
* 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
|
* go. For example, if foo() calls bar(), and bar() calls getCaller(0), it returns info about
|
||||||
|
|||||||
Reference in New Issue
Block a user