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

Commit f0a852f4 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11392706 from 87b83a22 to 24Q2-release

Change-Id: Ibd85e8c6333b549689be3b2ff07453a8c9a422e4
parents 1d03ab69 87b83a22
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
    <string name="telecommAppLabel" product="default" msgid="1825598513414129827">"ဖုန်းခေါ်ဆိုမှုများ"</string>
    <string name="userCallActivityLabel" product="default" msgid="3605391260292846248">"ဖုန်း"</string>
    <string name="unknown" msgid="6993977514360123431">"မသိပါ"</string>
    <string name="notification_missedCallTitle" msgid="5060387047205532974">"လွသွားသော ဖုန်းခေါ်မှု"</string>
    <string name="notification_missedCallTitle" msgid="5060387047205532974">"လွတ်သွားသော ခေါ်ဆိုမှု"</string>
    <string name="notification_missedWorkCallTitle" msgid="6965463282259034953">"လွတ်သွားသည့် အလုပ်ဆိုင်ရာ ခ​ေါ်ဆိုမှု"</string>
    <string name="notification_missedCallsTitle" msgid="3910479625507893809">"လွဲသွားသော ဖုန်းခေါ်မှုများ"</string>
    <string name="notification_missedCallsMsg" msgid="5055782736170916682">"<xliff:g id="NUM_MISSED_CALLS">%s</xliff:g> လွဲသွားသော ဖုန်းခေါ်မှုများ"</string>
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
    <string name="notification_missedCallsTitle" msgid="3910479625507893809">"ମିସ୍ଡ କଲ୍"</string>
    <string name="notification_missedCallsMsg" msgid="5055782736170916682">"<xliff:g id="NUM_MISSED_CALLS">%s</xliff:g>ଟି ମିସ୍ଡ କଲ୍"</string>
    <string name="notification_missedCallTicker" msgid="6731461957487087769">"<xliff:g id="MISSED_CALL_FROM">%s</xliff:g>ଙ୍କ ଠାରୁ ମିସ୍-କଲ୍ ମିଳିଛି"</string>
    <string name="notification_missedCall_call_back" msgid="7900333283939789732">"କଲବ୍ୟାକ୍ କରନ୍ତୁ"</string>
    <string name="notification_missedCall_call_back" msgid="7900333283939789732">"କଲବେକ କରନ୍ତୁ"</string>
    <string name="notification_missedCall_message" msgid="4054698824390076431">"ମେସେଜ୍‍ ଦିଅନ୍ତୁ"</string>
    <string name="notification_disconnectedCall_title" msgid="1790131923692416928">"କଲ୍ ବିଚ୍ଛିନ୍ନ କରାଯାଇଛି"</string>
    <string name="notification_disconnectedCall_body" msgid="600491714584417536">"ଏକ ଜରୁରୀକାଳୀନ କଲ୍ କରାଯାଇଥିବାରୁ <xliff:g id="CALLER">%s</xliff:g>ଙ୍କୁ କରାଯାଇଥିବା କଲ୍ ବିଚ୍ଛିନ୍ନ କରାଯାଇଛି।"</string>
+144 −45
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ import android.util.Xml;

// TODO: Needed for move to system service: import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.flags.FeatureFlags;
import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.XmlUtils;
import com.android.modules.utils.ModifiedUtf8;
@@ -81,10 +82,12 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
@@ -181,19 +184,19 @@ public class PhoneAccountRegistrar {
    private interface PhoneAccountRegistrarWriteLock {}
    private final PhoneAccountRegistrarWriteLock mWriteLock =
            new PhoneAccountRegistrarWriteLock() {};
    private final com.android.internal.telephony.flags.FeatureFlags mTelephonyFeatureFlags;
    private final FeatureFlags mTelephonyFeatureFlags;

    @VisibleForTesting
    public PhoneAccountRegistrar(Context context, TelecomSystem.SyncRoot lock,
            DefaultDialerCache defaultDialerCache, AppLabelProxy appLabelProxy,
            com.android.internal.telephony.flags.FeatureFlags telephonyFeatureFlags) {
            FeatureFlags telephonyFeatureFlags) {
        this(context, lock, FILE_NAME, defaultDialerCache, appLabelProxy, telephonyFeatureFlags);
    }

    @VisibleForTesting
    public PhoneAccountRegistrar(Context context, TelecomSystem.SyncRoot lock, String fileName,
            DefaultDialerCache defaultDialerCache, AppLabelProxy appLabelProxy,
            com.android.internal.telephony.flags.FeatureFlags telephonyFeatureFlags) {
            FeatureFlags telephonyFeatureFlags) {

        mAtomicFile = new AtomicFile(new File(context.getFilesDir(), fileName));

@@ -951,6 +954,9 @@ public class PhoneAccountRegistrar {
        enforceCharacterLimit(account);
        enforceIconSizeLimit(account);
        enforceMaxPhoneAccountLimit(account);
        if (mTelephonyFeatureFlags.simultaneousCallingIndications()) {
            enforceSimultaneousCallingRestrictionLimit(account);
        }
        addOrReplacePhoneAccount(account);
    }

@@ -1078,6 +1084,43 @@ public class PhoneAccountRegistrar {
        }
    }

    /**
     * Enforce size limits on the simultaneous calling restriction of a PhoneAccount.
     * If a PhoneAccount has a simultaneous calling restriction on it, enforce the following: the
     * number of PhoneAccountHandles in the Set can not exceed the per app restriction on
     * PhoneAccounts registered and each PhoneAccountHandle's fields must not exceed the per field
     * character limit.
     * @param account The PhoneAccount to enforce simultaneous calling restrictions on.
     * @throws IllegalArgumentException if the PhoneAccount exceeds size limits.
     */
    public void enforceSimultaneousCallingRestrictionLimit(@NonNull PhoneAccount account) {
        if (!account.hasSimultaneousCallingRestriction()) return;
        Set<PhoneAccountHandle> restrictions = account.getSimultaneousCallingRestriction();
        if (restrictions.size() > MAX_PHONE_ACCOUNT_REGISTRATIONS) {
            throw new IllegalArgumentException("Can not register a PhoneAccount with a number"
                    + "of simultaneous calling restrictions that is greater than "
                    + MAX_PHONE_ACCOUNT_REGISTRATIONS);
        }
        for (PhoneAccountHandle handle : restrictions) {
            ComponentName component = handle.getComponentName();
            if (component.getPackageName().length() > MAX_PHONE_ACCOUNT_FIELD_CHAR_LIMIT) {
                throw new IllegalArgumentException("A PhoneAccountHandle added as part of "
                        + "a simultaneous calling restriction has a package name that has exceeded "
                        + "the character limit of " + MAX_PHONE_ACCOUNT_FIELD_CHAR_LIMIT);
            }
            if (component.getClassName().length() > MAX_PHONE_ACCOUNT_FIELD_CHAR_LIMIT) {
                throw new IllegalArgumentException("A PhoneAccountHandle added as part of "
                        + "a simultaneous calling restriction has a class name that has exceeded "
                        + "the character limit of " + MAX_PHONE_ACCOUNT_FIELD_CHAR_LIMIT);
            }
            if (handle.getId().length() > MAX_PHONE_ACCOUNT_FIELD_CHAR_LIMIT) {
                throw new IllegalArgumentException("A PhoneAccountHandle added as part of "
                        + "a simultaneous calling restriction has an ID that has exceeded "
                        + "the character limit of " + MAX_PHONE_ACCOUNT_FIELD_CHAR_LIMIT);
            }
        }
    }

    /**
     * Enforce a character limit on all PA and PAH string or char-sequence fields.
     *
@@ -1878,7 +1921,7 @@ public class PhoneAccountRegistrar {
            sortPhoneAccounts();
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            XmlSerializer serializer = Xml.resolveSerializer(os);
            writeToXml(mState, serializer, mContext);
            writeToXml(mState, serializer, mContext, mTelephonyFeatureFlags);
            serializer.flush();
            new AsyncXmlWriter().execute(os);
        } catch (IOException e) {
@@ -1899,7 +1942,7 @@ public class PhoneAccountRegistrar {
        try {
            XmlPullParser parser = Xml.resolvePullParser(is);
            parser.nextTag();
            mState = readFromXml(parser, mContext);
            mState = readFromXml(parser, mContext, mTelephonyFeatureFlags);
            migratePhoneAccountHandle(mState);
            versionChanged = mState.versionNumber < EXPECTED_STATE_VERSION;

@@ -1934,14 +1977,14 @@ public class PhoneAccountRegistrar {
        }
    }

    private static void writeToXml(State state, XmlSerializer serializer, Context context)
            throws IOException {
        sStateXml.writeToXml(state, serializer, context);
    private static void writeToXml(State state, XmlSerializer serializer, Context context,
            FeatureFlags telephonyFeatureFlags) throws IOException {
        sStateXml.writeToXml(state, serializer, context, telephonyFeatureFlags);
    }

    private static State readFromXml(XmlPullParser parser, Context context)
            throws IOException, XmlPullParserException {
        State s = sStateXml.readFromXml(parser, 0, context);
    private static State readFromXml(XmlPullParser parser, Context context,
            FeatureFlags telephonyFeatureFlags) throws IOException, XmlPullParserException {
        State s = sStateXml.readFromXml(parser, 0, context, telephonyFeatureFlags);
        return s != null ? s : new State();
    }

@@ -2007,8 +2050,8 @@ public class PhoneAccountRegistrar {
        /**
         * Write the supplied object to XML
         */
        public abstract void writeToXml(T o, XmlSerializer serializer, Context context)
                throws IOException;
        public abstract void writeToXml(T o, XmlSerializer serializer, Context context,
                FeatureFlags telephonyFeatureFlags) throws IOException;

        /**
         * Read from the supplied XML into a new object, returning null in case of an
@@ -2017,8 +2060,8 @@ public class PhoneAccountRegistrar {
         * object's writeToXml(). This object tries to fail early without modifying
         * 'parser' if it does not recognize the data it sees.
         */
        public abstract T readFromXml(XmlPullParser parser, int version, Context context)
                throws IOException, XmlPullParserException;
        public abstract T readFromXml(XmlPullParser parser, int version, Context context,
                FeatureFlags telephonyFeatureFlags) throws IOException, XmlPullParserException;

        protected void writeTextIfNonNull(String tagName, Object value, XmlSerializer serializer)
                throws IOException {
@@ -2029,6 +2072,29 @@ public class PhoneAccountRegistrar {
            }
        }

        /**
         * Serializes a List of PhoneAccountHandles.
         * @param tagName The tag for the List
         * @param handles The List of PhoneAccountHandles to serialize
         * @param serializer The serializer
         * @throws IOException if serialization fails.
         */
        protected void writePhoneAccountHandleSet(String tagName, Set<PhoneAccountHandle> handles,
                XmlSerializer serializer, Context context, FeatureFlags telephonyFeatureFlags)
                throws IOException {
            serializer.startTag(null, tagName);
            if (handles != null) {
                serializer.attribute(null, ATTRIBUTE_LENGTH, Objects.toString(handles.size()));
                for (PhoneAccountHandle handle : handles) {
                    sPhoneAccountHandleXml.writeToXml(handle, serializer, context,
                            telephonyFeatureFlags);
                }
            } else {
                serializer.attribute(null, ATTRIBUTE_LENGTH, "0");
            }
            serializer.endTag(null, tagName);
        }

        /**
         * Serializes a string array.
         *
@@ -2123,6 +2189,21 @@ public class PhoneAccountRegistrar {
            serializer.endTag(null, tagName);
        }

        protected Set<PhoneAccountHandle> readPhoneAccountHandleSet(XmlPullParser parser,
                int version, Context context, FeatureFlags telephonyFeatureFlags)
                throws IOException, XmlPullParserException {
            int length = Integer.parseInt(parser.getAttributeValue(null, ATTRIBUTE_LENGTH));
            Set<PhoneAccountHandle> handles = new HashSet<>(length);
            if (length == 0) return handles;

            int outerDepth = parser.getDepth();
            while (XmlUtils.nextElementWithin(parser, outerDepth)) {
                handles.add(sPhoneAccountHandleXml.readFromXml(parser, version, context,
                        telephonyFeatureFlags));
            }
            return handles;
        }

        /**
         * Reads a string array from the XML parser.
         *
@@ -2230,8 +2311,8 @@ public class PhoneAccountRegistrar {
        private static final String VERSION = "version";

        @Override
        public void writeToXml(State o, XmlSerializer serializer, Context context)
                throws IOException {
        public void writeToXml(State o, XmlSerializer serializer, Context context,
                FeatureFlags telephonyFeatureFlags) throws IOException {
            if (o != null) {
                serializer.startTag(null, CLASS_STATE);
                serializer.attribute(null, VERSION, Objects.toString(EXPECTED_STATE_VERSION));
@@ -2239,14 +2320,15 @@ public class PhoneAccountRegistrar {
                serializer.startTag(null, DEFAULT_OUTGOING);
                for (DefaultPhoneAccountHandle defaultPhoneAccountHandle : o
                        .defaultOutgoingAccountHandles.values()) {
                    sDefaultPhoneAcountHandleXml
                            .writeToXml(defaultPhoneAccountHandle, serializer, context);
                    sDefaultPhoneAccountHandleXml
                            .writeToXml(defaultPhoneAccountHandle, serializer, context,
                                    telephonyFeatureFlags);
                }
                serializer.endTag(null, DEFAULT_OUTGOING);

                serializer.startTag(null, ACCOUNTS);
                for (PhoneAccount m : o.accounts) {
                    sPhoneAccountXml.writeToXml(m, serializer, context);
                    sPhoneAccountXml.writeToXml(m, serializer, context, telephonyFeatureFlags);
                }
                serializer.endTag(null, ACCOUNTS);

@@ -2255,8 +2337,8 @@ public class PhoneAccountRegistrar {
        }

        @Override
        public State readFromXml(XmlPullParser parser, int version, Context context)
                throws IOException, XmlPullParserException {
        public State readFromXml(XmlPullParser parser, int version, Context context,
                FeatureFlags telephonyFeatureFlags) throws IOException, XmlPullParserException {
            if (parser.getName().equals(CLASS_STATE)) {
                State s = new State();

@@ -2272,7 +2354,8 @@ public class PhoneAccountRegistrar {
                            // assume there are no groups.
                            parser.nextTag();
                            PhoneAccountHandle phoneAccountHandle = sPhoneAccountHandleXml
                                    .readFromXml(parser, s.versionNumber, context);
                                    .readFromXml(parser, s.versionNumber, context,
                                            telephonyFeatureFlags);
                            UserManager userManager = UserManager.get(context);
                            UserInfo primaryUser = userManager.getPrimaryUser();
                            if (primaryUser != null) {
@@ -2287,8 +2370,9 @@ public class PhoneAccountRegistrar {
                            int defaultAccountHandlesDepth = parser.getDepth();
                            while (XmlUtils.nextElementWithin(parser, defaultAccountHandlesDepth)) {
                                DefaultPhoneAccountHandle accountHandle
                                        = sDefaultPhoneAcountHandleXml
                                        .readFromXml(parser, s.versionNumber, context);
                                        = sDefaultPhoneAccountHandleXml
                                        .readFromXml(parser, s.versionNumber, context,
                                                telephonyFeatureFlags);
                                if (accountHandle != null && s.accounts != null) {
                                    s.defaultOutgoingAccountHandles
                                            .put(accountHandle.userHandle, accountHandle);
@@ -2299,7 +2383,7 @@ public class PhoneAccountRegistrar {
                        int accountsDepth = parser.getDepth();
                        while (XmlUtils.nextElementWithin(parser, accountsDepth)) {
                            PhoneAccount account = sPhoneAccountXml.readFromXml(parser,
                                    s.versionNumber, context);
                                    s.versionNumber, context, telephonyFeatureFlags);

                            if (account != null && s.accounts != null) {
                                s.accounts.add(account);
@@ -2314,7 +2398,7 @@ public class PhoneAccountRegistrar {
    };

    @VisibleForTesting
    public static final XmlSerialization<DefaultPhoneAccountHandle> sDefaultPhoneAcountHandleXml  =
    public static final XmlSerialization<DefaultPhoneAccountHandle> sDefaultPhoneAccountHandleXml =
            new XmlSerialization<DefaultPhoneAccountHandle>() {
                private static final String CLASS_DEFAULT_OUTGOING_PHONE_ACCOUNT_HANDLE
                        = "default_outgoing_phone_account_handle";
@@ -2324,7 +2408,7 @@ public class PhoneAccountRegistrar {

                @Override
                public void writeToXml(DefaultPhoneAccountHandle o, XmlSerializer serializer,
                        Context context) throws IOException {
                        Context context, FeatureFlags telephonyFeatureFlags) throws IOException {
                    if (o != null) {
                        final UserManager userManager = UserManager.get(context);
                        final long serialNumber = userManager.getSerialNumberForUser(o.userHandle);
@@ -2334,7 +2418,7 @@ public class PhoneAccountRegistrar {
                            writeNonNullString(GROUP_ID, o.groupId, serializer);
                            serializer.startTag(null, ACCOUNT_HANDLE);
                            sPhoneAccountHandleXml.writeToXml(o.phoneAccountHandle, serializer,
                                    context);
                                    context, telephonyFeatureFlags);
                            serializer.endTag(null, ACCOUNT_HANDLE);
                            serializer.endTag(null, CLASS_DEFAULT_OUTGOING_PHONE_ACCOUNT_HANDLE);
                        }
@@ -2343,7 +2427,7 @@ public class PhoneAccountRegistrar {

                @Override
                public DefaultPhoneAccountHandle readFromXml(XmlPullParser parser, int version,
                        Context context)
                        Context context, FeatureFlags telephonyFeatureFlags)
                        throws IOException, XmlPullParserException {
                    if (parser.getName().equals(CLASS_DEFAULT_OUTGOING_PHONE_ACCOUNT_HANDLE)) {
                        int outerDepth = parser.getDepth();
@@ -2354,7 +2438,7 @@ public class PhoneAccountRegistrar {
                            if (parser.getName().equals(ACCOUNT_HANDLE)) {
                                parser.nextTag();
                                accountHandle = sPhoneAccountHandleXml.readFromXml(parser, version,
                                        context);
                                        context, telephonyFeatureFlags);
                            } else if (parser.getName().equals(USER_SERIAL_NUMBER)) {
                                parser.next();
                                userSerialNumberString = parser.getText();
@@ -2405,16 +2489,19 @@ public class PhoneAccountRegistrar {
        private static final String ICON = "icon";
        private static final String EXTRAS = "extras";
        private static final String ENABLED = "enabled";
        private static final String SIMULTANEOUS_CALLING_RESTRICTION
                = "simultaneous_calling_restriction";

        @Override
        public void writeToXml(PhoneAccount o, XmlSerializer serializer, Context context)
                throws IOException {
        public void writeToXml(PhoneAccount o, XmlSerializer serializer, Context context,
                FeatureFlags telephonyFeatureFlags) throws IOException {
            if (o != null) {
                serializer.startTag(null, CLASS_PHONE_ACCOUNT);

                if (o.getAccountHandle() != null) {
                    serializer.startTag(null, ACCOUNT_HANDLE);
                    sPhoneAccountHandleXml.writeToXml(o.getAccountHandle(), serializer, context);
                    sPhoneAccountHandleXml.writeToXml(o.getAccountHandle(), serializer, context,
                            telephonyFeatureFlags);
                    serializer.endTag(null, ACCOUNT_HANDLE);
                }

@@ -2431,13 +2518,19 @@ public class PhoneAccountRegistrar {
                writeTextIfNonNull(ENABLED, o.isEnabled() ? "true" : "false" , serializer);
                writeTextIfNonNull(SUPPORTED_AUDIO_ROUTES, Integer.toString(
                        o.getSupportedAudioRoutes()), serializer);
                if (o.hasSimultaneousCallingRestriction()
                        && telephonyFeatureFlags.simultaneousCallingIndications()) {
                    writePhoneAccountHandleSet(SIMULTANEOUS_CALLING_RESTRICTION,
                            o.getSimultaneousCallingRestriction(), serializer, context,
                            telephonyFeatureFlags);
                }

                serializer.endTag(null, CLASS_PHONE_ACCOUNT);
            }
        }

        public PhoneAccount readFromXml(XmlPullParser parser, int version, Context context)
                throws IOException, XmlPullParserException {
        public PhoneAccount readFromXml(XmlPullParser parser, int version, Context context,
                FeatureFlags telephonyFeatureFlags) throws IOException, XmlPullParserException {
            if (parser.getName().equals(CLASS_PHONE_ACCOUNT)) {
                int outerDepth = parser.getDepth();
                PhoneAccountHandle accountHandle = null;
@@ -2456,12 +2549,13 @@ public class PhoneAccountRegistrar {
                Icon icon = null;
                boolean enabled = false;
                Bundle extras = null;
                Set<PhoneAccountHandle> simultaneousCallingRestriction = null;

                while (XmlUtils.nextElementWithin(parser, outerDepth)) {
                    if (parser.getName().equals(ACCOUNT_HANDLE)) {
                        parser.nextTag();
                        accountHandle = sPhoneAccountHandleXml.readFromXml(parser, version,
                                context);
                                context, telephonyFeatureFlags);
                    } else if (parser.getName().equals(ADDRESS)) {
                        parser.next();
                        address = Uri.parse(parser.getText());
@@ -2506,6 +2600,12 @@ public class PhoneAccountRegistrar {
                    } else if (parser.getName().equals(SUPPORTED_AUDIO_ROUTES)) {
                        parser.next();
                        supportedAudioRoutes = Integer.parseInt(parser.getText());
                    } else if (parser.getName().equals(SIMULTANEOUS_CALLING_RESTRICTION)) {
                        // We can not flag this because we always need to handle the case where
                        // this info is in the XML for parsing reasons. We only flag setting the
                        // parsed value below based on the flag.
                        simultaneousCallingRestriction = readPhoneAccountHandleSet(parser, version,
                                context, telephonyFeatureFlags);
                    }
                }

@@ -2587,6 +2687,9 @@ public class PhoneAccountRegistrar {
                } else if (!TextUtils.isEmpty(iconPackageName)) {
                    builder.setIcon(Icon.createWithResource(iconPackageName, iconResId));
                    // TODO: Need to set tint.
                } else if (simultaneousCallingRestriction != null
                        && telephonyFeatureFlags.simultaneousCallingIndications()) {
                    builder.setSimultaneousCallingRestriction(simultaneousCallingRestriction);
                }

                return builder.build();
@@ -2618,8 +2721,8 @@ public class PhoneAccountRegistrar {
        private static final String USER_SERIAL_NUMBER = "user_serial_number";

        @Override
        public void writeToXml(PhoneAccountHandle o, XmlSerializer serializer, Context context)
                throws IOException {
        public void writeToXml(PhoneAccountHandle o, XmlSerializer serializer, Context context,
                FeatureFlags telephonyFeatureFlags) throws IOException {
            if (o != null) {
                serializer.startTag(null, CLASS_PHONE_ACCOUNT_HANDLE);

@@ -2641,8 +2744,8 @@ public class PhoneAccountRegistrar {
        }

        @Override
        public PhoneAccountHandle readFromXml(XmlPullParser parser, int version, Context context)
                throws IOException, XmlPullParserException {
        public PhoneAccountHandle readFromXml(XmlPullParser parser, int version, Context context,
                FeatureFlags telephonyFeatureFlags) throws IOException, XmlPullParserException {
            if (parser.getName().equals(CLASS_PHONE_ACCOUNT_HANDLE)) {
                String componentNameString = null;
                String idString = null;
@@ -2682,8 +2785,4 @@ public class PhoneAccountRegistrar {
            return null;
        }
    };

    private String nullToEmpty(String str) {
        return str == null ? "" : str;
    }
}