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

Unverified Commit 70d4b0ab authored by Kevin F. Haggerty's avatar Kevin F. Haggerty
Browse files

Merge tag 'android-security-10.0.0_r48' into staging/lineage-17.1_merge-android-security-10.0.0_r48

Android security 10.0.0 release 48

* tag 'android-security-10.0.0_r48':
  Accept repeated locale as an input of LocaleList construction.
  Sanitize more of the notification text fields
  DO NOT MERGE Don't allow non-instant permissions for instant apps.

Change-Id: Idc1a183b62e2cb8194b5af467a5ee0fdcb3d6505
parents 44f7cdc0 9d69c14f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ public class Notification implements Parcelable
     * <p>
     * Avoids spamming the system with overly large strings such as full e-mails.
     */
    private static final int MAX_CHARSEQUENCE_LENGTH = 5 * 1024;
    private static final int MAX_CHARSEQUENCE_LENGTH = 1024;

    /**
     * Maximum entries of reply text that are accepted by Builder and friends.
@@ -7561,7 +7561,7 @@ public class Notification implements Parcelable
             */
            public Message(@NonNull CharSequence text, long timestamp, @Nullable Person sender,
                    boolean remoteInputHistory) {
                mText = text;
                mText = safeCharSequence(text);
                mTimestamp = timestamp;
                mSender = sender;
                mRemoteInputHistory = remoteInputHistory;
@@ -7675,7 +7675,7 @@ public class Notification implements Parcelable
                bundle.putLong(KEY_TIMESTAMP, mTimestamp);
                if (mSender != null) {
                    // Legacy listeners need this
                    bundle.putCharSequence(KEY_SENDER, mSender.getName());
                    bundle.putCharSequence(KEY_SENDER, safeCharSequence(mSender.getName()));
                    bundle.putParcelable(KEY_SENDER_PERSON, mSender);
                }
                if (mDataMimeType != null) {
+6 −5
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.icu.util.ULocale;

import com.android.internal.annotations.GuardedBy;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
@@ -151,18 +152,18 @@ public final class LocaleList implements Parcelable {
    /**
     * Creates a new {@link LocaleList}.
     *
     * If two or more same locales are passed, the repeated locales will be dropped.
     * <p>For empty lists of {@link Locale} items it is better to use {@link #getEmptyLocaleList()},
     * which returns a pre-constructed empty list.</p>
     *
     * @throws NullPointerException if any of the input locales is <code>null</code>.
     * @throws IllegalArgumentException if any of the input locales repeat.
     */
    public LocaleList(@NonNull Locale... list) {
        if (list.length == 0) {
            mList = sEmptyList;
            mStringRepresentation = "";
        } else {
            final Locale[] localeList = new Locale[list.length];
            final ArrayList<Locale> localeList = new ArrayList<>();
            final HashSet<Locale> seenLocales = new HashSet<Locale>();
            final StringBuilder sb = new StringBuilder();
            for (int i = 0; i < list.length; i++) {
@@ -170,10 +171,10 @@ public final class LocaleList implements Parcelable {
                if (l == null) {
                    throw new NullPointerException("list[" + i + "] is null");
                } else if (seenLocales.contains(l)) {
                    throw new IllegalArgumentException("list[" + i + "] is a repetition");
                    // Dropping duplicated locale entries.
                } else {
                    final Locale localeClone = (Locale) l.clone();
                    localeList[i] = localeClone;
                    localeList.add(localeClone);
                    sb.append(localeClone.toLanguageTag());
                    if (i < list.length - 1) {
                        sb.append(',');
@@ -181,7 +182,7 @@ public final class LocaleList implements Parcelable {
                    seenLocales.add(localeClone);
                }
            }
            mList = localeList;
            mList = localeList.toArray(new Locale[localeList.size()]);
            mStringRepresentation = sb.toString();
        }
    }
+23 −11
Original line number Diff line number Diff line
@@ -3994,14 +3994,10 @@ public class PackageManagerService extends IPackageManager.Stub
        Iterator<ResolveInfo> iter = matches.iterator();
        while (iter.hasNext()) {
            final ResolveInfo rInfo = iter.next();
            final PackageSetting ps = mSettings.mPackages.get(rInfo.activityInfo.packageName);
            if (ps != null) {
                final PermissionsState permissionsState = ps.getPermissionsState();
                if (permissionsState.hasPermission(Manifest.permission.INSTALL_PACKAGES, 0)
                        || Build.IS_ENG) {
            if (checkPermission(Manifest.permission.INSTALL_PACKAGES,
                    rInfo.activityInfo.packageName, 0) == PERMISSION_GRANTED || Build.IS_ENG) {
                continue;
            }
            }
            iter.remove();
        }
        if (matches.size() == 0) {
@@ -4176,8 +4172,24 @@ public class PackageManagerService extends IPackageManager.Stub
            final int[] gids = (flags & PackageManager.GET_GIDS) == 0
                    ? EMPTY_INT_ARRAY : permissionsState.computeGids(userId);
            // Compute granted permissions only if package has requested permissions
            final Set<String> permissions = ArrayUtils.isEmpty(p.requestedPermissions)
            Set<String> permissions = ArrayUtils.isEmpty(p.requestedPermissions)
                    ? Collections.emptySet() : permissionsState.getPermissions(userId);
            if (state.instantApp) {
                permissions = new ArraySet<>(permissions);
                permissions.removeIf(permissionName -> {
                    BasePermission permission = mPermissionManager.getPermissionTEMP(
                            permissionName);
                    if (permission == null) {
                        return true;
                    }
                    if (!permission.isInstant()) {
                        EventLog.writeEvent(0x534e4554, "140256621", UserHandle.getUid(userId,
                                ps.appId), permissionName);
                        return true;
                    }
                    return false;
                });
            }
            PackageInfo packageInfo = PackageParser.generatePackageInfo(p, gids, flags,
                    ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId);
@@ -8661,10 +8673,9 @@ public class PackageManagerService extends IPackageManager.Stub
    private void addPackageHoldingPermissions(ArrayList<PackageInfo> list, PackageSetting ps,
            String[] permissions, boolean[] tmp, int flags, int userId) {
        int numMatch = 0;
        final PermissionsState permissionsState = ps.getPermissionsState();
        for (int i=0; i<permissions.length; i++) {
            final String permission = permissions[i];
            if (permissionsState.hasPermission(permission, userId)) {
            if (checkPermission(permission, ps.name, userId) == PERMISSION_GRANTED) {
                tmp[i] = true;
                numMatch++;
            } else {
@@ -19628,7 +19639,8 @@ public class PackageManagerService extends IPackageManager.Stub
        }
        final int userId = user == null ? UserHandle.USER_ALL : user.getIdentifier();
        if (ps.getPermissionsState().hasPermission(Manifest.permission.SUSPEND_APPS, userId)) {
        if (checkPermission(Manifest.permission.SUSPEND_APPS, packageName, userId)
                 == PERMISSION_GRANTED) {
            unsuspendForSuspendingPackage(packageName, userId);
        }
        if ((!systemApp || (flags & PackageManager.DELETE_SYSTEM_APP) != 0)