Loading core/java/android/content/pm/Signature.java +51 −0 Original line number Diff line number Diff line Loading @@ -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; /** Loading Loading @@ -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; } } core/java/android/os/storage/IMountService.java +63 −0 Original line number Diff line number Diff line Loading @@ -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"; Loading Loading @@ -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. Loading Loading @@ -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); } Loading Loading @@ -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; } core/java/android/provider/Settings.java +7 −0 Original line number Diff line number Diff line Loading @@ -5914,6 +5914,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 Loading core/res/res/values-mcc204-mnc04/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -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> core/res/res/values-mcc310-mnc004/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -43,5 +43,8 @@ <!-- Configuration that determines if PROTOCOL_ERRORS is to be treated as 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
core/java/android/content/pm/Signature.java +51 −0 Original line number Diff line number Diff line Loading @@ -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; /** Loading Loading @@ -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; } }
core/java/android/os/storage/IMountService.java +63 −0 Original line number Diff line number Diff line Loading @@ -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"; Loading Loading @@ -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. Loading Loading @@ -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); } Loading Loading @@ -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; }
core/java/android/provider/Settings.java +7 −0 Original line number Diff line number Diff line Loading @@ -5914,6 +5914,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 Loading
core/res/res/values-mcc204-mnc04/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -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>
core/res/res/values-mcc310-mnc004/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -43,5 +43,8 @@ <!-- Configuration that determines if PROTOCOL_ERRORS is to be treated as 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>