diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/AppOpsManager.java | 2 | ||||
| -rw-r--r-- | core/java/android/app/FragmentManager.java | 4 | ||||
| -rw-r--r-- | core/java/android/ddm/DdmHandleProfiling.java | 47 | ||||
| -rw-r--r-- | core/java/android/net/SSLCertificateSocketFactory.java | 2 | ||||
| -rw-r--r-- | core/java/android/net/arp/ArpPeer.java | 174 | ||||
| -rw-r--r-- | core/java/android/os/Process.java | 4 | ||||
| -rw-r--r-- | core/java/android/os/RecoverySystem.java | 24 | ||||
| -rw-r--r-- | core/java/android/os/SELinux.java | 12 | ||||
| -rw-r--r-- | core/java/android/text/MeasuredText.java | 2 | ||||
| -rw-r--r-- | core/java/android/util/CharsetUtils.java | 198 | ||||
| -rw-r--r-- | core/java/com/android/internal/os/ZygoteConnection.java | 6 |
11 files changed, 40 insertions, 435 deletions
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 183927b..aece462 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -369,8 +369,8 @@ public class AppOpsManager { android.Manifest.permission.WRITE_CALL_LOG, android.Manifest.permission.READ_CALENDAR, android.Manifest.permission.WRITE_CALENDAR, - null, // no permission required for notifications android.Manifest.permission.ACCESS_WIFI_STATE, + null, // no permission required for notifications null, // neighboring cells shares the coarse location perm android.Manifest.permission.CALL_PHONE, android.Manifest.permission.READ_SMS, diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java index 4371907..bf2a629 100644 --- a/core/java/android/app/FragmentManager.java +++ b/core/java/android/app/FragmentManager.java @@ -574,12 +574,12 @@ final class FragmentManagerImpl extends FragmentManager { return null; } if (index >= mActive.size()) { - throwException(new IllegalStateException("Fragement no longer exists for key " + throwException(new IllegalStateException("Fragment no longer exists for key " + key + ": index " + index)); } Fragment f = mActive.get(index); if (f == null) { - throwException(new IllegalStateException("Fragement no longer exists for key " + throwException(new IllegalStateException("Fragment no longer exists for key " + key + ": index " + index)); } return f; diff --git a/core/java/android/ddm/DdmHandleProfiling.java b/core/java/android/ddm/DdmHandleProfiling.java index ec08393..537763d 100644 --- a/core/java/android/ddm/DdmHandleProfiling.java +++ b/core/java/android/ddm/DdmHandleProfiling.java @@ -37,6 +37,7 @@ public class DdmHandleProfiling extends ChunkHandler { public static final int CHUNK_SPSS = type("SPSS"); public static final int CHUNK_SPSE = type("SPSE"); + private static final boolean DEBUG = false; private static DdmHandleProfiling mInstance = new DdmHandleProfiling(); @@ -72,7 +73,7 @@ public class DdmHandleProfiling extends ChunkHandler { * Handle a chunk of data. */ public Chunk handleChunk(Chunk request) { - if (false) + if (DEBUG) Log.v("ddm-heap", "Handling " + name(request.type) + " chunk"); int type = request.type; @@ -83,13 +84,13 @@ public class DdmHandleProfiling extends ChunkHandler { } else if (type == CHUNK_MPSS) { return handleMPSS(request); } else if (type == CHUNK_MPSE) { - return handleMPSE(request); + return handleMPSEOrSPSE(request, "Method"); } else if (type == CHUNK_MPRQ) { return handleMPRQ(request); } else if (type == CHUNK_SPSS) { return handleSPSS(request); } else if (type == CHUNK_SPSE) { - return handleSPSE(request); + return handleMPSEOrSPSE(request, "Sample"); } else { throw new RuntimeException("Unknown packet " + ChunkHandler.name(type)); @@ -106,7 +107,7 @@ public class DdmHandleProfiling extends ChunkHandler { int flags = in.getInt(); int len = in.getInt(); String fileName = getString(in, len); - if (false) + if (DEBUG) Log.v("ddm-heap", "Method profiling start: filename='" + fileName + "', size=" + bufferSize + ", flags=" + flags); @@ -146,7 +147,7 @@ public class DdmHandleProfiling extends ChunkHandler { int bufferSize = in.getInt(); int flags = in.getInt(); - if (false) { + if (DEBUG) { Log.v("ddm-heap", "Method prof stream start: size=" + bufferSize + ", flags=" + flags); } @@ -160,20 +161,18 @@ public class DdmHandleProfiling extends ChunkHandler { } /* - * Handle a "Method Profiling w/Streaming End" request. + * Handle a "Method Profiling w/Streaming End" request or a + * "Sample Profiling w/Streaming End" request. */ - private Chunk handleMPSE(Chunk request) { - byte result; - - if (false) { - Log.v("ddm-heap", "Method prof stream end"); + private Chunk handleMPSEOrSPSE(Chunk request, String type) { + if (DEBUG) { + Log.v("ddm-heap", type + " prof stream end"); } try { Debug.stopMethodTracing(); - result = 0; } catch (RuntimeException re) { - Log.w("ddm-heap", "Method prof stream end failed: " + Log.w("ddm-heap", type + " prof stream end failed: " + re.getMessage()); return createFailChunk(1, re.getMessage()); } @@ -202,7 +201,7 @@ public class DdmHandleProfiling extends ChunkHandler { int bufferSize = in.getInt(); int flags = in.getInt(); int interval = in.getInt(); - if (false) { + if (DEBUG) { Log.v("ddm-heap", "Sample prof stream start: size=" + bufferSize + ", flags=" + flags + ", interval=" + interval); } @@ -214,25 +213,5 @@ public class DdmHandleProfiling extends ChunkHandler { return createFailChunk(1, re.getMessage()); } } - - /* - * Handle a "Sample Profiling w/Streaming End" request. - */ - private Chunk handleSPSE(Chunk request) { - if (false) { - Log.v("ddm-heap", "Sample prof stream end"); - } - - try { - Debug.stopMethodTracing(); - } catch (RuntimeException re) { - Log.w("ddm-heap", "Sample prof stream end failed: " - + re.getMessage()); - return createFailChunk(1, re.getMessage()); - } - - /* VM sent the (perhaps very large) response directly */ - return null; - } } diff --git a/core/java/android/net/SSLCertificateSocketFactory.java b/core/java/android/net/SSLCertificateSocketFactory.java index 208b212..b0278d3 100644 --- a/core/java/android/net/SSLCertificateSocketFactory.java +++ b/core/java/android/net/SSLCertificateSocketFactory.java @@ -533,7 +533,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { @Override public String[] getDefaultCipherSuites() { - return getDelegate().getSupportedCipherSuites(); + return getDelegate().getDefaultCipherSuites(); } @Override diff --git a/core/java/android/net/arp/ArpPeer.java b/core/java/android/net/arp/ArpPeer.java deleted file mode 100644 index 2013b11..0000000 --- a/core/java/android/net/arp/ArpPeer.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net.arp; - -import android.net.LinkAddress; -import android.net.LinkProperties; -import android.net.RouteInfo; -import android.os.SystemClock; -import android.util.Log; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.Inet6Address; -import java.net.SocketException; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.Arrays; - -import libcore.net.RawSocket; - -/** - * This class allows simple ARP exchanges over an uninitialized network - * interface. - * - * @hide - */ -public class ArpPeer { - private static final boolean DBG = false; - private static final String TAG = "ArpPeer"; - private String mInterfaceName; - private final InetAddress mMyAddr; - private final byte[] mMyMac = new byte[6]; - private final InetAddress mPeer; - private final RawSocket mSocket; - private final byte[] L2_BROADCAST; // TODO: refactor from DhcpClient.java - private static final int MAX_LENGTH = 1500; // refactor from DhcpPacket.java - private static final int ETHERNET_TYPE = 1; - private static final int ARP_LENGTH = 28; - private static final int MAC_ADDR_LENGTH = 6; - private static final int IPV4_LENGTH = 4; - - public ArpPeer(String interfaceName, InetAddress myAddr, String mac, - InetAddress peer) throws SocketException { - mInterfaceName = interfaceName; - mMyAddr = myAddr; - - if (mac != null) { - for (int i = 0; i < MAC_ADDR_LENGTH; i++) { - mMyMac[i] = (byte) Integer.parseInt(mac.substring( - i*3, (i*3) + 2), 16); - } - } - - if (myAddr instanceof Inet6Address || peer instanceof Inet6Address) { - throw new IllegalArgumentException("IPv6 unsupported"); - } - - mPeer = peer; - L2_BROADCAST = new byte[MAC_ADDR_LENGTH]; - Arrays.fill(L2_BROADCAST, (byte) 0xFF); - - mSocket = new RawSocket(mInterfaceName, RawSocket.ETH_P_ARP); - } - - /** - * Returns the MAC address (or null if timeout) for the requested - * peer. - */ - public byte[] doArp(int timeoutMillis) { - ByteBuffer buf = ByteBuffer.allocate(MAX_LENGTH); - byte[] desiredIp = mPeer.getAddress(); - long timeout = SystemClock.elapsedRealtime() + timeoutMillis; - - // construct ARP request packet, using a ByteBuffer as a - // convenient container - buf.clear(); - buf.order(ByteOrder.BIG_ENDIAN); - - buf.putShort((short) ETHERNET_TYPE); // Ethernet type, 16 bits - buf.putShort(RawSocket.ETH_P_IP); // Protocol type IP, 16 bits - buf.put((byte)MAC_ADDR_LENGTH); // MAC address length, 6 bytes - buf.put((byte)IPV4_LENGTH); // IPv4 protocol size - buf.putShort((short) 1); // ARP opcode 1: 'request' - buf.put(mMyMac); // six bytes: sender MAC - buf.put(mMyAddr.getAddress()); // four bytes: sender IP address - buf.put(new byte[MAC_ADDR_LENGTH]); // target MAC address: unknown - buf.put(desiredIp); // target IP address, 4 bytes - buf.flip(); - mSocket.write(L2_BROADCAST, buf.array(), 0, buf.limit()); - - byte[] recvBuf = new byte[MAX_LENGTH]; - - while (SystemClock.elapsedRealtime() < timeout) { - long duration = (long) timeout - SystemClock.elapsedRealtime(); - int readLen = mSocket.read(recvBuf, 0, recvBuf.length, -1, - (int) duration); - - // Verify packet details. see RFC 826 - if ((readLen >= ARP_LENGTH) // trailing bytes at times - && (recvBuf[0] == 0) && (recvBuf[1] == ETHERNET_TYPE) // type Ethernet - && (recvBuf[2] == 8) && (recvBuf[3] == 0) // protocol IP - && (recvBuf[4] == MAC_ADDR_LENGTH) // mac length - && (recvBuf[5] == IPV4_LENGTH) // IPv4 protocol size - && (recvBuf[6] == 0) && (recvBuf[7] == 2) // ARP reply - // verify desired IP address - && (recvBuf[14] == desiredIp[0]) && (recvBuf[15] == desiredIp[1]) - && (recvBuf[16] == desiredIp[2]) && (recvBuf[17] == desiredIp[3])) - { - // looks good. copy out the MAC - byte[] result = new byte[MAC_ADDR_LENGTH]; - System.arraycopy(recvBuf, 8, result, 0, MAC_ADDR_LENGTH); - return result; - } - } - - return null; - } - - public static boolean doArp(String myMacAddress, LinkProperties linkProperties, - int timeoutMillis, int numArpPings, int minArpResponses) { - String interfaceName = linkProperties.getInterfaceName(); - InetAddress inetAddress = null; - InetAddress gateway = null; - boolean success; - - for (LinkAddress la : linkProperties.getLinkAddresses()) { - inetAddress = la.getAddress(); - break; - } - - for (RouteInfo route : linkProperties.getRoutes()) { - gateway = route.getGateway(); - break; - } - - try { - ArpPeer peer = new ArpPeer(interfaceName, inetAddress, myMacAddress, gateway); - int responses = 0; - for (int i=0; i < numArpPings; i++) { - if(peer.doArp(timeoutMillis) != null) responses++; - } - if (DBG) Log.d(TAG, "ARP test result: " + responses + "/" + numArpPings); - success = (responses >= minArpResponses); - peer.close(); - } catch (SocketException se) { - //Consider an Arp socket creation issue as a successful Arp - //test to avoid any wifi connectivity issues - Log.e(TAG, "ARP test initiation failure: " + se); - success = true; - } - return success; - } - - public void close() { - try { - mSocket.close(); - } catch (IOException ex) { - } - } -} diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index cf9ddb3..631edd6 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -377,7 +377,7 @@ public class Process { * @param gids Additional group-ids associated with the process. * @param debugFlags Additional flags. * @param targetSdkVersion The target SDK version for the app. - * @param seInfo null-ok SE Android information for the new process. + * @param seInfo null-ok SELinux information for the new process. * @param zygoteArgs Additional arguments to supply to the zygote process. * * @return An object that describes the result of the attempt to start the process. @@ -557,7 +557,7 @@ public class Process { * new process should setgroup() to. * @param debugFlags Additional flags. * @param targetSdkVersion The target SDK version for the app. - * @param seInfo null-ok SE Android information for the new process. + * @param seInfo null-ok SELinux information for the new process. * @param extraArgs Additional arguments to supply to the zygote process. * @return An object that describes the result of the attempt to start the process. * @throws ZygoteStartFailedEx if process start failed for any reason diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index 5e20dec..b692ffd 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -32,10 +32,8 @@ import java.security.GeneralSecurityException; import java.security.PublicKey; import java.security.Signature; import java.security.SignatureException; -import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; -import java.util.Collection; import java.util.Enumeration; import java.util.HashSet; import java.util.Iterator; @@ -48,7 +46,7 @@ import org.apache.harmony.security.asn1.BerInputStream; import org.apache.harmony.security.pkcs7.ContentInfo; import org.apache.harmony.security.pkcs7.SignedData; import org.apache.harmony.security.pkcs7.SignerInfo; -import org.apache.harmony.security.provider.cert.X509CertImpl; +import org.apache.harmony.security.x509.Certificate; /** * RecoverySystem contains methods for interacting with the Android @@ -93,9 +91,9 @@ public class RecoverySystem { } /** @return the set of certs that can be used to sign an OTA package. */ - private static HashSet<Certificate> getTrustedCerts(File keystore) + private static HashSet<X509Certificate> getTrustedCerts(File keystore) throws IOException, GeneralSecurityException { - HashSet<Certificate> trusted = new HashSet<Certificate>(); + HashSet<X509Certificate> trusted = new HashSet<X509Certificate>(); if (keystore == null) { keystore = DEFAULT_KEYSTORE; } @@ -107,7 +105,7 @@ public class RecoverySystem { ZipEntry entry = entries.nextElement(); InputStream is = zip.getInputStream(entry); try { - trusted.add(cf.generateCertificate(is)); + trusted.add((X509Certificate) cf.generateCertificate(is)); } finally { is.close(); } @@ -201,21 +199,23 @@ public class RecoverySystem { if (signedData == null) { throw new IOException("signedData is null"); } - Collection encCerts = signedData.getCertificates(); + List<Certificate> encCerts = signedData.getCertificates(); if (encCerts.isEmpty()) { throw new IOException("encCerts is empty"); } // Take the first certificate from the signature (packages // should contain only one). - Iterator it = encCerts.iterator(); + Iterator<Certificate> it = encCerts.iterator(); X509Certificate cert = null; if (it.hasNext()) { - cert = new X509CertImpl((org.apache.harmony.security.x509.Certificate)it.next()); + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + InputStream is = new ByteArrayInputStream(it.next().getEncoded()); + cert = (X509Certificate) cf.generateCertificate(is); } else { throw new SignatureException("signature contains no certificates"); } - List sigInfos = signedData.getSignerInfos(); + List<SignerInfo> sigInfos = signedData.getSignerInfos(); SignerInfo sigInfo; if (!sigInfos.isEmpty()) { sigInfo = (SignerInfo)sigInfos.get(0); @@ -226,12 +226,12 @@ public class RecoverySystem { // Check that the public key of the certificate contained // in the package equals one of our trusted public keys. - HashSet<Certificate> trusted = getTrustedCerts( + HashSet<X509Certificate> trusted = getTrustedCerts( deviceCertsZipFile == null ? DEFAULT_KEYSTORE : deviceCertsZipFile); PublicKey signatureKey = cert.getPublicKey(); boolean verified = false; - for (Certificate c : trusted) { + for (X509Certificate c : trusted) { if (c.getPublicKey().equals(signatureKey)) { verified = true; break; diff --git a/core/java/android/os/SELinux.java b/core/java/android/os/SELinux.java index c05a974..c9dd5d7 100644 --- a/core/java/android/os/SELinux.java +++ b/core/java/android/os/SELinux.java @@ -45,7 +45,7 @@ public class SELinux { /** * Set whether SELinux is permissive or enforcing. - * @param boolean representing whether to set SELinux to enforcing + * @param value representing whether to set SELinux to enforcing * @return a boolean representing whether the desired mode was set */ public static final native boolean setSELinuxEnforce(boolean value); @@ -60,7 +60,7 @@ public class SELinux { /** * Change the security context of an existing file object. * @param path representing the path of file object to relabel. - * @param con new security context given as a String. + * @param context new security context given as a String. * @return a boolean indicating whether the operation succeeded. */ public static final native boolean setFileContext(String path, String context); @@ -87,8 +87,6 @@ public class SELinux { /** * Gets the security context of a given process id. - * Use of this function is discouraged for Binder transactions. - * Use Binder.getCallingSecctx() instead. * @param pid an int representing the process id to check. * @return a String representing the security context of the given pid. */ @@ -102,15 +100,15 @@ public class SELinux { /** * Gets the value for the given SELinux boolean name. - * @param String The name of the SELinux boolean. + * @param name The name of the SELinux boolean. * @return a boolean indicating whether the SELinux boolean is set. */ public static final native boolean getBooleanValue(String name); /** * Sets the value for the given SELinux boolean name. - * @param String The name of the SELinux boolean. - * @param Boolean The new value of the SELinux boolean. + * @param name The name of the SELinux boolean. + * @param value The new value of the SELinux boolean. * @return a boolean indicating whether or not the operation succeeded. */ public static final native boolean setBooleanValue(String name, boolean value); diff --git a/core/java/android/text/MeasuredText.java b/core/java/android/text/MeasuredText.java index bd9310c..101d6a2 100644 --- a/core/java/android/text/MeasuredText.java +++ b/core/java/android/text/MeasuredText.java @@ -46,7 +46,7 @@ class MeasuredText { } private static final Object[] sLock = new Object[0]; - private static MeasuredText[] sCached = new MeasuredText[3]; + private static final MeasuredText[] sCached = new MeasuredText[3]; static MeasuredText obtain() { MeasuredText mt; diff --git a/core/java/android/util/CharsetUtils.java b/core/java/android/util/CharsetUtils.java deleted file mode 100644 index a763a69..0000000 --- a/core/java/android/util/CharsetUtils.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.util; - -import android.os.Build; -import android.text.TextUtils; - -import java.nio.charset.Charset; -import java.nio.charset.IllegalCharsetNameException; -import java.nio.charset.UnsupportedCharsetException; -import java.util.HashMap; -import java.util.Map; - -/** - * <p> - * A class containing utility methods related to character sets. This - * class is primarily useful for code that wishes to be vendor-aware - * in its interpretation of Japanese charset names (used in DoCoMo, - * KDDI, and SoftBank). - * </p> - * - * <p> - * <b>Note:</b> Developers will need to add an appropriate mapping for - * each vendor-specific charset. You may need to modify the C libraries - * like icu4c in order to let Android support an additional charset. - * </p> - * - * @hide - */ -public final class CharsetUtils { - /** - * name of the vendor "DoCoMo". <b>Note:</b> This isn't a public - * constant, in order to keep this class from becoming a de facto - * reference list of vendor names. - */ - private static final String VENDOR_DOCOMO = "docomo"; - /** - * Name of the vendor "KDDI". - */ - private static final String VENDOR_KDDI = "kddi"; - /** - * Name of the vendor "SoftBank". - */ - private static final String VENDOR_SOFTBANK = "softbank"; - - /** - * Represents one-to-one mapping from a vendor name to a charset specific to the vendor. - */ - private static final Map<String, String> sVendorShiftJisMap = new HashMap<String, String>(); - - static { - // These variants of Shift_JIS come from icu's mapping data (convrtrs.txt) - sVendorShiftJisMap.put(VENDOR_DOCOMO, "docomo-shift_jis-2007"); - sVendorShiftJisMap.put(VENDOR_KDDI, "kddi-shift_jis-2007"); - sVendorShiftJisMap.put(VENDOR_SOFTBANK, "softbank-shift_jis-2007"); - } - - /** - * This class is uninstantiable. - */ - private CharsetUtils() { - // This space intentionally left blank. - } - - /** - * Returns the name of the vendor-specific character set - * corresponding to the given original character set name and - * vendor. If there is no vendor-specific character set for the - * given name/vendor pair, this returns the original character set name. - * - * @param charsetName the base character set name - * @param vendor the vendor to specialize for. All characters should be lower-cased. - * @return the specialized character set name, or {@code charsetName} if - * there is no specialized name - */ - public static String nameForVendor(String charsetName, String vendor) { - if (!TextUtils.isEmpty(charsetName) && !TextUtils.isEmpty(vendor)) { - // You can add your own mapping here. - if (isShiftJis(charsetName)) { - final String vendorShiftJis = sVendorShiftJisMap.get(vendor); - if (vendorShiftJis != null) { - return vendorShiftJis; - } - } - } - - return charsetName; - } - - /** - * Returns the name of the vendor-specific character set - * corresponding to the given original character set name and the - * default vendor (that is, the targeted vendor of the device this - * code is running on). This method merely calls through to - * {@link #nameForVendor(String,String)}, passing the default vendor - * as the second argument. - * - * @param charsetName the base character set name - * @return the specialized character set name, or {@code charsetName} if - * there is no specialized name - */ - public static String nameForDefaultVendor(String charsetName) { - return nameForVendor(charsetName, getDefaultVendor()); - } - - /** - * Returns the vendor-specific character set corresponding to the - * given original character set name and vendor. If there is no - * vendor-specific character set for the given name/vendor pair, - * this returns the character set corresponding to the original - * name. The vendor name is matched case-insensitively. This - * method merely calls {@code Charset.forName()} on a name - * transformed by a call to {@link #nameForVendor(String,String)}. - * - * @param charsetName the base character set name - * @param vendor the vendor to specialize for - * @return the specialized character set, or the one corresponding - * directly to {@code charsetName} if there is no specialized - * variant - * @throws UnsupportedCharsetException thrown if the named character - * set is not supported by the system - * @throws IllegalCharsetNameException thrown if {@code charsetName} - * has invalid syntax - */ - public static Charset charsetForVendor(String charsetName, String vendor) - throws UnsupportedCharsetException, IllegalCharsetNameException { - charsetName = nameForVendor(charsetName, vendor); - return Charset.forName(charsetName); - } - - /** - * Returns the vendor-specific character set corresponding to the - * given original character set name and default vendor (that is, - * the targeted vendor of the device this code is running on). - * This method merely calls through to {@link - * #charsetForVendor(String,String)}, passing the default vendor - * as the second argument. - * - * @param charsetName the base character set name - * @return the specialized character set, or the one corresponding - * directly to {@code charsetName} if there is no specialized - * variant - * @throws UnsupportedCharsetException thrown if the named character - * set is not supported by the system - * @throws IllegalCharsetNameException thrown if {@code charsetName} - * has invalid syntax - */ - public static Charset charsetForVendor(String charsetName) - throws UnsupportedCharsetException, IllegalCharsetNameException { - return charsetForVendor(charsetName, getDefaultVendor()); - } - - /** - * Returns whether the given character set name indicates the Shift-JIS - * encoding. Returns false if the name is null. - * - * @param charsetName the character set name - * @return {@code true} if the name corresponds to Shift-JIS or - * {@code false} if not - */ - private static boolean isShiftJis(String charsetName) { - // Bail quickly if the length doesn't match. - if (charsetName == null) { - return false; - } - int length = charsetName.length(); - if (length != 4 && length != 9) { - return false; - } - - return charsetName.equalsIgnoreCase("shift_jis") - || charsetName.equalsIgnoreCase("shift-jis") - || charsetName.equalsIgnoreCase("sjis"); - } - - /** - * Gets the default vendor for this build. - * - * @return the default vendor name - */ - private static String getDefaultVendor() { - return Build.BRAND; - } -} diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java index fd7e3b0..3381959 100644 --- a/core/java/com/android/internal/os/ZygoteConnection.java +++ b/core/java/com/android/internal/os/ZygoteConnection.java @@ -803,7 +803,7 @@ class ZygoteConnection { } /** - * Applies zygote security policy for SEAndroid information. + * Applies zygote security policy for SELinux information. * * @param args non-null; zygote spawner arguments * @param peer non-null; peer credentials @@ -822,7 +822,7 @@ class ZygoteConnection { if (!(peerUid == 0 || peerUid == Process.SYSTEM_UID)) { // All peers with UID other than root or SYSTEM_UID throw new ZygoteSecurityException( - "This UID may not specify SEAndroid info."); + "This UID may not specify SELinux info."); } boolean allowed = SELinux.checkSELinuxAccess(peerSecurityContext, @@ -831,7 +831,7 @@ class ZygoteConnection { "specifyseinfo"); if (!allowed) { throw new ZygoteSecurityException( - "Peer may not specify SEAndroid info"); + "Peer may not specify SELinux info"); } return; |
