Merge "Always redraw the UI on orientation change Bug #4994715"
diff --git a/Android.mk b/Android.mk
index 9fbdde7..335fb73 100644
--- a/Android.mk
+++ b/Android.mk
@@ -36,6 +36,7 @@
# EventLogTags files.
LOCAL_SRC_FILES += \
core/java/android/content/EventLogTags.logtags \
+ core/java/android/speech/tts/EventLogTags.logtags \
core/java/android/webkit/EventLogTags.logtags \
telephony/java/com/android/internal/telephony/EventLogTags.logtags \
diff --git a/api/14.txt b/api/14.txt
index 050540b..d25d2b9 100644
--- a/api/14.txt
+++ b/api/14.txt
@@ -16272,20 +16272,10 @@
public class AllocationAdapter extends android.renderscript.Allocation {
method public static android.renderscript.AllocationAdapter create2D(android.renderscript.RenderScript, android.renderscript.Allocation);
- method public void readData(int[]);
- method public void readData(float[]);
method public void setFace(android.renderscript.Type.CubemapFace);
method public void setLOD(int);
method public void setY(int);
method public void setZ(int);
- method public void subData(int, android.renderscript.FieldPacker);
- method public void subData1D(int, int, int[]);
- method public void subData1D(int, int, short[]);
- method public void subData1D(int, int, byte[]);
- method public void subData1D(int, int, float[]);
- method public void subData2D(int, int, int, int, int[]);
- method public void subData2D(int, int, int, int, float[]);
- method public void subElementData(int, int, android.renderscript.FieldPacker);
}
class BaseObj {
diff --git a/api/current.txt b/api/current.txt
index 6ebae35..559672f 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -312,10 +312,15 @@
field public static final int codes = 16843330; // 0x1010242
field public static final int collapseColumns = 16843083; // 0x101014b
field public static final int color = 16843173; // 0x10101a5
+ field public static final int colorActivatedHighlight = 16843684; // 0x10103a4
field public static final int colorBackground = 16842801; // 0x1010031
field public static final int colorBackgroundCacheHint = 16843435; // 0x10102ab
+ field public static final int colorFocusedHighlight = 16843683; // 0x10103a3
field public static final int colorForeground = 16842800; // 0x1010030
field public static final int colorForegroundInverse = 16843270; // 0x1010206
+ field public static final int colorLongPressedHighlight = 16843682; // 0x10103a2
+ field public static final int colorMultiSelectHighlight = 16843685; // 0x10103a5
+ field public static final int colorPressedHighlight = 16843681; // 0x10103a1
field public static final int columnCount = 16843638; // 0x1010376
field public static final int columnDelay = 16843215; // 0x10101cf
field public static final int columnOrderPreserved = 16843639; // 0x1010377
@@ -598,10 +603,10 @@
field public static final int layout_centerInParent = 16843151; // 0x101018f
field public static final int layout_centerVertical = 16843153; // 0x1010191
field public static final int layout_column = 16843084; // 0x101014c
- field public static final int layout_columnSpan = 16843644; // 0x101037c
+ field public static final int layout_columnFlexibility = 16843646; // 0x101037e
+ field public static final int layout_columnSpan = 16843645; // 0x101037d
field public static final int layout_gravity = 16842931; // 0x10100b3
field public static final int layout_height = 16842997; // 0x10100f5
- field public static final int layout_heightSpec = 16843646; // 0x101037e
field public static final int layout_margin = 16842998; // 0x10100f6
field public static final int layout_marginBottom = 16843002; // 0x10100fa
field public static final int layout_marginEnd = 16843674; // 0x101039a
@@ -610,6 +615,7 @@
field public static final int layout_marginStart = 16843673; // 0x1010399
field public static final int layout_marginTop = 16843000; // 0x10100f8
field public static final int layout_row = 16843642; // 0x101037a
+ field public static final int layout_rowFlexibility = 16843644; // 0x101037c
field public static final int layout_rowSpan = 16843643; // 0x101037b
field public static final int layout_scale = 16843155; // 0x1010193
field public static final int layout_span = 16843085; // 0x101014d
@@ -617,7 +623,6 @@
field public static final int layout_toRightOf = 16843139; // 0x1010183
field public static final int layout_weight = 16843137; // 0x1010181
field public static final int layout_width = 16842996; // 0x10100f4
- field public static final int layout_widthSpec = 16843645; // 0x101037d
field public static final int layout_x = 16843135; // 0x101017f
field public static final int layout_y = 16843136; // 0x1010180
field public static final int left = 16843181; // 0x10101ad
@@ -941,6 +946,7 @@
field public static final int tension = 16843370; // 0x101026a
field public static final int testOnly = 16843378; // 0x1010272
field public static final int text = 16843087; // 0x101014f
+ field public static final int textAllCaps = 16843680; // 0x10103a0
field public static final int textAppearance = 16842804; // 0x1010034
field public static final int textAppearanceButton = 16843271; // 0x1010207
field public static final int textAppearanceInverse = 16842805; // 0x1010035
@@ -1120,6 +1126,16 @@
field public static final int background_light = 17170447; // 0x106000f
field public static final int black = 17170444; // 0x106000c
field public static final int darker_gray = 17170432; // 0x1060000
+ field public static final int holo_blue_bright = 17170459; // 0x106001b
+ field public static final int holo_blue_dark = 17170451; // 0x1060013
+ field public static final int holo_blue_light = 17170450; // 0x1060012
+ field public static final int holo_green_dark = 17170453; // 0x1060015
+ field public static final int holo_green_light = 17170452; // 0x1060014
+ field public static final int holo_orange_dark = 17170457; // 0x1060019
+ field public static final int holo_orange_light = 17170456; // 0x1060018
+ field public static final int holo_purple = 17170458; // 0x106001a
+ field public static final int holo_red_dark = 17170455; // 0x1060017
+ field public static final int holo_red_light = 17170454; // 0x1060016
field public static final int primary_text_dark = 17170433; // 0x1060001
field public static final int primary_text_dark_nodisable = 17170434; // 0x1060002
field public static final int primary_text_light = 17170435; // 0x1060003
@@ -1512,6 +1528,7 @@
field public static final int TextAppearance_Holo_Small = 16974081; // 0x1030101
field public static final int TextAppearance_Holo_Small_Inverse = 16974082; // 0x1030102
field public static final int TextAppearance_Holo_Widget = 16974085; // 0x1030105
+ field public static final int TextAppearance_Holo_Widget_ActionBar_Menu = 16974113; // 0x1030121
field public static final int TextAppearance_Holo_Widget_ActionBar_Subtitle = 16974099; // 0x1030113
field public static final int TextAppearance_Holo_Widget_ActionBar_Subtitle_Inverse = 16974110; // 0x103011e
field public static final int TextAppearance_Holo_Widget_ActionBar_Title = 16974098; // 0x1030112
@@ -1582,16 +1599,16 @@
field public static final int Theme_Holo_Light_NoActionBar = 16974064; // 0x10300f0
field public static final int Theme_Holo_Light_NoActionBar_Fullscreen = 16974065; // 0x10300f1
field public static final int Theme_Holo_Light_Panel = 16973948; // 0x103007c
- field public static final int Theme_Holo_Light_SolidActionBar = 16974121; // 0x1030129
- field public static final int Theme_Holo_Light_SolidActionBar_Inverse = 16974122; // 0x103012a
- field public static final int Theme_Holo_Light_SolidActionBar_Inverse_SplitActionBarWhenNarrow = 16974125; // 0x103012d
- field public static final int Theme_Holo_Light_SolidActionBar_SplitActionBarWhenNarrow = 16974124; // 0x103012c
+ field public static final int Theme_Holo_Light_SolidActionBar = 16974122; // 0x103012a
+ field public static final int Theme_Holo_Light_SolidActionBar_Inverse = 16974123; // 0x103012b
+ field public static final int Theme_Holo_Light_SolidActionBar_Inverse_SplitActionBarWhenNarrow = 16974126; // 0x103012e
+ field public static final int Theme_Holo_Light_SolidActionBar_SplitActionBarWhenNarrow = 16974125; // 0x103012d
field public static final int Theme_Holo_Light_SplitActionBarWhenNarrow = 16974106; // 0x103011a
field public static final int Theme_Holo_NoActionBar = 16973932; // 0x103006c
field public static final int Theme_Holo_NoActionBar_Fullscreen = 16973933; // 0x103006d
field public static final int Theme_Holo_Panel = 16973947; // 0x103007b
- field public static final int Theme_Holo_SolidActionBar = 16974120; // 0x1030128
- field public static final int Theme_Holo_SolidActionBar_SplitActionBarWhenNarrow = 16974123; // 0x103012b
+ field public static final int Theme_Holo_SolidActionBar = 16974121; // 0x1030129
+ field public static final int Theme_Holo_SolidActionBar_SplitActionBarWhenNarrow = 16974124; // 0x103012c
field public static final int Theme_Holo_SplitActionBarWhenNarrow = 16974105; // 0x1030119
field public static final int Theme_Holo_Wallpaper = 16973949; // 0x103007d
field public static final int Theme_Holo_Wallpaper_NoTitleBar = 16973950; // 0x103007e
@@ -1643,7 +1660,7 @@
field public static final int Widget_GridView = 16973874; // 0x1030032
field public static final int Widget_Holo = 16973962; // 0x103008a
field public static final int Widget_Holo_ActionBar = 16974004; // 0x10300b4
- field public static final int Widget_Holo_ActionBar_Solid = 16974113; // 0x1030121
+ field public static final int Widget_Holo_ActionBar_Solid = 16974114; // 0x1030122
field public static final int Widget_Holo_ActionBar_TabBar = 16974071; // 0x10300f7
field public static final int Widget_Holo_ActionBar_TabText = 16974070; // 0x10300f6
field public static final int Widget_Holo_ActionBar_TabView = 16974069; // 0x10300f5
@@ -1673,19 +1690,19 @@
field public static final int Widget_Holo_ImageButton = 16973974; // 0x1030096
field public static final int Widget_Holo_Light = 16974005; // 0x10300b5
field public static final int Widget_Holo_Light_ActionBar = 16974049; // 0x10300e1
- field public static final int Widget_Holo_Light_ActionBar_Solid = 16974114; // 0x1030122
- field public static final int Widget_Holo_Light_ActionBar_Solid_Inverse = 16974115; // 0x1030123
+ field public static final int Widget_Holo_Light_ActionBar_Solid = 16974115; // 0x1030123
+ field public static final int Widget_Holo_Light_ActionBar_Solid_Inverse = 16974116; // 0x1030124
field public static final int Widget_Holo_Light_ActionBar_TabBar = 16974074; // 0x10300fa
- field public static final int Widget_Holo_Light_ActionBar_TabBar_Inverse = 16974116; // 0x1030124
+ field public static final int Widget_Holo_Light_ActionBar_TabBar_Inverse = 16974117; // 0x1030125
field public static final int Widget_Holo_Light_ActionBar_TabText = 16974073; // 0x10300f9
- field public static final int Widget_Holo_Light_ActionBar_TabText_Inverse = 16974118; // 0x1030126
+ field public static final int Widget_Holo_Light_ActionBar_TabText_Inverse = 16974119; // 0x1030127
field public static final int Widget_Holo_Light_ActionBar_TabView = 16974072; // 0x10300f8
- field public static final int Widget_Holo_Light_ActionBar_TabView_Inverse = 16974117; // 0x1030125
+ field public static final int Widget_Holo_Light_ActionBar_TabView_Inverse = 16974118; // 0x1030126
field public static final int Widget_Holo_Light_ActionButton = 16974045; // 0x10300dd
field public static final int Widget_Holo_Light_ActionButton_CloseMode = 16974048; // 0x10300e0
field public static final int Widget_Holo_Light_ActionButton_Overflow = 16974046; // 0x10300de
field public static final int Widget_Holo_Light_ActionMode = 16974047; // 0x10300df
- field public static final int Widget_Holo_Light_ActionMode_Inverse = 16974119; // 0x1030127
+ field public static final int Widget_Holo_Light_ActionMode_Inverse = 16974120; // 0x1030128
field public static final int Widget_Holo_Light_AutoCompleteTextView = 16974011; // 0x10300bb
field public static final int Widget_Holo_Light_Button = 16974006; // 0x10300b6
field public static final int Widget_Holo_Light_Button_Borderless_Small = 16974108; // 0x103011c
@@ -14997,6 +15014,257 @@
field public static final deprecated java.lang.String URL = "url";
}
+ public final class CalendarContract {
+ field public static final java.lang.String ACCOUNT_TYPE_LOCAL = "LOCAL";
+ field public static final java.lang.String ACTION_EVENT_REMINDER = "android.intent.action.EVENT_REMINDER";
+ field public static final java.lang.String AUTHORITY = "com.android.calendar";
+ field public static final java.lang.String CALLER_IS_SYNCADAPTER = "caller_is_syncadapter";
+ field public static final android.net.Uri CONTENT_URI;
+ field public static final java.lang.String EXTRA_EVENT_BEGIN_TIME = "beginTime";
+ field public static final java.lang.String EXTRA_EVENT_END_TIME = "endTime";
+ }
+
+ public static final class CalendarContract.Attendees implements android.provider.BaseColumns android.provider.CalendarContract.AttendeesColumns android.provider.CalendarContract.EventsColumns {
+ method public static final android.database.Cursor query(android.content.ContentResolver, long, java.lang.String[]);
+ field public static final android.net.Uri CONTENT_URI;
+ }
+
+ protected static abstract interface CalendarContract.AttendeesColumns {
+ field public static final java.lang.String ATTENDEE_EMAIL = "attendeeEmail";
+ field public static final java.lang.String ATTENDEE_NAME = "attendeeName";
+ field public static final java.lang.String ATTENDEE_RELATIONSHIP = "attendeeRelationship";
+ field public static final java.lang.String ATTENDEE_STATUS = "attendeeStatus";
+ field public static final int ATTENDEE_STATUS_ACCEPTED = 1; // 0x1
+ field public static final int ATTENDEE_STATUS_DECLINED = 2; // 0x2
+ field public static final int ATTENDEE_STATUS_INVITED = 3; // 0x3
+ field public static final int ATTENDEE_STATUS_NONE = 0; // 0x0
+ field public static final int ATTENDEE_STATUS_TENTATIVE = 4; // 0x4
+ field public static final java.lang.String ATTENDEE_TYPE = "attendeeType";
+ field public static final java.lang.String EVENT_ID = "event_id";
+ field public static final int RELATIONSHIP_ATTENDEE = 1; // 0x1
+ field public static final int RELATIONSHIP_NONE = 0; // 0x0
+ field public static final int RELATIONSHIP_ORGANIZER = 2; // 0x2
+ field public static final int RELATIONSHIP_PERFORMER = 3; // 0x3
+ field public static final int RELATIONSHIP_SPEAKER = 4; // 0x4
+ field public static final int TYPE_NONE = 0; // 0x0
+ field public static final int TYPE_OPTIONAL = 2; // 0x2
+ field public static final int TYPE_REQUIRED = 1; // 0x1
+ }
+
+ public static final class CalendarContract.CalendarAlerts implements android.provider.BaseColumns android.provider.CalendarContract.CalendarAlertsColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.EventsColumns {
+ field public static final android.net.Uri CONTENT_URI;
+ field public static final android.net.Uri CONTENT_URI_BY_INSTANCE;
+ }
+
+ protected static abstract interface CalendarContract.CalendarAlertsColumns {
+ field public static final java.lang.String ALARM_TIME = "alarmTime";
+ field public static final java.lang.String BEGIN = "begin";
+ field public static final java.lang.String CREATION_TIME = "creationTime";
+ field public static final java.lang.String DEFAULT_SORT_ORDER = "begin ASC,title ASC";
+ field public static final java.lang.String END = "end";
+ field public static final java.lang.String EVENT_ID = "event_id";
+ field public static final java.lang.String MINUTES = "minutes";
+ field public static final java.lang.String NOTIFY_TIME = "notifyTime";
+ field public static final java.lang.String RECEIVED_TIME = "receivedTime";
+ field public static final java.lang.String STATE = "state";
+ field public static final int STATE_DISMISSED = 2; // 0x2
+ field public static final int STATE_FIRED = 1; // 0x1
+ field public static final int STATE_SCHEDULED = 0; // 0x0
+ }
+
+ public static final class CalendarContract.CalendarCache implements android.provider.CalendarContract.CalendarCacheColumns {
+ field public static final java.lang.String KEY_TIMEZONE_INSTANCES = "timezoneInstances";
+ field public static final java.lang.String KEY_TIMEZONE_INSTANCES_PREVIOUS = "timezoneInstancesPrevious";
+ field public static final java.lang.String KEY_TIMEZONE_TYPE = "timezoneType";
+ field public static final java.lang.String TIMEZONE_TYPE_AUTO = "auto";
+ field public static final java.lang.String TIMEZONE_TYPE_HOME = "home";
+ field public static final android.net.Uri URI;
+ }
+
+ protected static abstract interface CalendarContract.CalendarCacheColumns {
+ field public static final java.lang.String KEY = "key";
+ field public static final java.lang.String VALUE = "value";
+ }
+
+ protected static abstract interface CalendarContract.CalendarColumns {
+ field public static final java.lang.String ALLOWED_REMINDERS = "allowedReminders";
+ field public static final java.lang.String CALENDAR_ACCESS_LEVEL = "calendar_access_level";
+ field public static final java.lang.String CALENDAR_COLOR = "calendar_color";
+ field public static final java.lang.String CALENDAR_DISPLAY_NAME = "calendar_displayName";
+ field public static final java.lang.String CALENDAR_TIME_ZONE = "calendar_timezone";
+ field public static final int CAL_ACCESS_CONTRIBUTOR = 500; // 0x1f4
+ field public static final int CAL_ACCESS_EDITOR = 600; // 0x258
+ field public static final int CAL_ACCESS_FREEBUSY = 100; // 0x64
+ field public static final int CAL_ACCESS_NONE = 0; // 0x0
+ field public static final int CAL_ACCESS_OVERRIDE = 400; // 0x190
+ field public static final int CAL_ACCESS_OWNER = 700; // 0x2bc
+ field public static final int CAL_ACCESS_READ = 200; // 0xc8
+ field public static final int CAL_ACCESS_RESPOND = 300; // 0x12c
+ field public static final int CAL_ACCESS_ROOT = 800; // 0x320
+ field public static final java.lang.String CAN_MODIFY_TIME_ZONE = "canModifyTimeZone";
+ field public static final java.lang.String CAN_ORGANIZER_RESPOND = "canOrganizerRespond";
+ field public static final java.lang.String MAX_REMINDERS = "maxReminders";
+ field public static final java.lang.String OWNER_ACCOUNT = "ownerAccount";
+ field public static final java.lang.String SYNC_EVENTS = "sync_events";
+ field public static final java.lang.String VISIBLE = "visible";
+ }
+
+ public static final class CalendarContract.CalendarEntity implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.SyncColumns {
+ method public static android.content.EntityIterator newEntityIterator(android.database.Cursor);
+ field public static final android.net.Uri CONTENT_URI;
+ }
+
+ protected static abstract interface CalendarContract.CalendarSyncColumns {
+ field public static final java.lang.String CAL_SYNC1 = "cal_sync1";
+ field public static final java.lang.String CAL_SYNC10 = "cal_sync10";
+ field public static final java.lang.String CAL_SYNC2 = "cal_sync2";
+ field public static final java.lang.String CAL_SYNC3 = "cal_sync3";
+ field public static final java.lang.String CAL_SYNC4 = "cal_sync4";
+ field public static final java.lang.String CAL_SYNC5 = "cal_sync5";
+ field public static final java.lang.String CAL_SYNC6 = "cal_sync6";
+ field public static final java.lang.String CAL_SYNC7 = "cal_sync7";
+ field public static final java.lang.String CAL_SYNC8 = "cal_sync8";
+ field public static final java.lang.String CAL_SYNC9 = "cal_sync9";
+ }
+
+ public static final class CalendarContract.Calendars implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.SyncColumns {
+ field public static final java.lang.String CALENDAR_LOCATION = "calendar_location";
+ field public static final android.net.Uri CONTENT_URI;
+ field public static final java.lang.String DEFAULT_SORT_ORDER = "displayName";
+ field public static final java.lang.String NAME = "name";
+ }
+
+ public static final class CalendarContract.EventDays implements android.provider.CalendarContract.EventDaysColumns {
+ method public static final android.database.Cursor query(android.content.ContentResolver, int, int, java.lang.String[]);
+ field public static final android.net.Uri CONTENT_URI;
+ }
+
+ protected static abstract interface CalendarContract.EventDaysColumns {
+ field public static final java.lang.String ENDDAY = "endDay";
+ field public static final java.lang.String STARTDAY = "startDay";
+ }
+
+ public static final class CalendarContract.Events implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.SyncColumns {
+ field public static final android.net.Uri CONTENT_EXCEPTION_URI;
+ field public static final android.net.Uri CONTENT_URI;
+ }
+
+ protected static abstract interface CalendarContract.EventsColumns {
+ field public static final int ACCESS_CONFIDENTIAL = 1; // 0x1
+ field public static final int ACCESS_DEFAULT = 0; // 0x0
+ field public static final java.lang.String ACCESS_LEVEL = "accessLevel";
+ field public static final int ACCESS_PRIVATE = 2; // 0x2
+ field public static final int ACCESS_PUBLIC = 3; // 0x3
+ field public static final java.lang.String ALL_DAY = "allDay";
+ field public static final java.lang.String AVAILABILITY = "availability";
+ field public static final int AVAILABILITY_BUSY = 0; // 0x0
+ field public static final int AVAILABILITY_FREE = 1; // 0x1
+ field public static final java.lang.String CALENDAR_ID = "calendar_id";
+ field public static final java.lang.String CAN_INVITE_OTHERS = "canInviteOthers";
+ field public static final java.lang.String DESCRIPTION = "description";
+ field public static final java.lang.String DTEND = "dtend";
+ field public static final java.lang.String DTSTART = "dtstart";
+ field public static final java.lang.String DURATION = "duration";
+ field public static final java.lang.String EVENT_COLOR = "eventColor";
+ field public static final java.lang.String EVENT_END_TIMEZONE = "eventEndTimezone";
+ field public static final java.lang.String EVENT_LOCATION = "eventLocation";
+ field public static final java.lang.String EVENT_TIMEZONE = "eventTimezone";
+ field public static final java.lang.String EXDATE = "exdate";
+ field public static final java.lang.String EXRULE = "exrule";
+ field public static final java.lang.String GUESTS_CAN_INVITE_OTHERS = "guestsCanInviteOthers";
+ field public static final java.lang.String GUESTS_CAN_MODIFY = "guestsCanModify";
+ field public static final java.lang.String GUESTS_CAN_SEE_GUESTS = "guestsCanSeeGuests";
+ field public static final java.lang.String HAS_ALARM = "hasAlarm";
+ field public static final java.lang.String HAS_ATTENDEE_DATA = "hasAttendeeData";
+ field public static final java.lang.String HAS_EXTENDED_PROPERTIES = "hasExtendedProperties";
+ field public static final java.lang.String LAST_DATE = "lastDate";
+ field public static final java.lang.String LAST_SYNCED = "lastSynced";
+ field public static final java.lang.String ORGANIZER = "organizer";
+ field public static final java.lang.String ORIGINAL_ALL_DAY = "originalAllDay";
+ field public static final java.lang.String ORIGINAL_ID = "original_id";
+ field public static final java.lang.String ORIGINAL_INSTANCE_TIME = "originalInstanceTime";
+ field public static final java.lang.String ORIGINAL_SYNC_ID = "original_sync_id";
+ field public static final java.lang.String RDATE = "rdate";
+ field public static final java.lang.String RRULE = "rrule";
+ field public static final java.lang.String SELF_ATTENDEE_STATUS = "selfAttendeeStatus";
+ field public static final java.lang.String STATUS = "eventStatus";
+ field public static final int STATUS_CANCELED = 2; // 0x2
+ field public static final int STATUS_CONFIRMED = 1; // 0x1
+ field public static final int STATUS_TENTATIVE = 0; // 0x0
+ field public static final java.lang.String SYNC_DATA1 = "sync_data1";
+ field public static final java.lang.String SYNC_DATA10 = "sync_data10";
+ field public static final java.lang.String SYNC_DATA2 = "sync_data2";
+ field public static final java.lang.String SYNC_DATA3 = "sync_data3";
+ field public static final java.lang.String SYNC_DATA4 = "sync_data4";
+ field public static final java.lang.String SYNC_DATA5 = "sync_data5";
+ field public static final java.lang.String SYNC_DATA6 = "sync_data6";
+ field public static final java.lang.String SYNC_DATA7 = "sync_data7";
+ field public static final java.lang.String SYNC_DATA8 = "sync_data8";
+ field public static final java.lang.String SYNC_DATA9 = "sync_data9";
+ field public static final java.lang.String TITLE = "title";
+ }
+
+ public static final class CalendarContract.EventsEntity implements android.provider.BaseColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.SyncColumns {
+ method public static android.content.EntityIterator newEntityIterator(android.database.Cursor, android.content.ContentResolver);
+ method public static android.content.EntityIterator newEntityIterator(android.database.Cursor, android.content.ContentProviderClient);
+ field public static final android.net.Uri CONTENT_URI;
+ }
+
+ public static final class CalendarContract.ExtendedProperties implements android.provider.BaseColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.ExtendedPropertiesColumns {
+ field public static final android.net.Uri CONTENT_URI;
+ }
+
+ protected static abstract interface CalendarContract.ExtendedPropertiesColumns {
+ field public static final java.lang.String EVENT_ID = "event_id";
+ field public static final java.lang.String NAME = "name";
+ field public static final java.lang.String VALUE = "value";
+ }
+
+ public static final class CalendarContract.Instances implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.EventsColumns {
+ method public static final android.database.Cursor query(android.content.ContentResolver, java.lang.String[], long, long);
+ method public static final android.database.Cursor query(android.content.ContentResolver, java.lang.String[], long, long, java.lang.String);
+ field public static final java.lang.String BEGIN = "begin";
+ field public static final android.net.Uri CONTENT_BY_DAY_URI;
+ field public static final android.net.Uri CONTENT_SEARCH_BY_DAY_URI;
+ field public static final android.net.Uri CONTENT_SEARCH_URI;
+ field public static final android.net.Uri CONTENT_URI;
+ field public static final java.lang.String END = "end";
+ field public static final java.lang.String END_DAY = "endDay";
+ field public static final java.lang.String END_MINUTE = "endMinute";
+ field public static final java.lang.String EVENT_ID = "event_id";
+ field public static final java.lang.String START_DAY = "startDay";
+ field public static final java.lang.String START_MINUTE = "startMinute";
+ }
+
+ public static final class CalendarContract.Reminders implements android.provider.BaseColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.RemindersColumns {
+ method public static final android.database.Cursor query(android.content.ContentResolver, long, java.lang.String[]);
+ field public static final android.net.Uri CONTENT_URI;
+ }
+
+ protected static abstract interface CalendarContract.RemindersColumns {
+ field public static final java.lang.String EVENT_ID = "event_id";
+ field public static final java.lang.String METHOD = "method";
+ field public static final int METHOD_ALERT = 1; // 0x1
+ field public static final int METHOD_DEFAULT = 0; // 0x0
+ field public static final int METHOD_EMAIL = 2; // 0x2
+ field public static final int METHOD_SMS = 3; // 0x3
+ field public static final java.lang.String MINUTES = "minutes";
+ field public static final int MINUTES_DEFAULT = -1; // 0xffffffff
+ }
+
+ protected static abstract interface CalendarContract.SyncColumns implements android.provider.CalendarContract.CalendarSyncColumns {
+ field public static final java.lang.String ACCOUNT_NAME = "account_name";
+ field public static final java.lang.String ACCOUNT_TYPE = "account_type";
+ field public static final java.lang.String CAN_PARTIALLY_UPDATE = "canPartiallyUpdate";
+ field public static final java.lang.String DELETED = "deleted";
+ field public static final java.lang.String DIRTY = "dirty";
+ field public static final java.lang.String _SYNC_ID = "_sync_id";
+ }
+
+ public static final class CalendarContract.SyncState implements android.provider.SyncStateContract.Columns {
+ field public static final android.net.Uri CONTENT_URI;
+ }
+
public class CallLog {
ctor public CallLog();
field public static final java.lang.String AUTHORITY = "call_log";
@@ -15622,6 +15890,10 @@
field public static final java.lang.String PHOTO = "data15";
}
+ public static final class ContactsContract.Contacts.StreamItems implements android.provider.ContactsContract.StreamItemsColumns {
+ field public static final java.lang.String CONTENT_DIRECTORY = "stream_items";
+ }
+
protected static abstract interface ContactsContract.ContactsColumns {
field public static final java.lang.String DISPLAY_NAME = "display_name";
field public static final java.lang.String HAS_PHONE_NUMBER = "has_phone_number";
@@ -15855,6 +16127,10 @@
field public static final java.lang.String DATA_ID = "data_id";
}
+ public static final class ContactsContract.RawContacts.StreamItems implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemsColumns {
+ field public static final java.lang.String CONTENT_DIRECTORY = "stream_items";
+ }
+
protected static abstract interface ContactsContract.RawContactsColumns {
field public static final java.lang.String AGGREGATION_MODE = "aggregation_mode";
field public static final java.lang.String CONTACT_ID = "contact_id";
@@ -15914,6 +16190,41 @@
field public static final android.net.Uri CONTENT_URI;
}
+ public static final class ContactsContract.StreamItemPhotos implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemPhotosColumns {
+ }
+
+ protected static abstract interface ContactsContract.StreamItemPhotosColumns {
+ field public static final java.lang.String ACTION = "action";
+ field public static final java.lang.String ACTION_URI = "action_uri";
+ field public static final java.lang.String PICTURE = "picture";
+ field public static final java.lang.String SORT_INDEX = "sort_index";
+ field public static final java.lang.String STREAM_ITEM_ID = "stream_item_id";
+ }
+
+ public static final class ContactsContract.StreamItems implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemsColumns {
+ field public static final android.net.Uri CONTENT_LIMIT_URI;
+ field public static final android.net.Uri CONTENT_PHOTO_URI;
+ field public static final android.net.Uri CONTENT_URI;
+ field public static final java.lang.String MAX_ITEMS = "max_items";
+ field public static final java.lang.String PHOTO_MAX_BYTES = "photo_max_bytes";
+ }
+
+ public static final class ContactsContract.StreamItems.StreamItemPhotos implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemPhotosColumns {
+ field public static final java.lang.String CONTENT_DIRECTORY = "photo";
+ }
+
+ protected static abstract interface ContactsContract.StreamItemsColumns {
+ field public static final java.lang.String ACTION = "action";
+ field public static final java.lang.String ACTION_URI = "action_uri";
+ field public static final java.lang.String COMMENTS = "comments";
+ field public static final java.lang.String RAW_CONTACT_ID = "raw_contact_id";
+ field public static final java.lang.String RES_ICON = "icon";
+ field public static final java.lang.String RES_LABEL = "label";
+ field public static final java.lang.String RES_PACKAGE = "res_package";
+ field public static final java.lang.String TEXT = "text";
+ field public static final java.lang.String TIMESTAMP = "timestamp";
+ }
+
protected static abstract interface ContactsContract.SyncColumns implements android.provider.ContactsContract.BaseSyncColumns {
field public static final java.lang.String ACCOUNT_NAME = "account_name";
field public static final java.lang.String ACCOUNT_TYPE = "account_type";
@@ -16637,23 +16948,12 @@
}
public class AllocationAdapter extends android.renderscript.Allocation {
+ method public static android.renderscript.AllocationAdapter create1D(android.renderscript.RenderScript, android.renderscript.Allocation);
method public static android.renderscript.AllocationAdapter create2D(android.renderscript.RenderScript, android.renderscript.Allocation);
- method public void readData(int[]);
- method public void readData(float[]);
method public void setFace(android.renderscript.Type.CubemapFace);
method public void setLOD(int);
method public void setY(int);
method public void setZ(int);
- method public void subData(int, android.renderscript.FieldPacker);
- method public void subData1D(int, int, int[]);
- method public void subData1D(int, int, short[]);
- method public void subData1D(int, int, byte[]);
- method public void subData1D(int, int, float[]);
- method public void subData1D(int, int, android.renderscript.AllocationAdapter, int);
- method public void subData2D(int, int, int, int, int[]);
- method public void subData2D(int, int, int, int, float[]);
- method public void subData2D(int, int, int, int, android.renderscript.AllocationAdapter, int, int);
- method public void subElementData(int, int, android.renderscript.FieldPacker);
}
public class BaseObj {
@@ -24955,11 +25255,9 @@
field public static final int ALIGN_MARGINS = 1; // 0x1
field public static final android.widget.GridLayout.Alignment BASELINE;
field public static final android.widget.GridLayout.Alignment BOTTOM;
- field public static final android.widget.GridLayout.Spec CAN_SHRINK;
- field public static final android.widget.GridLayout.Spec CAN_STRETCH;
+ field public static final int CAN_STRETCH = 2; // 0x2
field public static final android.widget.GridLayout.Alignment CENTER;
field public static final android.widget.GridLayout.Alignment FILL;
- field public static final android.widget.GridLayout.Spec FIXED;
field public static final int HORIZONTAL = 0; // 0x0
field public static final android.widget.GridLayout.Alignment LEFT;
field public static final android.widget.GridLayout.Alignment RIGHT;
@@ -24975,6 +25273,7 @@
ctor public GridLayout.Group(int, int, android.widget.GridLayout.Alignment);
ctor public GridLayout.Group(int, android.widget.GridLayout.Alignment);
field public final android.widget.GridLayout.Alignment alignment;
+ field public int flexibility;
}
public static class GridLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
@@ -24986,13 +25285,7 @@
ctor public GridLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
method public void setGravity(int);
field public android.widget.GridLayout.Group columnGroup;
- field public android.widget.GridLayout.Spec heightSpec;
field public android.widget.GridLayout.Group rowGroup;
- field public android.widget.GridLayout.Spec widthSpec;
- }
-
- public static abstract class GridLayout.Spec {
- ctor public GridLayout.Spec();
}
public class GridView extends android.widget.AbsListView {
@@ -26125,6 +26418,7 @@
method public boolean onTextContextMenuItem(int);
method public void removeTextChangedListener(android.text.TextWatcher);
method protected void resetLayoutDirectionResolution();
+ method public void setAllCaps(boolean);
method public final void setAutoLinkMask(int);
method public void setCompoundDrawablePadding(int);
method public void setCompoundDrawables(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
diff --git a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
index 38d0d2a..2666b41 100644
--- a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
+++ b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
@@ -23,6 +23,8 @@
import android.os.RemoteException;
import android.os.ServiceManager;
+import java.util.HashSet;
+
public final class Bmgr {
IBackupManager mBmgr;
IRestoreSession mRestore;
@@ -45,7 +47,6 @@
}
public void run(String[] args) {
- boolean validCommand = false;
if (args.length < 1) {
showUsage();
return;
@@ -329,7 +330,13 @@
} else {
try {
long token = Long.parseLong(arg, 16);
- doRestoreAll(token);
+ HashSet<String> filter = null;
+ while ((arg = nextArg()) != null) {
+ if (filter == null) filter = new HashSet<String>();
+ filter.add(arg);
+ }
+
+ doRestoreAll(token, filter);
} catch (NumberFormatException e) {
showUsage();
return;
@@ -364,7 +371,7 @@
}
}
- private void doRestoreAll(long token) {
+ private void doRestoreAll(long token, HashSet<String> filter) {
RestoreObserver observer = new RestoreObserver();
try {
@@ -383,7 +390,13 @@
for (RestoreSet s : sets) {
if (s.token == token) {
System.out.println("Scheduling restore: " + s.name);
- didRestore = (mRestore.restoreAll(token, observer) == 0);
+ if (filter == null) {
+ didRestore = (mRestore.restoreAll(token, observer) == 0);
+ } else {
+ String[] names = new String[filter.size()];
+ filter.toArray(names);
+ didRestore = (mRestore.restoreSome(token, observer, names) == 0);
+ }
break;
}
}
@@ -430,6 +443,7 @@
System.err.println(" bmgr list sets");
System.err.println(" bmgr transport WHICH");
System.err.println(" bmgr restore TOKEN");
+ System.err.println(" bmgr restore TOKEN PACKAGE...");
System.err.println(" bmgr restore PACKAGE");
System.err.println(" bmgr run");
System.err.println(" bmgr wipe PACKAGE");
@@ -457,12 +471,18 @@
System.err.println("The 'transport' command designates the named transport as the currently");
System.err.println("active one. This setting is persistent across reboots.");
System.err.println("");
- System.err.println("The 'restore' command when given a restore token initiates a full-system");
+ System.err.println("The 'restore' command when given just a restore token initiates a full-system");
System.err.println("restore operation from the currently active transport. It will deliver");
System.err.println("the restore set designated by the TOKEN argument to each application");
System.err.println("that had contributed data to that restore set.");
System.err.println("");
- System.err.println("The 'restore' command when given a package name intiates a restore of");
+ System.err.println("The 'restore' command when given a token and one or more package names");
+ System.err.println("initiates a restore operation of just those given packages from the restore");
+ System.err.println("set designated by the TOKEN argument. It is effectively the same as the");
+ System.err.println("'restore' operation supplying only a token, but applies a filter to the");
+ System.err.println("set of applications to be restored.");
+ System.err.println("");
+ System.err.println("The 'restore' command when given just a package name intiates a restore of");
System.err.println("just that one package according to the restore set selection algorithm");
System.err.println("used by the RestoreSession.restorePackage() method.");
System.err.println("");
diff --git a/cmds/stagefright/recordvideo.cpp b/cmds/stagefright/recordvideo.cpp
index 1264215..c402286 100644
--- a/cmds/stagefright/recordvideo.cpp
+++ b/cmds/stagefright/recordvideo.cpp
@@ -34,7 +34,7 @@
fprintf(stderr, "usage: %s\n", me);
fprintf(stderr, " -h(elp)\n");
fprintf(stderr, " -b bit rate in bits per second (default: 300000)\n");
- fprintf(stderr, " -c YUV420 color format: [0] semi planar or [1] planar (default: 1)\n");
+ fprintf(stderr, " -c YUV420 color format: [0] semi planar or [1] planar or other omx YUV420 color format (default: 1)\n");
fprintf(stderr, " -f frame rate in frames per second (default: 30)\n");
fprintf(stderr, " -i I frame interval in seconds (default: 1)\n");
fprintf(stderr, " -n number of frames to be recorded (default: 300)\n");
@@ -59,11 +59,6 @@
mSize((width * height * 3) / 2) {
mGroup.add_buffer(new MediaBuffer(mSize));
-
- // Check the color format to make sure
- // that the buffer size mSize it set correctly above.
- CHECK(colorFormat == OMX_COLOR_FormatYUV420SemiPlanar ||
- colorFormat == OMX_COLOR_FormatYUV420Planar);
}
virtual sp<MetaData> getFormat() {
@@ -144,9 +139,13 @@
case kYUV420P:
return OMX_COLOR_FormatYUV420Planar;
default:
- fprintf(stderr, "Unsupported color: %d\n", color);
- return -1;
+ fprintf(stderr, "Custom OMX color format: %d\n", color);
+ if (color == OMX_TI_COLOR_FormatYUV420PackedSemiPlanar ||
+ color == OMX_QCOM_COLOR_FormatYVU420SemiPlanar) {
+ return color;
+ }
}
+ return -1;
}
int main(int argc, char **argv) {
diff --git a/core/java/android/app/backup/IRestoreSession.aidl b/core/java/android/app/backup/IRestoreSession.aidl
index 1dddbb0..14731ee 100644
--- a/core/java/android/app/backup/IRestoreSession.aidl
+++ b/core/java/android/app/backup/IRestoreSession.aidl
@@ -52,6 +52,25 @@
int restoreAll(long token, IRestoreObserver observer);
/**
+ * Restore select packages from the given set onto the device, replacing the
+ * current data of any app contained in the set with the data previously
+ * backed up.
+ *
+ * <p>Callers must hold the android.permission.BACKUP permission to use this method.
+ *
+ * @return Zero on success, nonzero on error. The observer will only receive
+ * progress callbacks if this method returned zero.
+ * @param token The token from {@link getAvailableRestoreSets()} corresponding to
+ * the restore set that should be used.
+ * @param observer If non-null, this binder points to an object that will receive
+ * progress callbacks during the restore operation.
+ * @param packages The set of packages for which to attempt a restore. Regardless of
+ * the contents of the actual back-end dataset named by {@code token}, only
+ * applications mentioned in this list will have their data restored.
+ */
+ int restoreSome(long token, IRestoreObserver observer, in String[] packages);
+
+ /**
* Restore a single application from backup. The data will be restored from the
* current backup dataset if the given package has stored data there, or from
* the dataset used during the last full device setup operation if the current
diff --git a/core/java/android/app/backup/RestoreSession.java b/core/java/android/app/backup/RestoreSession.java
index 24ddb99..7181c61 100644
--- a/core/java/android/app/backup/RestoreSession.java
+++ b/core/java/android/app/backup/RestoreSession.java
@@ -87,6 +87,40 @@
}
/**
+ * Restore select packages from the given set onto the device, replacing the
+ * current data of any app contained in the set with the data previously
+ * backed up.
+ *
+ * <p>Callers must hold the android.permission.BACKUP permission to use this method.
+ *
+ * @return Zero on success, nonzero on error. The observer will only receive
+ * progress callbacks if this method returned zero.
+ * @param token The token from {@link getAvailableRestoreSets()} corresponding to
+ * the restore set that should be used.
+ * @param observer If non-null, this binder points to an object that will receive
+ * progress callbacks during the restore operation.
+ * @param packages The set of packages for which to attempt a restore. Regardless of
+ * the contents of the actual back-end dataset named by {@code token}, only
+ * applications mentioned in this list will have their data restored.
+ *
+ * @hide
+ */
+ public int restoreSome(long token, RestoreObserver observer, String[] packages) {
+ int err = -1;
+ if (mObserver != null) {
+ Log.d(TAG, "restoreAll() called during active restore");
+ return -1;
+ }
+ mObserver = new RestoreObserverWrapper(mContext, observer);
+ try {
+ err = mBinder.restoreSome(token, mObserver, packages);
+ } catch (RemoteException e) {
+ Log.d(TAG, "Can't contact server to restore packages");
+ }
+ return err;
+ }
+
+ /**
* Restore a single application from backup. The data will be restored from the
* current backup dataset if the given package has stored data there, or from
* the dataset used during the last full device setup operation if the current
diff --git a/core/java/android/bluetooth/BluetoothServerSocket.java b/core/java/android/bluetooth/BluetoothServerSocket.java
index 83e59e2..acce182 100644
--- a/core/java/android/bluetooth/BluetoothServerSocket.java
+++ b/core/java/android/bluetooth/BluetoothServerSocket.java
@@ -62,6 +62,7 @@
/*package*/ final BluetoothSocket mSocket;
private Handler mHandler;
private int mMessage;
+ private final int mChannel;
/**
* Construct a socket for incoming connections.
@@ -74,6 +75,7 @@
*/
/*package*/ BluetoothServerSocket(int type, boolean auth, boolean encrypt, int port)
throws IOException {
+ mChannel = port;
mSocket = new BluetoothSocket(type, -1, auth, encrypt, null, port, null);
}
@@ -125,4 +127,12 @@
mHandler = handler;
mMessage = message;
}
+
+ /**
+ * Returns the channel on which this socket is bound.
+ * @hide
+ */
+ public int getChannel() {
+ return mChannel;
+ }
}
diff --git a/core/java/android/content/XmlDocumentProvider.java b/core/java/android/content/XmlDocumentProvider.java
deleted file mode 100644
index 76539c7..0000000
--- a/core/java/android/content/XmlDocumentProvider.java
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * Copyright (C) 2010 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.content;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.methods.HttpGet;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlPullParserFactory;
-
-import android.content.ContentResolver.OpenResourceIdResult;
-import android.database.Cursor;
-import android.database.MatrixCursor;
-import android.net.Uri;
-import android.net.http.AndroidHttpClient;
-import android.util.Log;
-import android.widget.CursorAdapter;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.BitSet;
-import java.util.Stack;
-import java.util.regex.Pattern;
-
-/**
- * @hide -- not yet ready to support, should be provided just as a static lib.
- *
- * A read-only content provider which extracts data out of an XML document.
- *
- * <p>A XPath-like selection pattern is used to select some nodes in the XML document. Each such
- * node will create a row in the {@link Cursor} result.</p>
- *
- * Each row is then populated with columns that are also defined as XPath-like projections. These
- * projections fetch attributes values or text in the matching row node or its children.
- *
- * <p>To add this provider in your application, you should add its declaration to your application
- * manifest:
- * <pre class="prettyprint">
- * <provider android:name="android.content.XmlDocumentProvider" android:authorities="xmldocument" />
- * </pre>
- * </p>
- *
- * <h2>Node selection syntax</h2>
- * The node selection syntax is made of the concatenation of an arbitrary number (at least one) of
- * <code>/node_name</code> node selection patterns.
- *
- * <p>The <code>/root/child1/child2</code> pattern will for instance match all nodes named
- * <code>child2</code> which are children of a node named <code>child1</code> which are themselves
- * children of a root node named <code>root</code>.</p>
- *
- * Any <code>/</code> separator in the previous expression can be replaced by a <code>//</code>
- * separator instead, which indicated a <i>descendant</i> instead of a child.
- *
- * <p>The <code>//node1//node2</code> pattern will for instance match all nodes named
- * <code>node2</code> which are descendant of a node named <code>node1</code> located anywhere in
- * the document hierarchy.</p>
- *
- * Node names can contain namespaces in the form <code>namespace:node</code>.
- *
- * <h2>Projection syntax</h2>
- * For every selected node, the projection will then extract actual data from this node and its
- * descendant.
- *
- * <p>Use a syntax similar to the selection syntax described above to select the text associated
- * with a child of the selected node. The implicit root of this projection pattern is the selected
- * node. <code>/</code> will hence refer to the text of the selected node, while
- * <code>/child1</code> will fetch the text of its child named <code>child1</code> and
- * <code>//child1</code> will match any <i>descendant</i> named <code>child1</code>. If several
- * nodes match the projection pattern, their texts are appended as a result.</p>
- *
- * A projection can also fetch any node attribute by appending a <code>@attribute_name</code>
- * pattern to the previously described syntax. <code>//child1@price</code> will for instance match
- * the attribute <code>price</code> of any <code>child1</code> descendant.
- *
- * <p>If a projection does not match any node/attribute, its associated value will be an empty
- * string.</p>
- *
- * <h2>Example</h2>
- * Using the following XML document:
- * <pre class="prettyprint">
- * <library>
- * <book id="EH94">
- * <title>The Old Man and the Sea</title>
- * <author>Ernest Hemingway</author>
- * </book>
- * <book id="XX10">
- * <title>The Arabian Nights: Tales of 1,001 Nights</title>
- * </book>
- * <no-id>
- * <book>
- * <title>Animal Farm</title>
- * <author>George Orwell</author>
- * </book>
- * </no-id>
- * </library>
- * </pre>
- * A selection pattern of <code>/library//book</code> will match the three book entries (while
- * <code>/library/book</code> will only match the first two ones).
- *
- * <p>Defining the projections as <code>/title</code>, <code>/author</code> and <code>@id</code>
- * will retrieve the associated data. Note that the author of the second book as well as the id of
- * the third are empty strings.
- */
-public class XmlDocumentProvider extends ContentProvider {
- /*
- * Ideas for improvement:
- * - Expand XPath-like syntax to allow for [nb] child number selector
- * - Address the starting . bug in AbstractCursor which prevents a true XPath syntax.
- * - Provide an alternative to concatenation when several node match (list-like).
- * - Support namespaces in attribute names.
- * - Incremental Cursor creation, pagination
- */
- private static final String LOG_TAG = "XmlDocumentProvider";
- private AndroidHttpClient mHttpClient;
-
- @Override
- public boolean onCreate() {
- return true;
- }
-
- /**
- * Query data from the XML document referenced in the URI.
- *
- * <p>The XML document can be a local resource or a file that will be downloaded from the
- * Internet. In the latter case, your application needs to request the INTERNET permission in
- * its manifest.</p>
- *
- * The URI will be of the form <code>content://xmldocument/?resource=R.xml.myFile</code> for a
- * local resource. <code>xmldocument</code> should match the authority declared for this
- * provider in your manifest. Internet documents are referenced using
- * <code>content://xmldocument/?url=</code> followed by an encoded version of the URL of your
- * document (see {@link Uri#encode(String)}).
- *
- * <p>The number of columns of the resulting Cursor is equal to the size of the projection
- * array plus one, named <code>_id</code> which will contain a unique row id (allowing the
- * Cursor to be used with a {@link CursorAdapter}). The other columns' names are the projection
- * patterns.</p>
- *
- * @param uri The URI of your local resource or Internet document.
- * @param projection A set of patterns that will be used to extract data from each selected
- * node. See class documentation for pattern syntax.
- * @param selection A selection pattern which will select the nodes that will create the
- * Cursor's rows. See class documentation for pattern syntax.
- * @param selectionArgs This parameter is ignored.
- * @param sortOrder The row order in the resulting cursor is determined from the node order in
- * the XML document. This parameter is ignored.
- * @return A Cursor or null in case of error.
- */
- @Override
- public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
- String sortOrder) {
-
- XmlPullParser parser = null;
- mHttpClient = null;
-
- final String url = uri.getQueryParameter("url");
- if (url != null) {
- parser = getUriXmlPullParser(url);
- } else {
- final String resource = uri.getQueryParameter("resource");
- if (resource != null) {
- Uri resourceUri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" +
- getContext().getPackageName() + "/" + resource);
- parser = getResourceXmlPullParser(resourceUri);
- }
- }
-
- if (parser != null) {
- XMLCursor xmlCursor = new XMLCursor(selection, projection);
- try {
- xmlCursor.parseWith(parser);
- return xmlCursor;
- } catch (IOException e) {
- Log.w(LOG_TAG, "I/O error while parsing XML " + uri, e);
- } catch (XmlPullParserException e) {
- Log.w(LOG_TAG, "Error while parsing XML " + uri, e);
- } finally {
- if (mHttpClient != null) {
- mHttpClient.close();
- }
- }
- }
-
- return null;
- }
-
- /**
- * Creates an XmlPullParser for the provided URL. Can be overloaded to provide your own parser.
- * @param url The URL of the XML document that is to be parsed.
- * @return An XmlPullParser on this document.
- */
- protected XmlPullParser getUriXmlPullParser(String url) {
- XmlPullParser parser = null;
- try {
- XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
- factory.setNamespaceAware(true);
- parser = factory.newPullParser();
- } catch (XmlPullParserException e) {
- Log.e(LOG_TAG, "Unable to create XmlPullParser", e);
- return null;
- }
-
- InputStream inputStream = null;
- try {
- final HttpGet get = new HttpGet(url);
- mHttpClient = AndroidHttpClient.newInstance("Android");
- HttpResponse response = mHttpClient.execute(get);
- if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
- final HttpEntity entity = response.getEntity();
- if (entity != null) {
- inputStream = entity.getContent();
- }
- }
- } catch (IOException e) {
- Log.w(LOG_TAG, "Error while retrieving XML file " + url, e);
- return null;
- }
-
- try {
- parser.setInput(inputStream, null);
- } catch (XmlPullParserException e) {
- Log.w(LOG_TAG, "Error while reading XML file from " + url, e);
- return null;
- }
-
- return parser;
- }
-
- /**
- * Creates an XmlPullParser for the provided local resource. Can be overloaded to provide your
- * own parser.
- * @param resourceUri A fully qualified resource name referencing a local XML resource.
- * @return An XmlPullParser on this resource.
- */
- protected XmlPullParser getResourceXmlPullParser(Uri resourceUri) {
- OpenResourceIdResult resourceId;
- try {
- resourceId = getContext().getContentResolver().getResourceId(resourceUri);
- return resourceId.r.getXml(resourceId.id);
- } catch (FileNotFoundException e) {
- Log.w(LOG_TAG, "XML resource not found: " + resourceUri.toString(), e);
- return null;
- }
- }
-
- /**
- * Returns "vnd.android.cursor.dir/xmldoc".
- */
- @Override
- public String getType(Uri uri) {
- return "vnd.android.cursor.dir/xmldoc";
- }
-
- /**
- * This ContentProvider is read-only. This method throws an UnsupportedOperationException.
- **/
- @Override
- public Uri insert(Uri uri, ContentValues values) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * This ContentProvider is read-only. This method throws an UnsupportedOperationException.
- **/
- @Override
- public int delete(Uri uri, String selection, String[] selectionArgs) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * This ContentProvider is read-only. This method throws an UnsupportedOperationException.
- **/
- @Override
- public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
- throw new UnsupportedOperationException();
- }
-
- private static class XMLCursor extends MatrixCursor {
- private final Pattern mSelectionPattern;
- private Pattern[] mProjectionPatterns;
- private String[] mAttributeNames;
- private String[] mCurrentValues;
- private BitSet[] mActiveTextDepthMask;
- private final int mNumberOfProjections;
-
- public XMLCursor(String selection, String[] projections) {
- super(projections);
- // The first column in projections is used for the _ID
- mNumberOfProjections = projections.length - 1;
- mSelectionPattern = createPattern(selection);
- createProjectionPattern(projections);
- }
-
- private Pattern createPattern(String input) {
- String pattern = input.replaceAll("//", "/(.*/|)").replaceAll("^/", "^/") + "$";
- return Pattern.compile(pattern);
- }
-
- private void createProjectionPattern(String[] projections) {
- mProjectionPatterns = new Pattern[mNumberOfProjections];
- mAttributeNames = new String[mNumberOfProjections];
- mActiveTextDepthMask = new BitSet[mNumberOfProjections];
- // Add a column to store _ID
- mCurrentValues = new String[mNumberOfProjections + 1];
-
- for (int i=0; i<mNumberOfProjections; i++) {
- mActiveTextDepthMask[i] = new BitSet();
- String projection = projections[i + 1]; // +1 to skip the _ID column
- int atIndex = projection.lastIndexOf('@', projection.length());
- if (atIndex >= 0) {
- mAttributeNames[i] = projection.substring(atIndex+1);
- projection = projection.substring(0, atIndex);
- } else {
- mAttributeNames[i] = null;
- }
-
- // Conforms to XPath standard: reference to local context starts with a .
- if (projection.charAt(0) == '.') {
- projection = projection.substring(1);
- }
- mProjectionPatterns[i] = createPattern(projection);
- }
- }
-
- public void parseWith(XmlPullParser parser) throws IOException, XmlPullParserException {
- StringBuilder path = new StringBuilder();
- Stack<Integer> pathLengthStack = new Stack<Integer>();
-
- // There are two parsing mode: in root mode, rootPath is updated and nodes matching
- // selectionPattern are searched for and currentNodeDepth is negative.
- // When a node matching selectionPattern is found, currentNodeDepth is set to 0 and
- // updated as children are parsed and projectionPatterns are searched in nodePath.
- int currentNodeDepth = -1;
-
- // Index where local selected node path starts from in path
- int currentNodePathStartIndex = 0;
-
- int eventType = parser.getEventType();
- while (eventType != XmlPullParser.END_DOCUMENT) {
-
- if (eventType == XmlPullParser.START_TAG) {
- // Update path
- pathLengthStack.push(path.length());
- path.append('/');
- String prefix = null;
- try {
- // getPrefix is not supported by local Xml resource parser
- prefix = parser.getPrefix();
- } catch (RuntimeException e) {
- prefix = null;
- }
- if (prefix != null) {
- path.append(prefix);
- path.append(':');
- }
- path.append(parser.getName());
-
- if (currentNodeDepth >= 0) {
- currentNodeDepth++;
- } else {
- // A node matching selection is found: initialize child parsing mode
- if (mSelectionPattern.matcher(path.toString()).matches()) {
- currentNodeDepth = 0;
- currentNodePathStartIndex = path.length();
- mCurrentValues[0] = Integer.toString(getCount()); // _ID
- for (int i = 0; i < mNumberOfProjections; i++) {
- // Reset values to default (empty string)
- mCurrentValues[i + 1] = "";
- mActiveTextDepthMask[i].clear();
- }
- }
- }
-
- // This test has to be separated from the previous one as currentNodeDepth can
- // be modified above (when a node matching selection is found).
- if (currentNodeDepth >= 0) {
- final String localNodePath = path.substring(currentNodePathStartIndex);
- for (int i = 0; i < mNumberOfProjections; i++) {
- if (mProjectionPatterns[i].matcher(localNodePath).matches()) {
- String attribute = mAttributeNames[i];
- if (attribute != null) {
- mCurrentValues[i + 1] =
- parser.getAttributeValue(null, attribute);
- } else {
- mActiveTextDepthMask[i].set(currentNodeDepth, true);
- }
- }
- }
- }
-
- } else if (eventType == XmlPullParser.END_TAG) {
- // Pop last node from path
- final int length = pathLengthStack.pop();
- path.setLength(length);
-
- if (currentNodeDepth >= 0) {
- if (currentNodeDepth == 0) {
- // Leaving a selection matching node: add a new row with results
- addRow(mCurrentValues);
- } else {
- for (int i = 0; i < mNumberOfProjections; i++) {
- mActiveTextDepthMask[i].set(currentNodeDepth, false);
- }
- }
- currentNodeDepth--;
- }
-
- } else if ((eventType == XmlPullParser.TEXT) && (!parser.isWhitespace())) {
- for (int i = 0; i < mNumberOfProjections; i++) {
- if ((currentNodeDepth >= 0) &&
- (mActiveTextDepthMask[i].get(currentNodeDepth))) {
- mCurrentValues[i + 1] += parser.getText();
- }
- }
- }
-
- eventType = parser.next();
- }
- }
- }
-}
diff --git a/core/java/android/provider/CalendarContract.java b/core/java/android/provider/CalendarContract.java
index b492615..5b29103 100644
--- a/core/java/android/provider/CalendarContract.java
+++ b/core/java/android/provider/CalendarContract.java
@@ -17,6 +17,8 @@
package android.provider;
+import android.annotation.SdkConstant;
+import android.annotation.SdkConstant.SdkConstantType;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.ContentProviderClient;
@@ -83,7 +85,6 @@
* adapters</li>
* </ul>
*
- * @hide
*/
public final class CalendarContract {
private static final String TAG = "Calendar";
@@ -92,8 +93,8 @@
* Broadcast Action: This is the intent that gets fired when an alarm
* notification needs to be posted for a reminder.
*
- * @SdkConstant
*/
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_EVENT_REMINDER = "android.intent.action.EVENT_REMINDER";
/**
@@ -146,6 +147,11 @@
public static final String ACCOUNT_TYPE_LOCAL = "LOCAL";
/**
+ * This utility class cannot be instantiated
+ */
+ private CalendarContract() {}
+
+ /**
* Generic columns for use by sync adapters. The specific functions of these
* columns are private to the sync adapter. Other clients of the API should
* not attempt to either read or write this column. These columns are
@@ -384,7 +390,7 @@
* Class that represents a Calendar Entity. There is one entry per calendar.
* This is a helper class to make batch operations easier.
*/
- public static class CalendarEntity implements BaseColumns, SyncColumns, CalendarColumns {
+ public static final class CalendarEntity implements BaseColumns, SyncColumns, CalendarColumns {
/**
* The default Uri used when creating a new calendar EntityIterator.
@@ -394,6 +400,11 @@
"/calendar_entities");
/**
+ * This utility class cannot be instantiated
+ */
+ private CalendarEntity() {}
+
+ /**
* Creates an entity iterator for the given cursor. It assumes the
* cursor contains a calendars query.
*
@@ -566,7 +577,13 @@
* <li>{@link #CAL_SYNC10}</li>
* </ul>
*/
- public static class Calendars implements BaseColumns, SyncColumns, CalendarColumns {
+ public static final class Calendars implements BaseColumns, SyncColumns, CalendarColumns {
+
+ /**
+ * This utility class cannot be instantiated
+ */
+ private Calendars() {}
+
/**
* The content:// style URL for accessing Calendars
*/
@@ -687,7 +704,7 @@
/**
* Fields and helpers for interacting with Attendees. Each row of this table
* represents a single attendee or guest of an event. Calling
- * {@link #query(ContentResolver, long)} will return a list of attendees for
+ * {@link #query(ContentResolver, long, String[])} will return a list of attendees for
* the event with the given eventId. Both apps and sync adapters may write
* to this table. There are six writable fields and all of them except
* {@link #ATTENDEE_NAME} must be included when inserting a new attendee.
@@ -708,24 +725,25 @@
*/
@SuppressWarnings("hiding")
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/attendees");
- /**
- * the projection used by the attendees query
- */
- public static final String[] PROJECTION = new String[] {
- _ID, ATTENDEE_NAME, ATTENDEE_EMAIL, ATTENDEE_RELATIONSHIP, ATTENDEE_STATUS,};
private static final String ATTENDEES_WHERE = Attendees.EVENT_ID + "=?";
/**
+ * This utility class cannot be instantiated
+ */
+ private Attendees() {}
+
+ /**
* Queries all attendees associated with the given event. This is a
* blocking call and should not be done on the UI thread.
*
* @param cr The content resolver to use for the query
* @param eventId The id of the event to retrieve attendees for
+ * @param projection the columns to return in the cursor
* @return A Cursor containing all attendees for the event
*/
- public static final Cursor query(ContentResolver cr, long eventId) {
+ public static final Cursor query(ContentResolver cr, long eventId, String[] projection) {
String[] attArgs = {Long.toString(eventId)};
- return cr.query(CONTENT_URI, PROJECTION, ATTENDEES_WHERE, attArgs /* selection args */,
+ return cr.query(CONTENT_URI, projection, ATTENDEES_WHERE, attArgs /* selection args */,
null /* sort order */);
}
}
@@ -1068,6 +1086,11 @@
"/event_entities");
/**
+ * This utility class cannot be instantiated
+ */
+ private EventsEntity() {}
+
+ /**
* Creates a new iterator for events
*
* @param cursor An event query
@@ -1411,6 +1434,11 @@
Uri.parse("content://" + AUTHORITY + "/exception");
/**
+ * This utility class cannot be instantiated
+ */
+ private Events() {}
+
+ /**
* The default sort order for this table
*/
private static final String DEFAULT_SORT_ORDER = "";
@@ -1484,6 +1512,11 @@
};
/**
+ * This utility class cannot be instantiated
+ */
+ private Instances() {}
+
+ /**
* Performs a query to return all visible instances in the given range.
* This is a blocking function and should not be done on the UI thread.
* This will cause an expansion of recurring events to fill this time
@@ -1636,7 +1669,7 @@
* time zone for the instances. These settings are stored using a key/value
* scheme. A {@link #KEY} must be specified when updating these values.
*/
- public static class CalendarCache implements CalendarCacheColumns {
+ public static final class CalendarCache implements CalendarCacheColumns {
/**
* The URI to use for retrieving the properties from the Calendar db.
*/
@@ -1644,6 +1677,11 @@
Uri.parse("content://" + AUTHORITY + "/properties");
/**
+ * This utility class cannot be instantiated
+ */
+ private CalendarCache() {}
+
+ /**
* They key for updating the use of auto/home time zones in Calendar.
* Valid values are {@link #TIMEZONE_TYPE_AUTO} or
* {@link #TIMEZONE_TYPE_HOME}.
@@ -1724,6 +1762,11 @@
* @hide
*/
public static final class CalendarMetaData implements CalendarMetaDataColumns, BaseColumns {
+
+ /**
+ * This utility class cannot be instantiated
+ */
+ private CalendarMetaData() {}
}
protected interface EventDaysColumns {
@@ -1746,14 +1789,12 @@
public static final class EventDays implements EventDaysColumns {
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY
+ "/instances/groupbyday");
+ private static final String SELECTION = "selected=1";
/**
- * The projection used by the EventDays query.
+ * This utility class cannot be instantiated
*/
- public static final String[] PROJECTION = {
- STARTDAY, ENDDAY
- };
- private static final String SELECTION = "selected=1";
+ private EventDays() {}
/**
* Retrieves the days with events for the Julian days starting at
@@ -1765,10 +1806,12 @@
* @param cr the ContentResolver
* @param startDay the first Julian day in the range
* @param numDays the number of days to load (must be at least 1)
+ * @param projection the columns to return in the cursor
* @return a database cursor containing a list of start and end days for
* events
*/
- public static final Cursor query(ContentResolver cr, int startDay, int numDays) {
+ public static final Cursor query(ContentResolver cr, int startDay, int numDays,
+ String[] projection) {
if (numDays < 1) {
return null;
}
@@ -1776,7 +1819,7 @@
Uri.Builder builder = CONTENT_URI.buildUpon();
ContentUris.appendId(builder, startDay);
ContentUris.appendId(builder, endDay);
- return cr.query(builder.build(), PROJECTION, SELECTION,
+ return cr.query(builder.build(), projection, SELECTION,
null /* selection args */, STARTDAY);
}
}
@@ -1821,7 +1864,7 @@
/**
* Fields and helpers for accessing reminders for an event. Each row of this
* table represents a single reminder for an event. Calling
- * {@link #query(ContentResolver, long)} will return a list of reminders for
+ * {@link #query(ContentResolver, long, String[])} will return a list of reminders for
* the event with the given eventId. Both apps and sync adapters may write
* to this table. There are three writable fields and all of them must be
* included when inserting a new reminder. They are:
@@ -1833,25 +1876,26 @@
*/
public static final class Reminders implements BaseColumns, RemindersColumns, EventsColumns {
private static final String REMINDERS_WHERE = CalendarContract.Reminders.EVENT_ID + "=?";
- /**
- * The projection used by the reminders query.
- */
- public static final String[] PROJECTION = new String[] {
- _ID, MINUTES, METHOD,};
@SuppressWarnings("hiding")
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/reminders");
/**
+ * This utility class cannot be instantiated
+ */
+ private Reminders() {}
+
+ /**
* Queries all reminders associated with the given event. This is a
* blocking call and should not be done on the UI thread.
*
* @param cr The content resolver to use for the query
* @param eventId The id of the event to retrieve reminders for
+ * @param projection the columns to return in the cursor
* @return A Cursor containing all reminders for the event
*/
- public static final Cursor query(ContentResolver cr, long eventId) {
+ public static final Cursor query(ContentResolver cr, long eventId, String[] projection) {
String[] remArgs = {Long.toString(eventId)};
- return cr.query(CONTENT_URI, PROJECTION, REMINDERS_WHERE, remArgs /* selection args */,
+ return cr.query(CONTENT_URI, projection, REMINDERS_WHERE, remArgs /*selection args*/,
null /* sort order */);
}
}
@@ -1964,6 +2008,11 @@
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY +
"/calendar_alerts");
+ /**
+ * This utility class cannot be instantiated
+ */
+ private CalendarAlerts() {}
+
private static final String WHERE_ALARM_EXISTS = EVENT_ID + "=?"
+ " AND " + BEGIN + "=?"
+ " AND " + ALARM_TIME + "=?";
@@ -2134,7 +2183,7 @@
* given event id, begin time and alarm time. If one is found then this
* alarm already exists and this method returns true. TODO Move to
* provider
- *
+ *
* @param cr the ContentResolver
* @param eventId the event id to match
* @param begin the start time of the event in UTC millis
@@ -2203,6 +2252,11 @@
public static final Uri CONTENT_URI =
Uri.parse("content://" + AUTHORITY + "/extendedproperties");
+ /**
+ * This utility class cannot be instantiated
+ */
+ private ExtendedProperties() {}
+
// TODO: fill out this class when we actually start utilizing extendedproperties
// in the calendar application.
}
@@ -2271,5 +2325,10 @@
* @hide
*/
public static final class EventsRawTimes implements BaseColumns, EventsRawTimesColumns {
+
+ /**
+ * This utility class cannot be instantiated
+ */
+ private EventsRawTimes() {}
}
}
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index ad71061..61deea4 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -1536,6 +1536,23 @@
}
/**
+ * A sub-directory of a single contact that contains all of the constituent raw contact
+ * {@link ContactsContract.StreamItems} rows. This directory can be used either
+ * with a {@link #CONTENT_URI} or {@link #CONTENT_LOOKUP_URI}.
+ */
+ public static final class StreamItems implements StreamItemsColumns {
+ /**
+ * no public constructor since this is a utility class
+ */
+ private StreamItems() {}
+
+ /**
+ * The directory twig for this sub-table
+ */
+ public static final String CONTENT_DIRECTORY = "stream_items";
+ }
+
+ /**
* <p>
* A <i>read-only</i> sub-directory of a single contact aggregate that
* contains all aggregation suggestions (other contacts). The
@@ -2443,6 +2460,28 @@
}
/**
+ * <p>
+ * A sub-directory of a single raw contact that contains all of its
+ * {@link ContactsContract.StreamItems} rows. To access this directory append
+ * {@link RawContacts.StreamItems#CONTENT_DIRECTORY} to the raw contact URI. See
+ * {@link ContactsContract.StreamItems} for a stand-alone table containing the
+ * same data.
+ * </p>
+ */
+ public static final class StreamItems implements BaseColumns, StreamItemsColumns {
+ /**
+ * No public constructor since this is a utility class
+ */
+ private StreamItems() {
+ }
+
+ /**
+ * The directory twig for this sub-table
+ */
+ public static final String CONTENT_DIRECTORY = "stream_items";
+ }
+
+ /**
* TODO: javadoc
* @param cursor
* @return
@@ -2661,6 +2700,483 @@
}
/**
+ * <p>
+ * Constants for the stream_items table, which contains social stream updates from
+ * the user's contact list.
+ * </p>
+ * <p>
+ * Only a certain number of stream items will ever be stored under a given raw contact.
+ * Users of this API can query {@link ContactsContract.StreamItems#CONTENT_LIMIT_URI} to
+ * determine this limit, and should restrict the number of items inserted in any given
+ * transaction correspondingly. Insertion of more items beyond the limit will
+ * automatically lead to deletion of the oldest items, by {@link StreamItems#TIMESTAMP}.
+ * </p>
+ * <h3>Operations</h3>
+ * <dl>
+ * <dt><b>Insert</b></dt>
+ * <dd>
+ * <p>Social stream updates are always associated with a raw contact. There are a couple
+ * of ways to insert these entries.
+ * <dl>
+ * <dt>Via the {@link RawContacts.StreamItems#CONTENT_DIRECTORY} sub-path of a raw contact:</dt>
+ * <dd>
+ * <pre>
+ * ContentValues values = new ContentValues();
+ * values.put(StreamItems.TEXT, "Breakfasted at Tiffanys");
+ * values.put(StreamItems.TIMESTAMP, timestamp);
+ * values.put(StreamItems.COMMENT, "3 people reshared this");
+ * values.put(StreamItems.ACTION, action);
+ * values.put(StreamItems.ACTION_URI, actionUri);
+ * Uri streamItemUri = getContentResolver().insert(
+ * Uri.withAppendedPath(ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId),
+ * RawContacts.StreamItems.CONTENT_DIRECTORY), values);
+ * long streamItemId = ContentUris.parseId(streamItemUri);
+ * </pre>
+ * </dd>
+ * <dt>Via the {@link StreamItems#CONTENT_URI} URI:</dt>
+ * <dd>
+ * ContentValues values = new ContentValues();
+ * values.put(StreamItems.RAW_CONTACT_ID, rawContactId);
+ * values.put(StreamItems.TEXT, "Breakfasted at Tiffanys");
+ * values.put(StreamItems.TIMESTAMP, timestamp);
+ * values.put(StreamItems.COMMENT, "3 people reshared this");
+ * values.put(StreamItems.ACTION, action);
+ * values.put(StreamItems.ACTION_URI, actionUri);
+ * Uri streamItemUri = getContentResolver().insert(StreamItems.CONTENT_URI, values);
+ * long streamItemId = ContentUris.parseId(streamItemUri);
+ * </dd>
+ * </dl>
+ * </dd>
+ * </p>
+ * <p>
+ * Once a {@link StreamItems} entry has been inserted, photos associated with that
+ * social update can be inserted. For example, after one of the insertions above,
+ * photos could be added to the stream item in one of the following ways:
+ * <dl>
+ * <dt>Via a URI including the stream item ID:</dt>
+ * <dd>
+ * <pre>
+ * values.clear();
+ * values.put(StreamItemPhotos.SORT_INDEX, 1);
+ * values.put(StreamItemPhotos.PICTURE, photoData);
+ * values.put(StreamItemPhotos.ACTION, action);
+ * values.put(StreamItemPhotos.ACTION_URI, actionUri);
+ * getContentResolver().insert(Uri.withAppendedPath(
+ * ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId),
+ * StreamItems.StreamItemPhotos.CONTENT_DIRECTORY), values);
+ * </pre>
+ * </dd>
+ * <dt>Via {@link ContactsContract.StreamItems#CONTENT_PHOTO_URI}</dt>
+ * <dd>
+ * <pre>
+ * values.clear();
+ * values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
+ * values.put(StreamItemPhotos.SORT_INDEX, 1);
+ * values.put(StreamItemPhotos.PICTURE, photoData);
+ * values.put(StreamItemPhotos.ACTION, action);
+ * values.put(StreamItemPhotos.ACTION_URI, actionUri);
+ * getContentResolver().insert(StreamItems.CONTENT_PHOTO_URI, values);
+ * </pre>
+ * Note that this latter form allows the insertion of a stream item and its
+ * photos in a single transaction, by using {@link ContentProviderOperation} with
+ * back references to populate the stream item ID in the {@link ContentValues}.
+ * </dd>
+ * </dl>
+ * </p>
+ * </dd>
+ * <dt><b>Update</b></dt>
+ * <dd>Updates can be performed by appending the stream item ID to the
+ * {@link StreamItems#CONTENT_URI} URI. Only social stream entries that were
+ * created by the calling package can be updated.</dd>
+ * <dt><b>Delete</b></dt>
+ * <dd>Deletes can be performed by appending the stream item ID to the
+ * {@link StreamItems#CONTENT_URI} URI. Only social stream entries that were
+ * created by the calling package can be deleted.</dd>
+ * <dt><b>Query</b></dt>
+ * <dl>
+ * <dt>Finding all social stream updates for a given contact</dt>
+ * <dd>By Contact ID:
+ * <pre>
+ * Cursor c = getContentResolver().query(Uri.withAppendedPath(
+ * ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId),
+ * Contacts.StreamItems.CONTENT_DIRECTORY),
+ * null, null, null, null);
+ * </pre>
+ * </dd>
+ * <dd>By lookup key:
+ * <pre>
+ * Cursor c = getContentResolver().query(Contacts.CONTENT_URI.buildUpon()
+ * .appendPath(lookupKey)
+ * .appendPath(Contacts.StreamItems.CONTENT_DIRECTORY).build(),
+ * null, null, null, null);
+ * </pre>
+ * </dd>
+ * <dt>Finding all social stream updates for a given raw contact</dt>
+ * <dd>
+ * <pre>
+ * Cursor c = getContentResolver().query(Uri.withAppendedPath(
+ * ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId),
+ * RawContacts.StreamItems.CONTENT_DIRECTORY)),
+ * null, null, null, null);
+ * </pre>
+ * </dd>
+ * <dt>Querying for a specific stream item by ID</dt>
+ * <dd>
+ * <pre>
+ * Cursor c = getContentResolver().query(ContentUris.withAppendedId(
+ * StreamItems.CONTENT_URI, streamItemId),
+ * null, null, null, null);
+ * </pre>
+ * </dd>
+ * </dl>
+ */
+ public static final class StreamItems implements BaseColumns, StreamItemsColumns {
+ /**
+ * This utility class cannot be instantiated
+ */
+ private StreamItems() {
+ }
+
+ /**
+ * The content:// style URI for this table, which handles social network stream
+ * updates for the user's contacts.
+ */
+ public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "stream_items");
+
+ /**
+ * <p>
+ * A content:// style URI for the photos stored in a sub-table underneath
+ * stream items. This is only used for inserts, and updates - queries and deletes
+ * for photos should be performed by appending
+ * {@link StreamItems.StreamItemPhotos#CONTENT_DIRECTORY} path to URIs for a
+ * specific stream item.
+ * </p>
+ * <p>
+ * When using this URI, the stream item ID for the photo(s) must be identified
+ * in the {@link ContentValues} passed in.
+ * </p>
+ */
+ public static final Uri CONTENT_PHOTO_URI = Uri.withAppendedPath(CONTENT_URI, "photo");
+
+ /**
+ * This URI allows the caller to query for the maximum number of stream items
+ * that will be stored under any single raw contact, as well as the maximum
+ * photo size (in bytes) accepted in stream item photos.
+ */
+ public static final Uri CONTENT_LIMIT_URI =
+ Uri.withAppendedPath(AUTHORITY_URI, "stream_items_limit");
+
+ /**
+ * Queries to {@link ContactsContract.StreamItems#CONTENT_LIMIT_URI} will
+ * contain this column, with the value indicating the maximum number of
+ * stream items that will be stored under any single raw contact.
+ */
+ public static final String MAX_ITEMS = "max_items";
+
+ /**
+ * Queries to {@link ContactsContract.StreamItems#CONTENT_LIMIT_URI} will
+ * contain this column, with the value indicating the byte limit for
+ * individual photos.
+ */
+ public static final String PHOTO_MAX_BYTES = "photo_max_bytes";
+
+ /**
+ * <p>
+ * A sub-directory of a single stream item entry that contains all of its
+ * photo rows. To access this
+ * directory append {@link StreamItems.StreamItemPhotos#CONTENT_DIRECTORY} to
+ * an individual stream item URI.
+ * </p>
+ */
+ public static final class StreamItemPhotos
+ implements BaseColumns, StreamItemPhotosColumns {
+ /**
+ * No public constructor since this is a utility class
+ */
+ private StreamItemPhotos() {
+ }
+
+ /**
+ * The directory twig for this sub-table
+ */
+ public static final String CONTENT_DIRECTORY = "photo";
+ }
+ }
+
+ /**
+ * Columns in the StreamItems table.
+ *
+ * @see ContactsContract.StreamItems
+ */
+ protected interface StreamItemsColumns {
+ /**
+ * A reference to the {@link RawContacts#_ID}
+ * that this stream item belongs to.
+ */
+ public static final String RAW_CONTACT_ID = "raw_contact_id";
+
+ /**
+ * The package name to use when creating {@link Resources} objects for
+ * this stream item. This value is only designed for use when building
+ * user interfaces, and should not be used to infer the owner.
+ * <P>Type: NUMBER</P>
+ */
+ public static final String RES_PACKAGE = "res_package";
+
+ /**
+ * The resource ID of the icon for the source of the stream item.
+ * This resource should be scoped by the {@link #RES_PACKAGE}.
+ * <P>Type: NUMBER</P>
+ */
+ public static final String RES_ICON = "icon";
+
+ /**
+ * The resource ID of the label describing the source of the status update, e.g. "Google
+ * Talk". This resource should be scoped by the {@link #RES_PACKAGE}.
+ * <p>Type: NUMBER</p>
+ */
+ public static final String RES_LABEL = "label";
+
+ /**
+ * <P>
+ * The main textual contents of the item. Typically this is content
+ * that was posted by the source of this stream item, but it can also
+ * be a textual representation of an action (e.g. ”Checked in at Joe's”).
+ * This text is displayed to the user and allows formatting and embedded
+ * resource images via HTML (as parseable via
+ * {@link android.text.Html#fromHtml}).
+ * </P>
+ * <P>
+ * Long content may be truncated and/or ellipsized - the exact behavior
+ * is unspecified, but it should not break tags.
+ * </P>
+ * <P>Type: TEXT</P>
+ */
+ public static final String TEXT = "text";
+
+ /**
+ * The absolute time (milliseconds since epoch) when this stream item was
+ * inserted/updated.
+ * <P>Type: NUMBER</P>
+ */
+ public static final String TIMESTAMP = "timestamp";
+
+ /**
+ * <P>
+ * Summary information about the stream item, for example to indicate how
+ * many people have reshared it, how many have liked it, how many thumbs
+ * up and/or thumbs down it has, what the original source was, etc.
+ * </P>
+ * <P>
+ * This text is displayed to the user and allows simple formatting via
+ * HTML, in the same manner as {@link #TEXT} allows.
+ * </P>
+ * <P>
+ * Long content may be truncated and/or ellipsized - the exact behavior
+ * is unspecified, but it should not break tags.
+ * </P>
+ * <P>Type: TEXT</P>
+ */
+ public static final String COMMENTS = "comments";
+
+ /**
+ * The activity action to execute when the item is tapped.
+ * <P>Type: TEXT</P>
+ */
+ public static final String ACTION = "action";
+
+ /**
+ * The URI that is launched when the item is pressed. May be handled by
+ * the source app, but could also reference a website (e.g. YouTube).
+ * <P>Type: TEXT</P>
+ */
+ public static final String ACTION_URI = "action_uri";
+ }
+
+ /**
+ * <p>
+ * Constants for the stream_item_photos table, which contains photos associated with
+ * social stream updates.
+ * </p>
+ * <h3>Operations</h3>
+ * <dl>
+ * <dt><b>Insert</b></dt>
+ * <dd>
+ * <p>Social stream photo entries are associated with a social stream item. Photos
+ * can be inserted into a social stream item in a couple of ways:
+ * <dl>
+ * <dt>
+ * Via the {@link StreamItems.StreamItemPhotos#CONTENT_DIRECTORY} sub-path of a
+ * stream item:
+ * </dt>
+ * <dd>
+ * <pre>
+ * ContentValues values = new ContentValues();
+ * values.put(StreamItemPhotos.SORT_INDEX, 1);
+ * values.put(StreamItemPhotos.PICTURE, photoData);
+ * values.put(StreamItemPhotos.ACTION, action);
+ * values.put(StreamItemPhotos.ACTION_URI, actionUri);
+ * Uri photoUri = getContentResolver().insert(Uri.withAppendedPath(
+ * ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
+ * StreamItems.StreamItemPhotos#CONTENT_DIRECTORY), values);
+ * long photoId = ContentUris.parseId(photoUri);
+ * </pre>
+ * </dd>
+ * <dt>Via the {@link ContactsContract.StreamItems#CONTENT_PHOTO_URI} URI:</dt>
+ * <dd>
+ * <pre>
+ * ContentValues values = new ContentValues();
+ * values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
+ * values.put(StreamItemPhotos.SORT_INDEX, 1);
+ * values.put(StreamItemPhotos.PICTURE, photoData);
+ * values.put(StreamItemPhotos.ACTION, action);
+ * values.put(StreamItemPhotos.ACTION_URI, actionUri);
+ * Uri photoUri = getContentResolver().insert(StreamItems.CONTENT_PHOTO_URI, values);
+ * long photoId = ContentUris.parseId(photoUri);
+ * </pre>
+ * </dd>
+ * </dl>
+ * </p>
+ * </dd>
+ * <dt><b>Update</b></dt>
+ * <dd>
+ * <p>Updates can only be made against a specific {@link StreamItemPhotos} entry,
+ * identified by both the stream item ID it belongs to and the stream item photo ID.
+ * This can be specified in two ways.
+ * <dl>
+ * <dt>Via the {@link StreamItems.StreamItemPhotos#CONTENT_DIRECTORY} sub-path of a
+ * stream item:
+ * </dt>
+ * <dd>
+ * <pre>
+ * ContentValues values = new ContentValues();
+ * values.put(StreamItemPhotos.PICTURE, newPhotoData);
+ * getContentResolver().update(
+ * ContentUris.withAppendedId(
+ * Uri.withAppendedPath(
+ * ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
+ * StreamItems.StreamItemPhotos#CONTENT_DIRECTORY),
+ * streamItemPhotoId), values, null, null);
+ * </pre>
+ * </dd>
+ * <dt>Via the {@link ContactsContract.StreamItems#CONTENT_PHOTO_URI} URI:</dt>
+ * <dd>
+ * <pre>
+ * ContentValues values = new ContentValues();
+ * values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
+ * values.put(StreamItemPhotos.PICTURE, newPhotoData);
+ * getContentResolver().update(StreamItems.CONTENT_PHOTO_URI, values);
+ * </pre>
+ * </dd>
+ * </dl>
+ * </p>
+ * </dd>
+ * <dt><b>Delete</b></dt>
+ * <dd>Deletes can be made against either a specific photo item in a stream item, or
+ * against all or a selected subset of photo items under a stream item.
+ * For example:
+ * <dl>
+ * <dt>Deleting a single photo via the
+ * {@link StreamItems.StreamItemPhotos#CONTENT_DIRECTORY} sub-path of a stream item:
+ * </dt>
+ * <dd>
+ * <pre>
+ * getContentResolver().delete(
+ * ContentUris.withAppendedId(
+ * Uri.withAppendedPath(
+ * ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
+ * StreamItems.StreamItemPhotos#CONTENT_DIRECTORY),
+ * streamItemPhotoId), null, null);
+ * </pre>
+ * </dd>
+ * <dt>Deleting all photos under a stream item</dt>
+ * <dd>
+ * <pre>
+ * getContentResolver().delete(
+ * Uri.withAppendedPath(
+ * ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
+ * StreamItems.StreamItemPhotos#CONTENT_DIRECTORY), null, null);
+ * </pre>
+ * </dd>
+ * </dl>
+ * </dd>
+ * <dt><b>Query</b></dt>
+ * <dl>
+ * <dt>Querying for a specific photo in a stream item</dt>
+ * <dd>
+ * <pre>
+ * Cursor c = getContentResolver().query(
+ * ContentUris.withAppendedId(
+ * Uri.withAppendedPath(
+ * ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
+ * StreamItems.StreamItemPhotos#CONTENT_DIRECTORY),
+ * streamItemPhotoId), null, null, null, null);
+ * </pre>
+ * </dd>
+ * <dt>Querying for all photos in a stream item</dt>
+ * <dd>
+ * <pre>
+ * Cursor c = getContentResolver().query(
+ * Uri.withAppendedPath(
+ * ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
+ * StreamItems.StreamItemPhotos#CONTENT_DIRECTORY),
+ * null, null, null, StreamItemPhotos.SORT_INDEX);
+ * </pre>
+ * </dl>
+ * </dd>
+ * </dl>
+ */
+ public static final class StreamItemPhotos implements BaseColumns, StreamItemPhotosColumns {
+ /**
+ * No public constructor since this is a utility class
+ */
+ private StreamItemPhotos() {
+ }
+ }
+
+ /**
+ * Columns in the StreamItemPhotos table.
+ *
+ * @see ContactsContract.StreamItemPhotos
+ */
+ protected interface StreamItemPhotosColumns {
+ /**
+ * A reference to the {@link StreamItems#_ID} this photo is associated with.
+ * <P>Type: NUMBER</P>
+ */
+ public static final String STREAM_ITEM_ID = "stream_item_id";
+
+ /**
+ * An integer to use for sort order for photos in the stream item. If not
+ * specified, the {@link StreamItemPhotos#_ID} will be used for sorting.
+ * <P>Type: NUMBER</P>
+ */
+ public static final String SORT_INDEX = "sort_index";
+
+ /**
+ * The binary representation of the picture. Pictures larger than
+ * {@link ContactsContract.StreamItems#PHOTO_MAX_BYTES} bytes in size (as
+ * queryable from {@link ContactsContract.StreamItems#CONTENT_LIMIT_URI})
+ * will be rejected.
+ * <P>Type: BLOB</P>
+ */
+ public static final String PICTURE = "picture";
+
+ /**
+ * The activity action to execute when the photo is tapped.
+ * <P>Type: TEXT</P>
+ */
+ public static final String ACTION = "action";
+
+ /**
+ * The URI that is launched when the photo is pressed. May be handled by
+ * the source app, but could also reference a website (e.g. YouTube).
+ * <P>Type: TEXT</P>
+ */
+ public static final String ACTION_URI = "action_uri";
+ }
+
+ /**
* Columns in the Data table.
*
* @see ContactsContract.Data
diff --git a/core/java/android/speech/tts/AudioPlaybackHandler.java b/core/java/android/speech/tts/AudioPlaybackHandler.java
index c7603ee..8ef4295 100644
--- a/core/java/android/speech/tts/AudioPlaybackHandler.java
+++ b/core/java/android/speech/tts/AudioPlaybackHandler.java
@@ -384,11 +384,16 @@
}
count += written;
}
+
+ param.mLogger.onPlaybackStart();
}
private void handleSynthesisDone(MessageParams msg) {
final SynthesisMessageParams params = (SynthesisMessageParams) msg;
handleSynthesisDone(params);
+ // This call is delayed more than it should be, but we are
+ // certain at this point that we have all the data we want.
+ params.mLogger.onWriteData();
}
// Flush all remaining data to the audio track, stop it and release
@@ -416,6 +421,8 @@
final SynthesisMessageParams params = (SynthesisMessageParams) msg;
if (DBG) Log.d(TAG, "completeAudioAvailable(" + params + ")");
+ params.mLogger.onPlaybackStart();
+
// Channel config and bytes per frame are checked before
// this message is sent.
int channelConfig = AudioPlaybackHandler.getChannelConfig(params.mChannelCount);
diff --git a/core/java/android/speech/tts/EventLogTags.logtags b/core/java/android/speech/tts/EventLogTags.logtags
new file mode 100644
index 0000000..1a9f5fe
--- /dev/null
+++ b/core/java/android/speech/tts/EventLogTags.logtags
@@ -0,0 +1,6 @@
+# See system/core/logcat/event.logtags for a description of the format of this file.
+
+option java_package android.speech.tts;
+
+76001 tts_speak_success (engine|3),(caller|3),(length|1),(locale|3),(rate|1),(pitch|1),(engine_latency|2|3),(engine_total|2|3),(audio_latency|2|3)
+76002 tts_speak_failure (engine|3),(caller|3),(length|1),(locale|3),(rate|1),(pitch|1)
diff --git a/core/java/android/speech/tts/EventLogger.java b/core/java/android/speech/tts/EventLogger.java
new file mode 100644
index 0000000..63b954b
--- /dev/null
+++ b/core/java/android/speech/tts/EventLogger.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2011 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.speech.tts;
+
+import android.os.SystemClock;
+import android.text.TextUtils;
+
+/**
+ * Writes data about a given speech synthesis request to the event logs.
+ * The data that is logged includes the calling app, length of the utterance,
+ * speech rate / pitch and the latency and overall time taken.
+ *
+ * Note that {@link EventLogger#onStopped()} and {@link EventLogger#onError()}
+ * might be called from any thread, but on {@link EventLogger#onPlaybackStart()} and
+ * {@link EventLogger#onComplete()} must be called from a single thread
+ * (usually the audio playback thread}
+ */
+class EventLogger {
+ private final SynthesisRequest mRequest;
+ private final String mCallingApp;
+ private final String mServiceApp;
+ private final long mReceivedTime;
+ private long mPlaybackStartTime = -1;
+ private volatile long mRequestProcessingStartTime = -1;
+ private volatile long mEngineStartTime = -1;
+ private volatile long mEngineCompleteTime = -1;
+
+ private volatile boolean mError = false;
+ private volatile boolean mStopped = false;
+ private boolean mLogWritten = false;
+
+ EventLogger(SynthesisRequest request, String callingApp,
+ String serviceApp) {
+ mRequest = request;
+ mCallingApp = callingApp;
+ mServiceApp = serviceApp;
+ mReceivedTime = SystemClock.elapsedRealtime();
+ }
+
+ /**
+ * Notifies the logger that this request has been selected from
+ * the processing queue for processing. Engine latency / total time
+ * is measured from this baseline.
+ */
+ public void onRequestProcessingStart() {
+ mRequestProcessingStartTime = SystemClock.elapsedRealtime();
+ }
+
+ /**
+ * Notifies the logger that a chunk of data has been received from
+ * the engine. Might be called multiple times.
+ */
+ public void onEngineDataReceived() {
+ if (mEngineStartTime == -1) {
+ mEngineStartTime = SystemClock.elapsedRealtime();
+ }
+ }
+
+ /**
+ * Notifies the logger that the engine has finished processing data.
+ * Will be called exactly once.
+ */
+ public void onEngineComplete() {
+ mEngineCompleteTime = SystemClock.elapsedRealtime();
+ }
+
+ /**
+ * Notifies the logger that audio playback has started for some section
+ * of the synthesis. This is normally some amount of time after the engine
+ * has synthesized data and varides depending on utterances and
+ * other audio currently in the queue.
+ */
+ public void onPlaybackStart() {
+ // For now, keep track of only the first chunk of audio
+ // that was played.
+ if (mPlaybackStartTime == -1) {
+ mPlaybackStartTime = SystemClock.elapsedRealtime();
+ }
+ }
+
+ /**
+ * Notifies the logger that the current synthesis was stopped.
+ * Latency numbers are not reported for stopped syntheses.
+ */
+ public void onStopped() {
+ mStopped = false;
+ }
+
+ /**
+ * Notifies the logger that the current synthesis resulted in
+ * an error. This is logged using {@link EventLogTags#writeTtsSpeakFailure}.
+ */
+ public void onError() {
+ mError = true;
+ }
+
+ /**
+ * Notifies the logger that the current synthesis has completed.
+ * All available data is not logged.
+ */
+ public void onWriteData() {
+ if (mLogWritten) {
+ return;
+ } else {
+ mLogWritten = true;
+ }
+
+ long completionTime = SystemClock.elapsedRealtime();
+ // onPlaybackStart() should normally always be called if an
+ // error does not occur.
+ if (mError || mPlaybackStartTime == -1 || mEngineCompleteTime == -1) {
+ EventLogTags.writeTtsSpeakFailure(mServiceApp, mCallingApp,
+ getUtteranceLength(), getLocaleString(),
+ mRequest.getSpeechRate(), mRequest.getPitch());
+ return;
+ }
+
+ // We don't report stopped syntheses because their overall
+ // total time spent will be innacurate (will not correlate with
+ // the length of the utterance).
+ if (mStopped) {
+ return;
+ }
+
+ final long audioLatency = mPlaybackStartTime - mReceivedTime;
+ final long engineLatency = mEngineStartTime - mRequestProcessingStartTime;
+ final long engineTotal = mEngineCompleteTime - mRequestProcessingStartTime;
+ EventLogTags.writeTtsSpeakSuccess(mServiceApp, mCallingApp,
+ getUtteranceLength(), getLocaleString(),
+ mRequest.getSpeechRate(), mRequest.getPitch(),
+ engineLatency, engineTotal, audioLatency);
+ }
+
+ /**
+ * @return the length of the utterance for the given synthesis, 0
+ * if the utterance was {@code null}.
+ */
+ private int getUtteranceLength() {
+ final String utterance = mRequest.getText();
+ return utterance == null ? 0 : utterance.length();
+ }
+
+ /**
+ * Returns a formatted locale string from the synthesis params of the
+ * form lang-country-variant.
+ */
+ private String getLocaleString() {
+ StringBuilder sb = new StringBuilder(mRequest.getLanguage());
+ if (!TextUtils.isEmpty(mRequest.getCountry())) {
+ sb.append('-');
+ sb.append(mRequest.getCountry());
+
+ if (!TextUtils.isEmpty(mRequest.getVariant())) {
+ sb.append('-');
+ sb.append(mRequest.getVariant());
+ }
+ }
+
+ return sb.toString();
+ }
+
+}
diff --git a/core/java/android/speech/tts/PlaybackSynthesisCallback.java b/core/java/android/speech/tts/PlaybackSynthesisCallback.java
index bdaa1b8..38030a6 100644
--- a/core/java/android/speech/tts/PlaybackSynthesisCallback.java
+++ b/core/java/android/speech/tts/PlaybackSynthesisCallback.java
@@ -65,29 +65,42 @@
private final UtteranceCompletedDispatcher mDispatcher;
private final String mCallingApp;
+ private final EventLogger mLogger;
PlaybackSynthesisCallback(int streamType, float volume, float pan,
AudioPlaybackHandler audioTrackHandler, UtteranceCompletedDispatcher dispatcher,
- String callingApp) {
+ String callingApp, EventLogger logger) {
mStreamType = streamType;
mVolume = volume;
mPan = pan;
mAudioTrackHandler = audioTrackHandler;
mDispatcher = dispatcher;
mCallingApp = callingApp;
+ mLogger = logger;
}
@Override
void stop() {
if (DBG) Log.d(TAG, "stop()");
+ // Note that mLogger.mError might be true too at this point.
+ mLogger.onStopped();
+
synchronized (mStateLock) {
- if (mToken == null || mStopped) {
- Log.w(TAG, "stop() called twice, before start(), or after done()");
+ if (mStopped) {
+ Log.w(TAG, "stop() called twice");
return;
}
- mAudioTrackHandler.stop(mToken);
- mToken = null;
+ // mToken will be null if the engine encounters
+ // an error before it called start().
+ if (mToken != null) {
+ mAudioTrackHandler.stop(mToken);
+ mToken = null;
+ } else {
+ // In all other cases, mAudioTrackHandler.stop() will
+ // result in onComplete being called.
+ mLogger.onWriteData();
+ }
mStopped = true;
}
}
@@ -124,7 +137,7 @@
}
SynthesisMessageParams params = new SynthesisMessageParams(
mStreamType, sampleRateInHz, audioFormat, channelCount, mVolume, mPan,
- mDispatcher, mCallingApp);
+ mDispatcher, mCallingApp, mLogger);
mAudioTrackHandler.enqueueSynthesisStart(params);
mToken = params;
@@ -157,6 +170,8 @@
mAudioTrackHandler.enqueueSynthesisDataAvailable(mToken);
}
+ mLogger.onEngineDataReceived();
+
return TextToSpeech.SUCCESS;
}
@@ -177,6 +192,7 @@
}
mAudioTrackHandler.enqueueSynthesisDone(mToken);
+ mLogger.onEngineComplete();
}
return TextToSpeech.SUCCESS;
}
@@ -184,6 +200,9 @@
@Override
public void error() {
if (DBG) Log.d(TAG, "error() [will call stop]");
+ // Currently, this call will not be logged if error( ) is called
+ // before start.
+ mLogger.onError();
stop();
}
@@ -208,7 +227,7 @@
}
SynthesisMessageParams params = new SynthesisMessageParams(
mStreamType, sampleRateInHz, audioFormat, channelCount, mVolume, mPan,
- mDispatcher, mCallingApp);
+ mDispatcher, mCallingApp, mLogger);
params.addBuffer(buffer, offset, length);
mAudioTrackHandler.enqueueSynthesisCompleteDataAvailable(params);
diff --git a/core/java/android/speech/tts/SynthesisMessageParams.java b/core/java/android/speech/tts/SynthesisMessageParams.java
index 51f3d2e..caf02ef 100644
--- a/core/java/android/speech/tts/SynthesisMessageParams.java
+++ b/core/java/android/speech/tts/SynthesisMessageParams.java
@@ -30,6 +30,7 @@
final int mChannelCount;
final float mVolume;
final float mPan;
+ final EventLogger mLogger;
public volatile AudioTrack mAudioTrack;
@@ -38,7 +39,7 @@
SynthesisMessageParams(int streamType, int sampleRate,
int audioFormat, int channelCount,
float volume, float pan, UtteranceCompletedDispatcher dispatcher,
- String callingApp) {
+ String callingApp, EventLogger logger) {
super(dispatcher, callingApp);
mStreamType = streamType;
@@ -47,6 +48,7 @@
mChannelCount = channelCount;
mVolume = volume;
mPan = pan;
+ mLogger = logger;
// initially null.
mAudioTrack = null;
diff --git a/core/java/android/speech/tts/TextToSpeechService.java b/core/java/android/speech/tts/TextToSpeechService.java
index 7ea9373..010c155 100644
--- a/core/java/android/speech/tts/TextToSpeechService.java
+++ b/core/java/android/speech/tts/TextToSpeechService.java
@@ -82,8 +82,7 @@
private AudioPlaybackHandler mAudioPlaybackHandler;
private CallbackMap mCallbacks;
-
- private int mDefaultAvailability = TextToSpeech.LANG_NOT_SUPPORTED;
+ private String mPackageName;
@Override
public void onCreate() {
@@ -99,9 +98,10 @@
mCallbacks = new CallbackMap();
+ mPackageName = getApplicationInfo().packageName;
+
// Load default language
- mDefaultAvailability = onLoadLanguage(getDefaultLanguage(),
- getDefaultCountry(), getDefaultVariant());
+ onLoadLanguage(getDefaultLanguage(), getDefaultCountry(), getDefaultVariant());
}
@Override
@@ -457,12 +457,14 @@
// Non null after synthesis has started, and all accesses
// guarded by 'this'.
private AbstractSynthesisCallback mSynthesisCallback;
+ private final EventLogger mEventLogger;
public SynthesisSpeechItem(String callingApp, Bundle params, String text) {
super(callingApp, params);
mText = text;
mSynthesisRequest = new SynthesisRequest(mText, mParams);
setRequestParams(mSynthesisRequest);
+ mEventLogger = new EventLogger(mSynthesisRequest, getCallingApp(), mPackageName);
}
public String getText() {
@@ -485,6 +487,7 @@
@Override
protected int playImpl() {
AbstractSynthesisCallback synthesisCallback;
+ mEventLogger.onRequestProcessingStart();
synchronized (this) {
mSynthesisCallback = createSynthesisCallback();
synthesisCallback = mSynthesisCallback;
@@ -495,7 +498,7 @@
protected AbstractSynthesisCallback createSynthesisCallback() {
return new PlaybackSynthesisCallback(getStreamType(), getVolume(), getPan(),
- mAudioPlaybackHandler, this, getCallingApp());
+ mAudioPlaybackHandler, this, getCallingApp(), mEventLogger);
}
private void setRequestParams(SynthesisRequest request) {
diff --git a/core/java/android/text/method/AllCapsTransformationMethod.java b/core/java/android/text/method/AllCapsTransformationMethod.java
new file mode 100644
index 0000000..f9920dd
--- /dev/null
+++ b/core/java/android/text/method/AllCapsTransformationMethod.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2011 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.text.method;
+
+import android.content.Context;
+import android.graphics.Rect;
+import android.util.Log;
+import android.view.View;
+
+import java.util.Locale;
+
+/**
+ * Transforms source text into an ALL CAPS string, locale-aware.
+ *
+ * @hide
+ */
+public class AllCapsTransformationMethod implements TransformationMethod2 {
+ private static final String TAG = "AllCapsTransformationMethod";
+
+ private boolean mEnabled;
+ private Locale mLocale;
+
+ public AllCapsTransformationMethod(Context context) {
+ mLocale = context.getResources().getConfiguration().locale;
+ }
+
+ @Override
+ public CharSequence getTransformation(CharSequence source, View view) {
+ if (mEnabled) {
+ return source != null ? source.toString().toUpperCase(mLocale) : null;
+ }
+ Log.w(TAG, "Caller did not enable length changes; not transforming text");
+ return source;
+ }
+
+ @Override
+ public void onFocusChanged(View view, CharSequence sourceText, boolean focused, int direction,
+ Rect previouslyFocusedRect) {
+ }
+
+ @Override
+ public void setLengthChangesAllowed(boolean allowLengthChanges) {
+ mEnabled = allowLengthChanges;
+ }
+
+}
diff --git a/core/java/android/text/method/TransformationMethod2.java b/core/java/android/text/method/TransformationMethod2.java
new file mode 100644
index 0000000..ef00ecd
--- /dev/null
+++ b/core/java/android/text/method/TransformationMethod2.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2011 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.text.method;
+
+/**
+ * TransformationMethod2 extends the TransformationMethod interface
+ * and adds the ability to relax restrictions of TransformationMethod.
+ *
+ * @hide
+ */
+public interface TransformationMethod2 extends TransformationMethod {
+ /**
+ * Relax the contract of TransformationMethod to allow length changes,
+ * or revert to the length-restricted behavior.
+ *
+ * @param allowLengthChanges true to allow the transformation to change the length
+ * of the input string.
+ */
+ public void setLengthChangesAllowed(boolean allowLengthChanges);
+}
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index 72263a7..88f59d4 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -2881,10 +2881,6 @@
msg.append(", id[").append(i).append("]=").append(getPointerId(i));
msg.append(", x[").append(i).append("]=").append(getX(i));
msg.append(", y[").append(i).append("]=").append(getY(i));
- msg.append(", pressure[").append(i).append("]=").append(getPressure(i));
- msg.append(", touchMajor[").append(i).append("]=").append(getTouchMajor(i));
- msg.append(", touchMinor[").append(i).append("]=").append(getTouchMinor(i));
- msg.append(", orientation[").append(i).append("]=").append(getOrientation(i));
msg.append(", toolType[").append(i).append("]=").append(
toolTypeToString(getToolType(i)));
}
diff --git a/core/java/android/webkit/L10nUtils.java b/core/java/android/webkit/L10nUtils.java
index 4c42cde..f9d0067d 100644
--- a/core/java/android/webkit/L10nUtils.java
+++ b/core/java/android/webkit/L10nUtils.java
@@ -74,7 +74,8 @@
com.android.internal.R.string.autofill_country_code_re, // IDS_AUTOFILL_COUNTRY_CODE_RE
com.android.internal.R.string.autofill_area_code_notext_re, // IDS_AUTOFILL_AREA_CODE_NOTEXT_RE
com.android.internal.R.string.autofill_phone_prefix_separator_re, // IDS_AUTOFILL_PHONE_PREFIX_SEPARATOR_RE
- com.android.internal.R.string.autofill_phone_suffix_separator_re // IDS_AUTOFILL_PHONE_SUFFIX_SEPARATOR_RE
+ com.android.internal.R.string.autofill_phone_suffix_separator_re, // IDS_AUTOFILL_PHONE_SUFFIX_SEPARATOR_RE
+ com.android.internal.R.string.credit_card_number_preview_format // IDS_CREDIT_CARD_NUMBER_PREVIEW_FORMAT
};
private static Context mApplicationContext;
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index ffa52d1..7ba86a5 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -3467,40 +3467,6 @@
return Math.min(duration, MAX_DURATION);
}
-
- // Helper to build a TouchEventData object from a MotionEvent object.
- // A few fields are allocated now but will be set later:
- // mAction, mPoints and mPointsInView.
- private static TouchEventData buildTouchFromEvent(MotionEvent ev) {
- TouchEventData ted = new TouchEventData();
- ted.mAction = ev.getActionMasked();
- ted.mEventTime = ev.getEventTime();
-
- final int count = ev.getPointerCount();
- ted.mIds = new int[count];
- ted.mPoints = new Point[count];
- ted.mPointsInView = new Point[count];
- ted.mPressures = new float[count];
- ted.mTouchMajor = new int[count];
- ted.mTouchMinor = new int[count];
- ted.mOrientation = new float[count];
- for (int c = 0; c < count; c++) {
- ted.mIds[c] = ev.getPointerId(c);
- ted.mPressures[c] = ev.getPressure(c);
- ted.mTouchMajor[c] = (int) ev.getTouchMajor(c);
- ted.mTouchMinor[c] = (int) ev.getTouchMinor(c);
- ted.mOrientation[c] = ev.getOrientation(c);
- }
-
- if (ted.mAction == MotionEvent.ACTION_POINTER_DOWN
- || ted.mAction == MotionEvent.ACTION_POINTER_UP) {
- ted.mActionIndex = ev.getActionIndex();
- }
- ted.mMetaState = ev.getMetaState();
-
- return ted;
- }
-
// helper to pin the scrollBy parameters (already in view coordinates)
// returns true if the scroll was changed
private boolean pinScrollBy(int dx, int dy, boolean animate, int animationDuration) {
@@ -5899,10 +5865,15 @@
}
// pass the touch events from UI thread to WebCore thread
if (shouldForwardTouchEvent()) {
- TouchEventData ted = buildTouchFromEvent(ev);
+ TouchEventData ted = new TouchEventData();
ted.mAction = action;
+ ted.mIds = new int[1];
+ ted.mIds[0] = ev.getPointerId(0);
+ ted.mPoints = new Point[1];
ted.mPoints[0] = new Point(contentX, contentY);
+ ted.mPointsInView = new Point[1];
ted.mPointsInView[0] = new Point(x, y);
+ ted.mMetaState = ev.getMetaState();
ted.mReprocess = mDeferTouchProcess;
ted.mNativeLayer = nativeScrollableLayer(
contentX, contentY, ted.mNativeLayerRect, null);
@@ -5944,10 +5915,15 @@
// pass the touch events from UI thread to WebCore thread
if (shouldForwardTouchEvent() && mConfirmMove && (firstMove
|| eventTime - mLastSentTouchTime > mCurrentTouchInterval)) {
- TouchEventData ted = buildTouchFromEvent(ev);
+ TouchEventData ted = new TouchEventData();
ted.mAction = action;
+ ted.mIds = new int[1];
+ ted.mIds[0] = ev.getPointerId(0);
+ ted.mPoints = new Point[1];
ted.mPoints[0] = new Point(contentX, contentY);
+ ted.mPointsInView = new Point[1];
ted.mPointsInView[0] = new Point(x, y);
+ ted.mMetaState = ev.getMetaState();
ted.mReprocess = mDeferTouchProcess;
ted.mNativeLayer = mScrollingLayer;
ted.mNativeLayerRect.set(mScrollingLayerRect);
@@ -6117,10 +6093,15 @@
if (!isFocused()) requestFocus();
// pass the touch events from UI thread to WebCore thread
if (shouldForwardTouchEvent()) {
- TouchEventData ted = buildTouchFromEvent(ev);
+ TouchEventData ted = new TouchEventData();
+ ted.mIds = new int[1];
+ ted.mIds[0] = ev.getPointerId(0);
ted.mAction = action;
+ ted.mPoints = new Point[1];
ted.mPoints[0] = new Point(contentX, contentY);
+ ted.mPointsInView = new Point[1];
ted.mPointsInView[0] = new Point(x, y);
+ ted.mMetaState = ev.getMetaState();
ted.mReprocess = mDeferTouchProcess;
ted.mNativeLayer = mScrollingLayer;
ted.mNativeLayerRect.set(mScrollingLayerRect);
@@ -6137,10 +6118,15 @@
mPrivateHandler.removeMessages(SWITCH_TO_SHORTPRESS);
mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
if (inFullScreenMode() || mDeferTouchProcess) {
- TouchEventData ted = buildTouchFromEvent(ev);
+ TouchEventData ted = new TouchEventData();
+ ted.mIds = new int[1];
+ ted.mIds[0] = ev.getPointerId(0);
ted.mAction = WebViewCore.ACTION_DOUBLETAP;
+ ted.mPoints = new Point[1];
ted.mPoints[0] = new Point(contentX, contentY);
+ ted.mPointsInView = new Point[1];
ted.mPointsInView[0] = new Point(x, y);
+ ted.mMetaState = ev.getMetaState();
ted.mReprocess = mDeferTouchProcess;
ted.mNativeLayer = nativeScrollableLayer(
contentX, contentY,
@@ -6272,14 +6258,24 @@
}
private void passMultiTouchToWebKit(MotionEvent ev, long sequence) {
- TouchEventData ted = buildTouchFromEvent(ev);
- for (int c = 0; c < ev.getPointerCount(); c++) {
+ TouchEventData ted = new TouchEventData();
+ ted.mAction = ev.getActionMasked();
+ final int count = ev.getPointerCount();
+ ted.mIds = new int[count];
+ ted.mPoints = new Point[count];
+ ted.mPointsInView = new Point[count];
+ for (int c = 0; c < count; c++) {
ted.mIds[c] = ev.getPointerId(c);
int x = viewToContentX((int) ev.getX(c) + mScrollX);
int y = viewToContentY((int) ev.getY(c) + mScrollY);
ted.mPoints[c] = new Point(x, y);
ted.mPointsInView[c] = new Point((int) ev.getX(c), (int) ev.getY(c));
}
+ if (ted.mAction == MotionEvent.ACTION_POINTER_DOWN
+ || ted.mAction == MotionEvent.ACTION_POINTER_UP) {
+ ted.mActionIndex = ev.getActionIndex();
+ }
+ ted.mMetaState = ev.getMetaState();
ted.mReprocess = true;
ted.mMotionEvent = MotionEvent.obtain(ev);
ted.mSequence = sequence;
@@ -6353,11 +6349,7 @@
if (removeEvents) {
mWebViewCore.removeMessages(EventHub.TOUCH_EVENT);
}
-
TouchEventData ted = new TouchEventData();
- ted.mAction = MotionEvent.ACTION_CANCEL;
- ted.mEventTime = mLastTouchTime;
- ted.mMetaState = 0;
ted.mIds = new int[1];
ted.mIds[0] = 0;
ted.mPoints = new Point[1];
@@ -6366,15 +6358,7 @@
int viewX = contentToViewX(x) - mScrollX;
int viewY = contentToViewY(y) - mScrollY;
ted.mPointsInView[0] = new Point(viewX, viewY);
- ted.mPressures = new float[1];
- ted.mPressures[0] = 1;
- ted.mTouchMajor = new int[1];
- ted.mTouchMajor[0] = 1;
- ted.mTouchMinor = new int[1];
- ted.mTouchMinor[0] = 1;
- ted.mOrientation = new float[1];
- ted.mOrientation[0] = 0;
-
+ ted.mAction = MotionEvent.ACTION_CANCEL;
ted.mNativeLayer = nativeScrollableLayer(
x, y, ted.mNativeLayerRect, null);
ted.mSequence = mTouchEventQueue.nextTouchSequence();
@@ -8053,7 +8037,6 @@
if (inFullScreenMode() || mDeferTouchProcess) {
TouchEventData ted = new TouchEventData();
ted.mAction = WebViewCore.ACTION_LONGPRESS;
- ted.mEventTime = mLastTouchTime;
ted.mIds = new int[1];
ted.mIds[0] = 0;
ted.mPoints = new Point[1];
@@ -8061,15 +8044,6 @@
viewToContentY(mLastTouchY + mScrollY));
ted.mPointsInView = new Point[1];
ted.mPointsInView[0] = new Point(mLastTouchX, mLastTouchY);
- ted.mPressures = new float[1];
- ted.mPressures[0] = 1;
- ted.mTouchMajor = new int[1];
- ted.mTouchMajor[0] = 1;
- ted.mTouchMinor = new int[1];
- ted.mTouchMinor[0] = 1;
- ted.mOrientation = new float[1];
- ted.mOrientation[0] = 0;
-
// metaState for long press is tricky. Should it be the
// state when the press started or when the press was
// released? Or some intermediary key state? For
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 3357220..c652e55 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -577,10 +577,8 @@
private native void nativeTouchUp(int touchGeneration,
int framePtr, int nodePtr, int x, int y);
- private native boolean nativeHandleTouchEvent(int action, long eventTime,
- int[] idArray, int[] xArray, int[] yArray, float[] pressureArray,
- int[] touchMajorArray, int[] touchMinorArray, float[] orientationArray,
- int count, int actionIndex, int metaState);
+ private native boolean nativeHandleTouchEvent(int action, int[] idArray,
+ int[] xArray, int[] yArray, int count, int actionIndex, int metaState);
private native void nativeUpdateFrameCache();
@@ -835,21 +833,16 @@
static class TouchEventData {
int mAction;
- long mEventTime; // Time (in ms) this event was generated.
- int[] mIds; // Ids of the touch points.
+ int[] mIds; // Ids of the touch points
Point[] mPoints;
- Point[] mPointsInView; // Point coordinates in view axis.
- float[] mPressures; // Pressures of the touch points.
- int[] mTouchMajor; // Length of the major axis of the touch area.
- int[] mTouchMinor; // Length of the minor axis of the touch area.
- float[] mOrientation; // The orientation of the touch area.
- int mActionIndex; // Associated pointer index for ACTION_POINTER_DOWN/UP.
+ Point[] mPointsInView; // the point coordinates in view axis.
+ int mActionIndex; // Associated pointer index for ACTION_POINTER_DOWN/UP
int mMetaState;
boolean mReprocess;
- MotionEvent mMotionEvent; // Only used for multi-touch.
+ MotionEvent mMotionEvent;
int mNativeLayer;
Rect mNativeLayerRect = new Rect();
- long mSequence; // For queuing the events.
+ long mSequence;
boolean mNativeResult;
}
@@ -1358,11 +1351,8 @@
nativeScrollLayer(ted.mNativeLayer,
ted.mNativeLayerRect);
}
- ted.mNativeResult = nativeHandleTouchEvent(
- ted.mAction, ted.mEventTime, ted.mIds,
- xArray, yArray, ted.mPressures,
- ted.mTouchMajor, ted.mTouchMinor, ted.mOrientation,
- count, ted.mActionIndex, ted.mMetaState);
+ ted.mNativeResult = nativeHandleTouchEvent(ted.mAction, ted.mIds,
+ xArray, yArray, count, ted.mActionIndex, ted.mMetaState);
Message.obtain(
mWebView.mPrivateHandler,
WebView.PREVENT_TOUCH_ID,
@@ -2245,16 +2235,15 @@
// called by JNI
private void updateViewport() {
- // if updateViewport is called before first layout, wait until first
- // layout to update the viewport. In the rare case, this is called after
- // first layout, force an update as we have just parsed the viewport
- // meta tag.
- if (mBrowserFrame.firstLayoutDone()) {
- setupViewport(true);
- }
+ // Update viewport asap to make sure we get correct one.
+ setupViewport(true);
}
private void setupViewport(boolean updateViewState) {
+ if (mWebView == null || mSettings == null) {
+ // We've been destroyed or are being destroyed, return early
+ return;
+ }
// set the viewport settings from WebKit
setViewportSettingsFromNative();
@@ -2385,8 +2374,12 @@
(float) webViewWidth / mViewportWidth;
} else {
mInitialViewState.mTextWrapScale = adjust;
- // 0 will trigger WebView to turn on zoom overview mode
- mInitialViewState.mViewScale = 0;
+ if (mSettings.getUseWideViewPort()) {
+ // 0 will trigger WebView to turn on zoom overview mode
+ mInitialViewState.mViewScale = 0;
+ } else {
+ mInitialViewState.mViewScale = adjust;
+ }
}
}
@@ -2417,7 +2410,7 @@
mEventHub.removeMessages(EventHub.VIEW_SIZE_CHANGED);
mEventHub.sendMessageAtFrontOfQueue(Message.obtain(null,
EventHub.VIEW_SIZE_CHANGED, data));
- } else if (mSettings.getUseWideViewPort()) {
+ } else {
if (viewportWidth == 0) {
// Trick to ensure VIEW_SIZE_CHANGED will be sent from WebView
// to WebViewCore
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java
index 7c0470e..c2759e5 100644
--- a/core/java/android/widget/GridLayout.java
+++ b/core/java/android/widget/GridLayout.java
@@ -92,10 +92,8 @@
*
* <h4>Excess Space Distribution</h4>
*
- * Like {@link LinearLayout}, a child's ability to stretch is controlled
- * using <em>weights</em>, which are specified using the
- * {@link GridLayout.LayoutParams#widthSpec widthSpec} and
- * {@link GridLayout.LayoutParams#heightSpec heightSpec} layout parameters.
+ * A child's ability to stretch is controlled using the {@link Group#flexibility flexibility}
+ * properties of its row and column groups.
* <p>
* <p>
* See {@link GridLayout.LayoutParams} for a full description of the
@@ -1055,7 +1053,7 @@
if (isGone(c)) continue;
LayoutParams lp = getLayoutParams(c);
Group g = horizontal ? lp.columnGroup : lp.rowGroup;
- groupBounds.getValue(i).include(c, g, GridLayout.this, this, lp);
+ groupBounds.getValue(i).include(c, g, GridLayout.this, this);
}
}
@@ -1087,13 +1085,17 @@
spans[i].reset();
}
- // use getter to trigger a re-evaluation
+ // Use getter to trigger a re-evaluation
Bounds[] bounds = getGroupBounds().values;
for (int i = 0; i < bounds.length; i++) {
int size = bounds[i].size(min);
- int value = min ? size : -size;
MutableInt valueHolder = links.getValue(i);
- valueHolder.value = max(valueHolder.value, value);
+ if (min) {
+ valueHolder.value = max(valueHolder.value, size);
+ }
+ else {
+ valueHolder.value = -max(-valueHolder.value, size);
+ }
}
}
@@ -1155,7 +1157,7 @@
int[] sizes = new int[N];
for (Arc arc : arcs) {
sizes[arc.span.min]++;
- }
+ }
for (int i = 0; i < sizes.length; i++) {
result[i] = new Arc[sizes[i]];
}
@@ -1622,16 +1624,14 @@
* <li>{@link #rowGroup}{@code .alignment} = {@link #BASELINE} </li>
* <li>{@link #columnGroup}{@code .span} = {@code [0, 1]} </li>
* <li>{@link #columnGroup}{@code .alignment} = {@link #LEFT} </li>
- * <li>{@link #widthSpec} = {@link #FIXED} </li>
- * <li>{@link #heightSpec} = {@link #FIXED} </li>
* </ul>
*
* @attr ref android.R.styleable#GridLayout_Layout_layout_row
* @attr ref android.R.styleable#GridLayout_Layout_layout_rowSpan
- * @attr ref android.R.styleable#GridLayout_Layout_layout_heightSpec
+ * @attr ref android.R.styleable#GridLayout_Layout_layout_rowFlexibility
* @attr ref android.R.styleable#GridLayout_Layout_layout_column
* @attr ref android.R.styleable#GridLayout_Layout_layout_columnSpan
- * @attr ref android.R.styleable#GridLayout_Layout_layout_widthSpec
+ * @attr ref android.R.styleable#GridLayout_Layout_layout_columnFlexibility
* @attr ref android.R.styleable#GridLayout_Layout_layout_gravity
*/
public static class LayoutParams extends MarginLayoutParams {
@@ -1647,19 +1647,12 @@
private static final int DEFAULT_SPAN_SIZE = DEFAULT_SPAN.size();
private static final Alignment DEFAULT_COLUMN_ALIGNMENT = LEFT;
private static final Alignment DEFAULT_ROW_ALIGNMENT = BASELINE;
- private static final Group DEFAULT_COLUMN_GROUP =
- new Group(DEFAULT_SPAN, DEFAULT_COLUMN_ALIGNMENT);
- private static final Group DEFAULT_ROW_GROUP =
- new Group(DEFAULT_SPAN, DEFAULT_ROW_ALIGNMENT);
- private static final Spec DEFAULT_SPEC = FIXED;
- private static final int DEFAULT_SPEC_INDEX = 0;
// Misc
private static final Rect CONTAINER_BOUNDS = new Rect(0, 0, 2, 2);
private static final Alignment[] COLUMN_ALIGNMENTS = { LEFT, CENTER, RIGHT };
private static final Alignment[] ROW_ALIGNMENTS = { TOP, CENTER, BOTTOM };
- private static final Spec[] SPECS = { FIXED, CAN_SHRINK, CAN_STRETCH };
// TypedArray indices
@@ -1672,10 +1665,14 @@
private static final int COLUMN = styleable.GridLayout_Layout_layout_column;
private static final int COLUMN_SPAN = styleable.GridLayout_Layout_layout_columnSpan;
- private static final int WIDTH_SPEC = styleable.GridLayout_Layout_layout_widthSpec;
+ private static final int COLUMN_FLEXIBILITY =
+ styleable.GridLayout_Layout_layout_columnFlexibility;
+
private static final int ROW = styleable.GridLayout_Layout_layout_row;
private static final int ROW_SPAN = styleable.GridLayout_Layout_layout_rowSpan;
- private static final int HEIGHT_SPEC = styleable.GridLayout_Layout_layout_heightSpec;
+ private static final int ROW_FLEXIBILITY =
+ styleable.GridLayout_Layout_layout_rowFlexibility;
+
private static final int GRAVITY = styleable.GridLayout_Layout_layout_gravity;
// Instance variables
@@ -1690,30 +1687,17 @@
* described by these layout parameters.
*/
public Group columnGroup;
- /**
- * The proportional space that should be taken by the associated column group
- * during excess space distribution.
- */
- public Spec widthSpec;
- /**
- * The proportional space that should be taken by the associated row group
- * during excess space distribution.
- */
- public Spec heightSpec;
// Constructors
private LayoutParams(
int width, int height,
int left, int top, int right, int bottom,
- Group rowGroup, Group columnGroup,
- Spec widthSpec, Spec heightSpec) {
+ Group rowGroup, Group columnGroup) {
super(width, height);
setMargins(left, top, right, bottom);
this.rowGroup = rowGroup;
this.columnGroup = columnGroup;
- this.heightSpec = heightSpec;
- this.widthSpec = widthSpec;
}
/**
@@ -1727,14 +1711,15 @@
public LayoutParams(Group rowGroup, Group columnGroup) {
this(DEFAULT_WIDTH, DEFAULT_HEIGHT,
DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN,
- rowGroup, columnGroup, DEFAULT_SPEC, DEFAULT_SPEC);
+ rowGroup, columnGroup);
}
/**
* Constructs a new LayoutParams with default values as defined in {@link LayoutParams}.
*/
public LayoutParams() {
- this(DEFAULT_ROW_GROUP, DEFAULT_COLUMN_GROUP);
+ this(new Group(DEFAULT_SPAN, DEFAULT_ROW_ALIGNMENT),
+ new Group(DEFAULT_SPAN, DEFAULT_COLUMN_ALIGNMENT));
}
// Copying constructors
@@ -1758,10 +1743,8 @@
*/
public LayoutParams(LayoutParams that) {
super(that);
- this.columnGroup = that.columnGroup;
- this.rowGroup = that.rowGroup;
- this.widthSpec = that.widthSpec;
- this.heightSpec = that.heightSpec;
+ this.columnGroup = new Group(that.columnGroup);
+ this.rowGroup = new Group(that.rowGroup);
}
// AttributeSet constructors
@@ -1825,7 +1808,7 @@
// Gravity. For conversion from the static the integers defined in the Gravity class,
// use Gravity.apply() to apply gravity to a view of zero size and see where it ends up.
- private static Alignment getColumnAlignment(int gravity, int width) {
+ private static Alignment getColAlignment(int gravity, int width) {
Rect r = new Rect(0, 0, 0, 0);
Gravity.apply(gravity, 0, 0, CONTAINER_BOUNDS, r);
@@ -1853,14 +1836,14 @@
int column = a.getInt(COLUMN, DEFAULT_COLUMN);
int columnSpan = a.getInt(COLUMN_SPAN, DEFAULT_SPAN_SIZE);
Interval hSpan = new Interval(column, column + columnSpan);
- this.columnGroup = new Group(hSpan, getColumnAlignment(gravity, width));
- this.widthSpec = SPECS[a.getInt(WIDTH_SPEC, DEFAULT_SPEC_INDEX)];
+ int hFlexibility = a.getInt(COLUMN_FLEXIBILITY, Group.DEFAULT_FLEXIBILITY);
+ this.columnGroup = new Group(hSpan, getColAlignment(gravity, width), hFlexibility);
int row = a.getInt(ROW, DEFAULT_ROW);
int rowSpan = a.getInt(ROW_SPAN, DEFAULT_SPAN_SIZE);
Interval vSpan = new Interval(row, row + rowSpan);
- this.rowGroup = new Group(vSpan, getRowAlignment(gravity, height));
- this.heightSpec = SPECS[a.getInt(HEIGHT_SPEC, DEFAULT_SPEC_INDEX)];
+ int vFlexibility = a.getInt(ROW_FLEXIBILITY, Group.DEFAULT_FLEXIBILITY);
+ this.rowGroup = new Group(vSpan, getRowAlignment(gravity, height), vFlexibility);
} finally {
a.recycle();
}
@@ -1875,7 +1858,7 @@
* @attr ref android.R.styleable#GridLayout_Layout_layout_gravity
*/
public void setGravity(int gravity) {
- columnGroup = columnGroup.copyWriteAlignment(getColumnAlignment(gravity, width));
+ columnGroup = columnGroup.copyWriteAlignment(getColAlignment(gravity, width));
rowGroup = rowGroup.copyWriteAlignment(getRowAlignment(gravity, height));
}
@@ -2051,7 +2034,7 @@
public int before;
public int after;
- public boolean canStretch;
+ public int flexibility;
private Bounds() {
reset();
@@ -2060,7 +2043,7 @@
protected void reset() {
before = Integer.MIN_VALUE;
after = Integer.MIN_VALUE;
- canStretch = false;
+ flexibility = UNDEFINED_FLEXIBILITY;
}
protected void include(int before, int after) {
@@ -2069,8 +2052,13 @@
}
protected int size(boolean min) {
- if (!min && canStretch) {
- return MAX_SIZE;
+ if (!min) {
+ // Note in the usual case, components don't define anything
+ // leaving their flexibility is undefined and their stretchability
+ // defined as if the CAN_STRETCH flag was false.
+ if (canStretch(flexibility) && !isUndefined(flexibility)) {
+ return MAX_SIZE;
+ }
}
return before + after;
}
@@ -2079,14 +2067,11 @@
return before - alignment.getAlignmentValue(c, size);
}
- protected void include(View c, Group g, GridLayout gridLayout, Axis axis, LayoutParams lp) {
- Spec spec = axis.horizontal ? lp.widthSpec : lp.heightSpec;
- if (spec == CAN_STRETCH) {
- canStretch = true;
- }
+ protected void include(View c, Group group, GridLayout gridLayout, Axis axis) {
+ this.flexibility &= group.flexibility;
int size = gridLayout.getMeasurementIncludingMargin(c, axis.horizontal);
// todo test this works correctly when the returned value is UNDEFINED
- int before = g.alignment.getAlignmentValue(c, size);
+ int before = group.alignment.getAlignmentValue(c, size);
include(before, size - before);
}
@@ -2198,6 +2183,8 @@
* {@code span} and {@code alignment}.
*/
public static class Group {
+ private static final int DEFAULT_FLEXIBILITY = UNDEFINED_FLEXIBILITY;
+
private static final Group GONE = new Group(Interval.GONE, Alignment.GONE);
/**
@@ -2216,6 +2203,18 @@
public final Alignment alignment;
/**
+ * The flexibility field tells GridLayout how to derive minimum and maximum size
+ * values for a component. Specifications are made with respect to a child's
+ * 'measured size'. A child's measured size is, in turn, controlled by its
+ * height and width layout parameters which either specify a size or, in
+ * the case of {@link LayoutParams#WRAP_CONTENT WRAP_CONTENT}, defer to
+ * the computed size of the component.
+ *
+ * @see GridLayout#CAN_STRETCH
+ */
+ public int flexibility = DEFAULT_FLEXIBILITY;
+
+ /**
* Construct a new Group, {@code group}, where:
* <ul>
* <li> {@code group.span = span} </li>
@@ -2225,11 +2224,24 @@
* @param span the span
* @param alignment the alignment
*/
- Group(Interval span, Alignment alignment) {
+ private Group(Interval span, Alignment alignment) {
this.span = span;
this.alignment = alignment;
}
+ private Group(Interval span, Alignment alignment, int flexibility) {
+ this.span = span;
+ this.alignment = alignment;
+ this.flexibility = flexibility;
+ }
+
+ /* Copying constructor */
+ private Group(Group that) {
+ this.span = that.span;
+ this.alignment = that.alignment;
+ this.flexibility = that.flexibility;
+ }
+
/**
* Construct a new Group, {@code group}, where:
* <ul>
@@ -2260,11 +2272,11 @@
}
private Group copyWriteSpan(Interval span) {
- return new Group(span, alignment);
+ return new Group(span, alignment, flexibility);
}
private Group copyWriteAlignment(Alignment alignment) {
- return new Group(span, alignment);
+ return new Group(span, alignment, flexibility);
}
/**
@@ -2490,40 +2502,54 @@
}
};
- /**
- * Spec's tell GridLayout how to derive minimum and maximum size values for a
- * component. Specifications are made with respect to a child's 'measured size'.
- * A child's measured size is, in turn, controlled by its height and width
- * layout parameters which either specify a size or, in the case of
- * WRAP_CONTENT, defer to the computed size of the component.
- */
- public static abstract class Spec {
+ private static boolean canStretch(int flexibility) {
+ return (flexibility & CAN_STRETCH) != 0;
+ }
+
+ private static boolean isUndefined(int flexibility) {
+ return (flexibility & UNDEFINED) != 0;
}
/**
* Indicates that a view requests precisely the size specified by its layout parameters.
*
- * @see Spec
+ * @see Group#flexibility
+ *
+ * @hide
*/
- public static final Spec FIXED = new Spec() {
- };
+ public static final int FIXED = 0;
/**
* Indicates that a view's size should lie between its minimum and the size specified by
* its layout parameters.
*
- * @see Spec
+ * @see Group#flexibility
+ *
+ * @hide
*/
- public static final Spec CAN_SHRINK = new Spec() {
- };
+ public static final int CAN_SHRINK = 1;
/**
* Indicates that a view's size should be greater than or equal to the size specified by
* its layout parameters.
*
- * @see Spec
+ * @see Group#flexibility
*/
- public static final Spec CAN_STRETCH = new Spec() {
- };
+ public static final int CAN_STRETCH = 2;
+
+ /**
+ * Indicates that a view will ignore its measurement, and can take any size that is greater
+ * than its minimum.
+ *
+ * @see Group#flexibility
+ */
+ private static final int CAN_SHRINK_OR_STRETCH = CAN_SHRINK | CAN_STRETCH;
+
+ /**
+ * A default value for flexibility.
+ *
+ * @see Group#flexibility
+ */
+ private static final int UNDEFINED_FLEXIBILITY = UNDEFINED | CAN_SHRINK | CAN_STRETCH;
}
diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java
index b23a855..485c678 100644
--- a/core/java/android/widget/Spinner.java
+++ b/core/java/android/widget/Spinner.java
@@ -231,7 +231,8 @@
}
if (child != null) {
- return child.getTop() + child.getBaseline();
+ final int childBaseline = child.getBaseline();
+ return childBaseline >= 0 ? child.getTop() + childBaseline : -1;
} else {
return -1;
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 772e8e9..1e63e26 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -16,6 +16,11 @@
package android.widget;
+import com.android.internal.util.FastMath;
+import com.android.internal.widget.EditableInputConnection;
+
+import org.xmlpull.v1.XmlPullParserException;
+
import android.R;
import android.content.ClipData;
import android.content.ClipData.Item;
@@ -62,6 +67,7 @@
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.TextWatcher;
+import android.text.method.AllCapsTransformationMethod;
import android.text.method.ArrowKeyMovementMethod;
import android.text.method.DateKeyListener;
import android.text.method.DateTimeKeyListener;
@@ -76,6 +82,7 @@
import android.text.method.TextKeyListener;
import android.text.method.TimeKeyListener;
import android.text.method.TransformationMethod;
+import android.text.method.TransformationMethod2;
import android.text.method.WordIterator;
import android.text.style.ClickableSpan;
import android.text.style.ParagraphStyle;
@@ -125,11 +132,6 @@
import android.view.inputmethod.InputMethodManager;
import android.widget.RemoteViews.RemoteView;
-import com.android.internal.util.FastMath;
-import com.android.internal.widget.EditableInputConnection;
-
-import org.xmlpull.v1.XmlPullParserException;
-
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.text.BreakIterator;
@@ -424,6 +426,7 @@
int textSize = 15;
int typefaceIndex = -1;
int styleIndex = -1;
+ boolean allCaps = false;
/*
* Look the appearance up without checking first if it exists because
@@ -471,6 +474,10 @@
case com.android.internal.R.styleable.TextAppearance_textStyle:
styleIndex = appearance.getInt(attr, -1);
break;
+
+ case com.android.internal.R.styleable.TextAppearance_textAllCaps:
+ allCaps = appearance.getBoolean(attr, false);
+ break;
}
}
@@ -822,6 +829,10 @@
case com.android.internal.R.styleable.TextView_suggestionsEnabled:
mSuggestionsEnabled = a.getBoolean(attr, true);
break;
+
+ case com.android.internal.R.styleable.TextView_textAllCaps:
+ allCaps = a.getBoolean(attr, false);
+ break;
}
}
a.recycle();
@@ -1004,6 +1015,10 @@
}
setRawTextSize(textSize);
+ if (allCaps) {
+ setTransformationMethod(new AllCapsTransformationMethod(getContext()));
+ }
+
if (password || passwordInputType || webPasswordInputType || numberPasswordInputType) {
setTransformationMethod(PasswordTransformationMethod.getInstance());
typefaceIndex = MONOSPACE;
@@ -1331,6 +1346,14 @@
mTransformation = method;
+ if (method instanceof TransformationMethod2) {
+ TransformationMethod2 method2 = (TransformationMethod2) method;
+ mAllowTransformationLengthChange = !mTextIsSelectable && !(mText instanceof Editable);
+ method2.setLengthChangesAllowed(mAllowTransformationLengthChange);
+ } else {
+ mAllowTransformationLengthChange = false;
+ }
+
setText(mText);
}
@@ -1775,6 +1798,11 @@
setTypefaceByIndex(typefaceIndex, styleIndex);
+ if (appearance.getBoolean(com.android.internal.R.styleable.TextAppearance_textAllCaps,
+ false)) {
+ setTransformationMethod(new AllCapsTransformationMethod(getContext()));
+ }
+
appearance.recycle();
}
@@ -2823,14 +2851,15 @@
mBufferType = type;
mText = text;
- if (mTransformation == null)
+ if (mTransformation == null) {
mTransformed = text;
- else
+ } else {
mTransformed = mTransformation.getTransformation(text, this);
+ }
final int textLength = text.length();
- if (text instanceof Spannable) {
+ if (text instanceof Spannable && !mAllowTransformationLengthChange) {
Spannable sp = (Spannable) text;
// Remove any ChangeWatchers that might have come
@@ -2852,7 +2881,6 @@
if (mTransformation != null) {
sp.setSpan(mTransformation, 0, textLength, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
-
}
if (mMovement != null) {
@@ -6570,6 +6598,26 @@
}
/**
+ * Sets the properties of this field to transform input to ALL CAPS
+ * display. This may use a "small caps" formatting if available.
+ * This setting will be ignored if this field is editable or selectable.
+ *
+ * This call replaces the current transformation method. Disabling this
+ * will not necessarily restore the previous behavior from before this
+ * was enabled.
+ *
+ * @see #setTransformationMethod(TransformationMethod)
+ * @attr ref android.R.styleable#TextView_textAllCaps
+ */
+ public void setAllCaps(boolean allCaps) {
+ if (allCaps) {
+ setTransformationMethod(new AllCapsTransformationMethod(getContext()));
+ } else {
+ setTransformationMethod(null);
+ }
+ }
+
+ /**
* If true, sets the properties of this field (number of lines, horizontally scrolling,
* transformation method) to be for a single-line input; if false, restores these to the default
* conditions.
@@ -10254,6 +10302,7 @@
private MovementMethod mMovement;
private TransformationMethod mTransformation;
+ private boolean mAllowTransformationLengthChange;
private ChangeWatcher mChangeWatcher;
private ArrayList<TextWatcher> mListeners = null;
diff --git a/core/java/com/android/internal/util/Protocol.java b/core/java/com/android/internal/util/Protocol.java
index 2e7ec58..b754d94 100644
--- a/core/java/com/android/internal/util/Protocol.java
+++ b/core/java/com/android/internal/util/Protocol.java
@@ -26,6 +26,9 @@
* codes with Message.what starting at Protocol.WIFI + 1 and less than or equal to Protocol.WIFI +
* Protocol.MAX_MESSAGE
*
+ * NOTE: After a value is created and source released a value shouldn't be changed to
+ * maintain backwards compatibility.
+ *
* {@hide}
*/
public class Protocol {
@@ -40,7 +43,7 @@
public static final int BASE_DHCP = 0x00030000;
public static final int BASE_DATA_CONNECTION = 0x00040000;
public static final int BASE_DATA_CONNECTION_AC = 0x00041000;
- public static final int BASE_DATA_CONNECTION_TRACKER = 0x00050000;
+ public static final int BASE_DATA_CONNECTION_TRACKER = 0x00042000;
//TODO: define all used protocols
}
diff --git a/core/java/com/android/internal/view/menu/ActionMenuItemView.java b/core/java/com/android/internal/view/menu/ActionMenuItemView.java
index 3b497e4..09bebae 100644
--- a/core/java/com/android/internal/view/menu/ActionMenuItemView.java
+++ b/core/java/com/android/internal/view/menu/ActionMenuItemView.java
@@ -154,12 +154,7 @@
// populate accessibility description with title
setContentDescription(title);
- if (mShowTextAllCaps && title != null) {
- mTextButton.setText(title.toString().toUpperCase(
- getContext().getResources().getConfiguration().locale));
- } else {
- mTextButton.setText(mTitle);
- }
+ mTextButton.setText(mTitle);
updateTextButtonVisibility();
}
diff --git a/core/java/com/android/internal/view/menu/ActionMenuView.java b/core/java/com/android/internal/view/menu/ActionMenuView.java
index cfe9e59..bf2965b 100644
--- a/core/java/com/android/internal/view/menu/ActionMenuView.java
+++ b/core/java/com/android/internal/view/menu/ActionMenuView.java
@@ -112,7 +112,7 @@
int cellsRemaining = cellCount;
int maxChildHeight = 0;
int maxCellsUsed = 0;
- int multiCellItemCount = 0;
+ int expandableItemCount = 0;
if (mReserveOverflow) cellsRemaining--;
@@ -123,7 +123,7 @@
lp.expanded = false;
lp.extraPixels = 0;
lp.cellsUsed = 0;
- lp.multiCell = false;
+ lp.expandable = false;
// Overflow always gets 1 cell. No more, no less.
final int cellsAvailable = lp.isOverflowButton ? 1 : cellsRemaining;
@@ -132,7 +132,7 @@
heightMeasureSpec, heightPadding);
maxCellsUsed = Math.max(maxCellsUsed, cellsUsed);
- if (lp.multiCell) multiCellItemCount++;
+ if (lp.expandable) expandableItemCount++;
cellsRemaining -= cellsUsed;
maxChildHeight = Math.max(maxChildHeight, child.getMeasuredHeight());
@@ -142,8 +142,8 @@
// Try distributing whole leftover cells to smaller items first.
boolean needsExpansion = false;
- long smallestMultiCellItemsAt = 0;
- while (multiCellItemCount > 0 && cellsRemaining > 0) {
+ long smallestExpandableItemsAt = 0;
+ while (expandableItemCount > 0 && cellsRemaining > 0) {
int minCells = Integer.MAX_VALUE;
long minCellsAt = 0; // Bit locations are indices of relevant child views
int minCellsItemCount = 0;
@@ -152,7 +152,7 @@
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
// Don't try to expand items that shouldn't.
- if (!lp.multiCell) continue;
+ if (!lp.expandable) continue;
// Mark indices of children that can receive an extra cell.
if (lp.cellsUsed < minCells) {
@@ -165,10 +165,10 @@
}
}
- if (minCellsItemCount < cellsRemaining) break; // Couldn't expand anything evenly. Stop.
+ if (minCellsItemCount > cellsRemaining) break; // Couldn't expand anything evenly. Stop.
// Items that get expanded will always be in the set of smallest items when we're done.
- smallestMultiCellItemsAt |= minCellsAt;
+ smallestExpandableItemsAt |= minCellsAt;
for (int i = 0; i < childCount; i++) {
if ((minCellsAt & (1 << i)) == 0) continue;
@@ -186,12 +186,12 @@
// Divide any space left that wouldn't divide along cell boundaries
// evenly among the smallest multi-cell (expandable) items.
- if (cellsRemaining > 0 && smallestMultiCellItemsAt != 0) {
- final int expandCount = Long.bitCount(smallestMultiCellItemsAt);
+ if (cellsRemaining > 0 && smallestExpandableItemsAt != 0) {
+ final int expandCount = Long.bitCount(smallestExpandableItemsAt);
final int extraPixels = cellsRemaining * cellSize / expandCount;
for (int i = 0; i < childCount; i++) {
- if ((smallestMultiCellItemsAt & (1 << i)) == 0) continue;
+ if ((smallestExpandableItemsAt & (1 << i)) == 0) continue;
final View child = getChildAt(i);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
@@ -229,7 +229,7 @@
* Measure a child view to fit within cell-based formatting. The child's width
* will be measured to a whole multiple of cellSize.
*
- * <p>Sets the multiCell and cellsUsed fields of LayoutParams.
+ * <p>Sets the expandable and cellsUsed fields of LayoutParams.
*
* @param child Child to measure
* @param cellSize Size of one cell
@@ -241,21 +241,14 @@
static int measureChildForCells(View child, int cellSize, int cellsRemaining,
int parentHeightMeasureSpec, int parentHeightPadding) {
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
- final ActionMenuItemView itemView = child instanceof ActionMenuItemView ?
- (ActionMenuItemView) child : null;
final int childHeightSize = MeasureSpec.getSize(parentHeightMeasureSpec) -
parentHeightPadding;
final int childHeightMode = MeasureSpec.getMode(parentHeightMeasureSpec);
final int childHeightSpec = MeasureSpec.makeMeasureSpec(childHeightSize, childHeightMode);
- int cellsUsed = cellsRemaining > 0 ? 1 : 0;
- final boolean multiCell = !lp.isOverflowButton &&
- (itemView == null || itemView.hasText());
-
- lp.multiCell = multiCell;
-
- if (multiCell && cellsRemaining > 0) {
+ int cellsUsed = 0;
+ if (cellsRemaining > 0) {
final int childWidthSpec = MeasureSpec.makeMeasureSpec(
cellSize * cellsRemaining, MeasureSpec.AT_MOST);
child.measure(childWidthSpec, childHeightSpec);
@@ -264,6 +257,12 @@
cellsUsed = measuredWidth / cellSize;
if (measuredWidth % cellSize != 0) cellsUsed++;
}
+
+ final ActionMenuItemView itemView = child instanceof ActionMenuItemView ?
+ (ActionMenuItemView) child : null;
+ final boolean expandable = !lp.isOverflowButton && itemView != null && itemView.hasText();
+ lp.expandable = expandable;
+
lp.cellsUsed = cellsUsed;
final int targetWidth = cellsUsed * cellSize;
child.measure(MeasureSpec.makeMeasureSpec(targetWidth, MeasureSpec.EXACTLY),
@@ -426,9 +425,10 @@
@ViewDebug.ExportedProperty(category = "layout")
public int cellsUsed;
@ViewDebug.ExportedProperty(category = "layout")
- public boolean multiCell;
- @ViewDebug.ExportedProperty(category = "layout")
public int extraPixels;
+ @ViewDebug.ExportedProperty(category = "layout")
+ public boolean expandable;
+
public boolean expanded;
public LayoutParams(Context c, AttributeSet attrs) {
diff --git a/core/java/com/android/internal/widget/ScrollingTabContainerView.java b/core/java/com/android/internal/widget/ScrollingTabContainerView.java
index 2f7adf0..40e5e8a 100644
--- a/core/java/com/android/internal/widget/ScrollingTabContainerView.java
+++ b/core/java/com/android/internal/widget/ScrollingTabContainerView.java
@@ -260,7 +260,6 @@
if (mTextView == null) {
TextView textView = new TextView(getContext(), null,
com.android.internal.R.attr.actionBarTabTextStyle);
- textView.setSingleLine();
textView.setEllipsize(TruncateAt.END);
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
diff --git a/core/res/res/layout-xlarge/activity_list.xml b/core/res/res/layout-xlarge/activity_list.xml
index ad485c1..5093a5e 100644
--- a/core/res/res/layout-xlarge/activity_list.xml
+++ b/core/res/res/layout-xlarge/activity_list.xml
@@ -54,21 +54,15 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
- <ImageView android:id="@+id/titleDivider"
+ <View android:id="@+id/titleDivider"
android:layout_width="match_parent"
- android:layout_height="4dip"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
- android:scaleType="fitXY"
- android:gravity="fill_horizontal"
- android:src="@android:drawable/divider_strong_holo" />
+ android:layout_height="2dip"
+ android:background="@android:color/holo_blue_light" />
<!-- If the client uses a customTitle, it will be added here. -->
</LinearLayout>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_marginLeft="32dip"
- android:layout_marginRight="32dip"
android:layout_height="0dip"
android:layout_weight="1">
@@ -95,15 +89,12 @@
android:minHeight="54dip"
android:orientation="vertical"
android:divider="?android:attr/dividerHorizontal"
- android:showDividers="beginning"
- android:dividerPadding="16dip">
+ android:showDividers="beginning">
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
- android:paddingLeft="2dip"
- android:paddingRight="2dip"
android:measureWithLargestChild="true">
<LinearLayout android:id="@+id/leftSpacer"
android:layout_weight="0.25"
diff --git a/core/res/res/layout/activity_chooser_list_footer.xml b/core/res/res/layout/activity_chooser_list_footer.xml
index 7603a31..c05ba1a 100644
--- a/core/res/res/layout/activity_chooser_list_footer.xml
+++ b/core/res/res/layout/activity_chooser_list_footer.xml
@@ -23,13 +23,11 @@
android:gravity="center"
android:orientation="vertical">
- <ImageView
+ <View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="2dip"
- android:scaleType="fitXY"
- android:gravity="fill_horizontal"
- android:src="@drawable/divider_strong_holo" />
+ android:background="@android:color/holo_blue_light" />
<TextView
android:id="@+id/title"
diff --git a/core/res/res/layout/activity_chooser_list_header.xml b/core/res/res/layout/activity_chooser_list_header.xml
index 867014b9..0fb256f 100644
--- a/core/res/res/layout/activity_chooser_list_header.xml
+++ b/core/res/res/layout/activity_chooser_list_header.xml
@@ -32,12 +32,10 @@
android:duplicateParentState="true"
android:singleLine="true" />
- <ImageView
+ <View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="2dip"
- android:scaleType="fitXY"
- android:gravity="fill_horizontal"
android:src="@drawable/divider_strong_holo" />
</LinearLayout>
diff --git a/core/res/res/layout/alert_dialog_holo.xml b/core/res/res/layout/alert_dialog_holo.xml
index 2185467..2b686bd 100644
--- a/core/res/res/layout/alert_dialog_holo.xml
+++ b/core/res/res/layout/alert_dialog_holo.xml
@@ -30,13 +30,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
- <ImageView android:id="@+id/titleDividerTop"
+ <View android:id="@+id/titleDividerTop"
android:layout_width="match_parent"
- android:layout_height="1dip"
+ android:layout_height="2dip"
android:visibility="gone"
- android:scaleType="fitXY"
- android:gravity="fill_horizontal"
- android:src="@android:drawable/divider_strong_holo" />
+ android:background="@android:color/holo_blue_light" />
<LinearLayout android:id="@+id/title_template"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -51,20 +49,17 @@
android:paddingRight="8dip"
android:src="@null" />
<com.android.internal.widget.DialogTitle android:id="@+id/alertTitle"
- style="?android:attr/textAppearanceLarge"
- android:textColor="@android:color/holo_blue"
+ style="?android:attr/windowTitleStyle"
android:singleLine="true"
android:ellipsize="end"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
- <ImageView android:id="@+id/titleDivider"
+ <View android:id="@+id/titleDivider"
android:layout_width="match_parent"
- android:layout_height="1dip"
+ android:layout_height="2dip"
android:visibility="gone"
- android:scaleType="fitXY"
- android:gravity="fill_horizontal"
- android:src="@android:drawable/divider_strong_holo" />
+ android:background="@android:color/holo_blue_light" />
<!-- If the client uses a customTitle, it will be added here. -->
</LinearLayout>
diff --git a/core/res/res/layout/dialog_custom_title_holo.xml b/core/res/res/layout/dialog_custom_title_holo.xml
index 5261553..e2335a7 100644
--- a/core/res/res/layout/dialog_custom_title_holo.xml
+++ b/core/res/res/layout/dialog_custom_title_holo.xml
@@ -28,12 +28,10 @@
android:gravity="center_vertical|left"
style="?android:attr/windowTitleBackgroundStyle">
</FrameLayout>
- <ImageView android:id="@+id/titleDivider"
+ <View android:id="@+id/titleDivider"
android:layout_width="match_parent"
- android:layout_height="1dip"
- android:scaleType="fitXY"
- android:gravity="fill_horizontal"
- android:src="@android:drawable/divider_strong_holo" />
+ android:layout_height="2dip"
+ android:background="@android:color/holo_blue_light" />
<FrameLayout
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="1"
diff --git a/core/res/res/layout/dialog_title_holo.xml b/core/res/res/layout/dialog_title_holo.xml
index 400ef60..50bb0ba 100644
--- a/core/res/res/layout/dialog_title_holo.xml
+++ b/core/res/res/layout/dialog_title_holo.xml
@@ -30,12 +30,10 @@
android:paddingLeft="16dip"
android:paddingRight="16dip"
android:gravity="center_vertical|left" />
- <ImageView android:id="@+id/titleDivider"
+ <View android:id="@+id/titleDivider"
android:layout_width="match_parent"
- android:layout_height="1dip"
- android:scaleType="fitXY"
- android:gravity="fill_horizontal"
- android:src="@android:drawable/divider_strong_holo" />
+ android:layout_height="2dip"
+ android:background="@android:color/holo_blue_light" />
<FrameLayout
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="1"
diff --git a/core/res/res/layout/dialog_title_icons_holo.xml b/core/res/res/layout/dialog_title_icons_holo.xml
index f780ab0..7d7959f 100644
--- a/core/res/res/layout/dialog_title_icons_holo.xml
+++ b/core/res/res/layout/dialog_title_icons_holo.xml
@@ -48,12 +48,10 @@
android:layout_marginLeft="8dip" />
</LinearLayout>
- <ImageView android:id="@+id/titleDivider"
+ <View android:id="@+id/titleDivider"
android:layout_width="match_parent"
android:layout_height="1dip"
- android:scaleType="fitXY"
- android:gravity="fill_horizontal"
- android:src="@android:drawable/divider_strong_holo" />
+ android:background="@android:color/holo_blue_light" />
<FrameLayout
android:layout_width="match_parent" android:layout_height="wrap_content"
diff --git a/core/res/res/layout/keyguard_screen_password_landscape.xml b/core/res/res/layout/keyguard_screen_password_landscape.xml
index 30df91b..e867fe0 100644
--- a/core/res/res/layout/keyguard_screen_password_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_password_landscape.xml
@@ -24,15 +24,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:rowCount="11"
+ android:rowCount="10"
android:id="@+id/root"
android:clipChildren="false">
<!-- Column 0 -->
- <Space android:height="20dip"/>
-
<com.android.internal.widget.DigitalClock android:id="@+id/time"
- android:layout_marginTop="16dip"
+ android:layout_marginTop="8dip"
android:layout_marginBottom="8dip"
android:layout_gravity="right">
@@ -120,7 +118,10 @@
android:layout_gravity="right"
/>
- <Space android:height="20dip"/>
+ <Space
+ android:layout_rowFlexibility="canStretch"
+ android:layout_columnFlexibility="canStretch"
+ />
<TextView
android:id="@+id/carrier"
@@ -156,15 +157,13 @@
/>
<!-- Column 1 -->
- <Space android:layout_widthSpec="canStretch" android:layout_rowSpan="11" />
+ <Space android:layout_width="32dip" android:layout_rowSpan="10" />
<!-- Column 2 - password entry field and PIN keyboard -->
<LinearLayout
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
android:orientation="vertical"
android:layout_gravity="center|fill"
- android:layout_rowSpan="11">
+ android:layout_rowSpan="10">
<EditText android:id="@+id/passwordEntry"
android:layout_height="wrap_content"
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
index c859720..7aab04e 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
@@ -24,15 +24,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:rowCount="10"
+ android:rowCount="8"
android:id="@+id/root"
android:clipChildren="false">
<!-- Column 0 -->
- <Space android:height="20dip"/>
-
<com.android.internal.widget.DigitalClock android:id="@+id/time"
- android:layout_marginTop="16dip"
+ android:layout_marginTop="8dip"
android:layout_marginBottom="8dip"
android:layout_gravity="right">
@@ -120,7 +118,10 @@
android:layout_gravity="right"
/>
- <Space android:height="20dip"/>
+ <Space
+ android:layout_rowFlexibility="canStretch"
+ android:layout_columnFlexibility="canStretch"
+ />
<LinearLayout android:orientation="vertical"
android:layout_gravity="right"
@@ -169,17 +170,14 @@
</LinearLayout>
<!-- Column 1 -->
- <Space
- android:width="20dip"
- android:layout_heightSpec="canStretch"
- android:layout_rowSpan="10" />
+ <Space android:layout_width="32dip" android:layout_rowSpan="8" />
<!-- Column 2 -->
<com.android.internal.widget.multiwaveview.MultiWaveView
android:id="@+id/unlock_widget"
- android:layout_width="300dip"
+ android:layout_width="200dip"
android:layout_height="match_parent"
- android:layout_rowSpan="10"
+ android:layout_rowSpan="8"
android:targetDrawables="@array/lockscreen_targets_when_silent"
android:handleDrawable="@drawable/ic_lockscreen_handle"
diff --git a/core/res/res/layout/keyguard_screen_unlock_landscape.xml b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
index 0070ed0..8f083a0 100644
--- a/core/res/res/layout/keyguard_screen_unlock_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
@@ -30,8 +30,6 @@
<!-- Column 0: Time, date and status -->
<com.android.internal.widget.DigitalClock android:id="@+id/time"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
android:layout_marginTop="8dip"
android:layout_marginBottom="12dip"
android:layout_gravity="right">
@@ -66,8 +64,6 @@
<TextView
android:id="@+id/date"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceMedium"
@@ -77,8 +73,6 @@
<TextView
android:id="@+id/alarm_status"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceMedium"
@@ -89,8 +83,6 @@
<TextView
android:id="@+id/status1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceMedium"
@@ -100,10 +92,8 @@
<!-- TODO: remove hard coded height since layout_rowWeight doesn't seem to be working -->
<Space
- android:layout_height="43dip"
- android:layout_gravity="fill"
- android:layout_heightSpec="canStretch"
- android:layout_widthSpec="canStretch"
+ android:layout_rowFlexibility="canStretch"
+ android:layout_columnFlexibility="canStretch"
/>
<TextView android:id="@+id/carrier"
@@ -117,8 +107,6 @@
<LinearLayout
style="?android:attr/buttonBarStyle"
android:orientation="vertical"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
android:layout_gravity="right">
<Button android:id="@+id/emergencyCallButton"
diff --git a/core/res/res/layout/keyguard_screen_unlock_portrait.xml b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
index 28c5302..35fd473 100644
--- a/core/res/res/layout/keyguard_screen_unlock_portrait.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
@@ -125,7 +125,7 @@
android:layout_marginBottom="4dip"
android:layout_marginLeft="8dip"
android:layout_gravity="center|bottom"
- android:layout_heightSpec="canStretch"
+ android:layout_rowFlexibility="canStretch"
/>
<TextView
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index b92ce6a..4bc59e4 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -40,6 +40,21 @@
to use accelerated drawing (thus setting state_accelerated), the
cache hint is ignored and always assumed to be transparent. -->
<attr name="colorBackgroundCacheHint" format="color" />
+
+ <!-- Default highlight color for items that are pressed. -->
+ <attr name="colorPressedHighlight" format="color" />
+ <!-- Default highlight color for items that are long-pressed. -->
+ <attr name="colorLongPressedHighlight" format="color" />
+ <!-- Default highlight color for items that are
+ focused. (Focused meaning cursor-based selection.) -->
+ <attr name="colorFocusedHighlight" format="color" />
+ <!-- Default highlight color for items that are
+ activated. (Activated meaning persistent selection.) -->
+ <attr name="colorActivatedHighlight" format="color" />
+ <!-- Default highlight color for items in multiple selection
+ mode. -->
+ <attr name="colorMultiSelectHighlight" format="color" />
+
<!-- Default disabled alpha for widgets that set enabled/disabled alpha programmatically. -->
<attr name="disabledAlpha" format="float" />
<!-- Default background dim amount when a menu, dialog, or something similar pops up. -->
@@ -2810,6 +2825,8 @@
<attr name="textColorHint" />
<!-- Color of the links. -->
<attr name="textColorLink" />
+ <!-- Present the text in ALL CAPS. This may use a small-caps form when available. -->
+ <attr name="textAllCaps" format="boolean" />
</declare-styleable>
<declare-styleable name="TextSwitcher">
</declare-styleable>
@@ -3074,6 +3091,8 @@
<attr name="textIsSelectable" />
<!-- Suggestions will be displayed when the user double taps on editable text. -->
<attr name="suggestionsEnabled" />
+ <!-- Present the text in ALL CAPS. This may use a small-caps form when available. -->
+ <attr name="textAllCaps" />
</declare-styleable>
<!-- An <code>input-extras</code> is a container for extra data to supply to
an input method. Contains
@@ -3342,28 +3361,16 @@
<attr name="layout_gravity" />
<!-- A value specifying how much deficit or excess width this component can accomodate.
The default is FIXED.
- See {@link android.widget.GridLayout.LayoutParams#widthSpec}.-->
- <attr name="layout_widthSpec" >
- <!-- If possible, width should be exactly as specified.
- See {@link android.widget.GridLayout#FIXED}. -->
- <enum name="fixed" value="0" />
- <!-- If possible, width should be less than or equal to the specified width.
- See {@link android.widget.GridLayout#CAN_SHRINK}. -->
- <enum name="canShrink" value="1" />
+ See {@link android.widget.GridLayout.Group#flexibility}.-->
+ <attr name="layout_columnFlexibility" >
<!-- If possible, width should be greater than or equal to the specified width.
See {@link android.widget.GridLayout#CAN_STRETCH}. -->
<enum name="canStretch" value="2" />
</attr>
<!-- A value specifying how much deficit or excess height this component can accomodate.
The default is FIXED.
- See {@link android.widget.GridLayout.LayoutParams#heightSpec}.-->
- <attr name="layout_heightSpec" >
- <!-- If possible, height should be exactly as specified.
- See {@link android.widget.GridLayout#FIXED}. -->
- <enum name="fixed" value="0" />
- <!-- If possible, height should be less than or equal to the specified height.
- See {@link android.widget.GridLayout#CAN_SHRINK}. -->
- <enum name="canShrink" value="1" />
+ See {@link android.widget.GridLayout.Group#flexibility}.-->
+ <attr name="layout_rowFlexibility" >
<!-- If possible, height should be greater than or equal to the specified height.
See {@link android.widget.GridLayout#CAN_STRETCH}. -->
<enum name="canStretch" value="2" />
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 2a1ebfc..631d8c6 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -143,19 +143,42 @@
<color name="link_text_holo_light">#0000ee</color>
<!-- Group buttons -->
+ <eat-comment />
<color name="group_button_dialog_pressed_holo_dark">#46c5c1ff</color>
<color name="group_button_dialog_focused_holo_dark">#2699cc00</color>
<color name="group_button_dialog_pressed_holo_light">#ffffffff</color>
<color name="group_button_dialog_focused_holo_light">#4699cc00</color>
+ <!-- Highlight colors for the legacy themes -->
+ <eat-comment />
+ <color name="legacy_pressed_highlight">#fffeaa0c</color>
+ <color name="legacy_selected_highlight">#fff17a0a</color>
+ <color name="legacy_long_pressed_highlight">#ffffffff</color>
+
<!-- General purpose colors for Holo-themed elements -->
<eat-comment />
- <!-- A Holo shade of blue -->
- <color name="holo_blue">#ff6699ff</color>
- <!-- A Holo shade of green -->
- <color name="holo_green">#ff99cc00</color>
+ <!-- A light Holo shade of blue -->
+ <color name="holo_blue_light">#ff33b5e5</color>
+ <!-- A light Holo shade of green -->
+ <color name="holo_green_light">#ff99cc00</color>
+ <!-- A light Holo shade of red -->
+ <color name="holo_red_light">#ffff4444</color>
+ <!-- A dark Holo shade of blue -->
+ <color name="holo_blue_dark">#ff0099cc</color>
+ <!-- A dark Holo shade of green -->
+ <color name="holo_green_dark">#ff669900</color>
+ <!-- A dark Holo shade of red -->
+ <color name="holo_red_dark">#ffcc0000</color>
+ <!-- A Holo shade of purple -->
+ <color name="holo_purple">#ffaa66cc</color>
+ <!-- A light Holo shade of orange -->
+ <color name="holo_orange_light">#ffffbb33</color>
+ <!-- A dark Holo shade of orange -->
+ <color name="holo_orange_dark">#ffff8800</color>
+ <!-- A really bright Holo shade of blue -->
+ <color name="holo_blue_bright">#ff00ddff</color>
</resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 75acb37..f7701f2 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1732,10 +1732,10 @@
<public type="attr" name="layout_row" />
<public type="attr" name="layout_rowSpan" />
- <public type="attr" name="layout_columnSpan" />
+ <public type="attr" name="layout_rowFlexibility" />
- <public type="attr" name="layout_widthSpec" />
- <public type="attr" name="layout_heightSpec" />
+ <public type="attr" name="layout_columnSpan" />
+ <public type="attr" name="layout_columnFlexibility" />
<public type="attr" name="actionModeSelectAllDrawable" />
@@ -1779,6 +1779,14 @@
<public type="attr" name="backgroundStacked" />
<public type="attr" name="backgroundSplit" />
+ <public type="attr" name="textAllCaps" />
+
+ <public type="attr" name="colorPressedHighlight" />
+ <public type="attr" name="colorLongPressedHighlight" />
+ <public type="attr" name="colorFocusedHighlight" />
+ <public type="attr" name="colorActivatedHighlight" />
+ <public type="attr" name="colorMultiSelectHighlight" />
+
<public type="style" name="TextAppearance.SuggestionHighlight" />
<public type="style" name="Theme.Holo.SplitActionBarWhenNarrow" />
<public type="style" name="Theme.Holo.Light.SplitActionBarWhenNarrow" />
@@ -1789,6 +1797,7 @@
<public type="style" name="TextAppearance.Holo.Widget.ActionBar.Subtitle.Inverse" />
<public type="style" name="TextAppearance.Holo.Widget.ActionMode.Title.Inverse" />
<public type="style" name="TextAppearance.Holo.Widget.ActionMode.Subtitle.Inverse" />
+ <public type="style" name="TextAppearance.Holo.Widget.ActionBar.Menu" />
<public type="style" name="Widget.Holo.ActionBar.Solid" />
<public type="style" name="Widget.Holo.Light.ActionBar.Solid" />
<public type="style" name="Widget.Holo.Light.ActionBar.Solid.Inverse" />
@@ -1806,4 +1815,15 @@
<public type="integer" name="status_bar_notification_info_maxnum" />
<public type="string" name="status_bar_notification_info_overflow" />
+ <public type="color" name="holo_blue_light" />
+ <public type="color" name="holo_blue_dark" />
+ <public type="color" name="holo_green_light" />
+ <public type="color" name="holo_green_dark" />
+ <public type="color" name="holo_red_light" />
+ <public type="color" name="holo_red_dark" />
+ <public type="color" name="holo_orange_light" />
+ <public type="color" name="holo_orange_dark" />
+ <public type="color" name="holo_purple" />
+ <public type="color" name="holo_blue_bright" />
+
</resources>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 50f8df7..97a8c0b 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2085,6 +2085,10 @@
<!-- Do not translate. Regex used by AutoFill. -->
<string name="autofill_phone_suffix_separator_re">^-$</string>
+ <!-- Do not translate. Regex used by AutoFill. -->
+ <!-- Ex: ************1234 -->
+ <string name="credit_card_number_preview_format">$1</string>
+
<!-- Title of an application permission, listed so the user can choose whether
they want to allow the application to do this. -->
<string name="permlab_readHistoryBookmarks">read Browser\'s history and bookmarks</string>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 9ee4b6a..a5cd6e3 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -1314,6 +1314,14 @@
<item name="android:textSize">@android:dimen/action_bar_subtitle_text_size</item>
</style>
+ <style name="TextAppearance.Holo.Widget.ActionBar.Menu"
+ parent="TextAppearance.Holo.Small">
+ <item name="android:textSize">12sp</item>
+ <item name="android:textStyle">bold</item>
+ <item name="android:textColor">?android:attr/actionMenuTextColor</item>
+ <item name="android:textAllCaps">true</item>
+ </style>
+
<style name="TextAppearance.Holo.Widget.ActionMode">
</style>
@@ -1348,7 +1356,7 @@
<style name="TextAppearance.Holo.DialogWindowTitle">
<item name="android:textSize">22sp</item>
- <item name="android:textColor">@android:color/holo_blue</item>
+ <item name="android:textColor">@android:color/holo_blue_light</item>
</style>
<style name="TextAppearance.Holo.CalendarViewWeekDayView" parent="TextAppearance.Small.CalendarViewWeekDayView">
@@ -1447,7 +1455,7 @@
<style name="TextAppearance.Holo.Light.DialogWindowTitle">
<item name="android:textSize">22sp</item>
- <item name="android:textColor">@android:color/holo_blue</item>
+ <item name="android:textColor">@android:color/holo_blue_light</item>
</style>
<style name="TextAppearance.Holo.Light.CalendarViewWeekDayView" parent="TextAppearance.Small.CalendarViewWeekDayView">
@@ -1848,7 +1856,9 @@
<style name="Widget.Holo.ActionBar.TabText" parent="Widget.ActionBar.TabText">
<item name="android:textAppearance">@style/TextAppearance.Holo.Medium</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
- <item name="android:textSize">18sp</item>
+ <item name="android:textSize">12sp</item>
+ <item name="android:textStyle">bold</item>
+ <item name="android:textAllCaps">true</item>
</style>
<style name="Widget.Holo.ActionMode" parent="Widget.ActionMode">
@@ -2203,9 +2213,7 @@
</style>
<style name="Widget.Holo.Light.ActionBar.TabText.Inverse">
- <item name="android:textAppearance">@style/TextAppearance.Holo.Medium</item>
<item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
- <item name="android:textSize">18sp</item>
</style>
<style name="Widget.Holo.Light.ActionMode" parent="Widget.Holo.ActionMode">
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 23111e6..90f3602 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -31,6 +31,13 @@
<item name="colorForegroundInverse">@android:color/bright_foreground_dark_inverse</item>
<item name="colorBackground">@android:color/background_dark</item>
<item name="colorBackgroundCacheHint">?android:attr/colorBackground</item>
+
+ <item name="colorPressedHighlight">@color/legacy_pressed_highlight</item>
+ <item name="colorLongPressedHighlight">@color/legacy_long_pressed_highlight</item>
+ <item name="colorFocusedHighlight">@color/legacy_selected_highlight</item>
+ <item name="colorMultiSelectHighlight">@color/legacy_selected_highlight</item>
+ <item name="colorActivatedHighlight">@color/legacy_selected_highlight</item>
+
<item name="disabledAlpha">0.5</item>
<item name="backgroundDimAmount">0.6</item>
@@ -283,7 +290,7 @@
<item name="actionBarSplitStyle">?android:attr/actionBarStyle</item>
<item name="actionBarSize">@dimen/action_bar_default_height</item>
<item name="actionModePopupWindowStyle">?android:attr/popupWindowStyle</item>
- <item name="actionMenuTextAppearance">?android:attr/textAppearanceSmall</item>
+ <item name="actionMenuTextAppearance">@android:style/TextAppearance.Holo.Widget.ActionBar.Menu</item>
<item name="actionMenuTextColor">?android:attr/textColorPrimary</item>
<item name="dividerVertical">@drawable/divider_vertical_dark</item>
@@ -799,6 +806,12 @@
<item name="disabledAlpha">0.5</item>
<item name="backgroundDimAmount">0.6</item>
+ <item name="colorPressedHighlight">@color/holo_blue_light</item>
+ <item name="colorLongPressedHighlight">@color/holo_blue_bright</item>
+ <item name="colorFocusedHighlight">@color/holo_blue_dark</item>
+ <item name="colorMultiSelectHighlight">@color/holo_green_light</item>
+ <item name="colorActivatedHighlight">@color/holo_blue_dark</item>
+
<!-- Text styles -->
<item name="textAppearance">@android:style/TextAppearance.Holo</item>
<item name="textAppearanceInverse">@android:style/TextAppearance.Holo.Inverse</item>
@@ -1090,6 +1103,11 @@
<item name="disabledAlpha">0.5</item>
<item name="backgroundDimAmount">0.6</item>
+ <item name="colorPressedHighlight">@color/holo_blue_light</item>
+ <item name="colorLongPressedHighlight">@color/holo_blue_bright</item>
+ <item name="colorFocusedHighlight">@color/holo_blue_dark</item>
+ <item name="colorMultiSelectHighlight">@color/holo_green_light</item>
+ <item name="colorActivatedHighlight">@color/holo_blue_dark</item>
<!-- Text styles -->
<item name="textAppearance">@android:style/TextAppearance.Holo.Light</item>
@@ -1389,6 +1407,7 @@
<item name="actionOverflowButtonStyle">@android:style/Widget.Holo.ActionButton.Overflow</item>
<item name="actionModeBackground">@android:drawable/cab_background_holo_dark</item>
<item name="actionModeCloseDrawable">@android:drawable/cab_ic_close_holo</item>
+ <item name="homeAsUpIndicator">@android:drawable/ic_ab_back_holo_dark</item>
<item name="actionBarTabStyle">@style/Widget.Holo.Light.ActionBar.TabView.Inverse</item>
<item name="actionBarTabBarStyle">@style/Widget.Holo.Light.ActionBar.TabBar.Inverse</item>
<item name="actionBarTabTextStyle">@style/Widget.Holo.Light.ActionBar.TabText.Inverse</item>
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index e900584..6254192 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -67,6 +67,22 @@
Type mType;
Bitmap mBitmap;
int mUsage;
+ Allocation mAdaptedAllocation;
+
+ boolean mConstrainedLOD;
+ boolean mConstrainedFace;
+ boolean mConstrainedY;
+ boolean mConstrainedZ;
+ int mSelectedY;
+ int mSelectedZ;
+ int mSelectedLOD;
+ Type.CubemapFace mSelectedFace = Type.CubemapFace.POSITIVE_X;
+
+ int mCurrentDimX;
+ int mCurrentDimY;
+ int mCurrentDimZ;
+ int mCurrentCount;
+
/**
* The usage of the allocation. These signal to renderscript
@@ -139,6 +155,19 @@
}
}
+ private void updateCacheInfo(Type t) {
+ mCurrentDimX = t.getX();
+ mCurrentDimY = t.getY();
+ mCurrentDimZ = t.getZ();
+ mCurrentCount = mCurrentDimX;
+ if (mCurrentDimY > 1) {
+ mCurrentCount *= mCurrentDimY;
+ }
+ if (mCurrentDimZ > 1) {
+ mCurrentCount *= mCurrentDimZ;
+ }
+ }
+
Allocation(int id, RenderScript rs, Type t, int usage) {
super(id, rs);
if ((usage & ~(USAGE_SCRIPT |
@@ -149,6 +178,10 @@
throw new RSIllegalArgumentException("Unknown usage specified.");
}
mType = t;
+
+ if (t != null) {
+ updateCacheInfo(t);
+ }
}
private void validateIsInt32() {
@@ -210,6 +243,7 @@
if(typeID != 0) {
mType = new Type(typeID, mRS);
mType.updateFromNative();
+ updateCacheInfo(mType);
}
}
@@ -234,15 +268,15 @@
public void copyFrom(BaseObj[] d) {
mRS.validate();
validateIsObject();
- if (d.length != mType.getCount()) {
+ if (d.length != mCurrentCount) {
throw new RSIllegalArgumentException("Array size mismatch, allocation sizeX = " +
- mType.getCount() + ", array length = " + d.length);
+ mCurrentCount + ", array length = " + d.length);
}
int i[] = new int[d.length];
for (int ct=0; ct < d.length; ct++) {
i[ct] = d[ct].getID();
}
- copy1DRangeFromUnchecked(0, mType.getCount(), i);
+ copy1DRangeFromUnchecked(0, mCurrentCount, i);
}
private void validateBitmapFormat(Bitmap b) {
@@ -292,8 +326,7 @@
}
private void validateBitmapSize(Bitmap b) {
- if(mType.getX() != b.getWidth() ||
- mType.getY() != b.getHeight()) {
+ if((mCurrentDimX != b.getWidth()) || (mCurrentDimY != b.getHeight())) {
throw new RSIllegalArgumentException("Cannot update allocation from bitmap, sizes mismatch");
}
}
@@ -307,7 +340,7 @@
*/
public void copyFromUnchecked(int[] d) {
mRS.validate();
- copy1DRangeFromUnchecked(0, mType.getCount(), d);
+ copy1DRangeFromUnchecked(0, mCurrentCount, d);
}
/**
* Copy an allocation from an array. This variant is not type
@@ -318,7 +351,7 @@
*/
public void copyFromUnchecked(short[] d) {
mRS.validate();
- copy1DRangeFromUnchecked(0, mType.getCount(), d);
+ copy1DRangeFromUnchecked(0, mCurrentCount, d);
}
/**
* Copy an allocation from an array. This variant is not type
@@ -329,7 +362,7 @@
*/
public void copyFromUnchecked(byte[] d) {
mRS.validate();
- copy1DRangeFromUnchecked(0, mType.getCount(), d);
+ copy1DRangeFromUnchecked(0, mCurrentCount, d);
}
/**
* Copy an allocation from an array. This variant is not type
@@ -340,7 +373,7 @@
*/
public void copyFromUnchecked(float[] d) {
mRS.validate();
- copy1DRangeFromUnchecked(0, mType.getCount(), d);
+ copy1DRangeFromUnchecked(0, mCurrentCount, d);
}
/**
@@ -352,7 +385,7 @@
*/
public void copyFrom(int[] d) {
mRS.validate();
- copy1DRangeFrom(0, mType.getCount(), d);
+ copy1DRangeFrom(0, mCurrentCount, d);
}
/**
@@ -364,7 +397,7 @@
*/
public void copyFrom(short[] d) {
mRS.validate();
- copy1DRangeFrom(0, mType.getCount(), d);
+ copy1DRangeFrom(0, mCurrentCount, d);
}
/**
@@ -376,7 +409,7 @@
*/
public void copyFrom(byte[] d) {
mRS.validate();
- copy1DRangeFrom(0, mType.getCount(), d);
+ copy1DRangeFrom(0, mCurrentCount, d);
}
/**
@@ -388,7 +421,7 @@
*/
public void copyFrom(float[] d) {
mRS.validate();
- copy1DRangeFrom(0, mType.getCount(), d);
+ copy1DRangeFrom(0, mCurrentCount, d);
}
/**
@@ -420,8 +453,7 @@
throw new RSIllegalArgumentException("Field packer length " + data.length +
" not divisible by element size " + eSize + ".");
}
- data1DChecks(xoff, count, data.length, data.length);
- mRS.nAllocationData1D(getID(), xoff, 0, count, data, data.length);
+ copy1DRangeFromUnchecked(xoff, count, data);
}
/**
@@ -448,7 +480,8 @@
" does not match component size " + eSize + ".");
}
- mRS.nAllocationElementData1D(getID(), xoff, 0, component_number, data, data.length);
+ mRS.nAllocationElementData1D(getID(), xoff, mSelectedLOD,
+ component_number, data, data.length);
}
private void data1DChecks(int off, int count, int len, int dataSize) {
@@ -459,11 +492,11 @@
if(count < 1) {
throw new RSIllegalArgumentException("Count must be >= 1.");
}
- if((off + count) > mType.getCount()) {
- throw new RSIllegalArgumentException("Overflow, Available count " + mType.getCount() +
+ if((off + count) > mCurrentCount) {
+ throw new RSIllegalArgumentException("Overflow, Available count " + mCurrentCount +
", got " + count + " at offset " + off + ".");
}
- if((len) < dataSize) {
+ if(len < dataSize) {
throw new RSIllegalArgumentException("Array too small for allocation type.");
}
}
@@ -494,7 +527,7 @@
public void copy1DRangeFromUnchecked(int off, int count, int[] d) {
int dataSize = mType.mElement.getSizeBytes() * count;
data1DChecks(off, count, d.length * 4, dataSize);
- mRS.nAllocationData1D(getID(), off, 0, count, d, dataSize);
+ mRS.nAllocationData1D(getID(), off, mSelectedLOD, count, d, dataSize);
}
/**
* Copy part of an allocation from an array. This variant is
@@ -508,7 +541,7 @@
public void copy1DRangeFromUnchecked(int off, int count, short[] d) {
int dataSize = mType.mElement.getSizeBytes() * count;
data1DChecks(off, count, d.length * 2, dataSize);
- mRS.nAllocationData1D(getID(), off, 0, count, d, dataSize);
+ mRS.nAllocationData1D(getID(), off, mSelectedLOD, count, d, dataSize);
}
/**
* Copy part of an allocation from an array. This variant is
@@ -522,7 +555,7 @@
public void copy1DRangeFromUnchecked(int off, int count, byte[] d) {
int dataSize = mType.mElement.getSizeBytes() * count;
data1DChecks(off, count, d.length, dataSize);
- mRS.nAllocationData1D(getID(), off, 0, count, d, dataSize);
+ mRS.nAllocationData1D(getID(), off, mSelectedLOD, count, d, dataSize);
}
/**
* Copy part of an allocation from an array. This variant is
@@ -536,7 +569,7 @@
public void copy1DRangeFromUnchecked(int off, int count, float[] d) {
int dataSize = mType.mElement.getSizeBytes() * count;
data1DChecks(off, count, d.length * 4, dataSize);
- mRS.nAllocationData1D(getID(), off, 0, count, d, dataSize);
+ mRS.nAllocationData1D(getID(), off, mSelectedLOD, count, d, dataSize);
}
/**
@@ -606,21 +639,25 @@
*/
public void copy1DRangeFrom(int off, int count, Allocation data, int dataOff) {
mRS.nAllocationData2D(getID(), off, 0,
- 0, Type.CubemapFace.POSITIVE_X.mID,
+ mSelectedLOD, mSelectedFace.mID,
count, 1, data.getID(), dataOff, 0,
- 0, Type.CubemapFace.POSITIVE_X.mID);
+ data.mSelectedLOD, data.mSelectedFace.mID);
}
private void validate2DRange(int xoff, int yoff, int w, int h) {
- if (xoff < 0 || yoff < 0) {
- throw new RSIllegalArgumentException("Offset cannot be negative.");
- }
- if (h < 0 || w < 0) {
- throw new RSIllegalArgumentException("Height or width cannot be negative.");
- }
- if ((xoff + w) > mType.mDimX ||
- (yoff + h) > mType.mDimY) {
- throw new RSIllegalArgumentException("Updated region larger than allocation.");
+ if (mAdaptedAllocation != null) {
+
+ } else {
+
+ if (xoff < 0 || yoff < 0) {
+ throw new RSIllegalArgumentException("Offset cannot be negative.");
+ }
+ if (h < 0 || w < 0) {
+ throw new RSIllegalArgumentException("Height or width cannot be negative.");
+ }
+ if (((xoff + w) > mCurrentDimX) || ((yoff + h) > mCurrentDimY)) {
+ throw new RSIllegalArgumentException("Updated region larger than allocation.");
+ }
}
}
@@ -637,25 +674,29 @@
public void copy2DRangeFrom(int xoff, int yoff, int w, int h, byte[] data) {
mRS.validate();
validate2DRange(xoff, yoff, w, h);
- mRS.nAllocationData2D(getID(), xoff, yoff, 0, 0, w, h, data, data.length);
+ mRS.nAllocationData2D(getID(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
+ w, h, data, data.length);
}
public void copy2DRangeFrom(int xoff, int yoff, int w, int h, short[] data) {
mRS.validate();
validate2DRange(xoff, yoff, w, h);
- mRS.nAllocationData2D(getID(), xoff, yoff, 0, 0, w, h, data, data.length * 2);
+ mRS.nAllocationData2D(getID(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
+ w, h, data, data.length * 2);
}
public void copy2DRangeFrom(int xoff, int yoff, int w, int h, int[] data) {
mRS.validate();
validate2DRange(xoff, yoff, w, h);
- mRS.nAllocationData2D(getID(), xoff, yoff, 0, 0, w, h, data, data.length * 4);
+ mRS.nAllocationData2D(getID(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
+ w, h, data, data.length * 4);
}
public void copy2DRangeFrom(int xoff, int yoff, int w, int h, float[] data) {
mRS.validate();
validate2DRange(xoff, yoff, w, h);
- mRS.nAllocationData2D(getID(), xoff, yoff, 0, 0, w, h, data, data.length * 4);
+ mRS.nAllocationData2D(getID(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
+ w, h, data, data.length * 4);
}
/**
@@ -675,9 +716,9 @@
mRS.validate();
validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getID(), xoff, yoff,
- 0, Type.CubemapFace.POSITIVE_X.mID,
+ mSelectedLOD, mSelectedFace.mID,
w, h, data.getID(), dataXoff, dataYoff,
- 0, Type.CubemapFace.POSITIVE_X.mID);
+ data.mSelectedLOD, data.mSelectedFace.mID);
}
/**
@@ -693,7 +734,7 @@
mRS.validate();
validateBitmapFormat(data);
validate2DRange(xoff, yoff, data.getWidth(), data.getHeight());
- mRS.nAllocationData2D(getID(), xoff, yoff, 0, 0, data);
+ mRS.nAllocationData2D(getID(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, data);
}
@@ -750,6 +791,7 @@
int typeID = mRS.nAllocationGetType(getID());
mType = new Type(typeID, mRS);
mType.updateFromNative();
+ updateCacheInfo(mType);
}
/*
diff --git a/graphics/java/android/renderscript/AllocationAdapter.java b/graphics/java/android/renderscript/AllocationAdapter.java
index 77dd86a..ca5246a 100644
--- a/graphics/java/android/renderscript/AllocationAdapter.java
+++ b/graphics/java/android/renderscript/AllocationAdapter.java
@@ -17,228 +17,92 @@
package android.renderscript;
import android.content.res.Resources;
-import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
-import android.util.Log;
import android.util.TypedValue;
/**
*
**/
public class AllocationAdapter extends Allocation {
- private boolean mConstrainedLOD;
- private boolean mConstrainedFace;
- private boolean mConstrainedY;
- private boolean mConstrainedZ;
-
- private int mSelectedDimX;
- private int mSelectedDimY;
- private int mSelectedDimZ;
- private int mSelectedCount;
- private Allocation mAlloc;
-
- private int mSelectedLOD = 0;
- private Type.CubemapFace mSelectedFace = Type.CubemapFace.POSITIVE_X;
-
AllocationAdapter(int id, RenderScript rs, Allocation alloc) {
- super(id, rs, null, alloc.mUsage);
- mAlloc = alloc;
+ super(id, rs, alloc.mType, alloc.mUsage);
+ mAdaptedAllocation = alloc;
}
-
int getID() {
- return mAlloc.getID();
+ return mAdaptedAllocation.getID();
}
- public void copyFrom(BaseObj[] d) {
- mRS.validate();
- if (d.length != mSelectedCount) {
- throw new RSIllegalArgumentException("Array size mismatch, allocation size = " +
- mSelectedCount + ", array length = " + d.length);
- }
- int i[] = new int[d.length];
- for (int ct=0; ct < d.length; ct++) {
- i[ct] = d[ct].getID();
- }
- subData1D(0, mAlloc.mType.getCount(), i);
- }
-
- void validateBitmap(Bitmap b) {
- mRS.validate();
- if(mSelectedDimX != b.getWidth() ||
- mSelectedDimY != b.getHeight()) {
- throw new RSIllegalArgumentException("Cannot update allocation from bitmap, sizes mismatch");
- }
- }
-
- public void copyFrom(int[] d) {
- mRS.validate();
- subData1D(0, mSelectedCount, d);
- }
- public void copyFrom(short[] d) {
- mRS.validate();
- subData1D(0, mSelectedCount, d);
- }
- public void copyFrom(byte[] d) {
- mRS.validate();
- subData1D(0, mSelectedCount, d);
- }
- public void copyFrom(float[] d) {
- mRS.validate();
- subData1D(0, mSelectedCount, d);
- }
- public void copyFrom(Bitmap b) {
- validateBitmap(b);
- mRS.nAllocationCopyFromBitmap(getID(), b);
- }
-
- public void copyTo(Bitmap b) {
- validateBitmap(b);
- mRS.nAllocationCopyToBitmap(getID(), b);
- }
-
-
+ /**
+ * @hide
+ */
public void subData(int xoff, FieldPacker fp) {
- int eSize = mAlloc.mType.mElement.getSizeBytes();
- final byte[] data = fp.getData();
-
- int count = data.length / eSize;
- if ((eSize * count) != data.length) {
- throw new RSIllegalArgumentException("Field packer length " + data.length +
- " not divisible by element size " + eSize + ".");
- }
- data1DChecks(xoff, count, data.length, data.length);
- mRS.nAllocationData1D(getID(), xoff, mSelectedLOD, count, data, data.length);
+ super.setFromFieldPacker(xoff, fp);
}
-
-
+ /**
+ * @hide
+ */
public void subElementData(int xoff, int component_number, FieldPacker fp) {
- if (component_number >= mAlloc.mType.mElement.mElements.length) {
- throw new RSIllegalArgumentException("Component_number " + component_number + " out of range.");
- }
- if(xoff < 0) {
- throw new RSIllegalArgumentException("Offset must be >= 0.");
- }
-
- final byte[] data = fp.getData();
- int eSize = mAlloc.mType.mElement.mElements[component_number].getSizeBytes();
-
- if (data.length != eSize) {
- throw new RSIllegalArgumentException("Field packer sizelength " + data.length +
- " does not match component size " + eSize + ".");
- }
-
- mRS.nAllocationElementData1D(getID(), xoff, mSelectedLOD, component_number, data, data.length);
+ super.setFromFieldPacker(xoff, component_number, fp);
}
-
- void data1DChecks(int off, int count, int len, int dataSize) {
- mRS.validate();
- if(off < 0) {
- throw new RSIllegalArgumentException("Offset must be >= 0.");
- }
- if(count < 1) {
- throw new RSIllegalArgumentException("Count must be >= 1.");
- }
- if((off + count) > mSelectedCount) {
- throw new RSIllegalArgumentException("Overflow, Available count " + mAlloc.mType.getCount() +
- ", got " + count + " at offset " + off + ".");
- }
- if((len) < dataSize) {
- throw new RSIllegalArgumentException("Array too small for allocation type. len = " +
- len + ", dataSize = " + dataSize);
- }
- }
-
+ /**
+ * @hide
+ */
public void subData1D(int off, int count, int[] d) {
- int dataSize = mAlloc.mType.mElement.getSizeBytes() * count;
- data1DChecks(off, count, d.length * 4, dataSize);
- mRS.nAllocationData1D(getID(), off, mSelectedLOD, count, d, dataSize);
+ super.copy1DRangeFrom(off, count, d);
}
+ /**
+ * @hide
+ */
public void subData1D(int off, int count, short[] d) {
- int dataSize = mAlloc.mType.mElement.getSizeBytes() * count;
- data1DChecks(off, count, d.length * 2, dataSize);
- mRS.nAllocationData1D(getID(), off, mSelectedLOD, count, d, dataSize);
+ super.copy1DRangeFrom(off, count, d);
}
+ /**
+ * @hide
+ */
public void subData1D(int off, int count, byte[] d) {
- int dataSize = mAlloc.mType.mElement.getSizeBytes() * count;
- data1DChecks(off, count, d.length, dataSize);
- mRS.nAllocationData1D(getID(), off, mSelectedLOD, count, d, dataSize);
+ super.copy1DRangeFrom(off, count, d);
}
+ /**
+ * @hide
+ */
public void subData1D(int off, int count, float[] d) {
- int dataSize = mAlloc.mType.mElement.getSizeBytes() * count;
- data1DChecks(off, count, d.length * 4, dataSize);
- mRS.nAllocationData1D(getID(), off, mSelectedLOD, count, d, dataSize);
+ super.copy1DRangeFrom(off, count, d);
}
-
/**
- * Copy part of an allocation from another allocation.
- *
- * @param off The offset of the first element to be copied.
- * @param count The number of elements to be copied.
- * @param data the source data allocation.
- * @param dataOff off The offset of the first element in data to
- * be copied.
+ * @hide
*/
- public void subData1D(int off, int count, AllocationAdapter data, int dataOff) {
- mRS.nAllocationData2D(getID(), off, 0,
- mSelectedLOD, mSelectedFace.mID,
- count, 1, data.getID(), dataOff, 0,
- data.mSelectedLOD, data.mSelectedFace.mID);
- }
-
-
public void subData2D(int xoff, int yoff, int w, int h, int[] d) {
- mRS.validate();
- mRS.nAllocationData2D(getID(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, d, d.length * 4);
+ super.copy2DRangeFrom(xoff, yoff, w, h, d);
}
-
- public void subData2D(int xoff, int yoff, int w, int h, float[] d) {
- mRS.validate();
- mRS.nAllocationData2D(getID(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, d, d.length * 4);
- }
-
/**
- * Copy a rectangular region into the allocation from another
- * allocation.
- *
- * @param xoff X offset of the region to update.
- * @param yoff Y offset of the region to update.
- * @param w Width of the incoming region to update.
- * @param h Height of the incoming region to update.
- * @param data source allocation.
- * @param dataXoff X offset in data of the region to update.
- * @param dataYoff Y offset in data of the region to update.
+ * @hide
*/
- public void subData2D(int xoff, int yoff, int w, int h,
- AllocationAdapter data, int dataXoff, int dataYoff) {
- mRS.validate();
- mRS.nAllocationData2D(getID(), xoff, yoff,
- mSelectedLOD, mSelectedFace.mID,
- w, h, data.getID(), dataXoff, dataYoff,
- data.mSelectedLOD, data.mSelectedFace.mID);
+ public void subData2D(int xoff, int yoff, int w, int h, float[] d) {
+ super.copy2DRangeFrom(xoff, yoff, w, h, d);
}
-
+ /**
+ * @hide
+ */
public void readData(int[] d) {
- mRS.validate();
- mRS.nAllocationRead(getID(), d);
+ super.copyTo(d);
}
-
+ /**
+ * @hide
+ */
public void readData(float[] d) {
- mRS.validate();
- mRS.nAllocationRead(getID(), d);
+ super.copyTo(d);
}
- private void initLOD(int lod) {
+ void initLOD(int lod) {
if (lod < 0) {
throw new RSIllegalArgumentException("Attempting to set negative lod (" + lod + ").");
}
- int tx = mAlloc.mType.getX();
- int ty = mAlloc.mType.getY();
- int tz = mAlloc.mType.getZ();
+ int tx = mAdaptedAllocation.mType.getX();
+ int ty = mAdaptedAllocation.mType.getY();
+ int tz = mAdaptedAllocation.mType.getZ();
for (int ct=0; ct < lod; ct++) {
if ((tx==1) && (ty == 1) && (tz == 1)) {
@@ -250,25 +114,31 @@
if (tz > 1) tz >>= 1;
}
- mSelectedDimX = tx;
- mSelectedDimY = ty;
- mSelectedCount = tx;
- if (ty > 1) {
- mSelectedCount *= ty;
+ mCurrentDimX = tx;
+ mCurrentDimY = ty;
+ mCurrentDimZ = tz;
+ mCurrentCount = mCurrentDimX;
+ if (mCurrentDimY > 1) {
+ mCurrentCount *= mCurrentDimY;
}
- if (tz > 1) {
- mSelectedCount *= tz;
+ if (mCurrentDimZ > 1) {
+ mCurrentCount *= mCurrentDimZ;
}
+ mSelectedY = 0;
+ mSelectedZ = 0;
}
/**
* Set the active LOD. The LOD must be within the range for the
- * type being adapted.
+ * type being adapted. The base allocation must have mipmaps.
+ *
+ * Because this changes the dimensions of the adapter the
+ * current Y and Z will be reset.
*
* @param lod The LOD to make active.
*/
public void setLOD(int lod) {
- if (!mAlloc.getType().hasMipmaps()) {
+ if (!mAdaptedAllocation.getType().hasMipmaps()) {
throw new RSInvalidStateException("Cannot set LOD when the allocation type does not include mipmaps.");
}
if (!mConstrainedLOD) {
@@ -278,22 +148,81 @@
initLOD(lod);
}
+ /**
+ * Set the active Face. The base allocation must be of a type
+ * that includes faces.
+ *
+ * @param cf The face to make active.
+ */
public void setFace(Type.CubemapFace cf) {
+ if (!mAdaptedAllocation.getType().hasFaces()) {
+ throw new RSInvalidStateException("Cannot set Face when the allocation type does not include faces.");
+ }
+ if (!mConstrainedFace) {
+ throw new RSInvalidStateException("Cannot set LOD when the adapter includes mipmaps.");
+ }
+ if (cf == null) {
+ throw new RSIllegalArgumentException("Cannot set null face.");
+ }
+
mSelectedFace = cf;
}
+ /**
+ * Set the active Y. The y value must be within the range for
+ * the allocation being adapted. The base allocation must
+ * contain the Y dimension.
+ *
+ * @param y The y to make active.
+ */
public void setY(int y) {
- mSelectedDimY = y;
+ if (mAdaptedAllocation.getType().getY() == 0) {
+ throw new RSInvalidStateException("Cannot set Y when the allocation type does not include Y dim.");
+ }
+ if (mAdaptedAllocation.getType().getY() <= y) {
+ throw new RSInvalidStateException("Cannot set Y greater than dimension of allocation.");
+ }
+ if (!mConstrainedY) {
+ throw new RSInvalidStateException("Cannot set Y when the adapter includes Y.");
+ }
+
+ mSelectedY = y;
}
+ /**
+ * Set the active Z. The z value must be within the range for
+ * the allocation being adapted. The base allocation must
+ * contain the Z dimension.
+ *
+ * @param z The z to make active.
+ */
public void setZ(int z) {
+ if (mAdaptedAllocation.getType().getZ() == 0) {
+ throw new RSInvalidStateException("Cannot set Z when the allocation type does not include Z dim.");
+ }
+ if (mAdaptedAllocation.getType().getZ() <= z) {
+ throw new RSInvalidStateException("Cannot set Z greater than dimension of allocation.");
+ }
+ if (!mConstrainedZ) {
+ throw new RSInvalidStateException("Cannot set Z when the adapter includes Z.");
+ }
+
+ mSelectedZ = z;
}
- // creation
- //static public AllocationAdapter create1D(RenderScript rs, Allocation a) {
- //}
+ static public AllocationAdapter create1D(RenderScript rs, Allocation a) {
+ rs.validate();
+ AllocationAdapter aa = new AllocationAdapter(0, rs, a);
+ aa.mConstrainedLOD = true;
+ aa.mConstrainedFace = true;
+ aa.mConstrainedY = true;
+ aa.mConstrainedZ = true;
+ aa.initLOD(0);
+ return aa;
+ }
static public AllocationAdapter create2D(RenderScript rs, Allocation a) {
+ android.util.Log.e("rs", "create2d " + a);
rs.validate();
AllocationAdapter aa = new AllocationAdapter(0, rs, a);
aa.mConstrainedLOD = true;
@@ -305,6 +234,16 @@
}
+ /**
+ * Override the Allocation resize. Resizing adapters is not
+ * allowed and will throw a RSInvalidStateException.
+ *
+ * @param dimX ignored.
+ */
+ public synchronized void resize(int dimX) {
+ throw new RSInvalidStateException("Resize not allowed for Adapters.");
+ }
+
}
diff --git a/include/media/EffectBassBoostApi.h b/include/media/EffectBassBoostApi.h
deleted file mode 100644
index 56119eb..0000000
--- a/include/media/EffectBassBoostApi.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef ANDROID_EFFECTBASSBOOSTAPI_H_
-#define ANDROID_EFFECTBASSBOOSTAPI_H_
-
-#include <hardware/audio_effect.h>
-
-#if __cplusplus
-extern "C" {
-#endif
-
-#ifndef OPENSL_ES_H_
-static const effect_uuid_t SL_IID_BASSBOOST_ = { 0x0634f220, 0xddd4, 0x11db, 0xa0fc, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
-const effect_uuid_t * const SL_IID_BASSBOOST = &SL_IID_BASSBOOST_;
-#endif //OPENSL_ES_H_
-
-/* enumerated parameter settings for BassBoost effect */
-typedef enum
-{
- BASSBOOST_PARAM_STRENGTH_SUPPORTED,
- BASSBOOST_PARAM_STRENGTH
-} t_bassboost_params;
-
-#if __cplusplus
-} // extern "C"
-#endif
-
-
-#endif /*ANDROID_EFFECTBASSBOOSTAPI_H_*/
diff --git a/include/media/EffectEnvironmentalReverbApi.h b/include/media/EffectEnvironmentalReverbApi.h
deleted file mode 100644
index f11c5ec..0000000
--- a/include/media/EffectEnvironmentalReverbApi.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef ANDROID_EFFECTENVIRONMENTALREVERBAPI_H_
-#define ANDROID_EFFECTENVIRONMENTALREVERBAPI_H_
-
-#include <hardware/audio_effect.h>
-
-#if __cplusplus
-extern "C" {
-#endif
-
-#ifndef OPENSL_ES_H_
-static const effect_uuid_t SL_IID_ENVIRONMENTALREVERB_ = { 0xc2e5d5f0, 0x94bd, 0x4763, 0x9cac, { 0x4e, 0x23, 0x4d, 0x6, 0x83, 0x9e } };
-const effect_uuid_t * const SL_IID_ENVIRONMENTALREVERB = &SL_IID_ENVIRONMENTALREVERB_;
-#endif //OPENSL_ES_H_
-
-/* enumerated parameter settings for environmental reverb effect */
-typedef enum
-{
- // Parameters below are as defined in OpenSL ES specification for environmental reverb interface
- REVERB_PARAM_ROOM_LEVEL, // in millibels, range -6000 to 0
- REVERB_PARAM_ROOM_HF_LEVEL, // in millibels, range -4000 to 0
- REVERB_PARAM_DECAY_TIME, // in milliseconds, range 100 to 20000
- REVERB_PARAM_DECAY_HF_RATIO, // in permilles, range 100 to 1000
- REVERB_PARAM_REFLECTIONS_LEVEL, // in millibels, range -6000 to 0
- REVERB_PARAM_REFLECTIONS_DELAY, // in milliseconds, range 0 to 65
- REVERB_PARAM_REVERB_LEVEL, // in millibels, range -6000 to 0
- REVERB_PARAM_REVERB_DELAY, // in milliseconds, range 0 to 65
- REVERB_PARAM_DIFFUSION, // in permilles, range 0 to 1000
- REVERB_PARAM_DENSITY, // in permilles, range 0 to 1000
- REVERB_PARAM_PROPERTIES,
- REVERB_PARAM_BYPASS
-} t_env_reverb_params;
-
-//t_reverb_settings is equal to SLEnvironmentalReverbSettings defined in OpenSL ES specification.
-typedef struct s_reverb_settings {
- int16_t roomLevel;
- int16_t roomHFLevel;
- uint32_t decayTime;
- int16_t decayHFRatio;
- int16_t reflectionsLevel;
- uint32_t reflectionsDelay;
- int16_t reverbLevel;
- uint32_t reverbDelay;
- int16_t diffusion;
- int16_t density;
-} __attribute__((packed)) t_reverb_settings;
-
-
-#if __cplusplus
-} // extern "C"
-#endif
-
-
-#endif /*ANDROID_EFFECTENVIRONMENTALREVERBAPI_H_*/
diff --git a/include/media/EffectEqualizerApi.h b/include/media/EffectEqualizerApi.h
deleted file mode 100644
index 950d138..0000000
--- a/include/media/EffectEqualizerApi.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef ANDROID_EFFECTEQUALIZERAPI_H_
-#define ANDROID_EFFECTEQUALIZERAPI_H_
-
-#include <hardware/audio_effect.h>
-
-#ifndef OPENSL_ES_H_
-static const effect_uuid_t SL_IID_EQUALIZER_ = { 0x0bed4300, 0xddd6, 0x11db, 0x8f34, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
-const effect_uuid_t * const SL_IID_EQUALIZER = &SL_IID_EQUALIZER_;
-#endif //OPENSL_ES_H_
-
-#if __cplusplus
-extern "C" {
-#endif
-
-/* enumerated parameters for Equalizer effect */
-typedef enum
-{
- EQ_PARAM_NUM_BANDS, // Gets the number of frequency bands that the equalizer supports.
- EQ_PARAM_LEVEL_RANGE, // Returns the minimum and maximum band levels supported.
- EQ_PARAM_BAND_LEVEL, // Gets/Sets the gain set for the given equalizer band.
- EQ_PARAM_CENTER_FREQ, // Gets the center frequency of the given band.
- EQ_PARAM_BAND_FREQ_RANGE, // Gets the frequency range of the given frequency band.
- EQ_PARAM_GET_BAND, // Gets the band that has the most effect on the given frequency.
- EQ_PARAM_CUR_PRESET, // Gets/Sets the current preset.
- EQ_PARAM_GET_NUM_OF_PRESETS, // Gets the total number of presets the equalizer supports.
- EQ_PARAM_GET_PRESET_NAME, // Gets the preset name based on the index.
- EQ_PARAM_PROPERTIES // Gets/Sets all parameters at a time.
-} t_equalizer_params;
-
-//t_equalizer_settings groups all current equalizer setting for backup and restore.
-typedef struct s_equalizer_settings {
- uint16_t curPreset;
- uint16_t numBands;
- uint16_t bandLevels[];
-} t_equalizer_settings;
-
-#if __cplusplus
-} // extern "C"
-#endif
-
-
-#endif /*ANDROID_EFFECTEQUALIZERAPI_H_*/
diff --git a/include/media/EffectPresetReverbApi.h b/include/media/EffectPresetReverbApi.h
deleted file mode 100644
index e5b168a6..0000000
--- a/include/media/EffectPresetReverbApi.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef ANDROID_EFFECTPRESETREVERBAPI_H_
-#define ANDROID_EFFECTPRESETREVERBAPI_H_
-
-#include <hardware/audio_effect.h>
-
-#if __cplusplus
-extern "C" {
-#endif
-
-#ifndef OPENSL_ES_H_
-static const effect_uuid_t SL_IID_PRESETREVERB_ = { 0x47382d60, 0xddd8, 0x11db, 0xbf3a, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
-const effect_uuid_t * const SL_IID_PRESETREVERB = &SL_IID_PRESETREVERB_;
-#endif //OPENSL_ES_H_
-
-/* enumerated parameter settings for preset reverb effect */
-typedef enum
-{
- REVERB_PARAM_PRESET
-} t_preset_reverb_params;
-
-
-typedef enum
-{
- REVERB_PRESET_NONE,
- REVERB_PRESET_SMALLROOM,
- REVERB_PRESET_MEDIUMROOM,
- REVERB_PRESET_LARGEROOM,
- REVERB_PRESET_MEDIUMHALL,
- REVERB_PRESET_LARGEHALL,
- REVERB_PRESET_PLATE,
- REVERB_PRESET_LAST = REVERB_PRESET_PLATE
-} t_reverb_presets;
-
-#if __cplusplus
-} // extern "C"
-#endif
-
-
-#endif /*ANDROID_EFFECTPRESETREVERBAPI_H_*/
diff --git a/include/media/EffectVirtualizerApi.h b/include/media/EffectVirtualizerApi.h
deleted file mode 100644
index 2e216e2..0000000
--- a/include/media/EffectVirtualizerApi.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef ANDROID_EFFECTVIRTUALIZERAPI_H_
-#define ANDROID_EFFECTVIRTUALIZERAPI_H_
-
-#include <hardware/audio_effect.h>
-
-#if __cplusplus
-extern "C" {
-#endif
-
-#ifndef OPENSL_ES_H_
-static const effect_uuid_t SL_IID_VIRTUALIZER_ = { 0x37cc2c00, 0xdddd, 0x11db, 0x8577, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
-const effect_uuid_t * const SL_IID_VIRTUALIZER = &SL_IID_VIRTUALIZER_;
-#endif //OPENSL_ES_H_
-
-/* enumerated parameter settings for virtualizer effect */
-typedef enum
-{
- VIRTUALIZER_PARAM_STRENGTH_SUPPORTED,
- VIRTUALIZER_PARAM_STRENGTH
-} t_virtualizer_params;
-
-#if __cplusplus
-} // extern "C"
-#endif
-
-
-#endif /*ANDROID_EFFECTVIRTUALIZERAPI_H_*/
diff --git a/include/media/EffectVisualizerApi.h b/include/media/EffectVisualizerApi.h
deleted file mode 100644
index e0fa328..0000000
--- a/include/media/EffectVisualizerApi.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef ANDROID_EFFECTVISUALIZERAPI_H_
-#define ANDROID_EFFECTVISUALIZERAPI_H_
-
-#include <hardware/audio_effect.h>
-
-#if __cplusplus
-extern "C" {
-#endif
-
-#ifndef OPENSL_ES_H_
-static const effect_uuid_t SL_IID_VISUALIZATION_ =
- { 0xe46b26a0, 0xdddd, 0x11db, 0x8afd, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
-const effect_uuid_t * const SL_IID_VISUALIZATION = &SL_IID_VISUALIZATION_;
-#endif //OPENSL_ES_H_
-
-#define VISUALIZER_CAPTURE_SIZE_MAX 1024 // maximum capture size in samples
-#define VISUALIZER_CAPTURE_SIZE_MIN 128 // minimum capture size in samples
-
-/* enumerated parameters for Visualizer effect */
-typedef enum
-{
- VISU_PARAM_CAPTURE_SIZE, // Sets the number PCM samples in the capture.
-} t_visualizer_params;
-
-/* commands */
-typedef enum
-{
- VISU_CMD_CAPTURE = EFFECT_CMD_FIRST_PROPRIETARY, // Gets the latest PCM capture.
-}t_visualizer_cmds;
-
-// VISU_CMD_CAPTURE retrieves the latest PCM snapshot captured by the visualizer engine.
-// It returns the number of samples specified by VISU_PARAM_CAPTURE_SIZE
-// in 8 bit unsigned format (0 = 0x80)
-
-#if __cplusplus
-} // extern "C"
-#endif
-
-
-#endif /*ANDROID_EFFECTVISUALIZERAPI_H_*/
diff --git a/include/media/Visualizer.h b/include/media/Visualizer.h
index b8746c2..5d2c874 100644
--- a/include/media/Visualizer.h
+++ b/include/media/Visualizer.h
@@ -18,7 +18,7 @@
#define ANDROID_MEDIA_VISUALIZER_H
#include <media/AudioEffect.h>
-#include <media/EffectVisualizerApi.h>
+#include <audio_effects/effect_visualizer.h>
#include <string.h>
/**
diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp
index c06400e..88433fb 100644
--- a/libs/gui/tests/SurfaceTexture_test.cpp
+++ b/libs/gui/tests/SurfaceTexture_test.cpp
@@ -1180,8 +1180,7 @@
sp<FrameCondition> mFC;
};
-// XXX: This test is disabled because it causes hangs on some devices.
-TEST_F(SurfaceTextureGLToGLTest, DISABLED_UpdateTexImageBeforeFrameFinishedWorks) {
+TEST_F(SurfaceTextureGLToGLTest, UpdateTexImageBeforeFrameFinishedWorks) {
class PT : public ProducerThread {
virtual void render() {
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
@@ -1199,8 +1198,7 @@
// TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported!
}
-// XXX: This test is disabled because it causes hangs on some devices.
-TEST_F(SurfaceTextureGLToGLTest, DISABLED_UpdateTexImageAfterFrameFinishedWorks) {
+TEST_F(SurfaceTextureGLToGLTest, UpdateTexImageAfterFrameFinishedWorks) {
class PT : public ProducerThread {
virtual void render() {
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
@@ -1218,8 +1216,7 @@
// TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported!
}
-// XXX: This test is disabled because it causes hangs on some devices.
-TEST_F(SurfaceTextureGLToGLTest, DISABLED_RepeatedUpdateTexImageBeforeFrameFinishedWorks) {
+TEST_F(SurfaceTextureGLToGLTest, RepeatedUpdateTexImageBeforeFrameFinishedWorks) {
enum { NUM_ITERATIONS = 1024 };
class PT : public ProducerThread {
@@ -1247,8 +1244,7 @@
}
}
-// XXX: This test is disabled because it causes hangs on some devices.
-TEST_F(SurfaceTextureGLToGLTest, DISABLED_RepeatedUpdateTexImageAfterFrameFinishedWorks) {
+TEST_F(SurfaceTextureGLToGLTest, RepeatedUpdateTexImageAfterFrameFinishedWorks) {
enum { NUM_ITERATIONS = 1024 };
class PT : public ProducerThread {
diff --git a/libs/rs/driver/rsdGL.cpp b/libs/rs/driver/rsdGL.cpp
index 1f7bb0f..04446ad 100644
--- a/libs/rs/driver/rsdGL.cpp
+++ b/libs/rs/driver/rsdGL.cpp
@@ -99,9 +99,8 @@
for (size_t j = 0; j < sizeof(names) / sizeof(names[0]); j++) {
EGLint value = -1;
- EGLint returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value);
- EGLint error = eglGetError();
- if (returnVal && error == EGL_SUCCESS) {
+ EGLBoolean returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value);
+ if (returnVal) {
LOGV(" %s: %d (0x%x)", names[j].name, value, value);
}
}
@@ -169,6 +168,24 @@
configAttribsPtr[1] = EGL_OPENGL_ES2_BIT;
configAttribsPtr += 2;
+ configAttribsPtr[0] = EGL_RED_SIZE;
+ configAttribsPtr[1] = 8;
+ configAttribsPtr += 2;
+
+ configAttribsPtr[0] = EGL_GREEN_SIZE;
+ configAttribsPtr[1] = 8;
+ configAttribsPtr += 2;
+
+ configAttribsPtr[0] = EGL_BLUE_SIZE;
+ configAttribsPtr[1] = 8;
+ configAttribsPtr += 2;
+
+ if (rsc->mUserSurfaceConfig.alphaMin > 0) {
+ configAttribsPtr[0] = EGL_ALPHA_SIZE;
+ configAttribsPtr[1] = rsc->mUserSurfaceConfig.alphaMin;
+ configAttribsPtr += 2;
+ }
+
if (rsc->mUserSurfaceConfig.depthMin > 0) {
configAttribsPtr[0] = EGL_DEPTH_SIZE;
configAttribsPtr[1] = rsc->mUserSurfaceConfig.depthMin;
@@ -191,16 +208,53 @@
eglInitialize(dc->gl.egl.display, &dc->gl.egl.majorVersion, &dc->gl.egl.minorVersion);
checkEglError("eglInitialize");
- PixelFormat pf = PIXEL_FORMAT_RGBA_8888;
- if (rsc->mUserSurfaceConfig.alphaMin == 0) {
- pf = PIXEL_FORMAT_RGBX_8888;
+ EGLBoolean ret;
+
+ EGLint numConfigs = -1, n = 0;
+ ret = eglChooseConfig(dc->gl.egl.display, configAttribs, 0, 0, &numConfigs);
+ checkEglError("eglGetConfigs", ret);
+
+ if (numConfigs) {
+ EGLConfig* const configs = new EGLConfig[numConfigs];
+
+ ret = eglChooseConfig(dc->gl.egl.display,
+ configAttribs, configs, numConfigs, &n);
+ if (!ret || !n) {
+ checkEglError("eglChooseConfig", ret);
+ LOGE("%p, couldn't find an EGLConfig matching the screen format\n", rsc);
+ }
+
+ // The first config is guaranteed to over-satisfy the constraints
+ dc->gl.egl.config = configs[0];
+
+ // go through the list and skip configs that over-satisfy our needs
+ for (int i=0 ; i<n ; i++) {
+ if (rsc->mUserSurfaceConfig.alphaMin <= 0) {
+ EGLint alphaSize;
+ eglGetConfigAttrib(dc->gl.egl.display,
+ configs[i], EGL_ALPHA_SIZE, &alphaSize);
+ if (alphaSize > 0) {
+ continue;
+ }
+ }
+
+ if (rsc->mUserSurfaceConfig.depthMin <= 0) {
+ EGLint depthSize;
+ eglGetConfigAttrib(dc->gl.egl.display,
+ configs[i], EGL_DEPTH_SIZE, &depthSize);
+ if (depthSize > 0) {
+ continue;
+ }
+ }
+
+ // Found one!
+ dc->gl.egl.config = configs[i];
+ break;
+ }
+
+ delete [] configs;
}
- status_t err = EGLUtils::selectConfigForPixelFormat(dc->gl.egl.display, configAttribs,
- pf, &dc->gl.egl.config);
- if (err) {
- LOGE("%p, couldn't find an EGLConfig matching the screen format\n", rsc);
- }
//if (props.mLogVisual) {
if (0) {
printEGLConfiguration(dc->gl.egl.display, dc->gl.egl.config);
@@ -227,8 +281,8 @@
return false;
}
- EGLBoolean ret = eglMakeCurrent(dc->gl.egl.display, dc->gl.egl.surfaceDefault,
- dc->gl.egl.surfaceDefault, dc->gl.egl.context);
+ ret = eglMakeCurrent(dc->gl.egl.display, dc->gl.egl.surfaceDefault,
+ dc->gl.egl.surfaceDefault, dc->gl.egl.context);
if (ret == EGL_FALSE) {
LOGE("eglMakeCurrent returned EGL_FALSE");
checkEglError("eglMakeCurrent", ret);
diff --git a/libs/ui/EGLUtils.cpp b/libs/ui/EGLUtils.cpp
index f24a71d..020646b 100644
--- a/libs/ui/EGLUtils.cpp
+++ b/libs/ui/EGLUtils.cpp
@@ -24,6 +24,8 @@
#include <EGL/egl.h>
+#include <system/graphics.h>
+
#include <private/ui/android_natives_priv.h>
// ----------------------------------------------------------------------------
@@ -67,31 +69,49 @@
return BAD_VALUE;
// Get all the "potential match" configs...
- if (eglGetConfigs(dpy, NULL, 0, &numConfigs) == EGL_FALSE)
+ if (eglChooseConfig(dpy, attrs, 0, 0, &numConfigs) == EGL_FALSE)
return BAD_VALUE;
- EGLConfig* const configs = (EGLConfig*)malloc(sizeof(EGLConfig)*numConfigs);
- if (eglChooseConfig(dpy, attrs, configs, numConfigs, &n) == EGL_FALSE) {
- free(configs);
- return BAD_VALUE;
- }
-
- int i;
- EGLConfig config = NULL;
- for (i=0 ; i<n ; i++) {
- EGLint nativeVisualId = 0;
- eglGetConfigAttrib(dpy, configs[i], EGL_NATIVE_VISUAL_ID, &nativeVisualId);
- if (nativeVisualId>0 && format == nativeVisualId) {
+ if (numConfigs) {
+ EGLConfig* const configs = new EGLConfig[numConfigs];
+ if (eglChooseConfig(dpy, attrs, configs, numConfigs, &n) == EGL_FALSE) {
+ delete [] configs;
+ return BAD_VALUE;
+ }
+
+ bool hasAlpha = false;
+ switch (format) {
+ case HAL_PIXEL_FORMAT_RGBA_8888:
+ case HAL_PIXEL_FORMAT_BGRA_8888:
+ case HAL_PIXEL_FORMAT_RGBA_5551:
+ case HAL_PIXEL_FORMAT_RGBA_4444:
+ hasAlpha = true;
+ break;
+ }
+
+ // The first config is guaranteed to over-satisfy the constraints
+ EGLConfig config = configs[0];
+
+ // go through the list and skip configs that over-satisfy our needs
+ int i;
+ for (i=0 ; i<n ; i++) {
+ if (!hasAlpha) {
+ EGLint alphaSize;
+ eglGetConfigAttrib(dpy, configs[i], EGL_ALPHA_SIZE, &alphaSize);
+ if (alphaSize > 0) {
+ continue;
+ }
+ }
config = configs[i];
break;
}
- }
- free(configs);
-
- if (i<n) {
- *outConfig = config;
- return NO_ERROR;
+ delete [] configs;
+
+ if (i<n) {
+ *outConfig = config;
+ return NO_ERROR;
+ }
}
return NAME_NOT_FOUND;
diff --git a/media/jni/audioeffect/Android.mk b/media/jni/audioeffect/Android.mk
index 4c5cf71..3e493b1 100644
--- a/media/jni/audioeffect/Android.mk
+++ b/media/jni/audioeffect/Android.mk
@@ -12,6 +12,9 @@
libnativehelper \
libmedia
+LOCAL_C_INCLUDES := \
+ system/media/audio_effects/include
+
LOCAL_MODULE:= libaudioeffect_jni
include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/lvm/wrapper/Android.mk b/media/libeffects/lvm/wrapper/Android.mk
index 99cfdfa..ab13605 100644
--- a/media/libeffects/lvm/wrapper/Android.mk
+++ b/media/libeffects/lvm/wrapper/Android.mk
@@ -30,7 +30,8 @@
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/Bundle \
$(LOCAL_PATH)/../lib/Common/lib/ \
- $(LOCAL_PATH)/../lib/Bundle/lib/
+ $(LOCAL_PATH)/../lib/Bundle/lib/ \
+ system/media/audio_effects/include
include $(BUILD_SHARED_LIBRARY)
@@ -64,6 +65,6 @@
$(LOCAL_PATH)/Reverb \
$(LOCAL_PATH)/../lib/Common/lib/ \
$(LOCAL_PATH)/../lib/Reverb/lib/ \
-
+ system/media/audio_effects/include
include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
index 2b51029..5634ca1 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
@@ -17,9 +17,9 @@
#ifndef ANDROID_EFFECTBUNDLE_H_
#define ANDROID_EFFECTBUNDLE_H_
-#include <media/EffectEqualizerApi.h>
-#include <media/EffectBassBoostApi.h>
-#include <media/EffectVirtualizerApi.h>
+#include <audio_effects/effect_bassboost.h>
+#include <audio_effects/effect_equalizer.h>
+#include <audio_effects/effect_virtualizer.h>
#include <LVM.h>
#include <limits.h>
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
index 093992b..7c15b18 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
@@ -17,8 +17,8 @@
#ifndef ANDROID_EFFECTREVERB_H_
#define ANDROID_EFFECTREVERB_H_
-#include <media/EffectEnvironmentalReverbApi.h>
-#include <media/EffectPresetReverbApi.h>
+#include <audio_effects/effect_environmentalreverb.h>
+#include <audio_effects/effect_presetreverb.h>
#if __cplusplus
extern "C" {
diff --git a/media/libeffects/testlibs/Android.mk_ b/media/libeffects/testlibs/Android.mk_
index 98d477b..249ebf4 100644
--- a/media/libeffects/testlibs/Android.mk_
+++ b/media/libeffects/testlibs/Android.mk_
@@ -23,6 +23,7 @@
endif
LOCAL_C_INCLUDES := \
+ system/media/audio_effects/include \
$(call include-path-for, graphics corecg)
LOCAL_MODULE_TAGS := optional
@@ -58,7 +59,8 @@
endif
LOCAL_C_INCLUDES := \
- $(call include-path-for, graphics corecg)
+ $(call include-path-for, graphics corecg) \
+ system/media/audio_effects/include
LOCAL_MODULE_TAGS := optional
diff --git a/media/libeffects/testlibs/EffectEqualizer.cpp b/media/libeffects/testlibs/EffectEqualizer.cpp
index 43dfa82..c2ffce5 100644
--- a/media/libeffects/testlibs/EffectEqualizer.cpp
+++ b/media/libeffects/testlibs/EffectEqualizer.cpp
@@ -26,7 +26,8 @@
#include "AudioEqualizer.h"
#include "AudioBiquadFilter.h"
#include "AudioFormatAdapter.h"
-#include <media/EffectEqualizerApi.h>
+#include <audio_effects/effect_equalizer.h>
+
// effect_handle_t interface implementation for equalizer effect
extern "C" const struct effect_interface_s gEqualizerInterface;
diff --git a/media/libeffects/testlibs/EffectReverb.h b/media/libeffects/testlibs/EffectReverb.h
index a239814..8e2cc31 100644
--- a/media/libeffects/testlibs/EffectReverb.h
+++ b/media/libeffects/testlibs/EffectReverb.h
@@ -17,8 +17,8 @@
#ifndef ANDROID_EFFECTREVERB_H_
#define ANDROID_EFFECTREVERB_H_
-#include <media/EffectEnvironmentalReverbApi.h>
-#include <media/EffectPresetReverbApi.h>
+#include <audio_effects/effect_environmentalreverb.h>
+#include <audio_effects/effect_presetreverb.h>
/*------------------------------------
diff --git a/media/libeffects/visualizer/Android.mk b/media/libeffects/visualizer/Android.mk
index 3a0f438..dff585f 100644
--- a/media/libeffects/visualizer/Android.mk
+++ b/media/libeffects/visualizer/Android.mk
@@ -23,8 +23,8 @@
endif
LOCAL_C_INCLUDES := \
- $(call include-path-for, graphics corecg)
-
+ $(call include-path-for, graphics corecg) \
+ system/media/audio_effects/include
include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index 80d1f69..aeebd4d 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include <new>
-#include <media/EffectVisualizerApi.h>
+#include <audio_effects/effect_visualizer.h>
extern "C" {
@@ -375,7 +375,7 @@
p->status = 0;
*replySize = sizeof(effect_param_t) + sizeof(uint32_t);
if (p->psize != sizeof(uint32_t) ||
- *(uint32_t *)p->data != VISU_PARAM_CAPTURE_SIZE) {
+ *(uint32_t *)p->data != VISUALIZER_PARAM_CAPTURE_SIZE) {
p->status = -EINVAL;
break;
}
@@ -394,7 +394,7 @@
effect_param_t *p = (effect_param_t *)pCmdData;
if (p->psize != sizeof(uint32_t) ||
p->vsize != sizeof(uint32_t) ||
- *(uint32_t *)p->data != VISU_PARAM_CAPTURE_SIZE) {
+ *(uint32_t *)p->data != VISUALIZER_PARAM_CAPTURE_SIZE) {
*(int32_t *)pReplyData = -EINVAL;
break;;
}
@@ -407,9 +407,9 @@
break;
- case VISU_CMD_CAPTURE:
+ case VISUALIZER_CMD_CAPTURE:
if (pReplyData == NULL || *replySize != pContext->mCaptureSize) {
- LOGV("VISU_CMD_CAPTURE() error *replySize %d pContext->mCaptureSize %d",
+ LOGV("VISUALIZER_CMD_CAPTURE() error *replySize %d pContext->mCaptureSize %d",
*replySize, pContext->mCaptureSize);
return -EINVAL;
}
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index 121e38a4..f7c54fa 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -68,6 +68,7 @@
$(call include-path-for, graphics corecg) \
$(TOP)/frameworks/base/include/media/stagefright/openmax \
external/icu4c/common \
- external/expat/lib
+ external/expat/lib \
+ system/media/audio_effects/include
include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp
index 366707c..bf40481 100644
--- a/media/libmedia/Visualizer.cpp
+++ b/media/libmedia/Visualizer.cpp
@@ -143,7 +143,7 @@
p->psize = sizeof(uint32_t);
p->vsize = sizeof(uint32_t);
- *(int32_t *)p->data = VISU_PARAM_CAPTURE_SIZE;
+ *(int32_t *)p->data = VISUALIZER_PARAM_CAPTURE_SIZE;
*((int32_t *)p->data + 1)= size;
status_t status = setParameter(p);
@@ -171,7 +171,7 @@
status_t status = NO_ERROR;
if (mEnabled) {
uint32_t replySize = mCaptureSize;
- status = command(VISU_CMD_CAPTURE, 0, NULL, &replySize, waveform);
+ status = command(VISUALIZER_CMD_CAPTURE, 0, NULL, &replySize, waveform);
LOGV("getWaveForm() command returned %d", status);
if (replySize == 0) {
status = NOT_ENOUGH_DATA;
@@ -276,7 +276,7 @@
p->psize = sizeof(uint32_t);
p->vsize = sizeof(uint32_t);
- *(int32_t *)p->data = VISU_PARAM_CAPTURE_SIZE;
+ *(int32_t *)p->data = VISUALIZER_PARAM_CAPTURE_SIZE;
status_t status = getParameter(p);
if (status == NO_ERROR) {
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index b003476..223e0be 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -1136,10 +1136,69 @@
clipVideoFrameRate();
clipVideoFrameWidth();
clipVideoFrameHeight();
+ setDefaultProfileIfNecessary();
}
return OK;
}
+// Set to use AVC baseline profile if the encoding parameters matches
+// CAMCORDER_QUALITY_LOW profile; this is for the sake of MMS service.
+void StagefrightRecorder::setDefaultProfileIfNecessary() {
+ LOGV("setDefaultProfileIfNecessary");
+
+ camcorder_quality quality = CAMCORDER_QUALITY_LOW;
+
+ int64_t durationUs = mEncoderProfiles->getCamcorderProfileParamByName(
+ "duration", mCameraId, quality) * 1000000LL;
+
+ int fileFormat = mEncoderProfiles->getCamcorderProfileParamByName(
+ "file.format", mCameraId, quality);
+
+ int videoCodec = mEncoderProfiles->getCamcorderProfileParamByName(
+ "vid.codec", mCameraId, quality);
+
+ int videoBitRate = mEncoderProfiles->getCamcorderProfileParamByName(
+ "vid.bps", mCameraId, quality);
+
+ int videoFrameRate = mEncoderProfiles->getCamcorderProfileParamByName(
+ "vid.fps", mCameraId, quality);
+
+ int videoFrameWidth = mEncoderProfiles->getCamcorderProfileParamByName(
+ "vid.width", mCameraId, quality);
+
+ int videoFrameHeight = mEncoderProfiles->getCamcorderProfileParamByName(
+ "vid.height", mCameraId, quality);
+
+ int audioCodec = mEncoderProfiles->getCamcorderProfileParamByName(
+ "aud.codec", mCameraId, quality);
+
+ int audioBitRate = mEncoderProfiles->getCamcorderProfileParamByName(
+ "aud.bps", mCameraId, quality);
+
+ int audioSampleRate = mEncoderProfiles->getCamcorderProfileParamByName(
+ "aud.hz", mCameraId, quality);
+
+ int audioChannels = mEncoderProfiles->getCamcorderProfileParamByName(
+ "aud.ch", mCameraId, quality);
+
+ if (durationUs == mMaxFileDurationUs &&
+ fileFormat == mOutputFormat &&
+ videoCodec == mVideoEncoder &&
+ videoBitRate == mVideoBitRate &&
+ videoFrameRate == mFrameRate &&
+ videoFrameWidth == mVideoWidth &&
+ videoFrameHeight == mVideoHeight &&
+ audioCodec == mAudioEncoder &&
+ audioBitRate == mAudioBitRate &&
+ audioSampleRate == mSampleRate &&
+ audioChannels == mAudioChannels) {
+ if (videoCodec == VIDEO_ENCODER_H264) {
+ LOGI("Force to use AVC baseline profile");
+ setParamVideoEncoderProfile(OMX_VIDEO_AVCProfileBaseline);
+ }
+ }
+}
+
status_t StagefrightRecorder::checkAudioEncoderCapabilities() {
clipAudioBitRate();
clipAudioSampleRate();
diff --git a/media/libmediaplayerservice/StagefrightRecorder.h b/media/libmediaplayerservice/StagefrightRecorder.h
index cb9c406..034b373 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.h
+++ b/media/libmediaplayerservice/StagefrightRecorder.h
@@ -174,6 +174,7 @@
void clipAudioBitRate();
void clipAudioSampleRate();
void clipNumberOfAudioChannels();
+ void setDefaultProfileIfNecessary();
StagefrightRecorder(const StagefrightRecorder &);
StagefrightRecorder &operator=(const StagefrightRecorder &);
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 1ac2c1f..06363ee 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1295,13 +1295,6 @@
h264type.nAllowedPictureTypes =
OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP;
- h264type.nSliceHeaderSpacing = 0;
- h264type.nBFrames = 0; // No B frames support yet
- h264type.nPFrames = setPFramesSpacing(iFramesInterval, frameRate);
- if (h264type.nPFrames == 0) {
- h264type.nAllowedPictureTypes = OMX_VIDEO_PictureTypeI;
- }
-
// Check profile and level parameters
CodecProfileLevel defaultProfileLevel, profileLevel;
defaultProfileLevel.mProfile = h264type.eProfile;
@@ -1312,8 +1305,14 @@
h264type.eLevel = static_cast<OMX_VIDEO_AVCLEVELTYPE>(profileLevel.mLevel);
if (h264type.eProfile == OMX_VIDEO_AVCProfileBaseline) {
+ h264type.nSliceHeaderSpacing = 0;
h264type.bUseHadamard = OMX_TRUE;
h264type.nRefFrames = 1;
+ h264type.nBFrames = 0;
+ h264type.nPFrames = setPFramesSpacing(iFramesInterval, frameRate);
+ if (h264type.nPFrames == 0) {
+ h264type.nAllowedPictureTypes = OMX_VIDEO_PictureTypeI;
+ }
h264type.nRefIdx10ActiveMinus1 = 0;
h264type.nRefIdx11ActiveMinus1 = 0;
h264type.bEntropyCodingCABAC = OMX_FALSE;
diff --git a/opengl/tests/EGLTest/Android.mk b/opengl/tests/EGLTest/Android.mk
new file mode 100644
index 0000000..ab5f4bd
--- /dev/null
+++ b/opengl/tests/EGLTest/Android.mk
@@ -0,0 +1,41 @@
+# Build the unit tests.
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+ifneq ($(TARGET_SIMULATOR),true)
+
+LOCAL_MODULE := EGL_test
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_SRC_FILES := \
+ EGL_test.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ libEGL \
+ libcutils \
+ libstlport \
+ libutils \
+
+LOCAL_STATIC_LIBRARIES := \
+ libgtest \
+ libgtest_main \
+
+LOCAL_C_INCLUDES := \
+ bionic \
+ bionic/libstdc++/include \
+ external/gtest/include \
+ external/stlport/stlport \
+
+include $(BUILD_EXECUTABLE)
+
+endif
+
+# Include subdirectory makefiles
+# ============================================================
+
+# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
+# team really wants is to build the stuff defined by this makefile.
+ifeq (,$(ONE_SHOT_MAKEFILE))
+include $(call first-makefiles-under,$(LOCAL_PATH))
+endif
diff --git a/opengl/tests/EGLTest/EGL_test.cpp b/opengl/tests/EGLTest/EGL_test.cpp
new file mode 100644
index 0000000..337ad33
--- /dev/null
+++ b/opengl/tests/EGLTest/EGL_test.cpp
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+#include <gtest/gtest.h>
+
+#include <utils/String8.h>
+
+#include <EGL/egl.h>
+
+namespace android {
+
+class EGLTest : public ::testing::Test {
+protected:
+ EGLDisplay mEglDisplay;
+
+protected:
+ EGLTest() :
+ mEglDisplay(EGL_NO_DISPLAY) {
+ }
+
+ virtual void SetUp() {
+ mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay);
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+
+ EGLint majorVersion;
+ EGLint minorVersion;
+ EXPECT_TRUE(eglInitialize(mEglDisplay, &majorVersion, &minorVersion));
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+ RecordProperty("EglVersionMajor", majorVersion);
+ RecordProperty("EglVersionMajor", minorVersion);
+ }
+
+ virtual void TearDown() {
+ EGLBoolean success = eglTerminate(mEglDisplay);
+ ASSERT_EQ(EGL_TRUE, success);
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+ }
+};
+
+TEST_F(EGLTest, DISABLED_EGLConfigEightBitFirst) {
+
+ EGLint numConfigs;
+ EGLConfig config;
+ EGLBoolean success;
+ EGLint attrs[] = {
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_NONE
+ };
+
+ success = eglChooseConfig(mEglDisplay, attrs, &config, 1, &numConfigs);
+ ASSERT_EQ(EGL_TRUE, success);
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+ ASSERT_GE(numConfigs, 1);
+
+ EGLint components[3];
+
+ success = eglGetConfigAttrib(mEglDisplay, config, EGL_RED_SIZE, &components[0]);
+ ASSERT_EQ(EGL_TRUE, success);
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+ success = eglGetConfigAttrib(mEglDisplay, config, EGL_GREEN_SIZE, &components[1]);
+ ASSERT_EQ(EGL_TRUE, success);
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+ success = eglGetConfigAttrib(mEglDisplay, config, EGL_BLUE_SIZE, &components[2]);
+ ASSERT_EQ(EGL_TRUE, success);
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+
+ EXPECT_GE(components[0], 8);
+ EXPECT_GE(components[1], 8);
+ EXPECT_GE(components[2], 8);
+}
+
+TEST_F(EGLTest, EGLConfigRGBA8888First) {
+
+ EGLint numConfigs;
+ EGLConfig config;
+ EGLBoolean success;
+ EGLint attrs[] = {
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_RED_SIZE, 8,
+ EGL_GREEN_SIZE, 8,
+ EGL_BLUE_SIZE, 8,
+ EGL_ALPHA_SIZE, 8,
+ EGL_NONE
+ };
+
+ success = eglChooseConfig(mEglDisplay, attrs, &config, 1, &numConfigs);
+ ASSERT_EQ(EGL_TRUE, success);
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+ ASSERT_GE(numConfigs, 1);
+
+ EGLint components[4];
+
+ success = eglGetConfigAttrib(mEglDisplay, config, EGL_RED_SIZE, &components[0]);
+ ASSERT_EQ(EGL_TRUE, success);
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+ success = eglGetConfigAttrib(mEglDisplay, config, EGL_GREEN_SIZE, &components[1]);
+ ASSERT_EQ(EGL_TRUE, success);
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+ success = eglGetConfigAttrib(mEglDisplay, config, EGL_BLUE_SIZE, &components[2]);
+ ASSERT_EQ(EGL_TRUE, success);
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+ success = eglGetConfigAttrib(mEglDisplay, config, EGL_ALPHA_SIZE, &components[3]);
+ ASSERT_EQ(EGL_TRUE, success);
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+
+ EXPECT_GE(components[0], 8);
+ EXPECT_GE(components[1], 8);
+ EXPECT_GE(components[2], 8);
+ EXPECT_GE(components[3], 8);
+}
+
+
+}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 47ab150..afe4246 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -16,17 +16,6 @@
package com.android.providers.settings;
-import com.android.internal.content.PackageHelper;
-import com.android.internal.telephony.BaseCommands;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.RILConstants;
-import com.android.internal.util.XmlUtils;
-import com.android.internal.widget.LockPatternUtils;
-import com.android.internal.widget.LockPatternView;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Context;
@@ -47,6 +36,17 @@
import android.text.TextUtils;
import android.util.Log;
+import com.android.internal.content.PackageHelper;
+import com.android.internal.telephony.BaseCommands;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.RILConstants;
+import com.android.internal.util.XmlUtils;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.internal.widget.LockPatternView;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
@@ -63,7 +63,7 @@
// database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
// is properly propagated through your change. Not doing so will result in a loss of user
// settings.
- private static final int DATABASE_VERSION = 65;
+ private static final int DATABASE_VERSION = 66;
private Context mContext;
@@ -839,6 +839,28 @@
upgradeVersion = 65;
}
+ if (upgradeVersion == 65) {
+ /*
+ * Animations are removed from Settings. Turned on by default
+ */
+ db.beginTransaction();
+ SQLiteStatement stmt = null;
+ try {
+ db.execSQL("DELETE FROM system WHERE name='"
+ + Settings.System.WINDOW_ANIMATION_SCALE + "'");
+ db.execSQL("DELETE FROM system WHERE name='"
+ + Settings.System.TRANSITION_ANIMATION_SCALE + "'");
+ stmt = db.compileStatement("INSERT INTO system(name,value)"
+ + " VALUES(?,?);");
+ loadDefaultAnimationSettings(stmt);
+ db.setTransactionSuccessful();
+ } finally {
+ db.endTransaction();
+ if (stmt != null) stmt.close();
+ }
+ upgradeVersion = 66;
+ }
+
// *** Remember to update DATABASE_VERSION above!
if (upgradeVersion != currentVersion) {
diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
index 4a80489..efdd9ac 100644
--- a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
@@ -22,11 +22,11 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recents_root"
android:layout_height="match_parent"
- android:layout_width="wrap_content">
+ android:layout_width="match_parent">
<FrameLayout
android:id="@+id/recents_bg_protect"
- android:background="@drawable/recents_bg_protect_tile"
+ android:background="@drawable/status_bar_recents_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
@@ -38,7 +38,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
- android:background="@drawable/recents_blue_glow"
android:orientation="horizontal"
android:clipToPadding="false"
android:clipChildren="false"
@@ -78,6 +77,7 @@
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@drawable/ic_sysbar_back_ime"
+ android:visibility="gone"
/>
</com.android.systemui.recent.RecentsPanelView>
diff --git a/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
index 9391f9d..386182d 100644
--- a/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
@@ -26,7 +26,7 @@
<FrameLayout
android:id="@+id/recents_bg_protect"
- android:background="@drawable/recents_bg_protect_tile"
+ android:background="@drawable/status_bar_recents_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
@@ -39,7 +39,6 @@
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:layout_gravity="bottom"
- android:background="@drawable/recents_blue_glow"
android:orientation="horizontal"
android:clipToPadding="false"
android:clipChildren="false"
@@ -79,6 +78,7 @@
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@drawable/ic_sysbar_back_ime"
+ android:visibility="gone"
/>
</com.android.systemui.recent.RecentsPanelView>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 9341693..fd5fe7a 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -21,4 +21,5 @@
<drawable name="notification_item_background_color">#ff000000</drawable>
<drawable name="ticker_background_color">#ff1d1d1d</drawable>
<drawable name="status_bar_background">#000000</drawable>
+ <drawable name="status_bar_recents_background">#b3000000</drawable>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java b/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
index 49a65d8..37a9913 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
@@ -18,7 +18,9 @@
import android.animation.Animator;
import android.animation.AnimatorSet;
+import android.animation.AnimatorSet.Builder;
import android.animation.ObjectAnimator;
+import android.graphics.drawable.Drawable;
import android.util.Log;
import android.util.Slog;
import android.view.View;
@@ -78,14 +80,14 @@
? new android.view.animation.AccelerateInterpolator(1.0f)
: new android.view.animation.DecelerateInterpolator(1.0f));
- Animator bgAnim = ObjectAnimator.ofInt(mScrimView.getBackground(),
- "alpha", appearing ? 0 : 255, appearing ? 255 : 0);
-
mContentAnim = new AnimatorSet();
- mContentAnim
- .play(bgAnim)
- .with(glowAnim)
- .with(posAnim);
+ final Builder builder = mContentAnim.play(glowAnim).with(posAnim);
+ Drawable background = mScrimView.getBackground();
+ if (background != null) {
+ Animator bgAnim = ObjectAnimator.ofInt(background,
+ "alpha", appearing ? 0 : 255, appearing ? 255 : 0);
+ builder.with(bgAnim);
+ }
mContentAnim.setDuration(appearing ? OPEN_DURATION : CLOSE_DURATION);
mContentAnim.addListener(this);
if (mListener != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/Constants.java b/packages/SystemUI/src/com/android/systemui/recent/Constants.java
new file mode 100644
index 0000000..66f9292
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/recent/Constants.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2011 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 com.android.systemui.recent;
+
+public class Constants {
+ static final int MAX_ESCAPE_ANIMATION_DURATION = 500; // in ms
+ static final float FADE_CONSTANT = 0.5f; // unitless
+ static final int SNAP_BACK_DURATION = 250; // in ms
+ static final int ESCAPE_VELOCITY = 100; // speed of item required to "curate" it in dp/s
+}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 3dbcc59..fb7a0a7 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -25,6 +25,7 @@
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
+import android.content.res.Configuration;
import android.database.DataSetObserver;
import android.graphics.RectF;
import android.util.AttributeSet;
@@ -33,6 +34,7 @@
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
+import android.view.ViewConfiguration;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import android.widget.HorizontalScrollView;
@@ -42,12 +44,9 @@
public class RecentsHorizontalScrollView extends HorizontalScrollView
implements View.OnClickListener, View.OnTouchListener {
- private static final float FADE_CONSTANT = 0.5f;
- private static final int SNAP_BACK_DURATION = 250;
- private static final int ESCAPE_VELOCITY = 100; // speed of item required to "curate" it
- private static final String TAG = RecentsPanelView.TAG;
- private static final float THRESHHOLD = 50;
private static final boolean DEBUG_INVALIDATE = false;
+ private static final String TAG = RecentsPanelView.TAG;
+ private static final boolean DEBUG = RecentsPanelView.DEBUG;
private LinearLayout mLinearLayout;
private ActivityDescriptionAdapter mAdapter;
private RecentsCallback mCallback;
@@ -56,6 +55,8 @@
private float mLastY;
private boolean mDragging;
private VelocityTracker mVelocityTracker;
+ private float mDensityScale;
+ private float mPagingTouchSlop;
public RecentsHorizontalScrollView(Context context) {
this(context, null);
@@ -63,6 +64,8 @@
public RecentsHorizontalScrollView(Context context, AttributeSet attrs) {
super(context, attrs, 0);
+ mDensityScale = getResources().getDisplayMetrics().density;
+ mPagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
}
private int scrollPositionOfMostRecent() {
@@ -101,7 +104,8 @@
case MotionEvent.ACTION_MOVE:
float delta = ev.getY() - mLastY;
- if (Math.abs(delta) > THRESHHOLD) {
+ if (DEBUG) Log.v(TAG, "ACTION_MOVE : " + delta);
+ if (Math.abs(delta) > mPagingTouchSlop) {
mDragging = true;
}
break;
@@ -114,13 +118,14 @@
}
private float getAlphaForOffset(View view, float thumbHeight) {
- final float fadeHeight = FADE_CONSTANT * thumbHeight;
+ final float fadeHeight = Constants.FADE_CONSTANT * thumbHeight;
float result = 1.0f;
if (view.getY() >= thumbHeight) {
result = 1.0f - (view.getY() - thumbHeight) / fadeHeight;
} else if (view.getY() < 0.0f) {
result = 1.0f + (thumbHeight + view.getY()) / fadeHeight;
}
+ if (DEBUG) Log.v(TAG, "FADE AMOUNT: " + result);
return result;
}
@@ -155,12 +160,13 @@
final float velocityY = velocityTracker.getYVelocity();
final float curY = animView.getY();
final float newY = (velocityY >= 0.0f ? 1 : -1) * animView.getHeight();
-
+ final float maxVelocity = Constants.ESCAPE_VELOCITY * mDensityScale;
if (Math.abs(velocityY) > Math.abs(velocityX)
- && Math.abs(velocityY) > ESCAPE_VELOCITY
+ && Math.abs(velocityY) > maxVelocity
&& (velocityY >= 0.0f) == (animView.getY() >= 0)) {
- final long duration =
+ long duration =
(long) (Math.abs(newY - curY) * 1000.0f / Math.abs(velocityY));
+ duration = Math.min(duration, Constants.MAX_ESCAPE_ANIMATION_DURATION);
anim = ObjectAnimator.ofFloat(animView, "y", curY, newY);
anim.setInterpolator(new LinearInterpolator());
final int swipeDirection = animView.getY() >= 0.0f ?
@@ -181,9 +187,10 @@
});
anim.setDuration(duration);
} else { // Animate back to position
- final long duration = Math.abs(velocityY) > 0.0f ?
+ long duration = Math.abs(velocityY) > 0.0f ?
(long) (Math.abs(newY - curY) * 1000.0f / Math.abs(velocityY))
- : SNAP_BACK_DURATION;
+ : Constants.SNAP_BACK_DURATION;
+ duration = Math.min(duration, Constants.SNAP_BACK_DURATION);
anim = ObjectAnimator.ofFloat(animView, "y", animView.getY(), 0.0f);
anim.setInterpolator(new DecelerateInterpolator(2.0f));
anim.setDuration(duration);
@@ -241,8 +248,15 @@
setOverScrollEffectPadding(leftPadding, 0);
}
+ @Override
+ protected void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ mDensityScale = getResources().getDisplayMetrics().density;
+ mPagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
+ }
+
private void setOverScrollEffectPadding(int leftPadding, int i) {
- // TODO Add to RecentsHorizontalScrollView
+ // TODO Add to (Vertical)ScrollView
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 408436a..a55fe9c 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -318,7 +318,11 @@
}
private Drawable getFullResIcon(Resources resources, int iconId) {
- return resources.getDrawableForDensity(iconId, mIconDpi);
+ try {
+ return resources.getDrawableForDensity(iconId, mIconDpi);
+ } catch (Resources.NotFoundException e) {
+ return getFullResDefaultActivityIcon();
+ }
}
private Drawable getFullResIcon(ResolveInfo info, PackageManager packageManager) {
@@ -413,11 +417,11 @@
mActivityDescriptions = getRecentTasks();
mListAdapter.notifyDataSetInvalidated();
if (mActivityDescriptions.size() > 0) {
- Log.v(TAG, "Showing " + mActivityDescriptions.size() + " apps");
+ if (DEBUG) Log.v(TAG, "Showing " + mActivityDescriptions.size() + " apps");
updateUiElements(getResources().getConfiguration());
} else {
// Immediately hide this panel
- Log.v(TAG, "Nothing to show");
+ if (DEBUG) Log.v(TAG, "Nothing to show");
hide(false);
}
}
@@ -432,7 +436,7 @@
paint.setAlpha(255);
final int srcWidth = thumbnail.getWidth();
final int srcHeight = thumbnail.getHeight();
- Log.v(TAG, "Source thumb: " + srcWidth + "x" + srcHeight);
+ if (DEBUG) Log.v(TAG, "Source thumb: " + srcWidth + "x" + srcHeight);
canvas.drawBitmap(thumbnail,
new Rect(0, 0, srcWidth-1, srcHeight-1),
new RectF(mGlowBitmapPaddingLeftPx, mGlowBitmapPaddingTopPx,
@@ -482,7 +486,7 @@
public void handleSwipe(View view, int direction) {
ActivityDescription ad = ((ViewHolder) view.getTag()).activityDescription;
- Log.v(TAG, "Jettison " + ad.label);
+ if (DEBUG) Log.v(TAG, "Jettison " + ad.label);
mActivityDescriptions.remove(ad);
// Handled by widget containers to enable LayoutTransitions properly
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 6a962cb..711ffa3 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -25,6 +25,7 @@
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
+import android.content.res.Configuration;
import android.database.DataSetObserver;
import android.graphics.RectF;
import android.util.AttributeSet;
@@ -33,6 +34,7 @@
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
+import android.view.ViewConfiguration;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import android.widget.LinearLayout;
@@ -42,12 +44,9 @@
public class RecentsVerticalScrollView extends ScrollView
implements View.OnClickListener, View.OnTouchListener {
- private static final float FADE_CONSTANT = 0.5f;
- private static final int SNAP_BACK_DURATION = 250;
- private static final int ESCAPE_VELOCITY = 100; // speed of item required to "curate" it
private static final String TAG = RecentsPanelView.TAG;
- private static final float THRESHHOLD = 50;
private static final boolean DEBUG_INVALIDATE = false;
+ private static final boolean DEBUG = RecentsPanelView.DEBUG;
private LinearLayout mLinearLayout;
private ActivityDescriptionAdapter mAdapter;
private RecentsCallback mCallback;
@@ -56,6 +55,8 @@
private float mLastX;
private boolean mDragging;
private VelocityTracker mVelocityTracker;
+ private float mDensityScale;
+ private float mPagingTouchSlop;
public RecentsVerticalScrollView(Context context) {
this(context, null);
@@ -63,6 +64,8 @@
public RecentsVerticalScrollView(Context context, AttributeSet attrs) {
super(context, attrs, 0);
+ mDensityScale = getResources().getDisplayMetrics().density;
+ mPagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
}
private int scrollPositionOfMostRecent() {
@@ -101,8 +104,8 @@
case MotionEvent.ACTION_MOVE:
float delta = ev.getX() - mLastX;
- Log.v(TAG, "ACTION_MOVE : " + delta);
- if (Math.abs(delta) > THRESHHOLD) {
+ if (DEBUG) Log.v(TAG, "ACTION_MOVE : " + delta);
+ if (Math.abs(delta) > mPagingTouchSlop) {
mDragging = true;
}
break;
@@ -115,14 +118,14 @@
}
private float getAlphaForOffset(View view, float thumbWidth) {
- final float fadeWidth = FADE_CONSTANT * thumbWidth;
+ final float fadeWidth = Constants.FADE_CONSTANT * thumbWidth;
float result = 1.0f;
if (view.getX() >= thumbWidth) {
result = 1.0f - (view.getX() - thumbWidth) / fadeWidth;
} else if (view.getX() < 0.0f) {
result = 1.0f + (thumbWidth + view.getX()) / fadeWidth;
}
- Log.v(TAG, "FADE AMOUNT: " + result);
+ if (DEBUG) Log.v(TAG, "FADE AMOUNT: " + result);
return result;
}
@@ -157,12 +160,13 @@
final float velocityY = velocityTracker.getYVelocity();
final float curX = animView.getX();
final float newX = (velocityX >= 0.0f ? 1 : -1) * animView.getWidth();
-
+ final float maxVelocity = Constants.ESCAPE_VELOCITY * mDensityScale;
if (Math.abs(velocityX) > Math.abs(velocityY)
- && Math.abs(velocityX) > ESCAPE_VELOCITY
+ && Math.abs(velocityX) > maxVelocity
&& (velocityX > 0.0f) == (animView.getX() >= 0)) {
- final long duration =
+ long duration =
(long) (Math.abs(newX-curX) * 1000.0f / Math.abs(velocityX));
+ duration = Math.min(duration, Constants.MAX_ESCAPE_ANIMATION_DURATION);
anim = ObjectAnimator.ofFloat(animView, "x", curX, newX);
anim.setInterpolator(new LinearInterpolator());
final int swipeDirection = animView.getX() >= 0.0f ?
@@ -183,9 +187,10 @@
});
anim.setDuration(duration);
} else { // Animate back to position
- final long duration = Math.abs(velocityX) > 0.0f ?
+ long duration = Math.abs(velocityX) > 0.0f ?
(long) (Math.abs(newX-curX) * 1000.0f / Math.abs(velocityX))
- : SNAP_BACK_DURATION;
+ : Constants.SNAP_BACK_DURATION;
+ duration = Math.min(duration, Constants.SNAP_BACK_DURATION);
anim = ObjectAnimator.ofFloat(animView, "x", animView.getX(), 0.0f);
anim.setInterpolator(new DecelerateInterpolator(4.0f));
anim.setDuration(duration);
@@ -243,6 +248,13 @@
setOverScrollEffectPadding(leftPadding, 0);
}
+ @Override
+ protected void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ mDensityScale = getResources().getDisplayMetrics().density;
+ mPagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
+ }
+
private void setOverScrollEffectPadding(int leftPadding, int i) {
// TODO Add to (Vertical)ScrollView
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 4c7b0dd..5eacad7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -53,6 +53,7 @@
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManagerImpl;
@@ -318,11 +319,11 @@
return sb;
}
- protected WindowManager.LayoutParams getRecentsLayoutParams() {
+ protected WindowManager.LayoutParams getRecentsLayoutParams(LayoutParams layoutParams) {
boolean translucent = false;
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
- ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.WRAP_CONTENT,
+ layoutParams.width,
+ layoutParams.height,
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
@@ -344,13 +345,16 @@
visible = mRecentsPanel.getVisibility() == View.VISIBLE;
WindowManagerImpl.getDefault().removeView(mRecentsPanel);
}
- mRecentsPanel = (RecentsPanelView) View.inflate(mContext,
- R.layout.status_bar_recent_panel, null);
+
+ // Provide RecentsPanelView with a temporary parent to allow layout params to work.
+ LinearLayout tmpRoot = new LinearLayout(mContext);
+ mRecentsPanel = (RecentsPanelView) LayoutInflater.from(mContext).inflate(
+ R.layout.status_bar_recent_panel, tmpRoot, false);
mRecentsPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_RECENTS_PANEL,
mRecentsPanel));
mRecentsPanel.setVisibility(View.GONE);
- WindowManager.LayoutParams lp = getRecentsLayoutParams();
+ WindowManager.LayoutParams lp = getRecentsLayoutParams(mRecentsPanel.getLayoutParams());
WindowManagerImpl.getDefault().addView(mRecentsPanel, lp);
mRecentsPanel.setBar(this);
diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
index 2222e8b..75d24a1 100644
--- a/services/audioflinger/Android.mk
+++ b/services/audioflinger/Android.mk
@@ -10,6 +10,9 @@
AudioResamplerCubic.cpp.arm \
AudioPolicyService.cpp
+LOCAL_C_INCLUDES := \
+ system/media/audio_effects/include
+
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index f716e63..daf94f2 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -50,7 +50,7 @@
#include "AudioFlinger.h"
#include <media/EffectsFactoryApi.h>
-#include <media/EffectVisualizerApi.h>
+#include <audio_effects/effect_visualizer.h>
// ----------------------------------------------------------------------------
diff --git a/services/audioflinger/AudioResamplerCubic.cpp b/services/audioflinger/AudioResamplerCubic.cpp
index 1d247bd..4d721f6 100644
--- a/services/audioflinger/AudioResamplerCubic.cpp
+++ b/services/audioflinger/AudioResamplerCubic.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "AudioSRC"
+
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
@@ -22,8 +24,6 @@
#include "AudioResampler.h"
#include "AudioResamplerCubic.h"
-#define LOG_TAG "AudioSRC"
-
namespace android {
// ----------------------------------------------------------------------------
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 6afccec..786f2fa 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -224,6 +224,7 @@
public PackageInfo pkgInfo;
public int pmToken; // in post-install restore, the PM's token for this transaction
public boolean needFullBackup;
+ public String[] filterSet;
RestoreParams(IBackupTransport _transport, IRestoreObserver _obs,
long _token, PackageInfo _pkg, int _pmToken, boolean _needFullBackup) {
@@ -233,6 +234,7 @@
pkgInfo = _pkg;
pmToken = _pmToken;
needFullBackup = _needFullBackup;
+ filterSet = null;
}
RestoreParams(IBackupTransport _transport, IRestoreObserver _obs, long _token,
@@ -243,6 +245,18 @@
pkgInfo = null;
pmToken = 0;
needFullBackup = _needFullBackup;
+ filterSet = null;
+ }
+
+ RestoreParams(IBackupTransport _transport, IRestoreObserver _obs, long _token,
+ String[] _filterSet, boolean _needFullBackup) {
+ transport = _transport;
+ observer = _obs;
+ token = _token;
+ pkgInfo = null;
+ pmToken = 0;
+ needFullBackup = _needFullBackup;
+ filterSet = _filterSet;
}
}
@@ -404,7 +418,7 @@
Slog.d(TAG, "MSG_RUN_RESTORE observer=" + params.observer);
(new PerformRestoreTask(params.transport, params.observer,
params.token, params.pkgInfo, params.pmToken,
- params.needFullBackup)).run();
+ params.needFullBackup, params.filterSet)).run();
break;
}
@@ -3020,6 +3034,7 @@
private File mStateDir;
private int mPmToken;
private boolean mNeedFullBackup;
+ private HashSet<String> mFilterSet;
class RestoreRequest {
public PackageInfo app;
@@ -3033,7 +3048,7 @@
PerformRestoreTask(IBackupTransport transport, IRestoreObserver observer,
long restoreSetToken, PackageInfo targetPackage, int pmToken,
- boolean needFullBackup) {
+ boolean needFullBackup, String[] filterSet) {
mTransport = transport;
mObserver = observer;
mToken = restoreSetToken;
@@ -3041,6 +3056,15 @@
mPmToken = pmToken;
mNeedFullBackup = needFullBackup;
+ if (filterSet != null) {
+ mFilterSet = new HashSet<String>();
+ for (String pkg : filterSet) {
+ mFilterSet.add(pkg);
+ }
+ } else {
+ mFilterSet = null;
+ }
+
try {
mStateDir = new File(mBaseStateDir, transport.transportDirName());
} catch (RemoteException e) {
@@ -3052,7 +3076,8 @@
long startRealtime = SystemClock.elapsedRealtime();
if (DEBUG) Slog.v(TAG, "Beginning restore process mTransport=" + mTransport
+ " mObserver=" + mObserver + " mToken=" + Long.toHexString(mToken)
- + " mTargetPackage=" + mTargetPackage + " mPmToken=" + mPmToken);
+ + " mTargetPackage=" + mTargetPackage + " mFilterSet=" + mFilterSet
+ + " mPmToken=" + mPmToken);
PackageManagerBackupAgent pmAgent = null;
int error = -1; // assume error
@@ -3071,6 +3096,22 @@
List<PackageInfo> agentPackages = allAgentPackages();
if (mTargetPackage == null) {
+ // if there's a filter set, strip out anything that isn't
+ // present before proceeding
+ if (mFilterSet != null) {
+ for (int i = agentPackages.size() - 1; i >= 0; i--) {
+ final PackageInfo pkg = agentPackages.get(i);
+ if (! mFilterSet.contains(pkg.packageName)) {
+ agentPackages.remove(i);
+ }
+ }
+ if (DEBUG) {
+ Slog.i(TAG, "Post-filter package set for restore:");
+ for (PackageInfo p : agentPackages) {
+ Slog.i(TAG, " " + p);
+ }
+ }
+ }
restorePackages.addAll(agentPackages);
} else {
// Just one package to attempt restore of
@@ -4266,6 +4307,67 @@
return -1;
}
+ public synchronized int restoreSome(long token, IRestoreObserver observer,
+ String[] packages) {
+ mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
+ "performRestore");
+
+ if (DEBUG) {
+ StringBuilder b = new StringBuilder(128);
+ b.append("restoreSome token=");
+ b.append(Long.toHexString(token));
+ b.append(" observer=");
+ b.append(observer.toString());
+ b.append(" packages=");
+ if (packages == null) {
+ b.append("null");
+ } else {
+ b.append('{');
+ boolean first = true;
+ for (String s : packages) {
+ if (!first) {
+ b.append(", ");
+ } else first = false;
+ b.append(s);
+ }
+ b.append('}');
+ }
+ Slog.d(TAG, b.toString());
+ }
+
+ if (mEnded) {
+ throw new IllegalStateException("Restore session already ended");
+ }
+
+ if (mRestoreTransport == null || mRestoreSets == null) {
+ Slog.e(TAG, "Ignoring restoreAll() with no restore set");
+ return -1;
+ }
+
+ if (mPackageName != null) {
+ Slog.e(TAG, "Ignoring restoreAll() on single-package session");
+ return -1;
+ }
+
+ synchronized (mQueueLock) {
+ for (int i = 0; i < mRestoreSets.length; i++) {
+ if (token == mRestoreSets[i].token) {
+ long oldId = Binder.clearCallingIdentity();
+ mWakelock.acquire();
+ Message msg = mBackupHandler.obtainMessage(MSG_RUN_RESTORE);
+ msg.obj = new RestoreParams(mRestoreTransport, observer, token,
+ packages, true);
+ mBackupHandler.sendMessage(msg);
+ Binder.restoreCallingIdentity(oldId);
+ return 0;
+ }
+ }
+ }
+
+ Slog.w(TAG, "Restore token " + Long.toHexString(token) + " not found");
+ return -1;
+ }
+
public synchronized int restorePackage(String packageName, IRestoreObserver observer) {
if (DEBUG) Slog.v(TAG, "restorePackage pkg=" + packageName + " obs=" + observer);
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 3bf309b..be21ac0 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -231,7 +231,7 @@
// Maximum number of milliseconds to wait for input devices to be enumerated before
// proceding with safe mode detection.
private static final int INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS = 1000;
-
+
// Default input dispatching timeout in nanoseconds.
static final long DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS = 5000 * 1000000L;
@@ -4886,8 +4886,13 @@
int fw = frame.width();
int fh = frame.height();
- // First try reducing to fit in x dimension.
- scale = width/(float)fw;
+ // Constrain thumbnail to smaller of screen width or height. Assumes aspect
+ // of thumbnail is the same as the screen (in landscape) or square.
+ if (dw <= dh) {
+ scale = width / (float) fw; // portrait
+ } else {
+ scale = height / (float) fh; // landscape
+ }
// The screen shot will contain the entire screen.
dw = (int)(dw*scale);
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
index 33125c4..7bf3e0a 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
@@ -99,6 +99,31 @@
mMaxViewportDims[0] : mMaxViewportDims[1];
}
+static status_t selectConfigForPixelFormat(
+ EGLDisplay dpy,
+ EGLint const* attrs,
+ PixelFormat format,
+ EGLConfig* outConfig)
+{
+ EGLConfig config = NULL;
+ EGLint numConfigs = -1, n=0;
+ eglGetConfigs(dpy, NULL, 0, &numConfigs);
+ EGLConfig* const configs = new EGLConfig[numConfigs];
+ eglChooseConfig(dpy, attrs, configs, numConfigs, &n);
+ for (int i=0 ; i<n ; i++) {
+ EGLint nativeVisualId = 0;
+ eglGetConfigAttrib(dpy, configs[i], EGL_NATIVE_VISUAL_ID, &nativeVisualId);
+ if (nativeVisualId>0 && format == nativeVisualId) {
+ *outConfig = configs[i];
+ delete [] configs;
+ return NO_ERROR;
+ }
+ }
+ delete [] configs;
+ return NAME_NOT_FOUND;
+}
+
+
void DisplayHardware::init(uint32_t dpy)
{
mNativeWindow = new FramebufferNativeWindow();
@@ -108,6 +133,9 @@
exit(0);
}
+ int format;
+ ANativeWindow const * const window = mNativeWindow.get();
+ window->query(window, NATIVE_WINDOW_FORMAT, &format);
mDpiX = mNativeWindow->xdpi;
mDpiY = mNativeWindow->ydpi;
mRefreshRate = fbDev->fps;
@@ -116,11 +144,13 @@
EGLint numConfigs=0;
EGLSurface surface;
EGLContext context;
+ EGLBoolean result;
+ status_t err;
// initialize EGL
EGLint attribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_NONE, 0,
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_NONE, 0,
EGL_NONE
};
@@ -141,9 +171,8 @@
eglInitialize(display, NULL, NULL);
eglGetConfigs(display, NULL, 0, &numConfigs);
- EGLConfig config;
- status_t err = EGLUtils::selectConfigForNativeWindow(
- display, attribs, mNativeWindow.get(), &config);
+ EGLConfig config = NULL;
+ err = selectConfigForPixelFormat(display, attribs, format, &config);
LOGE_IF(err, "couldn't find an EGLConfig matching the screen format");
EGLint r,g,b,a;
@@ -224,7 +253,11 @@
* Gather OpenGL ES extensions
*/
- eglMakeCurrent(display, surface, surface, context);
+ result = eglMakeCurrent(display, surface, surface, context);
+ if (!result) {
+ LOGE("Couldn't create a working GLES context. check logs. exiting...");
+ exit(0);
+ }
GLExtensions& extensions(GLExtensions::getInstance());
extensions.initWithGLStrings(
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index bcd8c83..c86c659 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -228,13 +228,18 @@
const Layer::State& s(drawingState());
const Transform tr(planeTransform * s.transform);
const bool transformed = tr.transformed();
-
+ const DisplayHardware& hw(graphicPlane(0).displayHardware());
+ const uint32_t hw_h = hw.getHeight();
+
uint32_t w = s.w;
uint32_t h = s.h;
tr.transform(mVertices[0], 0, 0);
tr.transform(mVertices[1], 0, h);
tr.transform(mVertices[2], w, h);
tr.transform(mVertices[3], w, 0);
+ for (size_t i=0 ; i<4 ; i++)
+ mVertices[i][1] = hw_h - mVertices[i][1];
+
if (UNLIKELY(transformed)) {
// NOTE: here we could also punt if we have too many rectangles
// in the transparent region
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index cccab4a..b0881a4 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -276,7 +276,8 @@
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glOrthof(0, w, h, 0, 0, 1);
+ // put the origin in the left-bottom corner
+ glOrthof(0, w, 0, h, 0, 1); // l=0, r=w ; b=0, t=h
mReadyToRunBarrier.open();
@@ -1791,7 +1792,7 @@
}
GLfloat vtx[8];
- const GLfloat texCoords[4][2] = { {0,v}, {0,0}, {u,0}, {u,v} };
+ const GLfloat texCoords[4][2] = { {0,1}, {0,1-v}, {u,1-v}, {u,1} };
glBindTexture(GL_TEXTURE_2D, tname);
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -1800,6 +1801,22 @@
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, vtx);
+ /*
+ * Texture coordinate mapping
+ *
+ * u
+ * 1 +----------+---+
+ * | | | | image is inverted
+ * | V | | w.r.t. the texture
+ * 1-v +----------+ | coordinates
+ * | |
+ * | |
+ * | |
+ * 0 +--------------+
+ * 0 1
+ *
+ */
+
class s_curve_interpolator {
const float nbFrames, s, v;
public:
@@ -1824,10 +1841,10 @@
const GLfloat h = hw_h - (hw_h * v);
const GLfloat x = (hw_w - w) * 0.5f;
const GLfloat y = (hw_h - h) * 0.5f;
- vtx[0] = x; vtx[1] = y + h;
- vtx[2] = x; vtx[3] = y;
- vtx[4] = x + w; vtx[5] = y;
- vtx[6] = x + w; vtx[7] = y + h;
+ vtx[0] = x; vtx[1] = y;
+ vtx[2] = x; vtx[3] = y + h;
+ vtx[4] = x + w; vtx[5] = y + h;
+ vtx[6] = x + w; vtx[7] = y;
}
};
@@ -1842,15 +1859,20 @@
const GLfloat h = 1.0f;
const GLfloat x = (hw_w - w) * 0.5f;
const GLfloat y = (hw_h - h) * 0.5f;
- vtx[0] = x; vtx[1] = y + h;
- vtx[2] = x; vtx[3] = y;
- vtx[4] = x + w; vtx[5] = y;
- vtx[6] = x + w; vtx[7] = y + h;
+ vtx[0] = x; vtx[1] = y;
+ vtx[2] = x; vtx[3] = y + h;
+ vtx[4] = x + w; vtx[5] = y + h;
+ vtx[6] = x + w; vtx[7] = y;
}
};
// the full animation is 24 frames
- const int nbFrames = 12;
+ char value[PROPERTY_VALUE_MAX];
+ property_get("debug.sf.electron_frames", value, "24");
+ int nbFrames = (atoi(value) + 1) >> 1;
+ if (nbFrames <= 0) // just in case
+ nbFrames = 24;
+
s_curve_interpolator itr(nbFrames, 7.5f);
s_curve_interpolator itg(nbFrames, 8.0f);
s_curve_interpolator itb(nbFrames, 8.5f);
@@ -2225,10 +2247,11 @@
// invert everything, b/c glReadPixel() below will invert the FB
glViewport(0, 0, sw, sh);
glScissor(0, 0, sw, sh);
+ glEnable(GL_SCISSOR_TEST);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
- glOrthof(0, hw_w, 0, hw_h, 0, 1);
+ glOrthof(0, hw_w, hw_h, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
// redraw the screen entirely...
@@ -2244,6 +2267,7 @@
}
// XXX: this is needed on tegra
+ glEnable(GL_SCISSOR_TEST);
glScissor(0, 0, sw, sh);
// check for errors and return screen capture
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java
index 9695344..1f24b58 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java
@@ -76,8 +76,6 @@
+ "' APN: '" + mApn.apn
+ "' proxy: '" + mApn.proxy + "' port: '" + mApn.port);
- setHttpProxy (mApn.proxy, mApn.port);
-
createTime = -1;
lastFailTime = -1;
lastFailCause = FailCause.NONE;
@@ -152,38 +150,6 @@
Log.d(LOG_TAG, "[" + getName() + "] " + s);
}
- private void setHttpProxy(String httpProxy, String httpPort) {
-
- if (DBG) log("set http proxy for"
- + "' APN: '" + mActiveApnType
- + "' proxy: '" + mApn.proxy + "' port: '" + mApn.port);
- if(TextUtils.equals(mActiveApnType, Phone.APN_TYPE_DEFAULT)) {
- if (httpProxy == null || httpProxy.length() == 0) {
- phone.setSystemProperty("net.gprs.http-proxy", null);
- return;
- }
-
- if (httpPort == null || httpPort.length() == 0) {
- httpPort = "8080"; // Default to port 8080
- }
-
- phone.setSystemProperty("net.gprs.http-proxy",
- "http://" + httpProxy + ":" + httpPort + "/");
- } else {
- if (httpProxy == null || httpProxy.length() == 0) {
- phone.setSystemProperty("net.gprs.http-proxy." + mActiveApnType, null);
- return;
- }
-
- if (httpPort == null || httpPort.length() == 0) {
- httpPort = "8080"; // Default to port 8080
- }
-
- phone.setSystemProperty("net.gprs.http-proxy." + mActiveApnType,
- "http://" + httpProxy + ":" + httpPort + "/");
- }
- }
-
private boolean isIpAddress(String address) {
if (address == null) return false;
diff --git a/tests/GridLayoutTest/res/layout/grid3.xml b/tests/GridLayoutTest/res/layout/grid3.xml
index 536be7e..3c2db54 100644
--- a/tests/GridLayoutTest/res/layout/grid3.xml
+++ b/tests/GridLayoutTest/res/layout/grid3.xml
@@ -66,8 +66,8 @@
<Space
android:layout_row="4"
android:layout_column="2"
- android:layout_heightSpec="canStretch"
- android:layout_widthSpec="canStretch"
+ android:layout_rowFlexibility="canStretch"
+ android:layout_columnFlexibility="canStretch"
/>
<Button
diff --git a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
index cba98c2b..b9bf526 100644
--- a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
+++ b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
@@ -97,8 +97,8 @@
Space v = new Space(context);
{
LayoutParams lp = new LayoutParams(row5, col3);
- lp.widthSpec = CAN_STRETCH;
- lp.heightSpec = CAN_STRETCH;
+ lp.columnGroup.flexibility = CAN_STRETCH;
+ lp.rowGroup.flexibility = CAN_STRETCH;
vg.addView(v, lp);
}
}