diff options
| -rw-r--r-- | core/java/android/database/sqlite/SQLiteDebug.java | 12 | ||||
| -rw-r--r-- | core/java/android/util/TimeUtils.java | 161 | ||||
| -rw-r--r-- | core/java/android/webkit/HTML5VideoInline.java | 5 | ||||
| -rw-r--r-- | core/java/android/webkit/WebView.java | 6 | ||||
| -rw-r--r-- | include/media/AudioSystem.h | 2 | ||||
| -rw-r--r-- | include/media/IAudioPolicyService.h | 2 | ||||
| -rw-r--r-- | libs/hwui/FontRenderer.cpp | 17 | ||||
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 2 | ||||
| -rw-r--r-- | libs/rs/scriptc/rs_allocation.rsh | 62 | ||||
| -rw-r--r-- | libs/rs/scriptc/rs_graphics.rsh | 59 | ||||
| -rw-r--r-- | libs/rs/scriptc/rs_types.rsh | 158 | ||||
| -rw-r--r-- | services/audioflinger/AudioPolicyService.h | 2 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/RIL.java | 17 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/TelephonyProperties.java | 5 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java | 90 | ||||
| -rwxr-xr-x | telephony/java/com/android/internal/telephony/gsm/SIMRecords.java | 6 |
16 files changed, 438 insertions, 168 deletions
diff --git a/core/java/android/database/sqlite/SQLiteDebug.java b/core/java/android/database/sqlite/SQLiteDebug.java index 204483d..10ce991 100644 --- a/core/java/android/database/sqlite/SQLiteDebug.java +++ b/core/java/android/database/sqlite/SQLiteDebug.java @@ -33,12 +33,16 @@ public final class SQLiteDebug { /** * Controls the printing of informational SQL log messages. + * + * Enable using "adb shell setprop log.tag.SQLiteLog VERBOSE". */ public static final boolean DEBUG_SQL_LOG = Log.isLoggable("SQLiteLog", Log.VERBOSE); /** * Controls the printing of SQL statements as they are executed. + * + * Enable using "adb shell setprop log.tag.SQLiteStatements VERBOSE". */ public static final boolean DEBUG_SQL_STATEMENTS = Log.isLoggable("SQLiteStatements", Log.VERBOSE); @@ -46,6 +50,8 @@ public final class SQLiteDebug { /** * Controls the printing of wall-clock time taken to execute SQL statements * as they are executed. + * + * Enable using "adb shell setprop log.tag.SQLiteTime VERBOSE". */ public static final boolean DEBUG_SQL_TIME = Log.isLoggable("SQLiteTime", Log.VERBOSE); @@ -61,15 +67,17 @@ public final class SQLiteDebug { * * Reads the "db.log.slow_query_threshold" system property, which can be changed * by the user at any time. If the value is zero, then all queries will - * be considered slow. If the value does not exist, then no queries will + * be considered slow. If the value does not exist or is negative, then no queries will * be considered slow. * * This value can be changed dynamically while the system is running. + * For example, "adb shell setprop db.log.slow_query_threshold 200" will + * log all queries that take 200ms or longer to run. * @hide */ public static final boolean shouldLogSlowQuery(long elapsedTimeMillis) { int slowQueryMillis = SystemProperties.getInt("db.log.slow_query_threshold", -1); - return slowQueryMillis >= 0 && elapsedTimeMillis > slowQueryMillis; + return slowQueryMillis >= 0 && elapsedTimeMillis >= slowQueryMillis; } /** diff --git a/core/java/android/util/TimeUtils.java b/core/java/android/util/TimeUtils.java index 93299eb..2883eca 100644 --- a/core/java/android/util/TimeUtils.java +++ b/core/java/android/util/TimeUtils.java @@ -25,6 +25,8 @@ import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Collection; import java.util.TimeZone; import java.util.Date; @@ -35,18 +37,26 @@ import com.android.internal.util.XmlUtils; */ public class TimeUtils { /** @hide */ public TimeUtils() {} + private static final boolean DBG = false; private static final String TAG = "TimeUtils"; + /** Cached results of getTineZones */ + private static final Object sLastLockObj = new Object(); + private static ArrayList<TimeZone> sLastZones = null; + private static String sLastCountry = null; + + /** Cached results of getTimeZonesWithUniqueOffsets */ + private static final Object sLastUniqueLockObj = new Object(); + private static ArrayList<TimeZone> sLastUniqueZoneOffsets = null; + private static String sLastUniqueCountry = null; + + /** * Tries to return a time zone that would have had the specified offset * and DST value at the specified moment in the specified country. * Returns null if no suitable zone could be found. */ public static TimeZone getTimeZone(int offset, boolean dst, long when, String country) { - if (country == null) { - return null; - } - TimeZone best = null; Resources r = Resources.getSystem(); @@ -58,6 +68,107 @@ public class TimeUtils { int currentOffset = current.getOffset(when); boolean currentDst = current.inDaylightTime(d); + for (TimeZone tz : getTimeZones(country)) { + // If the current time zone is from the right country + // and meets the other known properties, keep it + // instead of changing to another one. + + if (tz.getID().equals(currentName)) { + if (currentOffset == offset && currentDst == dst) { + return current; + } + } + + // Otherwise, take the first zone from the right + // country that has the correct current offset and DST. + // (Keep iterating instead of returning in case we + // haven't encountered the current time zone yet.) + + if (best == null) { + if (tz.getOffset(when) == offset && + tz.inDaylightTime(d) == dst) { + best = tz; + } + } + } + + return best; + } + + /** + * Return list of unique time zones for the country. Do not modify + * + * @param country to find + * @return list of unique time zones, maybe empty but never null. Do not modify. + * @hide + */ + public static ArrayList<TimeZone> getTimeZonesWithUniqueOffsets(String country) { + synchronized(sLastUniqueLockObj) { + if ((country != null) && country.equals(sLastUniqueCountry)) { + if (DBG) { + Log.d(TAG, "getTimeZonesWithUniqueOffsets(" + + country + "): return cached version"); + } + return sLastUniqueZoneOffsets; + } + } + + Collection<TimeZone> zones = getTimeZones(country); + ArrayList<TimeZone> uniqueTimeZones = new ArrayList<TimeZone>(); + for (TimeZone zone : zones) { + // See if we already have this offset, + // Using slow but space efficient and these are small. + boolean found = false; + for (int i = 0; i < uniqueTimeZones.size(); i++) { + if (uniqueTimeZones.get(i).getRawOffset() == zone.getRawOffset()) { + found = true; + break; + } + } + if (found == false) { + if (DBG) { + Log.d(TAG, "getTimeZonesWithUniqueOffsets: add unique offset=" + + zone.getRawOffset() + " zone.getID=" + zone.getID()); + } + uniqueTimeZones.add(zone); + } + } + + synchronized(sLastUniqueLockObj) { + // Cache the last result + sLastUniqueZoneOffsets = uniqueTimeZones; + sLastUniqueCountry = country; + + return sLastUniqueZoneOffsets; + } + } + + /** + * Returns the time zones for the country, which is the code + * attribute of the timezone element in time_zones_by_country.xml. Do not modify. + * + * @param country is a two character country code. + * @return TimeZone list, maybe empty but never null. Do not modify. + * @hide + */ + public static ArrayList<TimeZone> getTimeZones(String country) { + synchronized (sLastLockObj) { + if ((country != null) && country.equals(sLastCountry)) { + if (DBG) Log.d(TAG, "getTimeZones(" + country + "): return cached version"); + return sLastZones; + } + } + + ArrayList<TimeZone> tzs = new ArrayList<TimeZone>(); + + if (country == null) { + if (DBG) Log.d(TAG, "getTimeZones(null): return empty list"); + return tzs; + } + + Resources r = Resources.getSystem(); + XmlResourceParser parser = r.getXml(com.android.internal.R.xml.time_zones_by_country); + try { XmlUtils.beginDocument(parser, "timezones"); @@ -73,43 +184,33 @@ public class TimeUtils { if (country.equals(code)) { if (parser.next() == XmlPullParser.TEXT) { - String maybe = parser.getText(); - - // If the current time zone is from the right country - // and meets the other known properties, keep it - // instead of changing to another one. - - if (maybe.equals(currentName)) { - if (currentOffset == offset && currentDst == dst) { - return current; - } - } - - // Otherwise, take the first zone from the right - // country that has the correct current offset and DST. - // (Keep iterating instead of returning in case we - // haven't encountered the current time zone yet.) - - if (best == null) { - TimeZone tz = TimeZone.getTimeZone(maybe); - - if (tz.getOffset(when) == offset && - tz.inDaylightTime(d) == dst) { - best = tz; + String zoneIdString = parser.getText(); + TimeZone tz = TimeZone.getTimeZone(zoneIdString); + if (tz.getID().startsWith("GMT") == false) { + // tz.getID doesn't start not "GMT" so its valid + tzs.add(tz); + if (DBG) { + Log.d(TAG, "getTimeZone('" + country + "'): found tz.getID==" + + ((tz != null) ? tz.getID() : "<no tz>")); } } } } } } catch (XmlPullParserException e) { - Log.e(TAG, "Got exception while getting preferred time zone.", e); + Log.e(TAG, "Got xml parser exception getTimeZone('" + country + "'): e=", e); } catch (IOException e) { - Log.e(TAG, "Got exception while getting preferred time zone.", e); + Log.e(TAG, "Got IO exception getTimeZone('" + country + "'): e=", e); } finally { parser.close(); } - return best; + synchronized(sLastLockObj) { + // Cache the last result; + sLastZones = tzs; + sLastCountry = country; + return sLastZones; + } } /** diff --git a/core/java/android/webkit/HTML5VideoInline.java b/core/java/android/webkit/HTML5VideoInline.java index 2d5b263..62e812e 100644 --- a/core/java/android/webkit/HTML5VideoInline.java +++ b/core/java/android/webkit/HTML5VideoInline.java @@ -92,6 +92,11 @@ public class HTML5VideoInline extends HTML5VideoView{ @Override public void deleteSurfaceTexture() { + cleanupSurfaceTexture(); + return; + } + + public static void cleanupSurfaceTexture() { mSurfaceTexture = null; mVideoLayerUsingSurfaceTexture = -1; return; diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index af3bb4d..a850379 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -96,6 +96,7 @@ import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; +import android.webkit.HTML5VideoInline; import android.webkit.WebTextView.AutoCompleteAdapter; import android.webkit.WebViewCore.DrawData; import android.webkit.WebViewCore.EventHub; @@ -842,6 +843,11 @@ public class WebView extends AbsoluteLayout if (DebugFlags.WEB_VIEW) { Log.d("WebView", "onTrimMemory: " + level); } + // When framework reset EGL context during high memory pressure, all + // the existing GL resources for the html5 video will be destroyed + // at native side. + // Here we just need to clean up the Surface Texture which is static. + HTML5VideoInline.cleanupSurfaceTexture(); WebView.nativeOnTrimMemory(level); } diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index 1916ac5..89bc95d 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -157,7 +157,7 @@ public: uint32_t samplingRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, uint32_t channels = AUDIO_CHANNEL_OUT_STEREO, - audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_INDIRECT); + audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_NONE); static status_t startOutput(audio_io_handle_t output, audio_stream_type_t stream, int session = 0); diff --git a/include/media/IAudioPolicyService.h b/include/media/IAudioPolicyService.h index 4d88297..bdd7747 100644 --- a/include/media/IAudioPolicyService.h +++ b/include/media/IAudioPolicyService.h @@ -52,7 +52,7 @@ public: uint32_t samplingRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, uint32_t channels = 0, - audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_INDIRECT) = 0; + audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_NONE) = 0; virtual status_t startOutput(audio_io_handle_t output, audio_stream_type_t stream, int session = 0) = 0; diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp index f2bb6ec..92a7573 100644 --- a/libs/hwui/FontRenderer.cpp +++ b/libs/hwui/FontRenderer.cpp @@ -170,16 +170,10 @@ void Font::drawCachedGlyph(CachedGlyphInfo* glyph, float x, float hOffset, float const float halfWidth = glyph->mBitmapWidth * 0.5f; const float height = glyph->mBitmapHeight; - float nPenX = glyph->mBitmapLeft; vOffset += glyph->mBitmapTop + height; - const float u1 = glyph->mBitmapMinU; - const float u2 = glyph->mBitmapMaxU; - const float v1 = glyph->mBitmapMinV; - const float v2 = glyph->mBitmapMaxV; - SkPoint destination[4]; - measure.getPosTan(x + hOffset + nPenX + halfWidth, position, tangent); + measure.getPosTan(x + hOffset + glyph->mBitmapLeft + halfWidth, position, tangent); // Move along the tangent and offset by the normal destination[0].set(-tangent->fX * halfWidth - tangent->fY * vOffset, @@ -191,6 +185,11 @@ void Font::drawCachedGlyph(CachedGlyphInfo* glyph, float x, float hOffset, float destination[3].set(destination[0].fX + tangent->fY * height, destination[0].fY - tangent->fX * height); + const float u1 = glyph->mBitmapMinU; + const float u2 = glyph->mBitmapMaxU; + const float v1 = glyph->mBitmapMinV; + const float v2 = glyph->mBitmapMaxV; + mState->appendRotatedMeshQuad( position->fX + destination[0].fX, position->fY + destination[0].fY, u1, v2, @@ -267,7 +266,7 @@ void Font::render(SkPaint* paint, const char *text, uint32_t start, uint32_t len penX += pathOffset - textWidth; } - while (glyphsCount < numGlyphs && penX <= pathLength) { + while (glyphsCount < numGlyphs && penX < pathLength) { glyph_t glyph = GET_GLYPH(text); if (IS_END_OF_STRING(glyph)) { @@ -279,7 +278,7 @@ void Font::render(SkPaint* paint, const char *text, uint32_t start, uint32_t len prevRsbDelta = cachedGlyph->mRsbDelta; if (cachedGlyph->mIsValid) { - drawCachedGlyph(cachedGlyph, roundf(penX), hOffset, vOffset, measure, &position, &tangent); + drawCachedGlyph(cachedGlyph, penX, hOffset, vOffset, measure, &position, &tangent); } penX += SkFixedToFloat(cachedGlyph->mAdvanceX); diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 73625b7..e3148e8 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -2477,7 +2477,7 @@ void OpenGLRenderer::setupPaintFilter(int clearBits, int setBits) { } SkPaint* OpenGLRenderer::filterPaint(SkPaint* paint) { - if (!mHasDrawFilter || !paint) return paint; + if (CC_LIKELY(!mHasDrawFilter || !paint)) return paint; uint32_t flags = paint->getFlags(); diff --git a/libs/rs/scriptc/rs_allocation.rsh b/libs/rs/scriptc/rs_allocation.rsh index a2f69d9..89696b8 100644 --- a/libs/rs/scriptc/rs_allocation.rsh +++ b/libs/rs/scriptc/rs_allocation.rsh @@ -298,5 +298,67 @@ extern rs_data_kind __attribute__((overloadable)) extern uint32_t __attribute__((overloadable)) rsElementGetVectorSize(rs_element e); +/** + * Fetch allocation in a way described by the sampler + * @param a 1D allocation to sample from + * @param s sampler state + * @param location to sample from + */ +extern const float4 __attribute__((overloadable)) + rsSample(rs_allocation a, rs_sampler s, float location); +/** + * Fetch allocation in a way described by the sampler + * @param a 1D allocation to sample from + * @param s sampler state + * @param location to sample from + * @param lod mip level to sample from, for fractional values + * mip levels will be interpolated if + * RS_SAMPLER_LINEAR_MIP_LINEAR is used + */ +extern const float4 __attribute__((overloadable)) + rsSample(rs_allocation a, rs_sampler s, float location, float lod); + +/** + * Fetch allocation in a way described by the sampler + * @param a 2D allocation to sample from + * @param s sampler state + * @param location to sample from + */ +extern const float4 __attribute__((overloadable)) + rsSample(rs_allocation a, rs_sampler s, float2 location); + +/** + * Fetch allocation in a way described by the sampler + * @param a 2D allocation to sample from + * @param s sampler state + * @param location to sample from + * @param lod mip level to sample from, for fractional values + * mip levels will be interpolated if + * RS_SAMPLER_LINEAR_MIP_LINEAR is used + */ +extern const float4 __attribute__((overloadable)) + rsSample(rs_allocation a, rs_sampler s, float2 location, float lod); + +/** + * Fetch allocation in a way described by the sampler + * @param a 3D allocation to sample from + * @param s sampler state + * @param location to sample from + */ +extern const float4 __attribute__((overloadable)) + rsSample(rs_allocation a, rs_sampler s, float3 location); + +/** + * Fetch allocation in a way described by the sampler + * @param a 3D allocation to sample from + * @param s sampler state + * @param location to sample from + * @param lod mip level to sample from, for fractional values + * mip levels will be interpolated if + * RS_SAMPLER_LINEAR_MIP_LINEAR is used + */ +extern const float4 __attribute__((overloadable)) + rsSample(rs_allocation a, rs_sampler s, float3 location, float lod); + #endif diff --git a/libs/rs/scriptc/rs_graphics.rsh b/libs/rs/scriptc/rs_graphics.rsh index 7fdebdc..e3fde82 100644 --- a/libs/rs/scriptc/rs_graphics.rsh +++ b/libs/rs/scriptc/rs_graphics.rsh @@ -23,65 +23,6 @@ #ifndef __RS_GRAPHICS_RSH__ #define __RS_GRAPHICS_RSH__ -// These are API 15 once it get official -typedef enum { - RS_DEPTH_FUNC_ALWAYS, - RS_DEPTH_FUNC_LESS, - RS_DEPTH_FUNC_LEQUAL, - RS_DEPTH_FUNC_GREATER, - RS_DEPTH_FUNC_GEQUAL, - RS_DEPTH_FUNC_EQUAL, - RS_DEPTH_FUNC_NOTEQUAL, - - RS_DEPTH_FUNC_INVALID = 100, -} rs_depth_func; - -typedef enum { - RS_BLEND_SRC_ZERO, // 0 - RS_BLEND_SRC_ONE, // 1 - RS_BLEND_SRC_DST_COLOR, // 2 - RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3 - RS_BLEND_SRC_SRC_ALPHA, // 4 - RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5 - RS_BLEND_SRC_DST_ALPHA, // 6 - RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7 - RS_BLEND_SRC_SRC_ALPHA_SATURATE, // 8 - - RS_BLEND_SRC_INVALID = 100, -} rs_blend_src_func; - -typedef enum { - RS_BLEND_DST_ZERO, // 0 - RS_BLEND_DST_ONE, // 1 - RS_BLEND_DST_SRC_COLOR, // 2 - RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3 - RS_BLEND_DST_SRC_ALPHA, // 4 - RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5 - RS_BLEND_DST_DST_ALPHA, // 6 - RS_BLEND_DST_ONE_MINUS_DST_ALPHA, // 7 - - RS_BLEND_DST_INVALID = 100, -} rs_blend_dst_func; - -typedef enum { - RS_CULL_BACK, - RS_CULL_FRONT, - RS_CULL_NONE, - - RS_CULL_INVALID = 100, -} rs_cull_mode; - -typedef enum { - RS_SAMPLER_NEAREST, - RS_SAMPLER_LINEAR, - RS_SAMPLER_LINEAR_MIP_LINEAR, - RS_SAMPLER_WRAP, - RS_SAMPLER_CLAMP, - RS_SAMPLER_LINEAR_MIP_NEAREST, - - RS_SAMPLER_INVALID = 100, -} rs_sampler_value; - #if (defined(RS_VERSION) && (RS_VERSION >= 14)) /** * Set the color target used for all subsequent rendering calls diff --git a/libs/rs/scriptc/rs_types.rsh b/libs/rs/scriptc/rs_types.rsh index 5345a48..f8c2657 100644 --- a/libs/rs/scriptc/rs_types.rsh +++ b/libs/rs/scriptc/rs_types.rsh @@ -407,14 +407,14 @@ typedef enum { * **/ typedef enum { - RS_PRIMITIVE_POINT, - RS_PRIMITIVE_LINE, - RS_PRIMITIVE_LINE_STRIP, - RS_PRIMITIVE_TRIANGLE, - RS_PRIMITIVE_TRIANGLE_STRIP, - RS_PRIMITIVE_TRIANGLE_FAN, - - RS_PRIMITIVE_INVALID = 100, + RS_PRIMITIVE_POINT = 0, + RS_PRIMITIVE_LINE = 1, + RS_PRIMITIVE_LINE_STRIP = 2, + RS_PRIMITIVE_TRIANGLE = 3, + RS_PRIMITIVE_TRIANGLE_STRIP = 4, + RS_PRIMITIVE_TRIANGLE_FAN = 5, + + RS_PRIMITIVE_INVALID = 100, } rs_primitive; /** @@ -436,41 +436,41 @@ typedef enum { * RS_* objects. 32 bit opaque handles. */ typedef enum { - RS_TYPE_NONE, + RS_TYPE_NONE = 0, //RS_TYPE_FLOAT_16, - RS_TYPE_FLOAT_32 = 2, - RS_TYPE_FLOAT_64, - RS_TYPE_SIGNED_8, - RS_TYPE_SIGNED_16, - RS_TYPE_SIGNED_32, - RS_TYPE_SIGNED_64, - RS_TYPE_UNSIGNED_8, - RS_TYPE_UNSIGNED_16, - RS_TYPE_UNSIGNED_32, - RS_TYPE_UNSIGNED_64, - - RS_TYPE_BOOLEAN, - - RS_TYPE_UNSIGNED_5_6_5, - RS_TYPE_UNSIGNED_5_5_5_1, - RS_TYPE_UNSIGNED_4_4_4_4, - - RS_TYPE_MATRIX_4X4, - RS_TYPE_MATRIX_3X3, - RS_TYPE_MATRIX_2X2, - - RS_TYPE_ELEMENT = 1000, - RS_TYPE_TYPE, - RS_TYPE_ALLOCATION, - RS_TYPE_SAMPLER, - RS_TYPE_SCRIPT, - RS_TYPE_MESH, - RS_TYPE_PROGRAM_FRAGMENT, - RS_TYPE_PROGRAM_VERTEX, - RS_TYPE_PROGRAM_RASTER, - RS_TYPE_PROGRAM_STORE, - - RS_TYPE_INVALID = 10000, + RS_TYPE_FLOAT_32 = 2, + RS_TYPE_FLOAT_64 = 3, + RS_TYPE_SIGNED_8 = 4, + RS_TYPE_SIGNED_16 = 5, + RS_TYPE_SIGNED_32 = 6, + RS_TYPE_SIGNED_64 = 7, + RS_TYPE_UNSIGNED_8 = 8, + RS_TYPE_UNSIGNED_16 = 9, + RS_TYPE_UNSIGNED_32 = 10, + RS_TYPE_UNSIGNED_64 = 11, + + RS_TYPE_BOOLEAN = 12, + + RS_TYPE_UNSIGNED_5_6_5 = 13, + RS_TYPE_UNSIGNED_5_5_5_1 = 14, + RS_TYPE_UNSIGNED_4_4_4_4 = 15, + + RS_TYPE_MATRIX_4X4 = 16, + RS_TYPE_MATRIX_3X3 = 17, + RS_TYPE_MATRIX_2X2 = 18, + + RS_TYPE_ELEMENT = 1000, + RS_TYPE_TYPE = 1001, + RS_TYPE_ALLOCATION = 1002, + RS_TYPE_SAMPLER = 1003, + RS_TYPE_SCRIPT = 1004, + RS_TYPE_MESH = 1005, + RS_TYPE_PROGRAM_FRAGMENT = 1006, + RS_TYPE_PROGRAM_VERTEX = 1007, + RS_TYPE_PROGRAM_RASTER = 1008, + RS_TYPE_PROGRAM_STORE = 1009, + + RS_TYPE_INVALID = 10000, } rs_data_type; /** @@ -482,16 +482,74 @@ typedef enum { * representing texture formats. */ typedef enum { - RS_KIND_USER, + RS_KIND_USER = 0, - RS_KIND_PIXEL_L = 7, - RS_KIND_PIXEL_A, - RS_KIND_PIXEL_LA, - RS_KIND_PIXEL_RGB, - RS_KIND_PIXEL_RGBA, - RS_KIND_PIXEL_DEPTH, + RS_KIND_PIXEL_L = 7, + RS_KIND_PIXEL_A = 8, + RS_KIND_PIXEL_LA = 9, + RS_KIND_PIXEL_RGB = 10, + RS_KIND_PIXEL_RGBA = 11, + RS_KIND_PIXEL_DEPTH = 12, - RS_KIND_INVALID = 100, + RS_KIND_INVALID = 100, } rs_data_kind; +typedef enum { + RS_DEPTH_FUNC_ALWAYS = 0, + RS_DEPTH_FUNC_LESS = 1, + RS_DEPTH_FUNC_LEQUAL = 2, + RS_DEPTH_FUNC_GREATER = 3, + RS_DEPTH_FUNC_GEQUAL = 4, + RS_DEPTH_FUNC_EQUAL = 5, + RS_DEPTH_FUNC_NOTEQUAL = 6, + + RS_DEPTH_FUNC_INVALID = 100, +} rs_depth_func; + +typedef enum { + RS_BLEND_SRC_ZERO = 0, + RS_BLEND_SRC_ONE = 1, + RS_BLEND_SRC_DST_COLOR = 2, + RS_BLEND_SRC_ONE_MINUS_DST_COLOR = 3, + RS_BLEND_SRC_SRC_ALPHA = 4, + RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA = 5, + RS_BLEND_SRC_DST_ALPHA = 6, + RS_BLEND_SRC_ONE_MINUS_DST_ALPHA = 7, + RS_BLEND_SRC_SRC_ALPHA_SATURATE = 8, + + RS_BLEND_SRC_INVALID = 100, +} rs_blend_src_func; + +typedef enum { + RS_BLEND_DST_ZERO = 0, + RS_BLEND_DST_ONE = 1, + RS_BLEND_DST_SRC_COLOR = 2, + RS_BLEND_DST_ONE_MINUS_SRC_COLOR = 3, + RS_BLEND_DST_SRC_ALPHA = 4, + RS_BLEND_DST_ONE_MINUS_SRC_ALPHA = 5, + RS_BLEND_DST_DST_ALPHA = 6, + RS_BLEND_DST_ONE_MINUS_DST_ALPHA = 7, + + RS_BLEND_DST_INVALID = 100, +} rs_blend_dst_func; + +typedef enum { + RS_CULL_BACK = 0, + RS_CULL_FRONT = 1, + RS_CULL_NONE = 2, + + RS_CULL_INVALID = 100, +} rs_cull_mode; + +typedef enum { + RS_SAMPLER_NEAREST = 0, + RS_SAMPLER_LINEAR = 1, + RS_SAMPLER_LINEAR_MIP_LINEAR = 2, + RS_SAMPLER_WRAP = 3, + RS_SAMPLER_CLAMP = 4, + RS_SAMPLER_LINEAR_MIP_NEAREST = 5, + + RS_SAMPLER_INVALID = 100, +} rs_sampler_value; + #endif diff --git a/services/audioflinger/AudioPolicyService.h b/services/audioflinger/AudioPolicyService.h index 679fd30..962c917 100644 --- a/services/audioflinger/AudioPolicyService.h +++ b/services/audioflinger/AudioPolicyService.h @@ -66,7 +66,7 @@ public: audio_format_t format = AUDIO_FORMAT_DEFAULT, uint32_t channels = 0, audio_policy_output_flags_t flags = - AUDIO_POLICY_OUTPUT_FLAG_INDIRECT); + AUDIO_POLICY_OUTPUT_FLAG_NONE); virtual status_t startOutput(audio_io_handle_t output, audio_stream_type_t stream, int session = 0); diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 5afc1f3..cf96ab2 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -2566,13 +2566,20 @@ public final class RIL extends BaseCommands implements CommandsInterface { result[0] = ret; result[1] = Long.valueOf(nitzReceiveTime); - if (mNITZTimeRegistrant != null) { + boolean ignoreNitz = SystemProperties.getBoolean( + TelephonyProperties.PROPERTY_IGNORE_NITZ, false); - mNITZTimeRegistrant - .notifyRegistrant(new AsyncResult (null, result, null)); + if (ignoreNitz) { + if (RILJ_LOGD) riljLog("ignoring UNSOL_NITZ_TIME_RECEIVED"); } else { - // in case NITZ time registrant isnt registered yet - mLastNITZTimeInfo = result; + if (mNITZTimeRegistrant != null) { + + mNITZTimeRegistrant + .notifyRegistrant(new AsyncResult (null, result, null)); + } else { + // in case NITZ time registrant isnt registered yet + mLastNITZTimeInfo = result; + } } break; diff --git a/telephony/java/com/android/internal/telephony/TelephonyProperties.java b/telephony/java/com/android/internal/telephony/TelephonyProperties.java index abb4523..f95e081 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyProperties.java +++ b/telephony/java/com/android/internal/telephony/TelephonyProperties.java @@ -182,4 +182,9 @@ public interface TelephonyProperties * in commercial configuration. */ static final String PROPERTY_TEST_CSIM = "persist.radio.test-csim"; + + /** + * Ignore RIL_UNSOL_NITZ_TIME_RECEIVED completely, used for debugging/testing. + */ + static final String PROPERTY_IGNORE_NITZ = "telephony.test.ignore.nitz"; } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java index a4fb1d8..148b139 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java @@ -59,9 +59,12 @@ import android.util.EventLog; import android.util.Log; import android.util.TimeUtils; +import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; +import java.util.Collection; import java.util.Date; +import java.util.HashSet; import java.util.TimeZone; /** @@ -112,6 +115,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker { private boolean mGotCountryCode = false; private ContentResolver cr; + /** Boolean is true is setTimeFromNITZString was called */ + private boolean mNitzUpdatedTime = false; + String mSavedTimeZone; long mSavedTime; long mSavedAtTime; @@ -698,6 +704,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { newCellLoc.setStateInvalid(); setSignalStrengthDefaultValues(); mGotCountryCode = false; + mNitzUpdatedTime = false; pollStateDone(); break; @@ -706,6 +713,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { newCellLoc.setStateInvalid(); setSignalStrengthDefaultValues(); mGotCountryCode = false; + mNitzUpdatedTime = false; pollStateDone(); break; @@ -826,6 +834,12 @@ final class GsmServiceStateTracker extends ServiceStateTracker { if (hasRegistered) { mNetworkAttachedRegistrants.notifyRegistrants(); + + if (DBG) { + log("pollStateDone: registering current mNitzUpdatedTime=" + + mNitzUpdatedTime + " changing to false"); + } + mNitzUpdatedTime = false; } if (hasChanged) { @@ -840,28 +854,71 @@ final class GsmServiceStateTracker extends ServiceStateTracker { phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric); if (operatorNumeric == null) { + if (DBG) { + log("pollStateDone: operatorNumeric is null:" + + " clear PROPERTY_OPERATOR_ISO_COUNTRY"); + } phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, ""); mGotCountryCode = false; + mNitzUpdatedTime = false; } else { String iso = ""; + String mcc = operatorNumeric.substring(0, 3); try{ - iso = MccTable.countryCodeForMcc(Integer.parseInt( - operatorNumeric.substring(0,3))); + iso = MccTable.countryCodeForMcc(Integer.parseInt(mcc)); } catch ( NumberFormatException ex){ - loge("countryCodeForMcc error" + ex); + loge("pollStateDone: countryCodeForMcc error" + ex); } catch ( StringIndexOutOfBoundsException ex) { - loge("countryCodeForMcc error" + ex); + loge("pollStateDone: countryCodeForMcc error" + ex); + } + if (DBG) { + log("pollStateDone: operatorNumeric=" + operatorNumeric + + " mcc=" + mcc + " iso=" + iso); } phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, iso); mGotCountryCode = true; + TimeZone zone = null; + + if (!mNitzUpdatedTime && !mcc.equals("000") && !TextUtils.isEmpty(iso) && + getAutoTimeZone()) { + + // Test both paths if ignore nitz is true + boolean testOneUniqueOffsetPath = SystemProperties.getBoolean( + TelephonyProperties.PROPERTY_IGNORE_NITZ, false) && + ((SystemClock.uptimeMillis() & 1) == 0); + + ArrayList<TimeZone> uniqueZones = TimeUtils.getTimeZonesWithUniqueOffsets(iso); + if ((uniqueZones.size() == 1) || testOneUniqueOffsetPath) { + zone = uniqueZones.get(0); + if (DBG) { + log("pollStateDone: no nitz but one TZ for iso=" + iso + + " with zone.getID=" + zone.getID() + + " testOneUniqueOffsetPath=" + testOneUniqueOffsetPath); + } + setAndBroadcastNetworkSetTimeZone(zone.getID()); + } else { + if (DBG) { + log("pollStateDone: there are " + uniqueZones.size() + + " unique offsets for iso='" + iso + + " testOneUniqueOffsetPath=" + testOneUniqueOffsetPath + + "', do nothing"); + } + } + } + if (mNeedFixZone) { - TimeZone zone = null; // If the offset is (0, false) and the timezone property // is set, use the timezone property rather than // GMT. String zoneName = SystemProperties.get(TIMEZONE_PROPERTY); + if (DBG) { + log("pollStateDone: mNeedFixZone==true zoneName='" + zoneName + + "' mZoneOffset=" + mZoneOffset + " mZoneDst=" + mZoneDst + + " iso='" + iso + + "' iso-cc-idx=" + Arrays.binarySearch(GMT_COUNTRY_CODES, iso)); + } if ((mZoneOffset == 0) && (mZoneDst == false) && (zoneName != null) && (zoneName.length() > 0) && (Arrays.binarySearch(GMT_COUNTRY_CODES, iso) < 0)) { @@ -876,22 +933,36 @@ final class GsmServiceStateTracker extends ServiceStateTracker { // Adjust the saved NITZ time to account for tzOffset. mSavedTime = mSavedTime - tzOffset; } + if (DBG) log("pollStateDone: using default TimeZone"); } else if (iso.equals("")){ // Country code not found. This is likely a test network. // Get a TimeZone based only on the NITZ parameters (best guess). zone = getNitzTimeZone(mZoneOffset, mZoneDst, mZoneTime); + if (DBG) log("pollStateDone: using NITZ TimeZone"); } else { - zone = TimeUtils.getTimeZone(mZoneOffset, - mZoneDst, mZoneTime, iso); + zone = TimeUtils.getTimeZone(mZoneOffset, mZoneDst, mZoneTime, iso); + if (DBG) log("pollStateDone: using getTimeZone(off, dst, time, iso)"); } mNeedFixZone = false; if (zone != null) { + log("pollStateDone: zone != null zone.getID=" + zone.getID()); if (getAutoTimeZone()) { setAndBroadcastNetworkSetTimeZone(zone.getID()); } saveNitzTimeZone(zone.getID()); + } else { + log("pollStateDone: zone == null"); + } + } else { + if (DBG) { + String zoneName = SystemProperties.get(TIMEZONE_PROPERTY); + zone = TimeZone.getDefault(); + log("pollStateDone: mNeedFixZone==false zoneName='" + zoneName + + "' mZoneOffset=" + mZoneOffset + " mZoneDst=" + mZoneDst + + " iso='" + iso + + "' iso-cc-idx=" + Arrays.binarySearch(GMT_COUNTRY_CODES, iso)); } } } @@ -1440,6 +1511,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { long end = SystemClock.elapsedRealtime(); log("NITZ: end=" + end + " dur=" + (end - start)); } + mNitzUpdatedTime = true; } finally { mWakeLock.release(); } @@ -1489,6 +1561,10 @@ final class GsmServiceStateTracker extends ServiceStateTracker { intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); intent.putExtra("time-zone", zoneId); phone.getContext().sendStickyBroadcast(intent); + if (DBG) { + log("setAndBroadcastNetworkSetTimeZone: call alarm.setTimeZone and broadcast zoneId=" + + zoneId); + } } /** diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java index de8401e..d98aa62 100755 --- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java +++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java @@ -166,8 +166,10 @@ public class SIMRecords extends IccRecords { "405841", "405842", "405843", "405844", "405845", "405846", "405847", "405848", "405849", "405850", "405851", "405852", "405853", "405875", "405876", "405877", "405878", "405879", "405880", "405881", "405882", "405883", "405884", "405885", - "405886", "405908", "405909", "405910", "405911", "405925", "405926", "405927", - "405928", "405929", "405932" + "405886", "405908", "405909", "405910", "405911", "405912", "405913", "405914", + "405915", "405916", "405917", "405918", "405919", "405920", "405921", "405922", + "405923", "405924", "405925", "405926", "405927", "405928", "405929", "405930", + "405931", "405932" }; // ***** Constructor |
