From d3badad3aa7fd250a0a81549c6c3c15d8aee9f8d Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Sat, 18 Jul 2009 11:37:10 -0500 Subject: [PATCH 01/10] Clarify use of InputType flags Some developers were confused about how to use the inputType field and were omitting the class type when setting variations. There are places in the framework where it specifically checks for a class and variation before it invokes the desired behavior. For instance, in EditText when setting the input type to a visible password, it specifically checks for this condition: inputType == (TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) --- core/java/android/text/InputType.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/core/java/android/text/InputType.java b/core/java/android/text/InputType.java index d50684af911d5..41d5b84a5b66f 100644 --- a/core/java/android/text/InputType.java +++ b/core/java/android/text/InputType.java @@ -20,7 +20,25 @@ import android.text.TextUtils; /** * Bit definitions for an integer defining the basic content type of text - * held in an {@link Editable} object. + * held in an {@link Editable} object. Supported classes may be combined + * with variations and flags to indicate desired behaviors. + * + *

Examples

+ * + *
+ *
A password field with with the password visible to the user: + *
inputType = TYPE_CLASS_TEXT | + * TYPE_TEXT_VARIATION_VISIBLE_PASSWORD + * + *
A multi-line postal address with automatic capitalization: + *
inputType = TYPE_CLASS_TEXT | + * TYPE_TEXT_VARIATION_POSTAL_ADDRESS | + * TYPE_TEXT_FLAG_MULTI_LINE + * + *
A time field: + *
inputType = TYPE_CLASS_DATETIME | + * TYPE_DATETIME_VARIATION_TIME + *
*/ public interface InputType { /** From 219749df3ef8ad8efa4a1d4889403e179c268067 Mon Sep 17 00:00:00 2001 From: Li Wenhao Date: Wed, 29 Jul 2009 14:45:08 +0800 Subject: [PATCH 02/10] the vertex index should be "first + i". --- opengl/java/android/opengl/GLLogWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opengl/java/android/opengl/GLLogWrapper.java b/opengl/java/android/opengl/GLLogWrapper.java index 4119bf821823f..f332448ea2152 100644 --- a/opengl/java/android/opengl/GLLogWrapper.java +++ b/opengl/java/android/opengl/GLLogWrapper.java @@ -1517,7 +1517,7 @@ class GLLogWrapper extends GLWrapperBase { arg("count", count); startLogIndices(); for (int i = 0; i < count; i++) { - doElement(mStringBuilder, i, first + count); + doElement(mStringBuilder, i, first + i); } endLogIndices(); end(); From 1ac3b5ff60def97b66d38ab5aa3e22efd17711c0 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Mon, 10 Aug 2009 13:02:28 +0200 Subject: [PATCH 03/10] If FLAGS_2D_PROJECTION is set, the MVP matrices need updating when changing the viewport. --- opengl/libagl/matrix.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opengl/libagl/matrix.cpp b/opengl/libagl/matrix.cpp index 0b68dc06f5e32..21ef50e6b6228 100644 --- a/opengl/libagl/matrix.cpp +++ b/opengl/libagl/matrix.cpp @@ -696,6 +696,8 @@ void ogles_viewport(ogles_context_t* c, f[2] = 0; f[6] = 0; f[10] = A; f[14] = B; f[3] = 0; f[7] = 0; f[11] = 0; f[15] = 1; c->transforms.dirty |= transform_state_t::VIEWPORT; + if (c->transforms.mvp4.flags & transform_t::FLAGS_2D_PROJECTION) + c->transforms.dirty |= transform_state_t::MVP; } // ---------------------------------------------------------------------------- From 79ad0e6623998ca2006aa0c17f902340132c3e1c Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Tue, 11 Aug 2009 18:01:14 +0200 Subject: [PATCH 04/10] Calculate specular lighting correctly Since the lighting calculations are done in object space, the vector from the object to the viewer also needs to be transformed to object space. --- include/private/opengles/gl_context.h | 1 + opengl/libagl/light.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/private/opengles/gl_context.h b/include/private/opengles/gl_context.h index a85f275bf9b12..e32e332663e3a 100644 --- a/include/private/opengles/gl_context.h +++ b/include/private/opengles/gl_context.h @@ -285,6 +285,7 @@ struct light_t { vec4_t normalizedObjPosition; vec4_t spotDir; vec4_t normalizedSpotDir; + vec4_t objViewer; GLfixed spotExp; GLfixed spotCutoff; GLfixed spotCutoffCosine; diff --git a/opengl/libagl/light.cpp b/opengl/libagl/light.cpp index 8ae32cc0f0e11..f211bcab3221a 100644 --- a/opengl/libagl/light.cpp +++ b/opengl/libagl/light.cpp @@ -216,6 +216,8 @@ static inline void light_picker(ogles_context_t* c) static inline void validate_light_mvi(ogles_context_t* c) { uint32_t en = c->lighting.enabledLights; + // Vector from object to viewer, in eye coordinates + const vec4_t eyeViewer = { 0, 0, 0x1000, 0 }; while (en) { const int i = 31 - gglClz(en); en &= ~(1<transforms.mvui.point4(&c->transforms.mvui, &l.objPosition, &l.position); vnorm3(l.normalizedObjPosition.v, l.objPosition.v); + c->transforms.mvui.point4(&c->transforms.mvui, + &l.objViewer, &eyeViewer); + vnorm3(l.objViewer.v, l.objViewer.v); } } @@ -379,9 +384,9 @@ void lightVertex(ogles_context_t* c, vertex_t* v) // specular if (ggl_unlikely(s && l.implicitSpecular.v[3])) { vec4_t h; - h.x = d.x; - h.y = d.y; - h.z = d.z + 0x10000; + h.x = d.x + l.objViewer.x; + h.y = d.y + l.objViewer.y; + h.z = d.z + l.objViewer.z; vnorm3(h.v, h.v); s = dot3(n.v, h.v); s = (s<0) ? (twoSide?(-s):0) : s; From 841ce8b7b9fffcc66cf1349097ed821b94627d63 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Fri, 21 Aug 2009 15:23:45 -0500 Subject: [PATCH 05/10] Fix bitmask in aapt's StringPool length construction The StringPool indicates the length of a string with a 16-bit integer. If the length of the string is greater than 0x7FFF, it splits it into two 16-bit integers with the first one having the high bit set. The length calculation has a small bug that masks off the 19 bits instead of the first 15 bits as intended. --- tools/aapt/StringPool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/aapt/StringPool.cpp b/tools/aapt/StringPool.cpp index 878d3b1fea7e1..715170aedfebf 100644 --- a/tools/aapt/StringPool.cpp +++ b/tools/aapt/StringPool.cpp @@ -228,7 +228,7 @@ status_t StringPool::writeStringBlock(const sp& pool) } dat += (preSize+strPos)/sizeof(uint16_t); if (lenSize > sizeof(uint16_t)) { - *dat = htods(0x8000 | ((strSize>>16)&0x7ffff)); + *dat = htods(0x8000 | ((strSize>>16)&0x7fff)); dat++; } *dat++ = htods(strSize); From d5d4e63ea46f513d035992070b376589760d7017 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Sat, 13 Jun 2009 06:03:24 -0500 Subject: [PATCH 06/10] Documentation: add preposition and clarify permissions --- docs/html/guide/topics/fundamentals.jd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/html/guide/topics/fundamentals.jd b/docs/html/guide/topics/fundamentals.jd index 71705d354f622..640e44bbfe3af 100644 --- a/docs/html/guide/topics/fundamentals.jd +++ b/docs/html/guide/topics/fundamentals.jd @@ -72,8 +72,8 @@ resources are required by other applications. runs in isolation from the code of all other applications.
  • By default, each application is assigned a unique Linux user ID. -Permissions are set so that the application's files are visible only -that user, only to the application itself — although there are ways +Permissions are set so that the application's files are visible only to +that user and only to the application itself — although there are ways to export them to other applications as well.
  • From 6ab180aa65d2b4f155518af0ac7bb2777f9ce61f Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Sat, 13 Jun 2009 06:16:23 -0500 Subject: [PATCH 07/10] Documentation: Clarify that a FileDescriptor must be seekable In MediaPlayer, methods with an offset specified must be passed a FileDescriptor that is seekable. This change notes that in the JavaDoc. --- media/java/android/media/MediaPlayer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java index 3b46d690c40be..fe768be6fb442 100644 --- a/media/java/android/media/MediaPlayer.java +++ b/media/java/android/media/MediaPlayer.java @@ -644,7 +644,8 @@ public class MediaPlayer } /** - * Sets the data source (FileDescriptor) to use. It is the caller's responsibility + * Sets the data source (FileDescriptor) to use. The FileDescriptor must be + * seekable (N.B. a LocalSocket is not seekable). It is the caller's responsibility * to close the file descriptor. It is safe to do so as soon as this call returns. * * @param fd the FileDescriptor for the file you want to play From 6ee299a327ce3713473eaec748233dc4f7ec466e Mon Sep 17 00:00:00 2001 From: "Yusuf T. Mobile" Date: Tue, 21 Jul 2009 14:51:39 -0700 Subject: [PATCH 08/10] Updated tutorial to no longer use the deprecated MapView.getZoomControls() function. Also fixed a spelling error. --- .../guide/tutorials/views/hello-mapview.jd | 40 +++---------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/docs/html/guide/tutorials/views/hello-mapview.jd b/docs/html/guide/tutorials/views/hello-mapview.jd index 868bfaa6a081d..50cb0303f0ef4 100644 --- a/docs/html/guide/tutorials/views/hello-mapview.jd +++ b/docs/html/guide/tutorials/views/hello-mapview.jd @@ -93,28 +93,6 @@ protected boolean isRouteDisplayed() { }

    You can actually run this now, but all it does is allow you to pan around the map.

    -

    Android provides a handy {@link android.widget.ZoomControls} widget for zooming in and out of a View. -MapView can automatically hook one for us by requesting it with the getZoomControls() -method. Let's do this.

    - -
  • Go back to the layout file. We need a new ViewGroup element, in which we'll - place the ZoomControls. Just below the MapView element (but inside the RelativeLayout), add this element: -
    -<LinearLayout
    -    android:id="@+id/zoomview"
    -    android:layout_width="wrap_content"
    -    android:layout_height="wrap_content"
    -    android:layout_alignBottom="@id/mapview"
    -    android:layout_centerHorizontal="true"
    -/>
    - -

    It doesn't really matter what kind of ViewGroup we use, because we just want a - container that we can position within our root RelativeLayout.

    - -

    The last two attributes are available only to an element that's a child of a - RelativeLayout. layout_alignBottom aligns the bottom of this element to the bottom of - the element identified with a resource tag (which must be a sibling to this element). - layout_centerHorizontal centers this on the horizontal plane.

  • Now go back to the HelloMapView class. We'll now retrieve the ZoomControls object from the MapView and add it to our new layout element. First, at the top of the HelloMapView, @@ -122,24 +100,18 @@ method. Let's do this.

     LinearLayout linearLayout;
     MapView mapView;
    -ZoomControls mZoom;
  • +
  • Then initialize each of these in onCreate(). We'll capture the LinearLayout and MapView through their layout resources. Then get the ZoomControls from the MapView::
    -linearLayout = (LinearLayout) findViewById(R.id.zoomview);
     mapView = (MapView) findViewById(R.id.mapview);
    -mZoom = (ZoomControls) mapView.getZoomControls();
    +mapView.setBuiltInZoomControls(true); + -

    By using the ZoomControls object provided by MapView, we don't have to do any of the work - required to actually perform the zoom operations. The ZoomControls widget that MapView - returns for us is already hooked into the MapView and works as soon as we add it to the - layout. The controls will appear whenever the user touches the map, then dissapear after - a few moments of inactivity.

  • - -
  • Now just plug our ZoomControls into the LinearLayout we added: - -
    linearLayout.addView(mZoom);
  • +

    By using the built-in zoom control provided by MapView, we don't have to do any of the work + required to actually perform the zoom operations. The controls will appear whenever the user + touches the map, then disappear after a few moments of inactivity.

  • Run it.
  • From c0bfbd341454912f18b54278e84e88bff9a87e6a Mon Sep 17 00:00:00 2001 From: linuxemacs Date: Fri, 5 Dec 2008 00:01:36 +0800 Subject: [PATCH 09/10] Fix android application platform will crash problem. If slide on password lock panel and repeatedly swith this panel to lock panel with BACK button and POWER/HOME button, the android application platform will crash. --- core/java/com/android/internal/widget/LockPatternView.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java index 53be8911f3754..bad7292b8f57b 100644 --- a/core/java/com/android/internal/widget/LockPatternView.java +++ b/core/java/com/android/internal/widget/LockPatternView.java @@ -582,6 +582,8 @@ public class LockPatternView extends View { mInProgressY = y; if (mPatternInProgress) { + if (mPattern.isEmpty()) return false; + final ArrayList pattern = mPattern; final float radius = mSquareWidth * mDiameterFactor * 0.5f; From 0369a7c3ac97b4791716ddd183e83309b1455476 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 23 Mar 2009 15:20:47 +0100 Subject: [PATCH 10/10] Improve warning messages for permission denial due to non-exported intent receivers. --- services/java/com/android/server/am/ActivityManagerService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 2e2cdb228cdd8..5585ea7febf2b 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -5746,6 +5746,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } // If the target requires a specific UID, always fail for others. if (reqUid >= 0 && uid != reqUid) { + Log.w(TAG, "Permission denied: checkComponentPermission() reqUid=" + reqUid); return PackageManager.PERMISSION_DENIED; } if (permission == null) {