Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1f1852c authored by Rhed Jao's avatar Rhed Jao Committed by Android (Google) Code Review
Browse files

Merge changes from topic "increase_call_log_size" into main

* changes:
  Allow partners to config the maximum number of call logs for Sim
  Define a new config for the maximum call log size
parents 94b25af6 69fc8d93
Loading
Loading
Loading
Loading
+33 −9
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.UserHandleAware;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.ContentProvider;
import android.content.ContentResolver;
import android.content.ContentValues;
@@ -1623,6 +1624,19 @@ public class CallLog {
        public static final String IS_PHONE_ACCOUNT_MIGRATION_PENDING =
                "is_call_log_phone_account_migration_pending";

        /**
         * The default maximum number of call log entries stored in the call log provider for each
         * {@link PhoneAccountHandle}.
         */
        private static final int DEFAULT_MAX_CALL_LOG_SIZE = 500;

        /**
         * Expected component name of Telephony phone accounts.
         */
        private static final ComponentName TELEPHONY_COMPONENT_NAME =
                new ComponentName("com.android.phone",
                        "com.android.services.telephony.TelephonyConnectionService");

        /**
         * Adds a call to the call log.
         *
@@ -2084,25 +2098,35 @@ public class CallLog {
                }

                int numDeleted;
                if (values.containsKey(PHONE_ACCOUNT_ID)
                        && !TextUtils.isEmpty(values.getAsString(PHONE_ACCOUNT_ID))
                        && values.containsKey(PHONE_ACCOUNT_COMPONENT_NAME)
                        && !TextUtils.isEmpty(values.getAsString(PHONE_ACCOUNT_COMPONENT_NAME))) {
                final String phoneAccountId =
                        values.containsKey(PHONE_ACCOUNT_ID)
                                ? values.getAsString(PHONE_ACCOUNT_ID) : null;
                final String phoneAccountComponentName =
                        values.containsKey(PHONE_ACCOUNT_COMPONENT_NAME)
                                ? values.getAsString(PHONE_ACCOUNT_COMPONENT_NAME) : null;
                int maxCallLogSize = DEFAULT_MAX_CALL_LOG_SIZE;
                if (!TextUtils.isEmpty(phoneAccountId)
                        && !TextUtils.isEmpty(phoneAccountComponentName)) {
                    if (android.provider.Flags.allowConfigMaximumCallLogEntriesPerSim()
                            && TELEPHONY_COMPONENT_NAME
                                    .flattenToString().equals(phoneAccountComponentName)) {
                        maxCallLogSize = context.getResources().getInteger(
                                com.android.internal.R.integer.config_maximumCallLogEntriesPerSim);
                    }
                    // Only purge entries for the same phone account.
                    numDeleted = resolver.delete(uri, "_id IN "
                            + "(SELECT _id FROM calls"
                            + " WHERE " + PHONE_ACCOUNT_COMPONENT_NAME + " = ?"
                            + " AND " + PHONE_ACCOUNT_ID + " = ?"
                            + " ORDER BY " + DEFAULT_SORT_ORDER
                            + " LIMIT -1 OFFSET 500)", new String[] {
                            values.getAsString(PHONE_ACCOUNT_COMPONENT_NAME),
                            values.getAsString(PHONE_ACCOUNT_ID)
                    });
                            + " LIMIT -1 OFFSET " + maxCallLogSize + ")",
                            new String[] { phoneAccountComponentName, phoneAccountId }
                    );
                } else {
                    // No valid phone account specified, so default to the old behavior.
                    numDeleted = resolver.delete(uri, "_id IN "
                            + "(SELECT _id FROM calls ORDER BY " + DEFAULT_SORT_ORDER
                            + " LIMIT -1 OFFSET 500)", null);
                            + " LIMIT -1 OFFSET " + maxCallLogSize + ")", null);
                }
                Log.i(LOG_TAG, "addEntry: cleaned up " + numDeleted + " old entries");

+13 −1
Original line number Diff line number Diff line
@@ -31,3 +31,15 @@ flag {
    description: "Add a new settings page for the RUN_BACKUP_JOBS permission."
    bug: "320563660"
}

# OWNER = tgunn TARGET=25Q1
flag {
    name: "allow_config_maximum_call_log_entries_per_sim"
    is_exported: true
    namespace: "telecom"
    description: "Allow partners to modify the maximum number of call log size for each sim card."
    bug: "352235494"
    metadata {
        purpose: PURPOSE_FEATURE
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -7100,4 +7100,8 @@
    <!-- Whether to enable the private space search illustration and search tile content in "Hide Private Space" settings page.
         OEM/Partner can explicitly opt to hide the illustration and search tile content. -->
    <bool name="config_enableSearchTileHideIllustrationInPrivateSpace">true</bool>

    <!-- The maximum number of call log entries for each sim card that can be stored in the call log
         provider on the device. -->
    <integer name="config_maximumCallLogEntriesPerSim">500</integer>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -5530,6 +5530,8 @@
  <java-symbol type="integer" name="config_wallpaperFrameRateCompatibility" />

  <java-symbol type="integer" name="config_defaultMinEmergencyGestureTapDurationMillis" />
  <java-symbol type="integer" name="config_maximumCallLogEntriesPerSim" />

  <!-- Back swipe thresholds -->
  <java-symbol type="dimen" name="navigation_edge_action_progress_threshold" />
  <java-symbol type="dimen" name="back_progress_non_linear_factor" />