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

Commit 1f4bc5d0 authored by Shruthi Krishna's avatar Shruthi Krishna
Browse files

Merge tag 'android-5.0.2_r1' into merge_branch

Android 5.0.2 release 1

* tag 'android-5.0.2_r1':
  Fix bad alarm delivery
  Tune delivery and batching of alarms
  Properly recognize repeating wakeup alarms
  Be increasingly aggressive about fstrim if it isn't being run
  Start MountService before performBootDexOpt
  Fix null handling in proxies.
  Setting ADB_ENABLED may result in a SecurityException.
  Add configuration to control converting sms destination number
  Increases the falsing threshold when for the keyguard affordances
  Import translations. DO NOT MERGE
  Recover apps with malformed certificates.
  Increasing the min swipe thresholds for the nav bar gestures. (Bug 17109581)
  [DO NOT MERGE] Increase min free levels for cached processes on 64bit
  DO NOT MERGE: Don't log passwords returned from vdc
  DO NOT MERGE: Don't log passwords returned from vdc

Conflicts:
	core/res/res/values-mcc310-mnc004/config.xml
	core/res/res/values-mcc311-mnc480/config.xml
	core/res/res/values/config.xml
	core/res/res/values/symbols.xml

Change-Id: Iae9bdddb80e0101b4465f7bc55002bf9d35340b6
parents 368dfaa5 0ac9664a
Loading
Loading
Loading
Loading
+51 −0
Original line number Diff line number Diff line
@@ -22,12 +22,14 @@ import android.os.Parcelable;
import com.android.internal.util.ArrayUtils;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.lang.ref.SoftReference;
import java.security.PublicKey;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.Arrays;

/**
@@ -252,4 +254,53 @@ public class Signature implements Parcelable {
        return (a.length == b.length) && ArrayUtils.containsAll(a, b)
                && ArrayUtils.containsAll(b, a);
    }

    /**
     * Test if given {@link Signature} sets are effectively equal. In rare
     * cases, certificates can have slightly malformed encoding which causes
     * exact-byte checks to fail.
     * <p>
     * To identify effective equality, we bounce the certificates through an
     * decode/encode pass before doing the exact-byte check. To reduce attack
     * surface area, we only allow a byte size delta of a few bytes.
     *
     * @throws CertificateException if the before/after length differs
     *             substantially, usually a signal of something fishy going on.
     * @hide
     */
    public static boolean areEffectiveMatch(Signature[] a, Signature[] b)
            throws CertificateException {
        final CertificateFactory cf = CertificateFactory.getInstance("X.509");

        final Signature[] aPrime = new Signature[a.length];
        for (int i = 0; i < a.length; i++) {
            aPrime[i] = bounce(cf, a[i]);
        }
        final Signature[] bPrime = new Signature[b.length];
        for (int i = 0; i < b.length; i++) {
            bPrime[i] = bounce(cf, b[i]);
        }

        return areExactMatch(aPrime, bPrime);
    }

    /**
     * Bounce the given {@link Signature} through a decode/encode cycle.
     *
     * @throws CertificateException if the before/after length differs
     *             substantially, usually a signal of something fishy going on.
     * @hide
     */
    public static Signature bounce(CertificateFactory cf, Signature s) throws CertificateException {
        final InputStream is = new ByteArrayInputStream(s.mSignature);
        final X509Certificate cert = (X509Certificate) cf.generateCertificate(is);
        final Signature sPrime = new Signature(cert.getEncoded());

        if (Math.abs(sPrime.mSignature.length - s.mSignature.length) > 2) {
            throw new CertificateException("Bounced cert length looks fishy; before "
                    + s.mSignature.length + ", after " + sPrime.mSignature.length);
        }

        return sPrime;
    }
}
+63 −0
Original line number Diff line number Diff line
@@ -856,6 +856,38 @@ public interface IMountService extends IInterface {
                }
                return _result;
            }

            @Override
            public long lastMaintenance() throws RemoteException {
                Parcel _data = Parcel.obtain();
                Parcel _reply = Parcel.obtain();
                long _result;
                try {
                    _data.writeInterfaceToken(DESCRIPTOR);
                    mRemote.transact(Stub.TRANSACTION_lastMaintenance, _data, _reply, 0);
                    _reply.readException();
                    _result = _reply.readLong();
                } finally {
                    _reply.recycle();
                    _data.recycle();
                }
                return _result;
            }

            @Override
            public void runMaintenance() throws RemoteException {
                Parcel _data = Parcel.obtain();
                Parcel _reply = Parcel.obtain();
                try {
                    _data.writeInterfaceToken(DESCRIPTOR);
                    mRemote.transact(Stub.TRANSACTION_runMaintenance, _data, _reply, 0);
                    _reply.readException();
                } finally {
                    _reply.recycle();
                    _data.recycle();
                }
                return;
            }
        }

        private static final String DESCRIPTOR = "IMountService";
@@ -942,6 +974,10 @@ public interface IMountService extends IInterface {

        static final int TRANSACTION_resizeSecureContainer = IBinder.FIRST_CALL_TRANSACTION + 40;

        static final int TRANSACTION_lastMaintenance = IBinder.FIRST_CALL_TRANSACTION + 41;

        static final int TRANSACTION_runMaintenance = IBinder.FIRST_CALL_TRANSACTION + 42;

        /**
         * Cast an IBinder object into an IMountService interface, generating a
         * proxy if needed.
@@ -1347,6 +1383,19 @@ public interface IMountService extends IInterface {
                    reply.writeInt(resultCode);
                    return true;
                }
                case TRANSACTION_lastMaintenance: {
                    data.enforceInterface(DESCRIPTOR);
                    long lastMaintenance = lastMaintenance();
                    reply.writeNoException();
                    reply.writeLong(lastMaintenance);
                    return true;
                }
                case TRANSACTION_runMaintenance: {
                    data.enforceInterface(DESCRIPTOR);
                    runMaintenance();
                    reply.writeNoException();
                    return true;
                }
            }
            return super.onTransact(code, data, reply, flags);
        }
@@ -1617,4 +1666,18 @@ public interface IMountService extends IInterface {
    public String getField(String field) throws RemoteException;

    public int resizeSecureContainer(String id, int sizeMb, String key) throws RemoteException;

    /**
     * Report the time of the last maintenance operation such as fstrim.
     * @return Timestamp of the last maintenance operation, in the
     *     System.currentTimeMillis() time base
     * @throws RemoteException
     */
    public long lastMaintenance() throws RemoteException;

    /**
     * Kick off an immediate maintenance operation
     * @throws RemoteException
     */
    public void runMaintenance() throws RemoteException;
}
+7 −0
Original line number Diff line number Diff line
@@ -5667,6 +5667,13 @@ public final class Settings {
        */
       public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs";

       /**
        * Time since last fstrim (milliseconds) after which we force one to happen
        * during device startup.  If unset, the default is 3 days.
        * @hide
        */
       public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval";

       /**
        * The interval in milliseconds at which to check packet counts on the
        * mobile data interface when screen is on, to detect possible data
+5 −0
Original line number Diff line number Diff line
@@ -31,4 +31,9 @@
        <item>"*611:+19085594899,BAE0000000000000"</item>
        <item>"*86:+1MDN,BAE0000000000000"</item>
    </string-array>

    <string-array translatable="false" name="config_sms_convert_destination_number_support">
        <item>true;BAE0000000000000</item>
        <item>false</item>
    </string-array>
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -44,4 +44,8 @@
         a permamnent error -->
    <bool name="config_protocol_errors_perm_failure">false</bool>

    <string-array translatable="false" name="config_sms_convert_destination_number_support">
        <item>true</item>
    </string-array>

</resources>
Loading