Replace default locale with US locale on Android.

This fixes a lint warning and also fixes potential bugs on devices
running locales where toLowerCase and toUpperCase don't behave
as expected.

BUG=webrtc:6597
R=magjed@webrtc.org
TBR=kjellander@webrtc.org

Review-Url: https://codereview.webrtc.org/2624423003
Cr-Commit-Position: refs/heads/master@{#16092}
This commit is contained in:
sakal 2017-01-16 04:57:32 -08:00 committed by Commit bot
parent 6deecb2a2f
commit 037b93af17
3 changed files with 6 additions and 4 deletions

View File

@ -8,7 +8,6 @@
<issue id="NewApi"></issue>
<issue id="InlinedApi" severity="ignore"/>
<issue id="DefaultLocale" severity="ignore"/>
<issue id="Assert" severity="ignore"/>
<issue id="UseSparseArrays" severity="ignore"/>

View File

@ -20,6 +20,7 @@ import android.view.Surface;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@ -678,7 +679,7 @@ public class EglRenderer implements VideoRenderer.Callbacks {
+ " Frames received: " + framesReceived + "."
+ " Dropped: " + framesDropped + "."
+ " Rendered: " + framesRendered + "."
+ " Render fps: " + String.format("%.1f", renderFps) + "."
+ " Render fps: " + String.format(Locale.US, "%.1f", renderFps) + "."
+ " Average render time: " + averageTimeAsString(renderTimeNs, framesRendered) + "."
+ " Average swapBuffer time: "
+ averageTimeAsString(renderSwapBufferTimeNs, framesRendered) + ".");

View File

@ -10,6 +10,8 @@
package org.webrtc;
import java.util.Locale;
/**
* Description of an RFC 4566 Session.
* SDPs are passed as serialized Strings in Java-land and are materialized
@ -23,11 +25,11 @@ public class SessionDescription {
ANSWER;
public String canonicalForm() {
return name().toLowerCase();
return name().toLowerCase(Locale.US);
}
public static Type fromCanonicalForm(String canonical) {
return Type.valueOf(Type.class, canonical.toUpperCase());
return Type.valueOf(Type.class, canonical.toUpperCase(Locale.US));
}
}